You're correct indeed...
So no way, on the API side to easily fetch the reference file of a
referenced node... Dammit...
I'll have to figure something else, it's annoying indeed.
[image: Nicolas Chaverou - Golaem Crowd Product Manager - Golaem SA]
+33 (0)2 99 27 21 44
On Fri, Feb 16, 2018 at 8:28 PM, Sivanny Selvakumar <
> Most referencing commands/functions require you to pass in the reference
> node (i.e. node type is "reference"). It looks like you are trying to use a
> reference*d* node -- the sphere.
> You can query the reference node for a reference*d* object with
> `referenceQuery -referenceNode ref:pSphere1`. This should give you
> something like sphereRN. You can then get the MObject for sphereRN, pass it
> to getReferenceFileByNode and it should work.
> I don't think this particular referenceQuery functionality is exposed in
> C++. It really should be. It's annoying that MFnDependencyNode has
> isFromReferencedFile, but doesn't give you a way to query which reference
> it's a part of.
> On Thursday, February 15, 2018 at 2:33:11 AM UTC-8, Nicolas Chaverou wrote:
>> Hey there,
>> Was trying to fetch information about the file a node has been referenced
>> from but I can't get OpenMaya.MFileIO.getReferenceFileByNode to work
>> I'm running the following piece of code:
>> import maya.OpenMaya
>> selectionList = maya.OpenMaya.MSelectionList()
>> selectionList.add( 'types_ToReference:pSphere1' )
>> node = maya.OpenMaya.MObject()
>> selectionList.getDependNode( 0, node )
>> file = maya.OpenMaya.MFileIO.getReferenceFileByNode( node )
>> # RuntimeError: (kInvalidParameter): Object does not exist //
>> Anything I missed?
>> [image: Nicolas Chaverou - Golaem Crowd Product Manager - Golaem SA]
>> +33 (0)2 99 27 21 44 <+33%202%2099%2027%2021%2044>
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> 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 view this discussion on the web visit
For more options, visit https://groups.google.com/d/optout.