First, let's correctly identify the problem.  The issue was the
AddPointInteriorToPolygon() command had a bug, not PolygonMesh.Set().  If
PolygonMesh.Set() didn't work, it would display problems on all polygon mesh
operations, not just with AddPointInteriorToPolygon().

As for PolygonNode data, such as vertex colors, you have to manage that
yourself.  Your data structure should be formed so they are associated with
a vertex of a particular polygon.  That way, if the polygon is redrawn or
edges inserted, your data is still intact.  Whether you store the data in a
table or as individual objects is up to you, but the management of which
color/uv/normal gets attached to a particular polygon node when you call
PolygonMesh.Set() is 100% your responsibility as a programmer.  If you write
a tool which modifies topology, it's the tool's job to manage the polygon
node data and make sure it's up to date.  One strategy is to modify the
geometry, then pull the polygon node data from the nearest untouched
neighbor polygons sharing the same vertex as those which were modified.  In
some cases you may need to interpolate from multiple neighbor polygons.
There's really not much more to say than that.

Matt




Date: Fri, 4 Nov 2016 17:23:47 +0300
From: Andrew Prostrelov <[email protected]>
Subject: Preserve UV methods after PolygonMesh.Set()
To: [email protected]

prev thread: "AddPointInteriorToPolygon() command args problem"
https://groups.google.com/forum/#!topic/xsi_list/ZzEg5nhjimU

Hi guys it's me again.
It took me a long time to establish low lvl SPLIT POLYGON processing(i mean
PolygonMesh.Get() & PolygonMesh.Set() methods)
and to cover all geometry cases (n-gons, tris and corners, holes, etc). So
now i'm close to recreate multicut-tool like Maya
have for XSI. But i find that PolygonMesh.Get() & PolygonMesh.Set() turns
UVs to randomized unusable garbage.
So i'm looking to find a way to preserve UVs as they should be. And since
Operators like Bevel, AddEdge, SpliEdge and many others,
add geometry and do not ruine UVs, i assume that there should be a
workaround or API method for that.
So far i figured out that after we use PolygonMesh.Set(), PolygonNodes
changes dramatically. So if there are any way to set PolygonNodes
or Samples from array to geometry it will be easiest way i guess. But i
didn't find any such methods in XSI API.
On the other hand, since we control vertex indices, polygon indices,
polygon vertices and array of coordinates in PolygonMesh.Set() method,
we can get UV coordinates of each vertex and update it after we apply
PolygonMesh.Set(). We also can easily calculate UV values for new vertices
simply by calculating percent distance value to the neighbor vertex and
place this percent value between UV neighbors.
But i still not sure about this way since native XSI Operators do not
change PolygonNodes at all.
So if someone already have the same problem or have any ideas about this
case it would be great to hear it.

p.s.
By the way, Matt i found your answer at www.si-community.com about UVs &
Samples and it helps allot.
But still i have blind spots at API UV processing. 


------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to