View Full Version : attach/detach ControlRig with Python
GiantG 08-04-2009, 07:47 AM Can’t find any input in the docs.
any idea?
|
|
_stev_
08-05-2009, 06:28 PM
You can turn off the ActiveInput attr:
lScene = FBSystem().Scene
lChar = lScene.Characters[0]
lChar.ActiveInput = False
Or do you mean something else?
GiantG
08-06-2009, 07:50 AM
Yes i mean something else.
You can have multiple rig's and mutliple chars in a scene. You can attach/detach all of them to any of the chars.
_stev_
08-06-2009, 05:48 PM
Since there doesn't seem to be any built in functions to do this, maybe you can try messing with the connections manually. This works for me in a simple test case with two characters in a scene with one control rig:
lScene = FBSystem().Scene
if len(lScene.Characters) > 1:
# This character has a control rig
lChar1 = lScene.Characters[0]
# This one does not
lChar2 = lScene.Characters[1]
lControlRig = None
# Search source connections
for i in range(lChar1.GetSrcCount()):
lNode = lChar1.GetSrc(i)
# We're looking for the FBControlSet
if lNode.__class__ is FBControlSet:
lControlRig = lNode
# Disconnect
lChar1.DisconnectSrcAt(i)
break
if lControlRig:
# Connect it back to the second character
lChar2.ConnectSrcAt(lChar2.GetSrcCount(), lControlRig, FBConnectionType.kFBConnectionTypeNone)
Stev
GiantG
08-06-2009, 06:39 PM
Great! Works fine!
If you do this via drag&drop mobu asks for resetten DOF Settings and Hierarchy Settings. What happens to them while changing the connection via script? Any Idea?
What about changing the Input Source for the character to achieve this?
But anyway... I little bit messy but works!
thanks!
_stev_
08-06-2009, 06:59 PM
Yeah, I wondered that too. I'm not sure if the DOF's would remain maybe because the rig was never officially detached. Just a guess.
What about changing the Input Source for the character to achieve this
I tried that like this:
lChar2.InputType = FBCharacterInput.kFBCharacterInputMarkerSet
...and it didn't seem to do anything. I couldn't find anything else.
Later,
Stev
CGTalk Moderation
08-06-2009, 06:59 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.