Hi all you good people!
I'm writing on a small script which is putting all objects in a scene into a container.
The script looks like this:
global assetproxyPUB
select objects
assetUnproxyPUB = $
cnt01 = container size:50 name:h1
cnt01.displaylabel = true
cnt01.localDefinitionFilename = h1 + "_container"
cnt01.AddNodeToContent assetproxyPUB
cnt01.SetAccessType #anythingUnlocked
cnt01.ClearLockedContents()
cnt01.SetLockedContents #lockAllAnimation true
cnt01.saveContainer true
cnt01.setOpen false
Sometimes it works, sometimes it doesn't.
Sometimes maxscript replys: "Unable to convert: $selection to type: "
and highlights this line:
cnt01.AddNodeToContent assetproxyPUB
Does anybody have an idea what could be the reason for this and how to deal with it?
Thank you so much! :)
Comments (4)
Comment policy
ahhhh, where was my head.. Thank you so much! I owe you a beer... Problem solved
Hi, I tried to use the selection as array but then I get this error message (in the file attachement).
Any idea, what's going on?
Thank you so much :)
Attachments
Well, it was meant to replace the whole line, not just part of it - note that it's AddNodesToContent, not AddNodeToContent.
It expects one node; when it errors out, you're feeding it multiple nodes. There's no reason to make the variable global, btw. (actually it's a bad practice), and as it's used only once you don't even need the variable. Delete the first three lines and replace the highlighted line with