1# Copyright 2015 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# Advanced script showing how to use cycle creator via script.
8#
9# You will find here:
10# - What is cycle creator?
11# - What can user specified?
12# - What is the exposed API?
13# - What is the pre-condition if using the API?
14# - What is the difference between using API and UI?
15# - Is it recommended to add zero key?
16# - How to use the API?
17#
18# Topic: FBCycleCreator
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#1
38 - the time scope
39 - the name of the new take
40 2) in step#2
41 - whether to align to time ZERO;
42 3) in step#5
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#7
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.