Hey Sivanny,

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.

Best,

---
[image: Nicolas Chaverou - Golaem Crowd Product Manager - Golaem SA]

+33 (0)2 99 27 21 44
http://www.golaem.com

On Fri, Feb 16, 2018 at 8:28 PM, Sivanny Selvakumar <
sivanny.selvaku...@gmail.com> wrote:

> 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.
>
> Sivanny
>
>
> 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
>> properly.
>>
>> 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>
>> http://www.golaem.com
>>
> --
> 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/
> msgid/python_inside_maya/844f9ea6-9da9-4c6d-82d7-
> e766190e3f57%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/844f9ea6-9da9-4c6d-82d7-e766190e3f57%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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFS5DCaQa%3Dx8G9YZTL8ePoncGwMAnyS5dy%2BNPgA1%3DjW2Pkrc-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to