TransferPropertiesAcrossGenOp

Introduced

v4.0

Description

Transfers a set of properties from the specified input objects on a generator operator to a specified output object as a new property. It can be optionally shared.

Note: To transfer cluster properties alone, use the TransferClusterPropertiesAcrossGenOp command.

Scripting Syntax

oReturn = TransferPropertiesAcrossGenOp( Operator, Object, PropertiesToTransfer, PropertyName, ShareProperty, TransferClusterProperties );

Return Value

Returns the created Property.

Parameters

Parameter Type Description
Operator String Specifies the generator operator on which the property transfer will be performed.
Object String Specifies an output object to which the new property will be added.
PropertiesToTransfer Selection list Specifies the properties to transfer to the new property. Properties are not cluster properties.

Possible Values:

Description:

Material Material on an object or cluster.
PropertyName String Specifies the name of the new property.
ShareProperty Boolean True implies that the property will be shared.

Default Value: True

TransferClusterProperties Boolean True implies that the cluster property references by name are also transfered according to an internal heuristic that considers all input properties equivalent.

Default Value: True

Examples

1. VBScript Example

'This example transfers properties across generator 

'operators that admit transfer of properties.

Dim l_NewMaterial

newscene ,false

'Create objects

CreatePrim "Grid", "MeshSurface", "grid"

CreatePrim "Grid", "MeshSurface", "grid1"

Translate "grid1", 8.2, 0, 0, siRelative, siView, siObj, siXYZ

'Add some properties to objects: Materials and texture coordinates.

ApplyShader , , , , siLetLocalMaterialsOverlap

SetValue "grid1.Material.Phong.diffuse.red", 0.750

SIApplyShaderToCnxPoint "Image", "grid1.Material.Phong.diffuse"

SelectObj "grid", , True

SetSelFilter "Polygon"

AddToSelection "grid.poly[18-21,26-29,34-37,42-45,50-53]", , True

ApplyShader , , , , siLetLocalMaterialsOverlap

SetValue "grid.polymsh.cls.Polygon.Material.Phong.diffuse.green", 0.250

SIApplyShaderToCnxPoint "Image", "grid.polymsh.cls.Polygon.Material.Phong.diffuse"

CreateProjection "grid", siTxtPlanarXZ, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection"

SetInstanceDataValue , "grid.polymsh.cls.Polygon.Material.Phong.Image.tspace_id", "Texture_Projection"

SelectObj "grid1", , True

CreateProjection "grid1", siTxtPlanarXZ, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection"

SetInstanceDataValue , "grid1.Material.Phong.Image.tspace_id", "Texture_Projection"

' Apply merge operator. 

ApplyGenOp "MeshMerge", , "grid,grid1", 3, siPersistentOperation, siKeepGenOpInputs

SetValue "polymsh.polymsh.mergemesh.tolerance", 2.0

Translate , -4.0, 3.0, -0.0, siRelative, siView, siObj, siXYZ

' Transfer properties across the merge operator.

set l_NewMaterial = TransferPropertiesAcrossGenOp( "polymsh.polymsh.mergemesh", "polymsh",_

"grid.polymsh.cls.Polygon.Material,grid1.Material", "Material_Gen", , True )

' View results.  

SetDisplayMode "Camera", "texturedecal"

SetValue "Camera.camvis.objctrlpropmaps", True

ActivateObjectSelTool

SelectObj "grid"

AddToSelection "grid1", , True

AddToSelection l_NewMaterial.Parent

2. JScript Example

//This example transfers properties across generator 

//operators that admit transfer of properties.

NewScene( null, false )

// Create objects

CreatePrim("Grid", "MeshSurface", "grid", null);

CreatePrim("Grid", "MeshSurface", "grid1", null);

Translate( "grid1", 8.2, 0.0, 0.0, 

siRelative, siView, siObj, siXYZ, 

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

// Add some properties to objects: Materials and texture coordinates.

ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);

SetValue("grid1.Material.Phong.diffuse.red", 1, null);

SIApplyShaderToCnxPoint("Image", "grid1.Material.Phong.diffuse", null, null);

CreateProjection("grid1", 

	siTxtPlanarXZ, 

	siTxtDefaultSpherical, 

	"Texture_Support", 	

	"Texture_Projection", 

	null, null, "");

SetInstanceDataValue(null, 

	"grid1.Material.Phong.Image.tspace_id", 

	"Texture_Projection");

SelectObj("grid", null, true);

SetSelFilter("Polygon");

AddToSelection("grid.poly[26-29,34-37,42-45]", null, true);

ApplyShader(null, "", null, "", siLetLocalMaterialsOverlap);

SetValue("grid.polymsh.cls.Polygon.Material.Phong.diffuse.blue", 0.006, null);

SIApplyShaderToCnxPoint("Image", 

	"grid.polymsh.cls.Polygon.Material.Phong.diffuse", 

	null, null);

CreateProjection("grid", 

	siTxtPlanarXZ, 

	siTxtDefaultSpherical, 

	"Texture_Support", 	

	"Texture_Projection1", 

	null, null, "");

SetInstanceDataValue(null, 

	"grid.polymsh.cls.Polygon.Material.Phong.Image.tspace_id", 

	"Texture_Projection1");

// Apply merge operator. 

ApplyGenOp("MeshMerge", "", "grid,grid1", 3, siPersistentOperation, siKeepGenOpInputs);

SetValue("polymsh.polymsh.mergemesh.tolerance", 2, null);

Translate( "polymsh", -4.0, 4.0, -5.0, 

	siRelative, siView, siObj, siXYZ,

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

// Transfer properties across the merge operator.

l_NewMaterial = TransferPropertiesAcrossGenOp(

	"polymsh.polymsh.mergemesh", 

	"polymsh", 	

	"grid.polymsh.cls.Polygon.Material, grid1.Material", 

	"Material_Gen", 

	null, 

	true);

// Transfer properties across the merge operator.

SelectObj("grid", null, true);

AddToSelection("grid1", null, true);

AddToSelection( l_NewMaterial , null, true);

SetDisplayMode("Camera", "texturedecal");

SetValue("Camera.camvis.objctrlpropmaps", true, null);

See Also

TransferClusterPropertiesAcrossGenOp TransferAllPropertiesAcrossGenOp CopyAnimationAcrossGenerator