## CopyAnimationAcrossGenerator

### Introduced

v5.0

### Description

Copies the shape and envelope animation from the generator operator inputs to the generated object. This includes the installation of the envelope and shape combiner operators on the generated primitive, and the copy of shape animation (tracks and clips).
If the generator is connected over the modeling marker, it will be reconnected automatically in modeling construction mode.
If none of the input primitives' envelope weight properties and shape key properties were transfered before the command was executed, the command will automatically transfer them all before copying the animation. However, if only some of input primitives' envelope weight properties or shape key properties were transfered before the command was executed, then the decision to transfer or not the remaining ones will depend on the TransferRemainingShapesAndEnvelopes argument.

### Scripting Syntax

    CopyAnimationAcrossGenerator( Operator, [ReadPosition], [TransferRemainingShapesAndEnvelopes] );

### Parameters

Parameter | Type | Description
--- | --- | ---
Operator | String | Specifies the generator operator to modify
ReadPosition | siConstructionMode | Specifies which construction stack to read from. Default Value: siConstructionModeModeling
TransferRemainingShapesAndEnvelopes | Integer | What to do with any transfered shapes and/or envelope weight properties when the command will reconnect the generator over the primary shape/animation construction mode. It is usually preferred to undo these transfers, since otherwise there could be a double deformation (the envelope is applied to the input and the generated object). Default Value: 2
Possible Values: | Description:
0 | Yes
1 | No
2 | Prompt the user

### Examples

#### JScript Example

    /*
            This example creates 2 spheres with animation (shapes and envelopes), merges them and manually transfers
            only one of the envelopes. Then, using CopyAnimationAcrossGenerator, it copies the animation with
            TransferRemainingShapesAndEnvelopes = 1, and then TransferRemainingShapesAndEnvelopes = 0.
    */
    NewScene(null, null);
    //Create an enveloped sphere that has an applied shape key
    Sphere1 = CreatePrim("Sphere", "MeshSurface", null, null);
    NullPrim1 = GetPrim("Null", null, null, null);
    SetSelFilter("Vertex");
    SelectGeometryComponents("sphere.pnt[44-50]");
    Translate(null, 0, 0, -4.83347471775276, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 1);
    StoreShapeKey("sphere.pnt[44-50]", "", siShapeObjectReferenceMode, 1, 0, 0, siShapeContentPrimaryShape);
    ApplyFlexEnv(Sphere1 + ";" + NullPrim1, false, 2);
    SelectObj(NullPrim1, null, true);
    Translate(null, -3.20599401067148, 0, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 0);
    //Create a second enveloped sphere
    Sphere2 = CreatePrim("Sphere", "MeshSurface", null, null);
    NullPrim2 = GetPrim("Null", null, null, null);
    ApplyFlexEnv(Sphere2 + ";" + NullPrim2, false, 2);
    SelectObj(NullPrim2, null, null);
    Translate(null, 6.77561899920499, 0, -1.00435838290967, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 2);
    //Generate a new object from the merge of the two spheres
    SetValue("Context.constructionmode", 0, null);
    ApplyGenOp("MeshMerge", "", Sphere1 + "," + Sphere2, 3, siPersistentOperation, siKeepGenOpInputs, null);
    Translate(null, 5.54342092599887, 0, 8.39090426346892, siRelative, siView, siObj, siXYZ, null, null, null, null, null, null, null, null, null, 2);
    //Transfer manually only one of the envelope weight props of the input spheres
    TransferClusterPropertiesAcrossGenOp("polymsh.polymsh.mergemesh", "polymsh", "sphere.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "Envelope_Weights", true);
    //Copy the animation without transfering the envelope weight props that were not transfered
    CopyAnimationAcrossGenerator("polymsh.polymsh.mergemesh", 0, 1 /*don't transfer remaining envelopes*/);
    //Copy the animation and transfer the envelope weight props that were not transfered
    CopyAnimationAcrossGenerator("polymsh.polymsh.mergemesh", 0, 0 /*transfer remaining envelopes*/);

### See Also

TransferPropertiesAcrossGenOp TransferPropertiesAcrossGenOp TransferClusterPropertiesAcrossGenOp TransferAllPropertiesAcrossGenOp