Very good what happened to me, I'll see with more time. 

If I could somehow get the RN from the references I would need to open the 
scene. 

I would use: 
      fileRN = 
pmc.system.FileReference(pathOrRefNode="Animal_RIG_A001_v005RN") 
      fileRN.unload() 

So I think I could. Thank you so much for your time helping me.

Em terça-feira, 20 de julho de 2021 às 17:12:31 UTC-3, justin...@gmail.com 
escreveu:

> I see what you mean now. Yes the API docs say that it is meant to return a 
> unicode string for the fileName parameter. I haven't played with this API 
> before so I can only guess as to what is going on and had a quick play to 
> try and get your expected results. 
>
> When you do buildLoadSettings=True, and loadReferenceDepth='none', Maya 
> only checks the paths and doesn't load or create any nodes. It saves an 
> internal settings list for the preload reference editor so you can be 
> selective about what to actually load. This can be controlled with the 
> selLoadSettings function and by default all the references will start out 
> as deferred (unloaded). You could selectively load some of them, but that 
> doesn't seem to be what you are after right now. 
>
> import pymel.core as pmc
>
> scene = "/tmp/refs.mb"
> pmc.openFile(scene, force=True, loadReferenceDepth='none', 
> buildLoadSettings=True)
> pmc.getReferences()# Oh no, it's currently empty!# {}
>
>
> But if you then tell Maya to load the scene with those previously built 
> settings, you should be able to get your FileReferences.
>
> pmc.openFile(scene, force=True, loadSettings="implicitLoadSettings")
> pmc.getReferences()     # or:   list(pmc.iterReferences())# Result: {
>  u'ball1': FileReference(u'/tmp/ball1.mb', refnode=u'ball1RN'),
>  u'cone1': FileReference(u'/tmp/cone1.mb', refnode=u'cone1RN'),
>  u'cube1': FileReference(u'/tmp/cube1.mb', refnode=u'cube1RN')} #
>
>
> You could also select the ones you want to have loaded up front:
>
> pmc.openFile(scene, force=True, loadReferenceDepth='none', 
> buildLoadSettings=True)
> ret = pmc.selLoadSettings(numSettings=True, query=True)
> ids = [str(i) for i in range(ret) if i]
> paths = pmc.selLoadSettings(ids, fileName=True, q=True)
> # tell the ball reference to load
> pmc.system.selLoadSettings(['1'], e=True, deferReference=0)
> pmc.system.selLoadSettings(ids, q=True, deferReference=1)# Result: [False, 
> True, True] # 
>
> pmc.openFile(scene, force=True, loadSettings="implicitLoadSettings")
>
>
> Hopefully this is what you were after?
>
>
> On Wed, Jul 21, 2021 at 12:32 AM Totally Zen <atu...@gmail.com> wrote:
>
>> Yes, in a new code I changed it to use only pymel, but I still have the 
>> result of the type "unicode" and if it's not a type : <class 
>> 'pymel.core.system.FileReference'> I can't use load() or unload() .. :(
>>
>> does anyone have any solution? 
>>
>> Em terça-feira, 20 de julho de 2021 às 06:35:04 UTC-3, 
>> justin...@gmail.com escreveu:
>>
>>>
>>>
>>> On Tue, 20 Jul 2021, 1:32 pm Totally Zen, <atu...@gmail.com> wrote:
>>>
>>>> this command:
>>>> pmc.system.openFile(sceneNameToOpen, force=True, loadReferenceDepth = 
>>>> 'none', buildLoadSettings=True)
>>>> result:
>>>> # C:/my_scene/animal_RIG_A001.v002.mb
>>>> # C:/my_scene/animal_RIG_A001.v002.mb
>>>> # C:/my_scene/animal_RIG_A001.v002.mb
>>>>
>>>
>>>
>>> You started here by using the pymel api.
>>>
>>>
>>>
>>>> nsettings = range(cmds.selLoadSettings(numSettings=1, query=1))
>>>> ids = [str(i) for i in nsettings if i]
>>>> result = cmds.selLoadSettings(ids, fileName=1, query=1)
>>>> print result
>>>> result:
>>>> [u'C:/my_scene/animal_RIG_A001.v002.mb', 
>>>> u'C:/my_scene/animal_RIG_A001.v002.mb', 
>>>> u'C:/my_scene/animal_RIG_A001.v002.mb']
>>>>
>>>> for item in result:
>>>>      item.load()
>>>> ERROR:
>>>> Error: AttributeError: file <maya console> line 27: 'unicode' object 
>>>> has no attribute 'load' #
>>>>
>>>> This is because my result type is coming "unicode" and not as a : 
>>>> <class 'pymel.core.system.FileReference'>
>>>>
>>>
>>> But then you switched to using the commands api which only deals in 
>>> strings. You should keep using pymel if that it what you wanted. 
>>>
>>>
>>> https://help.autodesk.com/cloudhelp/2018/JPN/Maya-Tech-Docs/PyMel/generated/functions/pymel.core.system/pymel.core.system.selLoadSettings.html
>>>
>>>
>>>> and remembering that I want to run my code to find the references and 
>>>> enable and disable without having to load it into maya.
>>>>
>>>>
>>>> Em segunda-feira, 19 de julho de 2021 às 22:18:07 UTC-3, 
>>>> justin...@gmail.com escreveu:
>>>>
>>>>> Did you give it a try with mayapy.exe? 
>>>>>
>>>>>
>>>>> https://knowledge.autodesk.com/support/maya/learn-explore/caas/CloudHelp/cloudhelp/2016/ENU/Maya/files/GUID-83799297-C629-48A8-BCE4-061D3F275215-htm.html
>>>>>
>>>>> On Tue, 20 Jul 2021, 11:36 am Totally Zen, <atu...@gmail.com> wrote:
>>>>>
>>>>>> I need to open a scene without loading in maya and get its 
>>>>>> references, to later work on some to load() correctly
>>>>>> *** I would like to use only pymel ***
>>>>>>
>>>>>> code example:
>>>>>> import maya.cmds as cmds
>>>>>> sceneNameToOpen = "C:\my_scene\animal.mb"
>>>>>>
>>>>>> cmds.file(sceneNameToOpen, loadReferenceDepth = 'none', open=1, 
>>>>>> buildLoadSettings=1):
>>>>>> mel.eval('PreloadReferenceEditor;')
>>>>>>
>>>>>> -- 
>>>>>> 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_m...@googlegroups.com.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/python_inside_maya/cbedc1bf-2d09-4921-8d95-8795855708d1n%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/cbedc1bf-2d09-4921-8d95-8795855708d1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> -- 
>>>> 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_m...@googlegroups.com.
>>>>
>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/python_inside_maya/b9ef65e8-d4c0-4cad-b062-04b0d2662ff2n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/python_inside_maya/b9ef65e8-d4c0-4cad-b062-04b0d2662ff2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> 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_m...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/python_inside_maya/96037f38-0de6-4e2a-a740-278f9c45e0bbn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/python_inside_maya/96037f38-0de6-4e2a-a740-278f9c45e0bbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/29ca0846-0cdb-4669-af31-462469e5c1f1n%40googlegroups.com.

Reply via email to