You may find this a helpful:

http://groups.google.com/group/python_inside_maya/browse_thread/thread/f5610cbfe466c07e/8b7d6a2ecbb6032d?lnk=gst&q=reference#8b7d6a2ecbb6032d

On Dec 16, 8:50 am, Pierre A <[email protected]> wrote:
> Hi list,
>
> I'm facing an issue regarding references which are deleted on load
> when their path does not correspond to an existing file.
>
> The user have a browse option to remap to an existing file, I'm
> looking for a way to reproduce the behavior in a python script. I've
> found no help in Echo All nor missingReferenceDialog.mel...
>
> Otherwise, perhaps these workflows could work:
> - parse the maya file ( if it's in ascii ), find the lines
> corresponding to the creation of the references and test for the file
> path. They should be like:
> file -r -ns "NS" -dr 1 -rfn "REF_NAME" "PATH";
> and
> file -rdi 1 -ns "NS" -rfn "REF_NAME" "PATH";
> But I don't know if it's safe...
>
> - add a call back ( MSceneMessage.Message.kBeforeCreateReferenceCheck
> or MSceneMessage.Message.kBeforeCreateReference ), but I don't know
> which enum to use nor the callback associated ( addCallback,
> addCheckCallback, addCheckFileCallback ) and the data accessible in
> the callback.
>
> Of course I need to have access to the name of the reference node,
> associated to the file path. Best would be to be able to instantiate
> it as a PyNode (or get its attrs with maya.cmds)
>
> Thanks!

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to