ChangeGeneratorInputReadPosition

Introduced

v5.0

Description

Changes the stack position at which the generator operator reads from its inputs. The generator can read above any of the construction mode markers. For a list of available generator operators, see Generator and Converter Operators

Scripting Syntax

ChangeGeneratorInputReadPosition( Operator, ReadPosition, [UnTransferShapesAndEnvelopes] );

Parameters

Parameter Type Description
Operator String Specifies the generator operator to modify
ReadPosition siConstructionMode Position on which the generator will reconnect. Can be above any construction mode markers.
UnTransferShapesAndEnvelopes 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 a generator operator and then moves

	its read positions across various construction modes.

*/

NewScene(null, null);

Sphere = CreatePrim("Sphere", "MeshSurface", null, null);

//Create a twist operator in modeling construction mode

TwistOp = ApplyOp("Twist", Sphere, 3, siPersistentOperation, null, 0);

//Envelope the shere with a Null (animation construction mode),

//and move the Null so we can see the difference:

NullObject = GetPrim("Null", null, null, null);

EnvOp = ApplyFlexEnv(Sphere + ";" + NullObject, false, 2);

Translate(NullObject, 4, 0, 0, siRelative, siView, siObj, siXYZ, null, null, null, null, 

	null, null, null, null, null, 0);

//Generate a subdivided sphere from this one

MeshSubdivideWithCenter(null, "sphere", null, siPersistentOperation, siKeepGenOpInputs);

GeneratorOp = GetValue("polymsh.polymsh.MeshSubdivideWithCenter");

logmessage( "Construction region after generator creation: " + 

			GetGeneratorInputReadPosition( GeneratorOp ) );

//Currently, the generated sphere inherits from the animated (result)

//position, since by default it connects in secondary shape construction mode.

//We will now move the read point over the modeling marker so it has

//has twisted but not enveloped positions:

ChangeGeneratorInputReadPosition( GeneratorOp, siConstructionModeModeling, 0 );

logmessage( "Construction region after moving in modeling: " + 

			GetGeneratorInputReadPosition( GeneratorOp ) );

//Transfer the envelope operator onto the generated sphere:

TransferClusterPropertiesAcrossGenOp("polymsh.polymsh.MeshSubdivideWithCenter", "polymsh", 

	"sphere.polymsh.cls.EnvelopWeightCls.Envelope_Weights", "Envelope_Weights", true);

//Move the read position to animation mode, but specify to untransfer

//the envelope in order to avoid the double deformation:

ChangeGeneratorInputReadPosition( GeneratorOp, siConstructionModeSecondaryShape, 0 );

logmessage( "Construction region after moving back in secondary shape: " + 

			GetGeneratorInputReadPosition( GeneratorOp ) );

//Output:

//	INFO : Construction region after generator creation: 3

//	INFO : Construction region after moving in modeling: 0

//	INFO : Construction region after moving back in secondary shape: 3

See Also

GetGeneratorInputReadPosition MoveOperator MoveOperatorBefore MoveOperatorAfter