Tasks/CreateAndPopulateAConstraintRelation.py
8 from pyfbsdk
import FBConstraintRelation, FBModelMarker, FBConnect
12 def FindAnimationNode( pParent, pName ):
14 for lNode
in pParent.Nodes:
15 if lNode.Name == pName:
25 lModel.Translation.SetAnimated(
True)
29 lSineRampBox = lConstraintRelation.CreateFunctionBox(
'Sources',
'Sine Ramp' )
30 lConstraintRelation.SetBoxPosition( lSineRampBox, 30, 30 )
33 lNumberToVectorBox = lConstraintRelation.CreateFunctionBox(
'Converters',
'Number to Vector' )
34 lConstraintRelation.SetBoxPosition( lNumberToVectorBox, 400, 30 )
37 lPlaceHolderBox = lConstraintRelation.ConstrainObject( lModel )
38 lConstraintRelation.SetBoxPosition(lPlaceHolderBox, 700, 30)
44 lSineRampOut = FindAnimationNode( lSineRampBox.AnimationNodeOutGet(),
'Result' )
45 lNumberToVectorIn = FindAnimationNode( lNumberToVectorBox.AnimationNodeInGet(),
'Y' )
46 if lSineRampOut
and lNumberToVectorIn:
47 FBConnect( lSineRampOut, lNumberToVectorIn )
50 lNumberToVectorOut = FindAnimationNode( lNumberToVectorBox.AnimationNodeOutGet(),
'Result' )
51 lModelIn = FindAnimationNode( lPlaceHolderBox.AnimationNodeInGet(),
'Translation' )
52 if lNumberToVectorOut
and lModelIn:
56 lConstraintRelation.Active =
True
59 del( lModelIn, lNumberToVectorOut, lNumberToVectorIn, lSineRampOut, lPlaceHolderBox, lNumberToVectorBox, lSineRampBox, lModel, lConstraintRelation )
62 del( FindAnimationNode )
65 del( FBConstraintRelation, FBModelMarker, FBConnect )