Hi sir did you find an answer for this??

Thanks!!

On Friday, October 31, 2014 at 5:44:29 PM UTC+1, Fredrik Averpil wrote:
>
> I think I found a bug in Maya. After having fiddled around with reference 
> edits in a script, something broke and it is impossible to load an “editMB” 
> file back into Maya using Python or MEL. See the example script below. Step 
> 4 won't work.
>
> However, if you re-open the scene after having run this code and then run 
> the code for step 4 … it works, and the reference edits are loaded back in 
> successfully. So it seems a re-open of the scene is needed for step 4 to 
> work properly when chaining these commands in a script.
>
> And if you right-click the reference and choose “Assign offline file” and 
> assign a file that way, it just works without re-opening the scene. My 
> problem is I have to automate this using a script.
>
> Anyone understand what’s going on?
>
> for ref in cmds.ls(references=True):
>     print 'Working on ' + ref
>
>     # Step 1. Export edits
>     print 'Exporting edits to C:/...'
>     cmds.exportEdits(
>                         'C:/'+ref.replace(':','')+'.editMB',
>                         type='editMB',          # default
>                         onReferenceNode=ref,    # default
>                         includeNetwork=True,    # default
>                         includeAnimation=True,  # default
>                         includeShaders=True,    # default
>                         includeSetAttrs=True,   # default
>
>                         includeSetDrivenKeys=True,
>                         includeConstraints=True,
>                         includeDeformers=True,
>
>                         force=True
>                     )
>
>     # Step 2. Remove all edits
>     print 'Removing all edits...'
>     cmds.file(unloadReference=ref)
>     cmds.file (cr=ref) # cleanReference
>     cmds.file(loadReference=ref)
>
>
>     # Step 3. Save down new edits into maya reference files
>     print 'Saving down new edits into reference...'
>     filepath = cmds.referenceQuery( ref, filename=True )
>     cmds.file(filepath, saveReference=True, force=True)
>
>
>     # Step 4. Apply the original reference edits back onto the reference files
>     print 'Apply reference edits from file in C:/...editMB back into 
> reference...'
>     cmds.file( 'C:/'+ref.replace(':','')+'.editMB', applyTo=ref, i=True, 
> namespace=ref.replace(':',''), type='editMB')
>
> // Fredrik
> ​
>

-- 
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/86d5ea0c-1679-4aca-bee4-297a5fbba2a2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to