1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21'''
22- What is cycle creator?
23
24 Cycle creator is a tool to automate the progress that an animator creates a
25 character animation cycle, which including below steps:
26 1) cut assigned time scope of character animation and copy to new take;
27 2) align copied animation to start from time ZERO (optional);
28 3) create a new layer;
29 4) add key in the start frame;
30 5) copy the character pose of start frame and paste it to the end frame;
31 6) add key in the end frame;
32 7) find the frame with most different pose from the pose in start frame,
33 and add zero key on that frame (optional).
34
35- What can user specified?
36
37 1) in step
38 - the time scope
39 - the name of the new take
40 2) in step
41 - whether to align to time ZERO;
42 3) in step
43 - how to match the referenced joint according to T x y z R?
44 - which referenced joint (limited to IK) is chosen?
45 4) in step
46 - whether want to add zero key?
47
48- What is the exposed API?
49
50 /** Create animation cycle for current character if pChar is
51 * NULL, else for the character assigned by pChar; during
52 * the time scope between pStartTime and pEndTime.
53 * \param pStartTime Start time of the cycle
54 * \param pEndTime End time of the cycle
55 * \param pChar Target character, if it is NULL, try to use current character
56 * \param pMoveStartToZero Whether move start time to zero time
57 * \param pAddZeroKey Whether add zero key
58 * \param pNewTakeName The name used to create the new take.
59 * \param pReferencedIK The IK that used as referenced object in pose pasting.
60 * \param pPasteTx Whether consider Translation X on referenced IK when doing pose pasting
61 * \param pPasteTy Whether consider Translation Y on referenced IK when doing pose pasting
62 * \param pPasteTz Whether consider Translation Z on referenced IK when doing pose pasting
63 * \param pPasteR Whether consider Rotation on referenced IK when doing pose pasting
64 * \param pPasteG Whether respect Gravity when doing pose pasting (Translation = Global XZ / Rotation = Global Y). Note: if G is true then Ty will be forced changed to false.
65 * \return true if successful.
66 */
67 bool FBCycleCreator::CreateCycle( FBTime pStartTime,
68 FBTime pEndTime,
69 FBCharacter* pChar = NULL,
70 bool pMoveStartToZero = false,
71 bool pAddZeroKey = true,
72 const char* pNewTakeName = "",
73 FBModel* pReferencedIK = NULL,
74 bool pPasteTx = true,
75 bool pPasteTy = false,
76 bool pPasteTz = true,
77 bool pPasteR = true,
78 bool pPasteG = true );
79
80- What is the pre-condition if using the API? And what is the difference from using UI?
81
82 From the UI, there are 4 preconditions:
83
84 1) Current character is not None;
85 2) Current character is driven by control rig;
86 3) the control rig has animatioin.
87 4) the local marks has been selected.
88
89 From the script,
90
91 If don't assign character, then there must be a valid current character fitting
92 above top 3 preconditions; else assigned character must fit top 3 preconditions.
93
94 The 4th condition is replaced by the pStartTime and pEndTime parameters. As
95 long as pStartTime and pEndTime are assigned, it knows where to cut the animation.
96
97- Is it recommended to add zero key?
98
99 Cycle Creator only adds one zero key considering the difference of pose, if
100 that fit your requirement, then the answer is yes. Else, you can skip it
101 and add the zero keys by yourself.
102
103'''
104
105from pyfbsdk import *
106import os, inspect, sys
107
108cycle = FBCycleCreator()
109start = FBTime(0)
110end = FBTime(0)
111end.SetFrame(15)
112
113# Note: Make sure there is at least one character in scene
114# Senarior#1. Assgin start time and end time (minimum parameters)
115
116
117
118
119
120
121
122
123
124
126if len(scene.Characters):
127 char = scene.Characters[0]
128 print(char.Name)
130success = cycle.CreateCycle(start, end, char, True, False, "new take name", model, True, False, True, True, True)
131print(success)
132
133
Provides access to the underlying system, and the MotionBuilder scene.
Definition: pyfbsdk_generated.h:18837
FBModel FBFindModelByLabelName(str pModelLabelName)
Find a model in the scene by its label name.