Are you taking into account the fact that some cluster properties
are on different types of clusters? E.g. some are per-vertex,
some per-polygon etc So the number of elements in the cluster
doesn't necessarily map to the number of polygons. You should find
a few more examples that should help, and SDK explorer shows cluster property content.
-Andrew
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM]On Behalf
Of Bernard Lebel
Posted At: Thursday, August 25, 2005 3:33 PM
Posted To: xsi
Conversation: [script] Weight map
Subject: [script] Weight map
Hello,
I'm new to scripting weight maps, envelopes and this type of maps in general.
When I log the sample indices of a texture projection, I get the whole
UV info. However when I try the same thing with a weight map, a
symmetry map or an envelope, I get only half of the polygon info.
I'm using this example from the SDK, slightly modified (to make sure
it won't attempt to find a second tuple of values with weight maps and
symmetry maps):
--------------------------------------------------
ClusterProperty
SIObject
ProjectItem
Property
ClusterProperty
--------------------------------------------------
' VBScript example showing how to find the
' texture projection UV values associated
' with each vertex of a polygon
set oRoot = application.activeproject.activescene.root
set oObject = oRoot.addgeometry("Grid", "MeshSurface")
setValue oObject & ".polymsh.geom.subdivu", 2
setValue oObject & ".polymsh.geom.subdivv", 1
BlendInPresets "Image", oObject, 1, False
CreateTextureSupport oObject, siTxtPlanarXZ, siTxtDefaultPlanarXZ,
"Texture_Support"
set oUVWProp = oObject.Material.CurrentUV
set oGeom = oObject.activeprimitive.geometry
' get UVW array
aUVW = oUVWProp.elements.Array
' The cluster knows the relationship between
' indices of the Samples and indices of the Sample cluster
set oCluster = oUVWProp.Parent
for Each oPolygon In oGeom.Polygons
' get polygon index
oPolygonId = oPolygon.Index
' get points index array under polygon
aPntsIndex = oPolygon.Points.IndexArray
logMessage "Polygon" & oPolygonId
' get sample indices
set oSamples = oPolygon.Samples
for i = 0 To oSamples.Count - 1
'Map from the geometry index to the cluster index
indexInCluster = oCluster.FindIndex( oSamples(i).Index )
if ( indexInCluster <> -1 ) then
logMessage "Point" & aPntsIndex(i) & ":" & "UV("_
& aUVW(0, oSamples(i).Index) & _
"," & aUVW(1, oSamples(i).Index) & ")"
end if
next
next
I will not print the full output of my script here because it would be
hard to swallow, however at one point, no point nor sample gets
printed under polygons, after polygon # 11 (my object has 48... a
sphere).
Thanks
Bernard
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi