PDA

View Full Version : newbie question: How to enter figure mode if i have only deformable mesh selected


oglop
11-21-2007, 05:29 AM
how do i enter figure mode, if for some reason i can't select the bone manually or create a new biped object, If i have only physique controlled mesh selected, how do i enter figure mode.

in my script, it works on every selection set, but the first step is to enter figure mode, and then i do some other things.


I try to find a solution but failed, physique modifier doesn't provide any properties, and i try to work around this by saving my character in a seperate max file, and select all object(then i must have selected the bone), then loop through each of the objects, but when i run


-- rootBipedObj is supposed to be a biped object
rootBipedObj.transform.controller.figuremode = true



listener responds :


-- Runtime error: Attempt to access deleted Biped


How do i do that ?




-- first display all
actionMan.executeAction 0 "277" -- Tools: Unhide All

-- only show geometry and bone
hideByCategory.all()
hideByCategory.geometry = false
hideByCategory.bones = false

-- now select all
actionMan.executeAction 0 "40021" -- Selection: Select All

-- at least find a bipe_object
selObj = (for o in $ collect o)

mybipedObj

for o in seloBj do
(
if (classof o as string == "Biped_Object") then
(
-- we found a biped_object
mybipedObj = o


try(mybipedObj.transform.controller.figuremode = true)catch
(
print (mybipedObj.name + " is deleted")
continue

)

print (mybipedObj.name + " found")
exit
)

)




I used try()catch() but only to find that all biped_object is deleted , but why ?

Rick Stirling
11-21-2007, 07:42 AM
I take it you can't just assume the name of the bone, and then hard select it?

oglop
11-21-2007, 07:49 AM
The pipeline here is a mess, many character have different biped_object name , some named B, some Biped01, some #$@#$

Rick Stirling
11-21-2007, 09:04 AM
Will there always be a skinned mesh in the scene?

You could select each bit of geo in turn, look to see if it has a skin modifier applied to it, then get the bone name from the bone list.


I've not tried this code, but I think it'll get you going...

You could probably try/catch select the skin modifier, as I recall the syntax was along the lines of:

modPanel.setCurrentObject $.modifiers[#Skin]

Getting the first bone in the list:
theSkin = $.modifiers[#skin]
boneID = skinOps.getVertexWeightBoneId theSkin 1 1
boneName = skinOps.GetBoneName theSkin boneID 0

RustyKnight
11-21-2007, 07:37 PM
Will there always be a skinned mesh in the scene?

You could select each bit of geo in turn, look to see if it has a skin modifier applied to it, then get the bone name from the bone list.


I've not tried this code, but I think it'll get you going...

You could probably try/catch select the skin modifier, as I recall the syntax was along the lines of:

modPanel.setCurrentObject $.modifiers[#Skin]

Getting the first bone in the list:
theSkin = $.modifiers[#skin]
boneID = skinOps.getVertexWeightBoneId theSkin 1 1
boneName = skinOps.GetBoneName theSkin boneID 0That's quite a good idea, I like!

Shane

oglop
11-21-2007, 10:45 PM
That's a good idea but we r using physique modifier here and it has no bonelist attribute. any other workarounds?

Rick Stirling
11-21-2007, 10:57 PM
Sorry, I can't help. As I recall you needed an extra plugin to expose a lot of Physique to script.

My best advice there is to switch from Physique to skin as soon as possible - the physique modifier is effectively dead, and these days Skin is vastly superior to work with. In the long run it really is worth the switch.

RustyKnight
11-21-2007, 11:32 PM
Okay, after some playing around, this is what I've come up with.

Scan the scene for any object with a "biped_object" ie classof $ == biped_objectOnce you have this, use:(biped.getnode $ 13).transform.controller.figuremode = trueto control the figuremode.

If there is more then one biped in the scene, you might want to run up the hierarcy until you find the last biped_object who's parent is either undefined or not a biped_object and store a reference to it. Once you've scaned the scene, you could then set them all...

Shane

oglop
11-22-2007, 12:57 AM
Thank u all guys for ur patience and detailed answer

but when i manually select a bone ( only one character in scene)

and run


biped.getnode $ 13



i got error

-- Runtime error: Attempt to access deleted Biped

what does this mean, sorry i'm a cs newbie


edit: i found the reason. It's beacause when i save out the character, i didn't select the bone. the animation is correct, but it seems the biped object got deleted...

fyi, i'm using max 8, and the character is saved out from a final animation max file using Saving Selected Command.

Now it works 100%, thank u guys

RustyKnight
11-22-2007, 01:10 AM
It would suggest to me that the object no longer exists...

What version of max are you using??

Is the scene Xrefed??

Try creating a new max file and new biped and typing the command again?


Shane

CGTalk Moderation
11-22-2007, 01:10 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.