I think using exportAll will solve the problem
cmds.file(path,
force=True,
typ="mayaAscii",
exportAll=True,
preserveReferences=True,
shader=True,
expressions=False,
constructionHistory=True)
On Thu, Jul 21, 2016 at 10:26 AM, Mahmoodreza Aarabi <[email protected]>
wrote:
> Hey again
> i test this snippet but this does not work:
>
> from maya import cmds
> dir_path = 'C:/test/test.ma'
> cmds.file(rename=dir_path)
> cmds.file(s=True, f=True, typ="mayaAscii")
>
> and gave this error:
> # Error: RuntimeError: file <maya console> line 3: An invalid path was
> specified. #
>
> any idea?!
>
>
> On Wed, Jul 20, 2016 at 1:50 PM, Mahmoodreza Aarabi <[email protected]>
> wrote:
>
>> Hey Sumant
>> thanks for answer.
>> i test rename flag of file, but it does not give path, just can i give it
>> a new name, i think to a new way to use save flag instead of exportSelected.
>>
>> but i want to know why export selecting in maya ruin our shaders, you
>> know?
>>
>> On Wed, Jul 20, 2016 at 1:46 PM, Sumant Shenoy <[email protected]>
>> wrote:
>>
>>> this may work
>>> select the objects or top group
>>> cmds.file(rename=path+filename.ma)
>>> cmds.file(type="mayaAscii",exportSelected=True,preserveReferences=True,
>>> shader=True,expressions=False,constructionHistory=True)
>>>
>>> On Wed, Jul 20, 2016 at 5:49 PM, Mahmoodreza Aarabi <[email protected]>
>>> wrote:
>>>
>>>> Hello guys
>>>>
>>>> Please take a look at this and guide me.
>>>> Situation:
>>>>
>>>> We have a FinalModel that is referenced in a scene for rig. In the rig
>>>> scene, meshes get skin and rigging stuffs.
>>>> after that i want to save the scene using code (Here using Pyblish’s
>>>> Plugin) that use this code:
>>>>
>>>> cmds.file(path,
>>>> force=True,
>>>> typ="mayaAscii",
>>>> exportSelected=True,
>>>> preserveReferences=True,
>>>> shader=True,
>>>> expressions=False,
>>>> constructionHistory=True)
>>>>
>>>> Problem:
>>>>
>>>> The code will save the selected group in a new file and their
>>>> connections in a new .ma file fine, but when we open the scene meshes does
>>>> not show their shaders and just show us wireframe, while, meshes have
>>>> materials connected to ShadingGroup.
>>>> This event happen when i export selection manually with maya menu.
>>>>
>>>> make sense?
>>>>
>>>> thanks
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Python Programming for Autodesk Maya" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/python_inside_maya/87371f12-d4e8-4e4f-9ea0-46e7cc28814e%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/python_inside_maya/87371f12-d4e8-4e4f-9ea0-46e7cc28814e%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Python Programming for Autodesk Maya" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/CAGhqNn%3DguYo8n7Zi%2BjFvhohNHFYqgf-%3D8ecH0krQWcC%3DryHEjg%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/CAGhqNn%3DguYo8n7Zi%2BjFvhohNHFYqgf-%3D8ecH0krQWcC%3DryHEjg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>>
>> Bests,
>> madoodia
>>
>
>
>
> --
>
>
> Bests,
> madoodia
>
--
Bests,
madoodia
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CADvbQwKfkKQEDaWNxqtMGUTwv%3D-HWgSAjPTqcWLP2U4EB67jRQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.