Hello folks,
I have some rigged biped characters which I want to export to UDK. For exporting to UDK, the bones objects must have the same name of default UDK Skeleton.
Whenever I manually rename the bones, it works perfectly, however I want a script to this automatically. Searching on google I came to this topic:
It`s exactly what I need, however, the above script does not work!
I only know the very few basic notions of maxscript, and whenever I run this script:
(
local fromPrefix = "mixamo:"
local toPrefix = "bip01_"
local nameMap = #( \
dataPair "left_foot" "Lfoot",
dataPair "neck" "neck_special_effects_attachment"
-- add more mappings here
)
for namePair in nameMap do
(
local fromName = fromPrefix + namePair.v1
for o in getNodebyName fromName all:on do
(
o.name = toPrefix + namePair.v2
)
)
)
I don`t receive any errors in Max Listener, however, the bones don`t get renamed and by analizing the script, I think the problem is with the variable namePair, which was not declared.
Whenever i try to print the fromName variable, then i get a Max Listener error message saying that the namePair.v1 (the first value of the array) is undefined.
I tried to read some instructions here on official 3dsmax documentation:
But i don`t know how to make this script to work.
If anyone can help me, I will be very gratefull.
Thanks in advance.
Cheers.
Replies
"I think the problem is with the variable namePair, which was not declared."
In MaxScript you don't need to declare variables as strictly as with other languages. "for namePair in nameMap do" is enough for MaxScript.
"Whenever i try to print the fromName variable, then i get a Max Listener error "
It works for me if I put print namePair.v1 after line 13.
You are right, the two values of dataPair are being correctly processed on the script.
I changed the script a bit:
Now it prints:
So this is good, however, the problem is that the object selected, in case the bone Clavicle, does not get renamed, the name is still Clavicle instead of Clav.
I think it is something which has to do with this part of the script, this statement which tells to rename the object:
Any help?
Cheers.
GetNodeByName needs the fullname not just a part of it.
The script work, it just doesn't find any node just named 'L_' or 'Clavicle'
It can't find (currently) 'L_Clavicle' or vice-versa.
This should do it: