[Closed] Beginner Maxscript help
Hi guys,
I am an animator and have recently been finding myself more and more in situations that require batch processing for efficiency, so time to learn some maxscript!
I am an absolute beginner as Maxscript so any help is appreciated. I have been searching for how to do this but haven’t found much, so I figured I’d just ask.
I need to delete all of the geometry in my scene – so far I think I need to use the geometry superclass, I just can’t find the right way to do it. I basically want.
select superclass geometryclass
delete selected
Further to that, I need to check if there is a helper called Dummy01 the scene, then if there isn’t, create one and align it to the biped root, and make sure it stays aligned during animation.
To align I have the following
$Dummy01.transform = $Bip01.transform
then
select $Bip01
select $Dummy01
$.parent = $Bip01
To parent the helper to the biped root.
If anyone could help me flesh out these scripts, there will be much good karma and internet cookies!
“delete all of the geometry in my scene”
delete geometry
keep in mind that some things are in the geometry class that you might not think of
“I need to check if there is a helper called Dummy01 the scene, then if there isn’t, create one and align it to the biped root, and make sure it stays aligned during animation.”
if $Dummy01 == undefined then --check to see if Dummy01 already exists
(
dummy transform:$Bip01.transform parent: $Bip01 --set the transform and parent on creation
)
^ No need to select anything
Wonderful, thanks! :love:
You were right about the geometry class though – is there a way to delete the meshes in the scene and not biped bones?
Alternatively, if I could delete anything that doesn’t have “Bip*” in the name?
When I try to run the dummy check/creation script, i get an error
if $Dummy01 == undefined then
(
dummy transform:$Bip001.transform parent:$Bip001
)
-- Syntax error: at ), expected <factor>
-- In line: )
)
edit If I put the script on one line, it works! lol
for the deletion:
delete (for o in geometry where classOf o != Biped_Object AND classOf o != Targetobject collect o)
and for the dummy
select( if $Dummy01 != undefined AND $Bip01 != undefined then
(
$Dummy01.transform = $Bip01.transform
$Dummy01.parent = $Bip01
$Dummy01
)
else
(
dummy transform:$Bip01.transform parent:$Bip01
))