UVProperty
v10.0 (2012)
Texture
UVProperty is a kind of ClusterProperty used for storing and
accessing the UV information of a cluster.
UVProperty supports a special API for pinning and unpinning UV
components. Pinning acts like a lock. When UV components are
pinned, they are not affected by operations performed on them. For
instance, pinned UVs cannot be rotated or scaled in the Texture
Editor.
# # Script to demonstrate how to pin and unpin UV components # from siutils import * # Create some UV components root = si.ActiveSceneRoot cube = root.AddGeometry( "Cube", "MeshSurface" ) si.BlendInPresets( "Image", cube, 1, False ) si.CreateTextureSupport( cube, C.siTxtUV, C.siTxtDefaultSpherical, "Texture_Support" ) si.SetInstanceDataValue( None, cube.FullName + ".Material.UV", "Texture_Support" ) uvprop = disp(cube.Material.CurrentUV) clsIndices = uvprop.Parent.Elements.Array # Pin components toPin = clsIndices[5:-8] uvprop.PinComponents( toPin ) uvsamples = uvprop.PinComponentArray log( 'Pinned components = %s' % str(uvsamples) ) # INFO : Pinned components = (5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15) # Unpin last 6 components toUnPin = uvsamples[5:] uvprop.UnPinComponents( toUnPin ) uvsamples = uvprop.PinComponentArray log( 'Pinned components = %s' % str(uvsamples) ) # INFO : Pinned components = (5, 6, 7, 8, 9, 10) |