After Effects
More info here
feed it a list of vertices space delimited "x1 y1 z1 x2 y2 z2 ..."
get back triangle data "#triangles,i1 j1 k1,i2 j2 k2, ..."
The polygon must have good geometry, will crash tS if fed bad geometry such as a rectangle that's been twisted into a bow tie shape.
polypoints = "-0.5 -0.5 -0.5 -0.5 -0.5 0.5 -0.5 0.5 0.5 -0.5 0.5 -0.5"
utilitydata = System.CreateDO("Clintons3D Package/Utility functions");
value = utilitydata.PolygonToTriangles(polypoints);
valArr = value.split(",");
for(var i = 0; i < valArr[0]*1; i++) {
localindices = valArr[i+1].split(" ");
a little sloppy trailing space and comma in each triangle definition
value is "2,0 1 2 ,0 2 3 ,"
//get triangle neighbors as a space delimited string of triangle indices
utilityFunctions = System.CreateDO("Clintons3D Package/Utility functions");
triangleIndex = 19;
neighborsS = utilityFunctions.GetTriangleNeighbors(firstSelected + "/Editable shape", triangleIndex);
result is "5 20 16", a space delimited list of neighbor indices at each edge of the triangle, -1 indicates no neighbor on that edge
the first value is the triangle index along the edge P1>P2, then P2>P3 and finally P3>P1
meshdata = System.CreateDO("Space 3D Package/Mesh Data");
faceEdgeStream = System.CreateDO('Space 3D Package/Face Edges Stream Data');
meshdata = Node.Value(Node.FirstSelected() + "/Editable shape" ,"Mesh");
faceEdgeStream = meshdata.GetTrianglesStreamByName("Face Edges Stream Data");
triangleIndex = 19;
triangleEdgesS = faceEdgeStream.edges(triangleIndex);
result is the value of 1 to show that the first edge of the triangle is visible. if the second edge was also visible the value would be 1+2=3 and if the third edge was also visible it would be 1+2+4=7
truespace does not store polygon information. it stores triangle edge visibility to give the appearance and behavior of polygons
This bug will crash tS if the command is run
var thesel = System.CreateDO("Space 3D Package/Selection Data");
thesel = Node.Value(firstSel, "Selection");
bobobo = thesel.GetSelectedFaceTriangle(0)
var thesel = System.CreateDO("Space 3D Package/Selection Data");
thesel = Node.Value(firstSel, "Selection");
util = System.CreateDO("Clintons3D Package/Utility functions");
bobobo = util.GetSelectedFaceTriangle(0);
get a comma separated list of each triangle's polygon face index, supply the path to the "Shape" or "Editable shape" node
The order of the triangles is not guaranteed to be in order. It can be reorganized like so.
var faceToTriangleList = [];
for(var i=0;i<faceUnitiesArr.length;i++) {
if(faceToTriangleList[faceUnitiesArr[i]])
faceToTriangleList[faceUnitiesArr[i]].push(i);
else
faceToTriangleList[faceUnitiesArr[i]] = [i];
}
get a comma separated list of each triangle index that the given vertex is a part of,
supply the path to the "Shape" or "Editable shape" node and a vertex index
Requires special material setups to see the vertex colors. Vertex colors will disappear from a mesh if the mesh has geometry added or taken away. They will also disappear on shape changes if the mesh edit settings autotriangulation option is not set to "None".
fill the supplied mesh's vertices with the desired color
supply the path to the "Shape" or "Editable shape" node and a color
set the color for a single mesh vertex
supply the path to the "Shape" or "Editable shape" node, a vertex index and a color
get the color of a single vertex in a string of the form "red, green, blue"
supply the path to the "Shape" or "Editable shape" node and a vertex index
copy the colors from a bitmap texture onto the mesh vertices
supply the path to the bitmap node, the bitmap connector name, the "Shape" or "Editable shape" node, u and v offsets, wrap/clamp and the uv channel to use
used with the vertex painting script to apply colors to a mesh using a simple brush
This tool will continuously erase undo history, because running undo during or after using the widget will crash trueSpace.
trueSpace vertex colors do not have alpha value and are internally limited to the integer values between 0 and 255. So floating point values will really be a stepped value multiple of 1/255.