[Closed] Selecting object from outputed text
hi all,
im trying to write a script that will output bone names in the skin of an object to a text file,
i am then loading those back in to a new maxfile and applying those bones to a new skin modifier.
The problem i am running in to while in the new file is that max wont recognize the bones as actual node, but when i copy the string manually from the text file and use that it works fine. Im guess there is a step im missing but i am stuck ATM.
here are some code snippets:
--creation of outputed text
boneName = skinOps.GetBoneName obj x 0
format ("$'" + boneName +"'
") to:out_file
--reading of text to add bones to modifier
curBone = readLine read_file
format "%
" curBone
skinOps.Addbone obj curBone 1
anyone have any alternate ideas?
You need to convert the string to a node reference. You can use getnodebyname() like Dave suggested or use the execute command to convert the string to a node:
boneNode = execute (“$”+curbone)
skinOps.Addbone obj boneNode 1
-Eric
getNodeByName is the proper way, though. here’s a third, just for kicks…
for o in objects where (o.name == curbone) do ( <something> )