I believe, in the mel, the refNode at the end is the object of the
command, not the value being passed to the flag.

You might try:

pm.cmds.file(ref.refNode, referenceNode=True, importReference=True)

On Thu, Aug 5, 2010 at 8:49 PM, Justin Rosen <[email protected]> wrote:
> Has anyone else noticed a discrepancy between the file command in mel and in
> python in relation to importing file references?
> pm.cmds.file(referenceNode=ref.refNode, importReference=True)  #Where ref is
> derived from pm.listReferences()
>
> # Traceback (most recent call last):
>
> # File
> "/tmp/TOOLS_INSTALL/cent5_x86_64_py26/MayaAssets-Project/MayaAssets/library/maya/python/importComponentReference.py",
> line 127, in importComponentReferences
>
> # pm.cmds.file(importReference=True,referenceNode=ref.refNode)
>
> # TypeError: Flag 'referenceNode' must be passed a boolean argument
>
> Is Pymel a bit stricter now?  I could of sworn this used to work. I have to
> resort to the following mel
>
> pm.mel.eval("file -importReference -referenceNode " + ref.refNode)
>
> The docs say it takes a boolean, but the mel code for importing a reference
> within the reference editor uses a reference node name
> scripts/others/referenceEditorPanel.mel
>
> if ( $numNodes >= $numFiles ) {
>         int $i = 0;
>         for ( $i = 0; $i < $numNodes; $i++ ) {
>             if ( size($selRefNode[$i]) > 0 ) {
>                 file -importReference -referenceNode $selRefNode[$i];
>             }
>         }
>     } else {
>         int $i = 0;
>         for ( $i = 0; $i < $numFiles; $i++ ) {
>             if ( size($selFileReal[$i]) > 0 ) {
>                 file -importReference $selFileReal[$i];
>             }
>         }
>     }
>
> Justin
>
> --
> http://groups.google.com/group/python_inside_maya

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

Reply via email to