Modifing figure geometry

SemicharmSemicharm Posts: 219

I'm trying to modify the geometry of a specific figure in order to fix a break between two groups. At the moment, the script prints the vertex values before and after setting them. The values seem to be set correctly, but if I run the script again, the "before" values are the same as last time. My changes don't seem to stick.

What am I missing?

var oNode = Scene.getPrimarySelection();// List of array objects in the format [ vertexIndex, xVale, yValue, zValue ]var vList;  // *omitted*if( oNode ){ var oSkeleton = oNode.getSkeleton(); if( oSkeleton ){  oNode = oSkeleton;  print(oNode.getName() + ": " + oNode.className());  var oObject = oNode.getObject();  if( oObject ){   var oShape = oObject.getCurrentShape();   if( oShape ){    var oVertexMesh = oShape.getModifiableAssemblyGeom( false );    if( oVertexMesh ){     print(oVertexMesh.getNumVertices());     oVertexMesh.beginEdit();     for( var i=0; i < vList.length; i++ ){      var oV = oVertexMesh.getVertex( vList[0] );      print(vList[0] + ": " + oV.x + ", " + oV.y + ", " + oV.z);      oVertexMesh.setVertex( vList[0], DzVec3( vList[1], vList[2], vList[3] ) );      oV = oVertexMesh.getVertex( vList[0] );      print(vList[0] + ": " + oV.x + ", " + oV.y + ", " + oV.z);      print("");     }      oVertexMesh.finishEdit();     oNode.update();    }   }  } }}

Post edited by Semicharm on

Comments

  • SemicharmSemicharm Posts: 219
    edited December 1969

    Never mind. Figured out that getModifiableAssemblyGeom creates a copy of the geometry, which is getting thrown away when the script finishes. To get to the actual mesh geometry, I needed to call getFacetMesh instead.

    var oVertexMesh = oShape.getFacetMesh();

  • SemicharmSemicharm Posts: 219
    edited December 1969

    That sort of works, but the welding between the groups doesn't seem to be updated. To be more specific about the problem, DS isn't welding all of the vertices between the groups correctly. This isn't a problem in Poser though. DS seems to be more picky, as the vertices needed to be closer for welds to work properly.

    It's possible to modify the original obj to correct this, but rather than putting everyone else through the trouble to doing the edits or decoding a modified obj file, I want to try to create a patch to automatically fix the figure when it loads in DS. I verified that the vertices are getting updated and they match the values from the corrected obj. However, the modified vertices aren't getting welded.

  • Richard HaseltineRichard Haseltine Posts: 19,294
    edited December 1969

    I think wlding happens at import, for a CR2 figure, so you may need to export the OBJ. However, I'm far from certain of that.

  • SemicharmSemicharm Posts: 219
    edited December 1969

    Is there a way to invoke it again after the obj has been imported?

  • Richard HaseltineRichard Haseltine Posts: 19,294
    edited December 1969

    I didn't see anything immediately on looking through the old scripting docs, but this is a new object type so it may have a way to trigger a weld.

  • BejaymacBejaymac Posts: 1,023
    edited December 1969

    There used to be a .ds script kicking around that fixed Miki2's neck for DS users, it edited the actual OBJ and welded the vertices of the neck, if you can find it you might be able to work out a way of doing that with the DS3 & 4 scripting language.

Sign In or Register to comment.
Rocket Fuel