Passing in ParmTuple into another ParmTuple with Set()

   1561   4   0
User Avatar
Member
41 posts
Joined: May 2021
Offline
To quote Help Files:
"Setting

set(values, language=None, follow_parm_references=True)

Sets the values of the parameters in the tuple at the current frame.

values

A sequence of floats, integers or strings, corresponding to the components of this parameter tuple.

For example, the parameter tuple for "translation" contains hou.Parm objects for translation along each of the axes, "tx", "ty" and "tz". If set is called with the following tuple of floats, (2.5, 4.0, 5.5), then the parameter "tx" with be set to 2.5, "ty" will be set to 4.0 and "tz" will be set to 5.5.

You can also pass in a hou.ParmTuple object for this argument to create channel references from the parameters in this tuple to the parameters in the passed-in tuple. If this tuple has more parameters than the passed-in tuple then no work is performed on the extra parameters. If the passed-in tuple has more parameters than this tuple then the extra parameters are ignored.
"

Can someone show me real world example of this syntax (bolder part of the text)?
User Avatar
Member
8683 posts
Joined: July 2007
Offline
to keep it simple, in empty scene create geo object so it's path will be /obj/geo1
t = hou.parmTuple('/obj/geo1/t')
r = hou.parmTuple('/obj/geo1/r')
r.set(t)
which should create reference link on r tuple to t tuple
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
41 posts
Joined: May 2021
Offline
Got it!!! Thank you very much! I suppose this is a "one way" connection? In this case from "t" to "r"? Can it be keyed afterwards automatically or I need to override manually?


EDIT: Wow this is "forever" connection?! Is there an option to "align" them without keeping the connection? hou.parms?

EDIT N.2: Got what I wanted with hou.parm... final result of prototyping looks like this

IK_rotations=hou.node('/obj/L_UpArm_IK')
>>> IK_rotations_parameter=hou.parm('/obj/L_UpArm_IK/rx').eval()
>>> print IK_rotations_parameter
-31.7642288427
>>> FK_rotations=hou.node('/obj/L_UpArm_FK_CTRL')
>>> FK_rotations_parameter=hou.parm('/obj/L_UpArm_FK_CTRL/rx').eval()
>>> print FK_rotations_parameter
0.0
>>> FK_rotations_parameter=hou.parm('/obj/L_UpArm_FK_CTRL/rx').set(IK_rotations_parameter)

And the FK control rotates properly without reference connection to IK bone... Is there a way to do this on the fly of all axis rotations rx ry rz? Less typing?
Edited by kriegmesser74 - May 24, 2021 15:28:34
User Avatar
Member
8683 posts
Joined: July 2007
Offline
Im a bit confused about what you are asking, you wanted the bold part, which is creating a channel reference
what you are mentioning now is just copying values which going back to the original example would be

t = hou.parmTuple('/obj/geo1/t')
r = hou.parmTuple('/obj/geo1/r')
r.set(t.eval())
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
41 posts
Joined: May 2021
Offline
Thanks again... I'm confused even more trust me... I'm translating an old MEL script I wrote a few winters a go... trying to achieve same things in a waaay different environment than Maya... Here you are throwing tuples around... in Maya you would rotate vectors with "GetAttr","SetAttr", and "Xform" in -WorldSpace (flag)...
  • Quick Links