Python Reference Guide
 
Loading...
Searching...
No Matches
BasicOperations\FBClusterTransactions.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Script description:
7# Shows you how to access the cluster and cluster index, while using the cluster
8# transactions.
9#
10# Sample scene file this script works with: FBClusterTransactions.fbx
11#
12# Topic: FBCluster
13#
14
15from pyfbsdk import *
16import os
17import os.path
18
19
20gApp = FBApplication()
21gSys = FBSystem()
22
23gApp.FileNew()
24
25lFilePath = os.path.abspath( os.path.join( gSys.ApplicationPath, r"..\config\FBClusterTransactions.fbx"))
26print("Source File Path", lFilePath)
27
28gApp.FileOpen(lFilePath)
29
30lSphere = FBFindModelByLabelName("pSphere1")
31
32if lSphere:
33 skinCluster = FBCluster(lSphere)
34 print(skinCluster.Name)
35
36 if skinCluster and skinCluster.LinkGetCount():
37 for n in range (skinCluster.LinkGetCount()):
38 skinCluster.ClusterBegin(n) # Set the current cluster index
39 linkName = skinCluster.LinkGetName(n)
40 linkModel = skinCluster.LinkGetModel(n)
41 numVerts = skinCluster.VertexGetCount() # Using the current cluster index
42 print(numVerts)
43 for v in range (numVerts):
44 vertIndex = skinCluster.VertexGetNumber(v) # Using the current cluster index
45 vertWeight = skinCluster.VertexGetWeight(v) # Using the current cluster index
46 print("For Vertex Index %d, the weight is %d" % (vertIndex, vertWeight))
47 skinCluster.ClusterEnd()
48
49
50
51
52
FBApplication is used mainly to manage files.
Definition: pyfbsdk_generated.h:801
Weighting interface for meshes.
Definition: pyfbsdk_generated.h:4325
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18771
FBModel FBFindModelByLabelName(str pModelLabelName)
Find a model in the scene by its label name.