Trying to get morphed mesh vertices values

RenhaRenha Posts: 12

Hi. I'm trying to get mesh vertices values via script, but looks like morphs aren't applied to vertices values, i.e. using script like that one http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/geometry/geometry_info/start I get same values no matter if I morph object or scale it. Object is imported .obj file, attached to Genesis 8 Female body via transfer utility, and all morphs are applied to that body (but I've tried to scale object itself - no luck).

Also  vertex values are not adequate to even bounding box (which is updating, btw):

obj= Scene.findNodeByLabel( "my_sword")mesh= obj.getObject().getCurrentShape().getGeometry()print(obj.getObject().getBoundingBox());		var X=[1000,-1000],Y=[1000,-1000],Z=[1000,-1000];for (i= 0; i<mesh.getNumVertices(); i+= 1) {	f= mesh.getVertex(i);	if (f.x<X[0])X[0]= f.x;	if (f.x>X[1])X[1]= f.x;	if (f.y<Y[0])Y[0]= f.y;	if (f.y>Y[1])Y[1]= f.y;	if (f.z<Z[0])Z[0]= f.z;	if (f.z>Z[1])Z[1]= f.z;}print(X,Y,Z);

My expectation was that X[1]-X[0] would be same as bbox[0][1]-bbox[0][0], because of extreme values of vertex positions. But no, bbox is correct and gives higher values than vertex positions! And it works ok with scale and morphs. I want same for vertices.

EDIT: looks like if I don't use Transfer Utility, initial values are same for bbox and extreme values of vertex coordinates. But no update on scale or morph anyway.

Post edited by Renha on

Comments

  • hphoenixhphoenix Posts: 1,335

    I believe object.shape.getGeometry() returns the UNmodified/UNtransformed mesh.  If you want the modified mesh, I think you want to be using object.getCachedGeom() instead.

     

Sign In or Register to comment.