adding rotation controller to the controller list via script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  02 February 2013
adding rotation controller to the controller list via script

having trouble adding a rotation controller to the controller list via script.
I have typical 3 chain IKFK bones, select the deformation bones, and run this script:


for each in $ do(
	local DEF_name=each.name
	local IK_name=substituteString DEF_name "DEF_" "IK_"
	local FK_name=substituteString DEF_name "DEF_" "FK_"

	local DEFobj=execute ("$" + DEF_name)
	local IKobj=execute ("$" +IK_name )
	local FKobj=execute ("$" + DEF_name)

	local rc = orientation_constraint()
	rc.appendTarget FKobj 50.0
	rc.appendTarget IKobj 50.0
	DEFobj.rotation.controller = Rotation_list()
	DEFobj.rotation.controller.available = rc --this seems to be the problem
	)


get this error:

-- Unable to convert: Controller:Orientation_Constraint to type: Quaternion


I am able use mxs to to completely replace the list with an orientation constraint, but that is not what I wish to do, as subsequent scripts will break.
 
  02 February 2013
That is because you are trying to set the value of the available controller. To assign a new controller you have to set the DEFobj.rotation.controller.available.controller = rc.

-Eric
__________________
"The Evil Monkey hiding in your closet."
 
  02 February 2013
hmmm... doesn't quiet do the trick.
No errors, but the controller it adds looks like a second Euler controller, named "Available".

I'm trying to add an orientation Constraint.

Perhaps I need to somehow add a Sub Anim?

In essence I am trying to replicate precisely the resulting controller configuration that you get when you manually assign an orient constraint to an object via the animation menu.

Last edited by Mambo4 : 02 February 2013 at 01:05 AM.
 
  02 February 2013
Originally Posted by Mambo4: In essence I am trying to replicate precisely the resulting controller configuration that you get when you manually assign an orient constraint to an object via the animation menu.

what can be easier? just look in mcr file and get how they do it. that was one of resources that helped me to learn 'rig scripting'.
 
  02 February 2013
If you are trying to add Orientation_Constraint via script then you can do it this way. where $[1] (first obj selected) is the object you want to constraint and $[2] (second object selected) is the object you want to constraint it to.


$[1].rotation.controller = Rotation_list()
Oc = Orientation_Constraint()
$[1].rotation.controller.available.controller = Oc
orientConstraint = Oc.constraints
orientConstraint.appendtarget $[2] 100


Let me know if that helps. I also agree with Denis looking at the .MCR in max will take a long way at figuring out how some things are done in max via script.
__________________
Felipe Nogueira aka: PePeTD
Technical Artist/Character TD
http://felipenogueira3d.com
 
  02 February 2013
thank everyone for the help.

It never occurred to me that much of the buttons in MAX would have associated .mcr files, thanks for the tip.
I assume Macro_Constraints.mcr is the script I should examine in this case.
Unfortunately the relevant command to orient constraint looks like this:

on execute do ( AssignConstraintSelection Orientation_Constraint ~ORIENTATION_CONSTRAINT_ROTATION~ Rotation_List ConstrFilterFn ~CONSTRFILTERFN_PICK_OBJ_CAPTION~ ~CONSTRFILTERFN_ORIENTATION_CONSTRAINT_CAPTION~ )


which is no more clearer than the max script help files
nor does it look like anything I can make functional.
I'm not even sure what ~TEXT_LIKE_THIS~ represents ( tho I suspect it's constants for localized interface text).

here is what worked for me:


$.rotation.controller = Rotation_list() --converts rotation controller form Euler XYZ to list, adds EulerXYZ to that list
$.rotation.controller.available.controller=orienta  tion_constraint() --adds orient constraint to the list
$.rotation.controller.setactive 2 --otherwise, EulerXYZ was active
$.rotation.controller[#Orientation_constraint].appendTarget $Bone001 50 --($.rotation.controller[2] would also work, but I like to keep things clearer)


My trouble seems always to arise from not understanding how to correctly target the constraints / controllers / subanims.
I'm used to the simplicity of Maya/Python object.property
versus Max's more obfuscated (to me) object.controller.controller_type.list_controller_ thingy.sub_anim_thingy.property
 
  02 February 2013
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:08 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.