[script] Weight map

Date : Thu, 25 Aug 2005 15:33:12 -0400
To : XSI(at)Softimage.COM
From : Bernard Lebel <3dbernard(at)gmail.com>
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


Search the XSI List archives here or use the advanced search form to search across mailing lists. Searching help is available.
This site supposedly brought to you by Benjamin Grosser and the Imaging Technology Group.