--
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.
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
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 resultresult:[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'>
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?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 cmdssceneNameToOpen = "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.
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.
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!
# {}
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')} #
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")
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/96037f38-0de6-4e2a-a740-278f9c45e0bbn%40googlegroups.com.
refnodes = pmc.selLoadSettings(ids, referenceNode=True, q=True)
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/4de28868-83cf-4801-86c5-cb414c330444n%40googlegroups.com.