I've been trying to get some information on how to create and/or modify Character Perform actions. Here is what I have learned including a quick tutorial on how to add a new action to an existing persona.
This tutorial uses only iClone and a text editor with Motion created in iClone. As such 3DXchange or other software is not required.
- New character actions can be added using either XML or LUA. Persona import supports both AML and LUA files but Persona exports only supports LUA.
- Since iClone 3, there has been an AML script editor for creating/modifying AML scripts. You can get it at:
http://developer.reallusion.com/amleditor.aspx with some demos. However, I found that editing the LUA scripts directly is just as easy. I suggest having a brief look at the first tutorial on that page since it explains some of the fields but after that just edit the LUA script directly (as per the below steps).
- A character's perform actions are combined into a single Persona LUA script file. As such if you want to add or modify a perform action you need to first export the current character Persona. You may be able to import individual perform actions by importing a LUA script directly (as opposed to loading a Persona) but I have not tried it.
- Personas (list of perform actions) are just references to iMotion files with possibly some additional information. So you need to start by creating some iMotion files.
Step 1: Creating iMotion files
1. Open a project
2. Add the desired Avatar
3. Create the desired motion on the time line using whatever method you prefer
(You can even use an existing perform motion and modify it)
4. Open the time line and ensure that the Collect Clip track is showing
5. On the Collect Clip track select by clicking and dragging the desired section of motion
6. Right click on the selection and select Add Motion To Library. Save as an iMotion file.
Step 2: Extracting a character's current Persona
If you want to add perform actions (instead of replace all of the existing perform actions) then you will need to follow the following steps:
1. Open a project
2. Add the desired Avatar
3. Right click the Avatar
4. Select Persona | Export Persona
5. Save as an LUA script
Step 3: Modifying the character's Persona to include the new perform action
1. Open the LUA script obtained in the above step in any text editor
2. The contents are in a hierarchy which needs to be maintained.
The top level is the iObject which is divided into two sections: Commands and Clips. The Commands is further sub-divided into Idle, Perform and Move. Each of those have a sub-heading following the type appended with the word Command (e.g. IdleCommand, PerformCommand, etc). Finally this structure has an array of the corresponding commands. This may sound complicated but all we need to do is do a little bit of copy an paste without really having to understand the full structure. The Clip section has a AnimationClips structure which contains an array of iMotion file references.
This may seem complicated but all we need to do is a little bit of copy and paste to add our new perform action.
3. Assuming that we are adding a Perform action, locate the PerformCommand section. Each perform action will have a corresponding entry which starts with a number is square brackets such as [1], [2], and so on. The number is sequentially increasing from 1 to the number of perform commands.
4. Copy the first entry from [1] all the way to just before the start of the next entry (i.e. just before [2]) and paste it after the last entry in the PerformCommand section. For example, Heidi has 12 perform commands so we paste after the end of the 12th perform entry.
5. Rename the [1] in the pasted entry to the next number. For example, if the last PerformCommand entry is 12 then change the pasted [1] entry to 13.
6. Change the HotkeyID to match the number in the above step (e.g. 13).
7. Modify the ID and DisplayName to whatever you like. The existing Personas seem to use the same entries for ID and DisplayName. I assume that ID must be unique and DisplayName is what will actually appear in iClone.
8. Modify the RefClipID to a name that uniquely identifies the iMotion clip that you will use. Note that this is only a reference name (ID) and not the actual clip file name. Typically existing Personas seem to use the same ID as is used as the action ID.
9. Lastly we need to add an AnimationClip entry which relates the RefClipID to an actual iMotion file. Find the AnimationClip section.
10. Copy the first entry starting at [1] all the way to the start of the second entry (i.e. just before the [2]).
11. Paste it at the end of the AnimationClip section (similarly to how we did it for the PerformCommand action).
12. Change the [1] of the pasted entry to the next available number (i.e. one more than the number of the last AnimationClip entry). For Heidi the last entry is 15 so we make it 16.
13. Change the ID to match the RefClipID.
14. Change the ClipLocation to point to the desired iMotion file.
15. Save the LUA script as a text file. Note: Ensure that the format is text (not a word processor format like MS Word).
Step 4: Loading the modified Persona
1. Open a new project
2. Add the desired Avatar
3. Right click the Avatar and select Persona | Remove Persona
4. Right click the Avatar and select Persona | Import Persona
5. Select the previously modified LUA file
Voila! When you right click on the character and select the Perform section you will now see your new perform action among the previously existing perform actions.
Please note that this tutorial is a very basic tutorial for modifying the simplest of perform actions. There LUA script has properties such as Delay and Loop that can be adjusted, the ClipSeq can have multiple clip entries as opposed to just one (see MoveCommand for an example), the ClipType can be adjusted to other types and Priority can be applied. Some of these things are covered in the tutorials for the AML script editor (see url at the beginning of the post).
"We often compare ourselves to the U.S. and often they come out the best, but they only have the right to bear arms while we have the right to bare breasts"
Bowser and Blue, Busting The Breast