GenerateAutomaticUVs

導入

v5.0

詳細

指定のジェネレータ オペレータから UV テクスチャ座標クラスタ プロパティを生成します。 入力カーブからメッシュまたは NURBS ジオメトリを生成するオペレータのみサポートされます(Birail、CrvNet、ExtrusionAlongAxis、Extrusion、ExtrusionTwoProfiles、FourSided、Loft、RevolutionAlongAxis、および Revolution)。

スクリプト構文

oReturn = GenerateAutomaticUVs( Operator, Object, [ClusterPropertyName] );

戻り値

新しく作成されたUV 座標 ClusterProperty を戻します。

パラメータ

パラメータ タイプ 説明
Operator 文字列 UV テクスチャ座標を作成するジェネレータ オペレータを指定します。
Object 文字列 新しい UV クラスタ プロパティを追加するオブジェクトを指定します。
ClusterPropertyName 文字列 新しい UV テクスチャ座標クラスタ プロパティの名前を指定します。

デフォルト値:""(Softimageの名前解決を使用)

1. VBScript の例

'

'	This example demonstrates how to generate a NURBS object from curves via the Extrusion operator

'	and then use that operator to generate UV texture coordinates for the new surface mesh. For a

'	JScript version, see the next example.

'

Dim l_GeneratedUVs

Dim l_AlreadyGeneratedUVs

NewScene ,false

' Create curve objects that will be used to create surfaces.

CreatePrim "Circle", "NurbsCurve" 

SetValue "circle.circle.radius", 1

SICreateCurve "crvlist", 3, 1

SIAddPointOnCurveAtEnd "crvlist", 0, 0, -3, False, 1

SIAddPointOnCurveAtEnd "crvlist", 0, 0, -13, False, 1

SIAddPointOnCurveAtEnd "crvlist", 8, 0, -13, False, 1

SIAddPointOnCurveAtEnd "crvlist", 8, 0, -3, False, 1

' Generate a mesh surface from the curves.

ApplyGenOp "Extrusion", "MeshSurface", "circle;crvlist", 3, siPersistentOperation, siKeepGenOpInputs

SetValue "polymsh.polymsh.extrusion.subdivvperspan", 5

' Put a material on the generated surface

ApplyShader , , , , siLetLocalMaterialsOverlap

SIApplyShaderToCnxPoint "Image", "Sources.Materials.DefaultLib.Material.Phong.diffuse"

' Generate automatic UVs.

set l_GeneratedUVs = GenerateAutomaticUVs( "polymsh.polymsh.extrusion", "polymsh", "AutoUVTxtCoords")

' Log name of UV texture coordinate cluster property

Application.LogMessage "Automatic Generation of UV Texture Coordinates returns the generated cluster property."

Application.LogMessage "Generated UV Texture Coordinate Cluster Property: " & l_GeneratedUVs.FullName

' Trying to regenerate again will log a warning message and the already existing 

' UV texture coordinate cluster property will be returned.

' Generate automatic UVs.

Application.LogMessage "Regeneration of UV Texture Coordinates generates a warning and the already generated cluster property is returned."

set l_AlreadyGeneratedUVs = GenerateAutomaticUVs( "polymsh.polymsh.extrusion", "polymsh", "AutoUVTxtCoords")

'Log name of UV texture coordinate cluster property

Application.LogMessage "Already Generated UV Texture Coordinate Cluster Property: " &l_AlreadyGeneratedUVs.FullName

'Logged information and warning by this example.

'INFO : Automatic Generation of UV Texture Coordinates returns the generated cluster property."

'INFO : Generated UV Texture Coordinate Cluster Property: polymsh.polymsh.cls.AutomaticSamples.AutoUVTxtCoords

'INFO : Regeneration of UV Texture Coordinates generates a warning and the already generated cluster property is returned.

'WARNING : 3000-MODE-GenerateAutomaticUVs - Returning already generated UV texture coordinate cluster property. None re-generated.

'INFO : Already Generated UV Texture Coordinate Cluster Property: polymsh.polymsh.cls.AutomaticSamples.AutoUVTxtCoords

' View results.  

SetDisplayMode "Camera", "texturedecal"

2. JScript の例

/*

	This example demonstrates how to generate a NURBS object from curves via the Extrusion operator

	and then use that operator to generate UV texture coordinates for the new surface mesh. This

	example is similar to the VBScript version above, except that it uses the object model 

	instead of scripting commands.

*/

var l_GeneratedUVs;

var l_AlreadyGeneratedUVs;

NewScene( null, false );

// Create curve objects that will be used to create surfaces.

var oCrv = ActiveSceneRoot.AddGeometry( "Circle", "NurbsCurve" );

oCrv.radius = 1;

var pnts = new Array( 0,0,-3,1, 0,0,-3,1, 0,0,-3,1, 0,0,-3,1, 0,0,-6.333333333333333,1,

	0,0,-9.666666666666666,1, 0,0,-13,1, 2.6666666666666665,0,-13,1, 5.333333333333333,0,-13,1, 

	8,0,-13,1, 8,0,-9.666666666666667,1, 8,0,-6.333333333333334,1, 8,0,-3,1 );

var oCrvlist = ActiveSceneRoot.AddNurbsCurve( pnts );

// // Generate a mesh surface from the curves.

var oGenOp = ApplyGenOp( "Extrusion", "MeshSurface", oCrv + ";" + oCrvlist, 3, siPersistentOperation, siKeepGenOpInputs )(0);

var oNewMesh = oGenOp.OutputPorts(0).Target2.Parent3DObject;

oGenOp.subdivvperspan = 5;

// Put a material on the generated surface

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

SIApplyShaderToCnxPoint( "Image", "Sources.Materials.DefaultLib.Material.Phong.diffuse" );

// Generate automatic UVs.

l_GeneratedUVs = GenerateAutomaticUVs( oGenOp, oNewMesh, "AutoUVTxtCoords");

// Log name of UV texture coordinate cluster property

Application.LogMessage( "Automatic Generation of UV Texture Coordinates returns the generated cluster property." );

Application.LogMessage( "Generated UV Texture Coordinate Cluster Property: " + l_GeneratedUVs.fullname );

// Trying to regenerate again will log a warning message and the already existing 

// UV texture coordinate cluster property will be returned.

// Generate automatic UVs.

Application.LogMessage( "Regeneration of UV Texture Coordinates generates a warning and the already generated cluster property is returned." );

l_AlreadyGeneratedUVs = GenerateAutomaticUVs( oGenOp, oNewMesh, "AutoUVTxtCoords");

// Log name of UV texture coordinate cluster property

Application.LogMessage( "Already Generated UV Texture Coordinate Cluster Property: " + l_AlreadyGeneratedUVs.fullname );

// Logged information and warning by this example.

//INFO : Automatic Generation of UV Texture Coordinates returns the generated cluster property."

//INFO : Generated UV Texture Coordinate Cluster Property: polymsh.polymsh.cls.AutomaticSamples.AutoUVTxtCoords

//INFO : Regeneration of UV Texture Coordinates generates a warning and the already generated cluster property is returned.

//WARNING : 3000-MODE-GenerateAutomaticUVs - Returning already generated UV texture coordinate cluster property. None re-generated.

//INFO : Already Generated UV Texture Coordinate Cluster Property: polymsh.polymsh.cls.AutomaticSamples.AutoUVTxtCoords

// View results.  

SetDisplayMode( "Camera", "texturedecal" );

関連項目

ApplyGenOp