## MakeHand

### Introduced

v4.0

### Description

Creates a one-bone hand and a set of finger bones using guide objects to position and orient the bone joints. Two collections of guide objects are necessary to create a hand: a collection of finger guide objects to position finger joints; and a collection of "blade" objects that control the curl direction of the fingers. The finger chain is set up so that bone Z rotation is in the plane of the blade.
Optionally a shadow rig can be attached to the hand and fingers. A shadow object is created for each chain element in the arm, and pose constrained to that element. Shadow rigs can be used to plot animation off of a rig.

### Scripting Syntax

    oHand = MakeHand( HandParent, FingerGuideCollection, BladeGuideCollection, HandGuideCollection, [Prefix], [FingerBoneType], [ShadowType], [ShadowParent], [NegativeScale] );

### Return Value

Returns a Hand JScript object.

### Parameters

Parameter | Type | Description
--- | --- | ---
HandParent | String | The object to which the new hand will be parented.
FingerGuideCollection | String | A collection of guides objects for the start of each finger. Given a guide object in the collection like "LRing1" make hand will search for "LRing2", "LRing3", etc. until it can't find more joints. At least one extra joint per root needs to be found in the scene for a bone to be drawn.
BladeGuideCollection | String | A collection of blade objects showing the orientation of the fingers being drawn. Needs to be in the same order as the Root Guides.
HandGuideCollection | String | A collection of two objects in the order: start of hand bone, end of hand bone.
Prefix | String | The prefix used to name new objects when making the new hand. For example, "L" and "R".
FingerBoneType | Integer | Option to construct finger bones from 2D or 3D chains. Default Value: 0
Possible Values: | Description:
0 | Fingers are 2D chains and the preference angles orient with Finger blades.
1 | Fingers are 3D chains and preference angles are the pose of the guide.
ShadowType | Integer | The type of shadow rig to attach to the hand. Shadow rigs can be used to transfer or remap animation. Default Value: 0
Possible Values: | Description:
0 | No shadow
1 | SI|3D Skeleton shadow rig
2 | XSI Skeleton shadow rig
3 | Null shadow rig
4 | Box shadow rig
9 | SI|3D Skeleton hand shadow (no fingers)
10 | XSI Skeleton hand shadow (no fingers)
11 | Null hand shadow (no fingers)
12 | Box hand shadow (no fingers)
ShadowParent | String | Parent of the shadow rig hiearchy. If empty, no shadow rig is generated.
NegativeScale | Boolean | Negative scaling on the chain. Negative scaling is useful for manipulating the left and right hands or fingers symmetrically. Default Value: False

### Examples

#### JScript Example

    /*
            Loads the Biped Guide then generates a left
            hand matched to the guide
    */
    GetProportionalGuide("Biped_Guide", 0, 0);
    var Guide    = ActiveSceneRoot.FindChild("Biped_Guide" );
    var LFingers = new ActiveXObject("XSI.Collection");
    var LBlades  = new ActiveXObject("XSI.Collection");
    var handKeys = new Array("Pinky", "Ring", "Middle", "Index", "Thumb");
    for(i=0;i<handKeys.length;i++){
            var finger = Guide.FindChild("L" + handKeys[i] + 1);
            var blade  = Guide.FindChild("L" + handKeys[i] + "_fingerBlade");
            if(finger && blade){
                    LFingers.add(finger);
                    LBlades.add(blade);
            }
    }
    var LHBone = new ActiveXObject("XSI.Collection");
    LHBone.add(Guide + ".LHand");
    LHBone.add(Guide + ".LHandEnd");
    var LHand = makeHand(ActiveSceneRoot, LFingers, LBlades, LHBone, "L", 0, 0, null, 0);
    DumpHand(LHand);
    //Delete the guide
    DeleteObj("B:"+Guide);
    //Move hand to the origin
    var xfo
    xfo = LHand.Root.Kinematics.Global.Transform;
    xfo.SetTranslationFromValues(0,0,0);
    LHand.Root.Kinematics.Global.Transform = xfo;
    function DumpHand(inHand)
    {
                    logmessage ("Data in the returned hand object:");
                    logmessage ("---------------------------------");
                    logmessage ("HandRoot  : " + inHand.Root);
                    logmessage ("HandEff   : " + inHand.Eff);
                    logmessage ("#FingRoots: " + inHand.FingerRoots.count);
                    for(var b=0;b<inHand.FingerRoots.count;b++)
                    {logmessage (" FingerRoot" + b + ": " + inHand.FingerRoots(b));}
                    logmessage ("Hidden    : " + inHand.Hidden);
                    logmessage ("Envelope  : " + inHand.Envelope);
                    logmessage ("Shadows   : " + inHand.Shadows);
    }
    //results from running this script:
    //INFO : "Data in the returned hand object:"
    //INFO : "---------------------------------"
    //INFO : "HandRoot  : LHandRoot"
    //INFO : "HandEff   : LHandEffector"
    //INFO : "#FingRoots: 5"
    //INFO : " FingerRoot0: LPinkyRoot"
    //INFO : " FingerRoot1: LRingRoot"
    //INFO : " FingerRoot2: LMiddleRoot"
    //INFO : " FingerRoot3: LIndexRoot"
    //INFO : " FingerRoot4: LThumbRoot"
    //INFO : "Hidden    : LPinkyRoot,LPinkyEffector,LRingRoot,LRingEffector,LMiddleRoot,LMiddleEffector,LIndexRoot,LIndexEffector,LThumbRoot,LThumbEffector,LHandRoot,LHandEffector"
    //INFO : "Envelope  : LPinky1,LPinky2,LPinky3,LRing1,LRing2,LRing3,LMiddle1,LMiddle2,LMiddle3,LIndex1,LIndex2,LIndex3,LThumb1,LThumb2,LThumb3,LHand"
    //INFO : "Shadows   : undefined"

### See Also

MakeArm