[Closed] assign mocap data
Hi,
I am an absolute beginner to maxscript, but not in programming at all. My task ist to assign different motion capturing data to a skinned model. I know the “normal” way how to do this in max, but I need to know how to do this through maxscript.
Is there a tutorial, I didnt found yet? What are the functions I should check?
Thanks
Oli
You’re not very specific… are you using Biped or a custum skeleton… what data do you put in fbx or something else… what exactly do you want that this script will do? Fully automatic loading of files and mocap data or just applying mocap data to a selection… There’s a lot of unknowns here… what did you try already?
-Johan
Hi,
sorry for being unspecific…I hope with answering your questions it will get better.
are you using Biped or a custum skeleton
It is an out-of-the-box biped.
what data do you put in fbx or something else
I am not totally sure, what you mean…the mocap-data is stored in .bip files.
what exactly do you want that this script will do?
First it would be great to load the mocap-data from file and apply it to the selecion.
I think, when this step is done I know how to get further…
I tried to find some stuff like this with google, but without any success…so I hope you can help me with some hints.
Thanks!
Oli
Lookup “biped.loadBipFile” or “biped.loadMocapFile” in the maxscript helpfile.
Something like:
n = $.rootNode //select a biped part
biped.loadMocapFile n "c:\mocapdata\mocapfile"
To start with…?
Goodluck,
-Johan
Hi,
thanks for your answer…I think it will help a lot, but unfortunatly I didnt reach the point where I can use it. I need to clone an existing skinned model with biped. Is there an special function for cloning a biped? I didn`t fount anything like this in the documentation…but probably I dont know enought about maxscript yet to look at the right place.
I have: a simple, skinned model with biped
I need: get an exact clone of it
When I select the model with the biped and clone it with Ctrl+V I got the result, I need. But unfortunatly the MacroRecorder doesnt help me, because there seems to be special commands for the recorder.
I hope my English was not too bad and you can help me.
Thanks!
Oli
You may want to think about merging the same biped rig again into the current scene instead of cloning. This works best after renaming the existing biped and related nodes.
I’m can’t garantee it works, but look at the
“CloneNodes” code… it may work, since it will take care of depencies to some extent.
-Johan
thanks…but I dont understand exactly what you mean with “merging into scene”.
Perhaps I should explain, what my final goal is:
We have a skinned model with biped and want to replicate this model. Afterwards I want to modify the model with some modifiers to change the look and assign mocap data to it.
At the end I want to have a few clones, which have a different look and does different things (mocap) in the scene.
I hope this explanation makes the thing more clear.
As I mentioned I am an absolute beginner to maxscript, so small code snippets would be extremly helpful.
thanks!
Oli
I wrote a sample script for you during my lunch hour … not yet done, but
you could go thro it,
It merges a character rig multiple times and then renames, and then modifies it …
not commented yet … will do so after I get home…
struct mocapImporterStruct
(
mCurMergedCharacters = #(),
mCurMergedBipRoots = #(),
mTheBipFileDir = "",
mCurRigPath = "",
mCurPrefix = "",
mCrowdCount = 0,
fn mergeACharacter theIndex =
(
curRigNodeNames = getMAXFileObjectNames mCurRigPath quiet:true;
mergeMaxFile mCurRigPath #select #useMergedMtlDups quiet:true;
allMergedNodes = for obj in $* where findItem curRigNodeNames obj.name != 0 collect obj
mCurMergedCharacters[theIndex] = allMergedNodes;
theBipRoot = for obj in allMergedNodes where (try(classof obj.controller == Vertical_Horizontal_Turn)catch(false)) collect obj;
mCurMergedBipRoots[theIndex] = theBipRoot[1];
),
fn renameCharacter theIndex =
(
-- #### CAUTION : This process of renaming is only a sample. Biped nodes may need to be renamed differently.#####
for obj in mCurMergedCharacters[theIndex] do
(
obj.name = mCurPrefix + (theIndex as string) + "_" + obj.name
)
),
fn modifyCharacter theIndex =
(
-- the below code needs to be changed if skin modifier is renamed to something other than "Skin".
allSkinnedObjs = for obj in mCurMergedCharacters[theIndex] where obj.modifiers[#skin] != undefined collect obj;
for obj in allSkinnedObjs do
(
addModifier obj (Push());
obj.push.push_Value = random 0.5 3;
)
),
fn loadBipFileOnChar theIndex theBipFile =
(
),
fn importMocapMultiple theIndex =
(
mergeACharacter (theIndex);
renameCharacter (theIndex);
modifyCharacter (theIndex);
)
)
iMocapImporterStruct = mocapImporterStruct()
iMocapImporterStruct.mCurRigPath = "C:/Shared/MaxMayaPipe/TestCharacters/MaxCharacters/skin_k0402_A.max";
iMocapImporterStruct.mCurPrefix = "Char_";
iMocapImporterStruct.mCrowdCount = 3;
for i = 1 to iMocapImporterStruct.mCrowdCount do
(
iMocapImporterStruct.importMocapMultiple i
gc()
)
ok, I got a few more things…so here is the code, which does the cloning of my model with the Biped.
for i = 1 to 10 do (
maxOps.cloneNodes $ cloneType:#copy newNodes:&nnl select #($Bip02,$Zeb_LR01) mod_result = mod i 2 if (mod_result == 0) then move $ [20,20,0] else move $ [-20,20,0] n = $Bip01.controller biped.loadBipFile n "C:\Users\Oli\Videos\Documents\3dsmax\mocap\walk-normal-takiguchi.bip" )
The root-nodes of the bipeds are called “Bip01”, “Bip02”, “Bip03” and so on…at the moment I dont know, how to get through all these root-nodes and assign the mocap-data to them.
What is the best way to loop through all my biped root nodes?
Thanks
Oli
EDIT: thanks for the script, but it looks much more difficult than my one…comments would be very useful. thanks!