from pyfbsdk import FBConstraintRelation, FBModelMarker, FBConnect
def FindAnimationNode( pParent, pName ):
lResult = None
for lNode in pParent.Nodes:
if lNode.Name == pName:
lResult = lNode
break
return lResult
lConstraintRelation = FBConstraintRelation( 'AConstraintRelation' )
lModel = FBModelMarker( 'AModelMarker' )
lModel.Visible = True
lSineRampBox = lConstraintRelation.CreateFunctionBox( 'Sources', 'Sine Ramp' )
lConstraintRelation.SetBoxPosition( lSineRampBox, 30, 30 )
lNumberToVectorBox = lConstraintRelation.CreateFunctionBox( 'Converters', 'Number to Vector' )
lConstraintRelation.SetBoxPosition( lNumberToVectorBox, 400, 30 )
lPlaceHolderBox = lConstraintRelation.ConstrainObject( lModel )
lConstraintRelation.SetBoxPosition(lPlaceHolderBox, 700, 30)
lSineRampOut = FindAnimationNode( lSineRampBox.AnimationNodeOutGet(), 'Result' )
lNumberToVectorIn = FindAnimationNode( lNumberToVectorBox.AnimationNodeInGet(), 'Y' )
if lSineRampOut and lNumberToVectorIn:
FBConnect( lSineRampOut, lNumberToVectorIn )
lNumberToVectorOut = FindAnimationNode( lNumberToVectorBox.AnimationNodeOutGet(), 'Result' )
lModelIn = FindAnimationNode( lPlaceHolderBox.AnimationNodeInGet(), 'Translation' )
if lNumberToVectorOut and lModelIn:
FBConnect( lNumberToVectorOut, lModelIn )
lConstraintRelation.Active = True
del( lModelIn, lNumberToVectorOut, lNumberToVectorIn, lSineRampOut, lPlaceHolderBox, lNumberToVectorBox, lSineRampBox, lModel, lConstraintRelation )
del( FindAnimationNode )
del( FBConstraintRelation, FBModelMarker, FBConnect )