TransferAllPropertiesAcrossGenOp

Introduced

v4.0

Description

Transfers all properties and cluster properties from the specified input objects on a generator operator to a specified output object using a heuristic.

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

Note: To transfer properties alone, use the TransferPropertiesAcrossGenOp command.

Scripting Syntax

oReturn = TransferAllPropertiesAcrossGenOp( Operator, Object, PropertyTransferType, ShareProperty, [IncludeAllClusters] );

Return Value

Returns the created XSICollection of new transferred properties.

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.
PropertyTransferType String Specifies the type of properties to transfer to the specified output object from the input objects of the specified generator operator. An empty string implies that all allowable properties are transferred. Specific string property types are listed in the siType enum.

Note: When siMaterialType is specified, all referenced cluster properties are also transferred.

Default Value: Empty string which implies the transfer of all allowable properties and cluster properties

Possible Values:

Description:

siMaterialType material property type.
siWgtMapType weight map cluster property type.
siClsUVSpaceTxtType uv texture coordinates cluster property type.
siVertexcolorType color at vertices cluster property type.
siClsKeyType shape cluster key cluster property type.
ShareProperty Boolean True implies that the transferred property will be shared.

Note: This applies to properties (currently only to materials) and not to cluster properties.

Default Value: True

IncludeAllClusters Boolean True implies that even clusters with no properties will be transferred. By default, clusters without properties are not transferred.

Default Value: False

Examples

1. VBScript Example

'

' This example transfers properties across generator 

' operators that admit transfer of properties.

'

Dim l_NewProperties

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"

' Add cluster property: weight map on both objects.

SelectObj "grid", , True

ActivateVertexSelTool

AddToSelection "grid.pnt[48-51,57-60,66-69]", , True

CreateWeightMap , , "Weight_Map"

SelectObj "grid1", , True

ActivateVertexSelTool

AddToSelection "grid1.pnt[20-25,29-34,38-43,47-52]", , True

CreateWeightMap , , "Weight_Map"

' 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 all properties across the merge operator.  The empty string is passed to 

' transfer all allowable properties.

set l_NewProperties = TransferAllPropertiesAcrossGenOp( "polymsh.polymsh.mergemesh", _

		"polymsh", "",  True )

' View results.  

SetValue "Camera.camvis.objctrlpropmaps", True

SetDisplayMode "Camera", "texturedecal"

SelectObj "polymsh.polymsh.cls.Point.Weight_Map"

for each item in l_NewProperties

	Application.LogMessage "New Property : " & item

next

' Expected results

' INFO : New Property : polymsh.polymsh.cls.Polygon.Material1

' INFO : New Property : polymsh.polymsh.cls.grid.Scene_Material

' INFO : New Property : polymsh.polymsh.cls.grid1.Material

' INFO : New Property : polymsh.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection

' INFO : New Property : polymsh.polymsh.cls.Point.Weight_Map

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");

// Add cluster property: weight map on both objects.

SetSelFilter("Point");

AddToSelection("grid.pnt[20-23,29-32,38-41,47-50,56-59]", null, true);

CreateWeightMap(null, null, "Weight_Map", null, null);

SelectObj("grid1", null, true);

ActivateVertexSelTool(null);

AddToSelection("grid1.pnt[30-32,39-41,48-50]", null, true);

CreateWeightMap(null, null, "Weight_Map", null, null);

// 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 all properties across the merge operator. Pass in empty string 

// to transfer all properties.

l_NewProperties = TransferAllPropertiesAcrossGenOp(

	"polymsh.polymsh.mergemesh", 

	"polymsh", 	

	"", 

	true);

// View results

SetDisplayMode("Camera", "texturedecal");

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

var eNewProps = new Enumerator( l_NewProperties );

for ( ; !eNewProps.atEnd(); eNewProps.moveNext() )

{	

	 Application.LogMessage( "New Property : " + eNewProps.item().FullName );

}

// Expected results:

// INFO : New Property : polymsh.polymsh.cls.Polygon.Material1

// INFO : New Property : polymsh.polymsh.cls.grid.Scene_Material

// INFO : New Property : polymsh.polymsh.cls.grid1.Material

// INFO : New Property : polymsh.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection1

// INFO : New Property : polymsh.polymsh.cls.Point.Weight_Map

See Also

TransferPropertiesAcrossGenOp TransferClusterPropertiesAcrossGenOp CopyAnimationAcrossGenerator