BasicOperations/CopyClone.py

BasicOperations/CopyClone.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 how the copy module can be use to duplicate some MotionBuilder objects.
8 # Internally, each type that has a Clone method exposed can be used with __copy__
9 #
10 
11 
12 from pyfbsdk import *
13 import copy
14 
15 sys = FBSystem()
16 scene = sys.Scene
17 
18 # Test built in __copy__ method that dispatches on Clone
19 
20 # Model
21 m = FBModelCube("Cube")
22 m.Show = True
23 m2 = copy.copy(m)
24 
25 # character
26 if len(scene.Characters):
27  c = scene.Characters[0]
28  c2 = copy.copy(c)
29 
30 # constraint
31 if len(scene.Constraints):
32  constraint = scene.Constraints[0]
33  constraint2 = copy.copy(constraint)
34 
35 # Material
36 if len(scene.Materials):
37  mat = scene.Materials[0]
38  mat2 = copy.copy(mat)
39 
40 # texture
41 if len(scene.Textures):
42  t = scene.Textures[0]
43  t2 = copy.copy(t)