Community
from pyfbsdk import *
lScene = FBSystem().Scene
iValue = 10 # sample value
iFrame = 10 # sample value
def FindAnimationNode( lScene, pNode ):
print("test first")
lResult = None
lName = pName.split( '/' )
for lNode in pNode.Nodes:
print("test second")
if lNode.Name == lName:
if len( lName ) > 1:
print("exist")
lResult = FindAnimationNode( pName.replace( '%s/' % lName, '' ), lNode )
else:
print("not exist")
lResult = lNode
break;
return lResult
def KeyAnimation( pName, pDst ):
print("test third")
lAnimNode = FindAnimationNode( pName, pDst.AnimationNode )
print("test fourth")
if lAnimNode.FCurve:
for lKey in lAnimNode.FCurve.Keys:
lAnimNode.KeyAdd( 10, 10 )
for lcon in lScene.Components:
if lcon:
# searching for constraint with locator in name
if lcon.Name.find("locator") != -1:
lDst = lcon.Name
print (lcon.Name)
KeyAnimation( 'Lcl Translation/X', lDst )
from pyfbsdk import FBModelList, FBGetSelectedModels, FBPropertyManager, FBVector3d
def SetKey( pAnimationNode, pValue):
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
lModelList = FBModelList()
# Get the selected models.
FBGetSelectedModels( lModelList )
for lModel in lModelList:
SetKey(lModel.Translation.GetAnimationNode(), FBVector3d(15,10,50))
# Cleanup.
del( lModelList, SetKey )
del(FBModelList, FBGetSelectedModels,FBPropertyManager, FBVector3d)
from pyfbsdk import FBModelList, FBGetSelectedModels, FBPropertyManager, FBVector3d,FBModelTransformationMatrix,FBSystem,FBFindModelByName,FBModel
lModelList = FBSystem().Scene
def SetKey( pAnimationNode, pValue):
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
lModelList = FBFindModelByName("locator" , None)
if lModelList == None:
print("None Found")
for lModel in lModelList:
lModel.Selected = True
tvector = FBVector3d()
lModel.GetVector(tvector, FBModelTransformationMatrix.kModelTranslation)
SetKey(lModel.Translation.GetAnimationNode(), tvector)
# Cleanup.
del( lModelList, SetKey )
del(FBModelList, FBGetSelectedModels,FBPropertyManager, FBVector3d, FBModelTransformationMatrix,FBSystem,FBFindModelByName,FBModel)
FBFindModelByName(...)
from pyfbsdk import FBSystem, FBScene, FBVector3d
def SetKey( pAnimationNode, pValue):
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
pAnimationNode.Nodes.KeyAdd(pValue)
def LookInHierarchy(pRoot, pPrefix):
if pRoot:
if pRoot.Name.find(pPrefix)==0 :
SetKey(pRoot.Translation.GetAnimationNode(), FBVector3d(15,10,50))
for lChild in pRoot.Children:
LookInHierarchy(lChild, pPrefix)
LookInHierarchy(FBSystem().Scene.RootModel, 'locator')
# Cleanup.
del( LookInHierarchy, SetKey)
del( FBSystem, FBScene, FBVector3d )
Can't find what you're looking for? Ask the community or share your knowledge.