Could somebody please help me out with a script that transfers SRTs from one group to another? Both groups have the same amount of objects with the same name. Actually I need to transfer the static pose of a model at a certain frame to another model with a similar rig (same amount of controletrs, but differently placed). So I want to copy the SRTs of the controler group a to group b.
# Python
xsi = Application
collSel = xsi.Selection
obj1 = collSel(0)
obj2 = collSel(1)
xformTemp = XSIMath.CreateTransform()
xform1 = obj1.Kinematics.Local.GetTransform2(None)
xform2 = obj2.Kinematics.Local.GetTransform2(None)
xformTemp.SetTranslation(xform2.Translation)
xformTemp.SetRotation(xform1.Rotation)
obj2.Kinematics.Local.PutTransform2(None, xformTemp)
That's the only thing I found on thre google group. It seems to transform only the rotation from selection a to b. I would need it to work for the whole SRT and from group a to group b.
No idea how to program this.
Anybody?
Cheers
Thomas
Transfer SRTs from one group to the other
Re: Transfer SRTs from one group to the other
Do you need to program this? How many times will you need to repeat it? You could just save an action for the first model with all the controllers included, copy the action into the mixer of the new model and apply action with new one selected. If named the same it should transfer across fine.
Re: Transfer SRTs from one group to the other
Didn't think of that so far. Might be fine. Probably I can make things easier with a text application to replace and replicate some stuff.
Thought there's an easy way to use the script if there is something like a "iterate over group members" in python.
Thanks, Matt.
Thought there's an easy way to use the script if there is something like a "iterate over group members" in python.
Thanks, Matt.
Re: Transfer SRTs from one group to the other
Of course you can iterate group members with a simple for loop group.members. As obvious as it sounds.
What this does:
condition: only works if you have 2 selected objects and the first one is a group.
copy the global transform (SRT) from each member of the first selected group to the object of the same name in the second selected group if it exists.
Code: Select all
x = Application
sel = x.Selection
l = x.Logmessage
if sel.count == 2 and sel(0).type == "#Group":
groupA = sel(0)
groupB = sel(1) #source
for objA in groupA.members:
objB = groupB.members(objA.name)
if objB :
objA.Kinematics.Global.Transform = objB.Kinematics.Global.Transform
else :
l ("["+ str(objA.name) + "] doesn't exist in " + str(groupB.name) )
condition: only works if you have 2 selected objects and the first one is a group.
copy the global transform (SRT) from each member of the first selected group to the object of the same name in the second selected group if it exists.
M.Yara
Character Modeler | Softimage Generalist (sort of)
Character Modeler | Softimage Generalist (sort of)
Re: Transfer SRTs from one group to the other
Thanks! I'll give it a try asap!
Re: Transfer SRTs from one group to the other
Excellent!!! Thanks so much!
Kine.global didn't work nicely, but kine.local did it!!!
Kine.global didn't work nicely, but kine.local did it!!!
Who is online
Users browsing this forum: No registered users and 21 guests