v5.0
Generates a UV texture coordinate cluster property from the specified generator operator. Only operators that generate mesh or NURBS geometry from input curves are supported (Birail, CrvNet, ExtrusionAlongAxis, Extrusion, ExtrusionTwoProfiles, FourSided, Loft, RevolutionAlongAxis, and Revolution).
oReturn = GenerateAutomaticUVs( Operator, Object, [ClusterPropertyName] ); |
Returns the newly created UV texture coordinate ClusterProperty.
Parameter | Type | Description |
---|---|---|
Operator | String | Specifies the generator operator from which to create the UV texture coordinates. |
Object | String | Specifies the object to which the new UV cluster property will be added. |
ClusterPropertyName | String | Specifies the name of the new UV texture coordinate cluster
property.
Default Value: "" (use Softimage's naming heuristic) |
' ' 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" |
/* 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" ); |