Forum Groups
  All forums
    Help & Feedback
      Questions
      Work in progress
      Finished Art
      Non-Max related
    Community
      Offtopic
      News
    Hardware
    Photography



Maxunderground news unavailable

Rename Multiple Morph Channels
show user profile  FX
Is it possible to rename morph channels the same way you can rename multiple objects, ie: removing prefix ?

I have a ton of morph channels I need to remove the first "15" characters from.



read 428 times
6/5/2016 8:15:01 PM (last edit: 6/5/2016 8:15:01 PM)
show user profile  Nanne
Any minute now Garp is gonna drop a maxscript on you that fixes that, I bet! ;)

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 423 times
6/5/2016 9:37:05 PM (last edit: 6/5/2016 9:37:05 PM)
show user profile  FX
I'm not sure..I've been digging around and I can't find out if it's exposed to maxscript.

I've been given a Daz Studio file to work with, in the last few hours I've developed a deep hatred for the software :/

edit: don't ask...you'll get a rant :)
read 418 times
6/5/2016 10:01:45 PM (last edit: 6/5/2016 10:04:02 PM)
show user profile  Nanne
Here you go :)

Just select one object with the Morpher modifier on it and run this script :)

-- script begins
for i = 1 to 100 do
(
oldName = WM3_MC_GetName$.modifiers[#Morpher] i
if oldName != "- empty -" do
(
newName = trimleft oldName "15"
WM3_MC_SetName$.modifiers[#Morpher] i newName
)
)
-- script end

You must deselect and reselect the object to see the changes in the Command Panel though, some Max UI update "bug".

I have marked in bold the string to change if I have misunderstood you. This will change the name from "15channel1" to "channel1". Is that what you want, or do you want to remove the first 15 characters of the name, i.e "AVeryLongStringName" to just "Name"?

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 394 times
6/5/2016 11:31:19 PM (last edit: 6/5/2016 11:38:28 PM)
show user profile  FX
"X" number of characters from the from the front would be cool, as in :

"dazstudioisapileofuttershite" to "shite"

..or more accurately "Genesis2Female.CTRLrFingersFist" to "rFingersFist"

It may be more tricky as some of the morphs are named differently so it would have to ignore any morphs that don't match.

The export options in DS are utter tosh bollocks.

No rush, I have caffeine crash and am hitting the beers again :)

Many thanks for taking the time on this...I will never be at one with code :(

Why am I typing everything in one line with a space in-between?

This is silly.

I obviously need a break, I cannot form a paragraph.



read 368 times
6/6/2016 12:37:10 AM (last edit: 6/6/2016 12:39:41 AM)
show user profile  Nanne
Is this the string you want to remove "Genesis2Female.CTRL" on all morph channels?

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 363 times
6/6/2016 12:45:54 AM (last edit: 6/6/2016 12:45:54 AM)
show user profile  FX
No, I have to be able to edit what needs changing, and for it to ignore any morphs names that don't match the input.
read 360 times
6/6/2016 12:49:31 AM (last edit: 6/6/2016 12:49:31 AM)
show user profile  Nanne
Alright, run this script to open the dialog and enter the string for the prefix you want to remove or replace. Add a string to replace, or leave empty if you just want to remove the prefix.

--script begin
rollout renameMorph "Rename Morhp Channels"
(
label info "First select your object."
edittext orgStrText "Replace:"
edittext replaceStrText "With:"
label tip "Tips: Leave empty to remove rather then replace."
button run "Do it!"

on run pressed do
(
orgStr = orgStrText.text
replaceStr = trimleft replaceStrText.text
print orgStr
print replaceStr

for i = 1 to 100 do
(
oldName = WM3_MC_GetName$.modifiers[#Morpher] i
if oldName != "- empty -" do
(
str = DotNetObject "System.String" oldName
if orgStr.count < oldName.count do
(
prefix = str.remove orgStr.count
if orgStr == prefix do
(
newName = str.remove 0 orgStr.count
newName = replaceStr + newName
WM3_MC_SetName$.modifiers[#Morpher] i newName
)
)
)
)
)
)
renameMorphFloater = newRolloutFloater "Rename Morhp Channel" 300 145
addRollout renameMorph renameMorphFloater
--script end

I have tested it a bit, but there might be some bugs in there, just so you know :P

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 350 times
6/6/2016 1:51:07 AM (last edit: 6/6/2016 1:52:35 AM)
show user profile  FX
That sir is feckin genius :)

Can this be tweaked to affect text anywhere in the morph channel name?

Morphs come in slightly different when using DAE :

JawSizeHeight-Genesis2Female

I tried replacing "trimleft" with "trimright" but it didn't work :)




read 320 times
6/6/2016 2:04:05 PM (last edit: 6/6/2016 2:04:05 PM)
show user profile  Nanne
Okey, try this one. Now you have two radio buttons for if you want to remove the prefix or the suffix.

--script begins
rollout renameMorph "Rename Morph Channels"
(
label info "First select your object."
edittext orgStrText "Replace:"
radiobuttons radiofix labels:#("Prefix", "Sufix") columns:2
edittext replaceStrText "With:"
label tip "Tips: Leave empty to remove rather then replace."
button run "Do it!"

on run pressed do
(
orgStr = orgStrText.text
replaceStr = trimleft replaceStrText.text
print orgStr
print replaceStr

for i = 1 to 100 do
(
oldName = WM3_MC_GetName$.modifiers[#Morpher] i
if oldName != "- empty -" do
(
str = DotNetObject "System.String" oldName
if orgStr.count < oldName.count do
(
if radiofix.state == 1 then
(
prefix = str.remove orgStr.count
if orgStr == prefix do
(
newName = str.remove 0 orgStr.count
newName = replaceStr + newName
WM3_MC_SetName$.modifiers[#Morpher] i newName
)
)
else if radiofix.state == 2 do
(
start = oldName.count - orgStr.count
sufix = str.remove 0 start
if orgStr == sufix do
(
newName = str.remove start
newName = replaceStr + newName
WM3_MC_SetName$.modifiers[#Morpher] i newName
)
)
)
)
)
)
)
renameMorphFloater = newRolloutFloater "Rename Morph Channels" 300 165
addRollout renameMorph renameMorphFloater
--script ends

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 306 times
6/6/2016 10:11:30 PM (last edit: 6/6/2016 10:11:30 PM)
show user profile  FX
Cheers Nanne, it works perfectly, thanks for taking the time on this.

Just out of interest, how long does it take you to do this, and what is the level of brain strain ?
read 283 times
6/8/2016 3:51:06 PM (last edit: 6/8/2016 3:51:06 PM)
show user profile  Nanne
No problem mate, it's always more fun to learn something new when it's for real.

I'm new to both programming and Maxscript, but I would say Maxscript is fairly easy to learn! The syntax can feel a bit inconsistent sometimes between the old stuff in Max and the newer features added lately, so there is a fair amount of googling and reading the Maxscript manual, but Bobo (I think it is him) has done a pretty great work on the manual, and there are lots of tutorials online, including a full tutorial series, called 'Maxscript 101', by the man whom created Maxscript from the beginning. So if you are curious I suggest that you start there. Scripting 3D is lots of FUN(!) because you get such a visual feedback of your work, and speeding up your workflow is tremendously rewarding :)
MAXScript 101 on Vimeo
https://vimeo.com/album/1514565

This was pretty much the 4th Maxscript I ever created :)

Kristoffer Helander
www.kristofferhelander.se
  :: Works ::   |  :: Resumé ::   |  :: Contact ::   |  :: CG Blog ::   |  :: Links ::     
read 282 times
6/8/2016 4:04:42 PM (last edit: 6/8/2016 4:04:42 PM)
show user profile  FX
Nah, I don't script, I don't have the mindset for it, and it doesn't scream fun to me :)

I'd much rather ask/pay someone who knows what they are doing. ;)

I can see how this renamer could be developed into an all in one morph tool, there are many scripts on SSpot, they help, but lack functions meaning having to use 4 or 5 different scripts in one workflow.

Makes you wonder how many "in-house" scripts are out there that never see the light of day :/
read 278 times
6/8/2016 4:18:00 PM (last edit: 6/8/2016 4:18:31 PM)
show user profile  FX
This is me trying to write Maxscript:


read 237 times
6/12/2016 6:07:00 AM (last edit: 6/12/2016 6:07:00 AM)
#Maxforums IRC
Open chat window


Support Maxforums.org