# cryTools: CryRiggingTools

## Internal Tools (some deprecated)

This tools rollout only shows up if the DOMAIN is set as INTERN.CRYTEK.DE (in the cryTools Control Panel you can see your DOMAIN). These tools are not secret in any way, they are just quick hacks to make it easier for artists, animators and TDs to fix issues more easily, and deal with certain project-specific rigs. Even if you are not in the Crytek offices you can easily enable this code or learn from it, or you can just check out how we patched different problems.
TechNote: Arrrr, these be untested waters with monsters abound! Wear a helmet.

### Helper Joints

This primarily deals with the Crysis NanoSuit helper joints, but also covers knees, breasts, and others. Hide/Show Helper Joints will hide and unhide the joints. Select Helper Joints will select them and Unselect Helper Joints will deselect them.

### File Fixes/Cleanup

Mirror Weapon Bone
This mirrors and correctly orients the right weapon bone to the left and renames the new one alt_weapon_bone01. At the start of Crysis characters only had one weapon bone (in the right hand), mid way through we decided that we would add another weapon bone in the left hand.
Select New Attachment Points
When pressed with nothing checked, this simply selects the new weapon attachment points. With delete\add checked, it either adds the new attachment points, or if they are present, deletes them. With hide\show checked it will hide them, or show them if they are hidden. After a year and a half of Crysis development, we decided to add many weapon attachment points to every human character in the game, that's why this tool was written, the attachment points added are:
weaponPos_hurricane
weaponPos_law
weaponPos_rifle01
weaponPos_rifle02
weaponPos_pistol_L_leg
weaponPos_pistol_R_leg
weaponPos_pistol_L_hip
weaponPos_pistol_R_hip
weaponPos_grenade_L_hip
weaponPos_grenade_R_hip
TechNote: The weapon positions are loaded from the following max file: Tools\maxscript\ref\weapon_positions.max
Wire FP Hands Twist Bones
This wires up and procedurally drives twist bones on the Crysis first person arms. When we were pretty far into development we decided twist bones were needed for correct pronation/supination of the first person arms. The wiring allowed the current animation assets to drive the twist bones.
Comment out Nub Bones
We have many 'nub' bones in our rigs, these are old holdovers from the Physique era. A nub bone was used to create a physique link, the same way some rigs have 'end' bones. When you press this button, the tool will search your scene for the following named nodes and replace them thusly:
Bip01 HeadNub - _Bip01 HeadNub
Bip01 R Finger0Nub - _Bip01 R Finger0Nub
Bip01 R Finger1Nub - _Bip01 R Finger1Nub
Bip01 R Finger2Nub - _Bip01 R Finger2Nub
Bip01 R Finger3Nub - _Bip01 R Finger3Nub
Bip01 R Finger4Nub - _Bip01 R Finger4Nub
Bip01 L Finger0Nub - _Bip01 L Finger0Nub
Bip01 L Finger1Nub - _Bip01 L Finger1Nub
Bip01 L Finger2Nub - _Bip01 L Finger2Nub
Bip01 L Finger3Nub - _Bip01 L Finger3Nub
Bip01 L Finger4Nub - _Bip01 L Finger4Nub
Bip01 L Heel - _Bip01 L Heel
Bip01 R Heel - _Bip01 R Heel
Bip01LToeHelper - _Bip01LToeHelper
Bip01RToeHelper - _Bip01RToeHelper

### Locomotion Manager

Extract Data to LocoMan Node
When pressed, this steps through all the frames of the current biped animation and adds a spedcial 'locoMan' node that the engine uses to get data about the characters movement and look direction. The node itself looks like a circle around the hips of the character (or on the ground) with an arrow breaking through it. The following check boxes effect how the node is created:
Lock to X/Y - This will lock the node to the X or Y axis.
Ignore Root Rotation - This will disable Use Head for Direction and Use Root for Direction, and the locoman node will not rotate at all.
Restrict to Ground Plane - This will restrict the locoMan node to a Z height of 0, or stick it to the flat ground plane during the animation.
Use Head for Direction - This will use the head of the character to point the locoMan node (you assume that the character is looking the direction you want him to be facing (useful for most instances the root would mess up (like prone))
Use Root for Direction - This will use the pelvis orientation to generate a locoMan node direction.
Freeze and Lock - When checked this will freeze and lock the locator, if you want to refine it's motion by hand, do not leave this checked.
Remove Unwanted Bones
When you press this button it will either remove bones from the Skin modifier of the currently selected node, or delete them, depending on which checkbox is selected. The bones removed or deleted are any bones commented out of export ('_' prefix) and *nub bones.

## Rigging Tools

### General Tools

matchPivot
Select two objects. When you press this button it will snap the pivot of the second object to that of the first.
zeroOut Rots
This is a bread and butter tool for TDs. When you press this, it inserts a point helper in the hierarchy between the currently selected node and it's parent effectively zeroing out the selected node's rotations. The new node created has the current node's name + 'ZERO', example: Bip01 R Hand Phys would have a helper inserted called Bip01 R Hand PhysZERO. This works for any number of selected objects.
Clamp Timeline at Current/Last
This clamps the timeline at the current key, if you click 'At Last Key' it will clamp the timeline at the last keyframe of the currently selected object.

### Biped Tools

Figure Mode / Hide Biped [Toggles]
These two checkbuttons are toggles, meaning that when you press 'Figure Mode' it stays hilighted for the duration that the characte is in figure mode. 'Hide Biped is one of the most used buttons in the entire Aniamtion toolset; it just hides the entire skeleton.
Bip Motion Menu
This takes you to the motion menu tab for the current biped loaded in the tools.
Select Biped Bones
Selects the original biped skeleton, and ignores any extra helper bones that have been added. Useful when you want to load up a pose or do some motion panel operation to all the original biped bones. (motion panel biped options will not load if a single non-original biped bone is in the current selection)
Toggle In Place Mode [Toggle]
Clikcing the 'In place Mode' toggle will turn on In Place Mode, which constrains the motion on X and Y, however, pressing 'X or Y will constrain the motion to only the selected axis.
Convert Biped to Bones
This will essentially snapshot out the biped to normal nodes that are no longer Biped related, yet keeping the hierarchy.

### Rotate Bind Pose

This will rotate Skinned characters an arbitrary rotation, updating the initial skeletal positions. It does this by saving the weights, removing skin, rotating the character and the skel, reset xforming the char, then reapplying skin and the weights.

### Bone Tools

Adjust Bones
This allows you to change the Taper, Width, and Height of any selected bones; great for bone chains, ropes, and tentacles!
Convert hierarchy to Bones
This will convert a node hierarchy to max bones matching their orientations, positions and hierarchy. 'fromSelected' will generate a hierarchy from the selected node down through all it's children. 'fromRoot' will find the root of the selected node and then convert all it's children to max bones.

### Vertex Tools

This is very much a work in progress. The exporter cannot currently export arbitrary channels of vertex colors, but when we can, you can use this to create multiple vertex color channels per object. ChannelInfo brings up the channel info spreadsheet so that you can see all the vertex channels. vertexColors is a toggle that enables/disables vertex color shaded mode. Add cryChannel to Selected will add a channel named 'cry' to the selected object, you can store various data here for export.

## Physics Setup

Create Phys Skeleton
This will create a Phys skeleton from a currently selected skeleton. Just select one node in the skeleton, and press the button.
Create Parent Frame
This will generate a ParentFrame for the currently selected node, set it above the node in the hierarchy, name it appropriately, and hide it.

## Diagnostic Tools

### General Diagnostics

selectRoot/selectChildren
With an object selected selectRoot will traverse the hierarchy and select the root of the object's hierarchy, whereas selectChildren will select all children of the current object.
numChildren [print]
When pressed, this will echo out the number of children of a currently selected node. When 'print' is checked, it will export the names of all children nodes in an excel-friendly format. This is very useful for comparing and troubleshooting two character hierarchies.
Compare Two Hierarchies
Select a root object, then press 'Hierarchy1, then select another root who's hierarchy you would like to compare and press 'Hierarchy2', any differences in the hierarchies will be printed to the Listener. The hierarchies are stored as global vars, so you can click one hierarchy and even load another max file or character to compare. 'Check Consistency' will check the hierarchy structure and report any inconsistencies.

### Physique Diagnostics (removed, exist but commented)

TechNote: This requires the Iphysique (IPhysique.gup) maxscript exposure from the Autodesk Sparks website
Select Verts that use X bones
This will select vertices in the selected node that use the input number of bones.
Get Bone Count
This returns the number of bones that are effecting the selected object's mesh. Not to be confused with the number of bones a character has. With Character Studio, you need to have a lot of terminator bones that are often not exported, and have no weights. This returns all bones weighted to the mesh.
Initial Pose
This shows the initial pose stored by Physique at the time the physique modifier is applied. Very useful when troubleshooting exporter issues.
Select Verts with 0.0 weight
Selects vertices where the sum of their weights is 0.0

### Animation Diganostics (removed, exist but commented)

Sometimes you will need to output character position data or translation data. For instance, AI may want to know how far a character moves out from behind cover in an animation, or how high the root is when he is in prone or behind cover. When you press ?Get Weapon\Root Info? the POS and TRANS boxes will refresh with data. The POS values are the world Z position (how high) in cm of the main weapon bone weapon_bone and the root. The TRANS data is the world translation of the weapon_bone and root during the animation. You can log this data to a file or to the listener, the logged info is a bit more detailed. (alt weapon bones or arbitrary objects) Here is an example of the logged data:
combat_peekIdle_rifle_rightReverse_01
POSITION
Frame: 0f (hiding)
root 88.846977
weapon_bone 101.276
alt_weapon_bone01 101.601
Frame: 13f (firing)
root 88.846977
weapon_bone 105.406
alt_weapon_bone01 110.632

### Attachment\Game Diagnostics (deprecated, you should now use Character Editor for creating attachments)

allows us to align Bone Attachments in Max and export them to Character Editor (which can be extremely useful for eyes, and constantly changing aliens). Select an object to be added to the CDF, enter a name for it (this will be the name of the bone attachment in Character Editor). Press 'Generate CDF Attachment Data' and it will open a dialogue asking "Is this the bone the CDF is attached to?". If it is the bone the you want associated in the CDF, click 'Yes', if not, click 'No, Pick Bone', then click the correct bone in the Max viewport. Example:

This will bring you to this next dialogue:

f this is the name of the exported CDF file, then click 'Yes', if it is not, click ?No, let me choose.? And a file dialogue will open. Find the CDF and click ok. The script will now pop open a window with a generated line of XML that you can paste into your CDF file. Here is an example:
<Attachment AName="Gun" Binding="J:\Game02\Game\Objects\Characters\Alien\Hunter\face_gun_geo.cdf" BoneName="face_connector" Position="-0.000635176,-2386.97,643.324" Rotation="-1,0,0,1.87841" Type="CA_BONE" />
TechNote: The bone associated with the CDF is taken from the parent bone (as it should be). The name and directory are taken from the geometry name and the max save path used by the exporter. Also, the quaternion values CharEdit needs are WXYZ. Also keep in mind that the CDF XML format may change, check to see what this exports vs the current CDF standards before checking assets with XML generated from this tool into a build.

## Smart Object Tools

Template Generator\Exporter
Select the geometry that you will export as the Smart Object CGF, then click Get Smart Obj Geometry. The button text will now change to reflect the object's name, and Add Start\Stop Locations will not be enabled. When you click Add Start\Stop Locations, two circles will appear, one red and one green, these denote the start and stop locations. They are named sequentially following the format 'so_start#' and 'so_end#'. If 'Project on Ground' is checked, in the Editor the two start/stop locations will be projected onto the ground.
Exporting Smart Object Data
When you click 'Export Smart Object Data' is pressed, a window will pop up asking you where you would like to save the XML file. The file will be named with the name of the Smart Object (printed in the save dialog). If Flip Around Z Axis is checked, the XML data exported will be rotated 180 degrees on export. This is done because all out animations are in -Y yet the engine requires things in +Y

## Reactor Tools

Add Objs to Rigid Body - Adds all selected objects to a picked rigid body node
Add Objs to Fracture - Adds all selected objects to a picked fracture node

## Bake to Bones

Bake Deformation to Bones
If you select verts in a deforming mesh, this will step through the timeline and add small bones to every vert and animate them throughout the timeline.
Blend All Bones
This will step through all bones in the Skin modifier and do the 'blend' function. This is used for smothing out baked deformation, such as a flag or cloth.