So I’m using Maya standalone to create a new scene and if I have a list of references it will then reference those items into the scene. I can get the script to bring in the references the problem I’m having is that the command is also creating all of these excess nodes, but when I run the script in Maya’s script editor it pulls in the references all nice and clean without the extra junk. Simply the script requires me to send it the name of the new scene and if there are references an array with the path to the references.
import maya.standalone
maya.standalone.initialize(name='python')
import tempfile
from pymel.core import *
def createScene(fileName, refs=None):
path = tempfile.gettempdir()
newFile(new=True, force=True)
print '--------------------'
for ref in refs:
if not ref == None:
FileReference(l=ref)
saveAs(os.path.join(path, fileName+'.ma'), type='mayaAscii')
return os.path.join(path, fileName+'.ma')
[QUOTE=patconnole;22439]What are the extra nodes? Are they specific to the references?[/QUOTE]
yes they seem to be related to the references. Things like ‘ArmRibbon_blendSet’, ‘unique_tweakSet16’, and ‘skinCluster9Set’. But doing the same reference setup in Maya’s console it doesn’t create all those extra nodes.
[QUOTE=Theodox;22441]Are you bypassing the namespace restriction by doing this from the command line? Maybe you’re getting name clashes between referenced files…[/QUOTE]
I just took at look at the namespaces for the file and they actually weren’t created when the script brought in the references. That’s kinda weird… Why would it not create them to begin with? I haven’t restricted the creation of namespaces with my script at all.
So I have set the script creating a namespace for each new reference coming into the scene, Just like maya does when you create one through the gui. It’s still doing this extra node creation when I run it through maya.standalone.
I’m really not sure. I would try a simple case with a cube scene reference, or whatever it takes to get those extra nodes to show up, just as a way to pinpoint why it’s happening. If it happens in that case, diffing the (hopefully small) .ma files might reveal what’s going on.