[Maxscript Help] How to rename multiple bones in 3dsmax?

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:

http://stackoverflow.com/questions/37261262/3dsmax-2011-script-how-to-re...

It`s exactly what I need, however, the above script does not work!

So I changed it a bit to this and at least got some results:

(
local nameMap = #( \
dataPair "R_" "Right",
dataPair "L_" "Left",
dataPair "Clavicle" "Clav"
-- add more mappings here
)

for namePair in nameMap do
(
--test variable values
print namePair.v1
print namePair.v2
for o in getNodebyName namePair.v1 all:on do
(
o.name = namePair.v2
)
)
)

Now it prints:

"R_"
"Right"
"L_"
"Left"
"Clavicle"
"Clav"
OK

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:

for o in getNodebyName namePair.v1 all:on do
(
o.name = namePair.v2
)

Any help?

Cheers.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
goldeneye007's picture

Hello, finnally i was able to

Hello, finnally i was able to solve this problem with the help of another folk from Polycount.

If anyone finds this script usefull, here goes:

(
local nameMap = #( \
dataPair "R_" "Right",
dataPair "R " "Right",
dataPair "L_" "Left",
dataPair "Clavicle" "Clav"
-- add more mappings here
)

for namePair in nameMap do ( -- check name pattern
for obj in objects where matchPattern obj.name pattern:("*" + namePair.v1 + "*") do ( -- parse all objects that match the pattern with the name of the object
obj.name = substituteString obj.name namePair.v1 namePair.v2 -- replace the strings
)
)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.