Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / Create AuxPivot in Python?
  RSS 2.0 ATOM  

Create AuxPivot in Python?
Rate this thread
 
40739
 
Permlink of this thread   Subscribe to this thread
avatar
  • Total Posts: 10
  • Joined: 15 March 2010 12:38 PM

How can i create an AuxPivot in Python and move them to a certain position?



Replies: 1
/img/forum/dark/default_avatar.png

so nobody knows......?

Author: oby1u1933u

Replied: 19 March 2010 01:20 AM  
avatar
  • kjetilhk
  • Posted: 23 March 2010 04:13 AM

I have the same problem…

Making a aux effector/pivot is simple because it’s just a FBModelMarker

# select the effector where you want an aux effector 
effector FBModelList()
FBGetSelectedModels( effector )

aux1 
FBModelMarker(effector[0].Name "Aux")
aux1
.Show True
aux1
.Type FBMarkerType.kFBMarkerTypeIKEffector

matrix 
FBMatrix()
effector[0]
.GetMatrix(matrix)
aux1
.SetMatrix(matrix)

Now the problem is connecting it to the rig :|
Dont know how to do this but I’m guessing it is trough the FBControlSet, which you can get like this:

char FBSystem().Scene.Characters[0]
controlSet 
char.GetSrc(0)

FBControlSet is inherited from FBPlug, so it has all the Connect functions.

Also there is a class named FBEffectorSetID which may be related to this issue? :|

Please tell me if you figure this out… I will report if I get it working



Replies: 0
avatar
  • kjetilhk
  • Posted: 23 March 2010 11:37 AM

This is how to do it! :)

def makeAuxEffector():

    
controlSet FBSystem().Scene.Characters[0].GetCurrentControlSet()
    effectorDst 
controlSet.PropertyList.Find("RightAnkleEffector")
    effector 
controlSet.GetIKEffectorModel(FBEffectorId.kFBRightAnkleEffectorId0)

    aux1 
FBModelMarker(effector.Name "Aux")
    aux1
.Show True
    aux1
.Type FBMarkerType.kFBMarkerTypeIKEffector

    matrix 
FBMatrix()
    effector
.GetMatrix(matrix)
    aux1
.SetMatrix(matrix)
    
    aux1
.ConnectDst(effectorDst)

makeAuxEffector()


Replies: 0
avatar

hi guys,

thank you for the rep. I will test it.



Replies: 0
avatar
  • Seb123
  • Posted: 14 July 2010 05:36 AM

works nicelly. how would I move its pivot then, so that the ankle rotates from the ball of the foot? I have tried using getvector and setvector to the IKPivot but that doesnt work properly. I have to some how get the pivot of the object i guess…



Replies: 1
/img/forum/dark/default_avatar.png

I think that property for that is called IKPivot, please try.

Cheers

Author: KxL

Replied: 14 July 2010 11:03 PM  
avatar
  • Seb123
  • Posted: 15 July 2010 12:21 AM

i tried that but it moves the foot with it. what i need is to move the pivot like if you go in pivot mode and move it manually.



Replies: 1
/img/forum/dark/default_avatar.png

strange, in 2010 I have created Aux Pivot for ankle, selected and runned this script

from pyfbsdk import *

lModels FBModelList()
FBGetSelectedModels(lModels)

if 
len(lModels) > 0:
    
IKPivot lModels[0].PropertyList.Find('IKPivot')
    if 
IKPivot:
        
IKPivot.Data FBVector3d(30,30,20)
        print 
IKPivot

worked as expected.

Author: KxL

Replied: 15 July 2010 01:05 AM  
avatar
  • Seb123
  • Posted: 15 July 2010 02:39 AM

so, here is how i create it. If i manually change the IK pivot the ankle effector moves oposite from the aux. same when i run the script you posted. The only way it works is by going into pivot mode and move it.

controlSet = FBSystem().Scene.ControlSets [0]

def makeAuxEffector(lEffector, lid, lname, lPlace):

lChar = FBSystem().Scene.Characters[0].GetCurrentControlSet()
effectorDst = controlSet.PropertyList.Find(lEffector)
effector = controlSet.GetIKEffectorModel(lid, 0)

laux = FBModelMarker(lname)
laux.Show = True
laux.Size = 350
#xlaux.Parent = lPar
laux.Type = FBMarkerType.kFBMarkerTypeIKEffector

lmatrix = FBMatrix()
effector.GetMatrix (lmatrix)
laux.SetMatrix (lmatrix)

laux.ConnectDst(effectorDst)

makeAuxEffector("RightAnkleEffector", FBEffectorId.kFBRightAnkleEffectorId, “R Ankle Aux Pivot”, “RightFootEffector")



Replies: 0




   
  Settings Choose Theme color: