Notifications
Clear all

[Closed] Help with Biped + Maxscript

Hi all,

First off, please bear with me, I am still a very new maxscript user. I’ve been searching how to do this without any luck and am a little frustrated.

Basically what I’m trying to create is a script that gathers all bipeds into an array, and then assigns each of the bipeds a random pose (out of a preset number of pre-created poses)

I renamed each biped Crowd1 – Crowd5 and gathered them in an array by

bipCrowd = $Cro* as array

I am stuck with how to use the copy/paste poses scripts and need some help understanding them

So for example

biped.pasteBipPosture <biped_ctrl>   (#pstdefault |#pstcopied |#pstinterp)  

I need some help in understanding a few things, like biped_ctrl, ICP_MXBipedCopy. What are these inputs that I need to be putting in. Also have I gone about reading the help file the wrong way, I can’t seem to see any examples.

Again, apologies if there is something blatantly obvious I’m missing, maybe I’m approaching the way I read the help file in the wrong way.

Any help appreciated.

Thanks

3 Replies

First off, the MaxScript help file is useless on this. The only file that will save you is the SDK.

EXTREMELY annoying and very frustrating, but there’s nothing documents in the normal Max help files that will tell you how to get an ICP_MXBipedCopy.

However, I’m here to help, since I’m actively trying to do something similar, and I just found the answer we’re both looking for.

First off, <biped_ctrl> is the .controller of the biped root node you want to copy from/paste to. In your example, you’d be using something like:

$Crowd1.controller

or even

bipCrowd[1].controller

Secondly, the ICP_MXBipedCopy can be gotten in a couple of steps. You need the copy collection that the pose/posture/track is in.

cpyCol = biped.getCopyCollection $Crowd1.controller 1

This will get you the first copy collection attached to that biped. I’m assuming you’ve only got one. If you’re looking for a copy collection with a specific name, you could do something like this:

i = 1  -- doing this outside the while loop so it doesn't disappear due to variable scope fun
cpyCol = undefined    -- doing this outside the while loop so it doesn't disappear due to variable scope fun
while (cpyCol = biped.getCopyCollection $Crowd1.controller i) != false do
(
if cpyCol.name == "TheCopyCollection" then exit
i += 1
)
-- cpyCol will either contain "false" meaning that the copy collection named "TheCopyCollection" did not exist, or it will contain the correct copy collection.

Once you have the copy collection, you need to get the pose/posture/track you’re looking for.

You can get the number of copies in the collection using:

numCopies cpyCol (#pose|#posture#track)

You can also get the copy using:

getCopy cpyCol (#pose|#posture|#track) <copy index>

The returned copy has a .name property so you can use it to search for a copy with a specific name.

Using the above code will get you the mysterious <ICP_MXBipedCopy> you need for

biped.pasteBipPosture <biped_ctrl> <ICP_MXBipedCopy> <bool_opposite> (#pstdefault |#pstcopied |#pstinterp) <bool_hor><bool_ver><bool_trn><bool_byvel>

and its friends. Now, I’m only interested in tracks, and I barely deal with postures… You’ll have to try (#pstdefault|#pstcopied|#pstinterp) each and see what results you get. I’ve never touched them, so I have no real idea what each of them does.

<bool_hor><bool_ver><bool_trn><bool_byvel>

refer to the Horizontal, Vertical, Turn, and By Velocity buttons in the paste options, though.

Hope this helps!

Interesting thread. I’ve had some success writing a small script to batch fix fingers on several hundred mocap anims.

					
--Clean up fingers, prior to Export

clearSelection()
biped.createLayer $Bip.controller 1 "fingerLayer"
										
select $Bip
with animate on 
	(
		copycol= biped.getcopycollection $.controller 9
		ICP_MXBipedCopy=getCopy copyCol #posture 0
		biped.pasteBipPosture $.controller ICP_MXBipedCopy true #pstdefault false false false false
		biped.pasteBipPosture $.controller ICP_MXBipedCopy false #pstdefault false false false false
		biped.collapseAtLayer $Bip.controller  0 	
		$Bip.transform.controller.inPlaceMode=false
	)
		

is there an example for this code