FitSubcomponentUVsToImage

Description

This command performs a scaling and translation operation on the UV properties so that the bounding box of the UV values of the selected subcomponents is equal to (0,0)x(1,1). As a result, if the UV properties are used for texturing, the selected subcomponents are guaranteed to be covered by texture.

There are two ways a UV property can be modified, based on the value of the Explicit parameter. If Explicit is false, the transformation in the UV property's projection definition is modified, and the actual UV values of the property are not changed. If Explicit is true, the command explicitly modifies the UV values of the UV property, and does not modify the projection definition transform.

Regardless of the Explicit parameter's setting, no rotation is performed when fitting.

Scripting Syntax

FitSubcomponentUVsToImage( Properties, SubComp, [Explicit], [MaintainAspect] );

Parameters

Parameter Type Description
Properties UV Property set The set of UV properties to perform the fitting on. Each UV property is handled independently.
SubComp String Subcomponents for which the UVs should be made to fit to the image.
Explicit Boolean If true, modify the UVs explicitly instead of modifying the transform.

Default Value: False

MaintainAspect Boolean If true, maintain the aspect ratio of the UVs (i.e., only perform uniform scaling).

Default Value: True

Examples

VBScript Example

NewScene

CreatePrim "Sphere", "MeshSurface"

SetDisplayMode "Camera", "texturedecal"

ApplyShader

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

CreateProjection "sphere", siTxtCylindrical, siTxtDefaultSpherical, "Texture_Support", "Texture_Projection"

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

FitSubcomponentUVsToImage "sphere.polymsh.cls.Texture_Coordinates_AUTO.Texture_Projection", "sphere.poly[11,12,19,20]"

See Also

CreateProjection CreateSubprojection