* Solved * addFacet with trigons?
Totte
Posts: 13,965
Hi,
I'm working on porting/rewriting something in DAZ Studio script that works with trigons, not quads.
When I try to create some resulting mesh, no facets are added.
aVertexIndices = new Array(3); aUVIndices = new Array(3); aVertexIndices[0] = oTriangle.v0id; aVertexIndices[1] = oTriangle.v1id; aVertexIndices[2] = oTriangle.v2id; aUVIndices[0] = oTriangle.t0id; aUVIndices[1] = oTriangle.t1id; aUVIndices[2] = oTriangle.t2id; oFacetMesh.addFacet( aVertexIndices, aUVIndices ); facets = oFacetMesh.getNumFacets(); logit("Facet Added - count now at:"+facets);
This gives as I said "Facet Added - count now at:0"
Looking at addFacet I get the following versions (using Robs trick):
addFacet(const int[4],const int[4],unsigned char)addFacet(const int[4],const int[4])addFacet(const int[4],const int[4],int,unsigned char)addFacet(QVariantList,QVariantList,unsigned char)addFacet(QVariantList,QVariantList)addFacet(DzFacet,int,unsigned char)addFacet(DzFacet,int)addFacet(DzFacet)
There seems to be no way to create a trigon DzFacet and add this way, or is the a trick to do that?
Post edited by Totte on
Comments
Totte,
Set your arrays sizes to 4, and the last element set it to unused with a -1 value:
aVertexIndices[3] = aUvIndices[3] = -1;
-jag
Thanks!
I will test this!
Rob has a relevant sample script http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/generate_sphere/start
I've looked at that and saw it was using quads but missed the one line