Digital Art Zone

 
     
Modifing figure geometry
Posted: 01 June 2013 04:04 PM   [ Ignore ]
Member
Avatar
Rank
Total Posts:  187
Joined  2007-10-30

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.getModifiableAssemblyGeomfalse );
    if( 
oVertexMesh ){
     
print(oVertexMesh.getNumVertices());
     
oVertexMesh.beginEdit();
     for( var 
i=0vList.lengthi++ ){
      
var oV oVertexMesh.getVertexvList[i][0] );
      print(
vList[i][0] ": " oV.", " oV.", " oV.z);
      
oVertexMesh.setVertexvList[i][0]DzVec3vList[i][1]vList[i][2]vList[i][3] ) );
      
oV oVertexMesh.getVertexvList[i][0] );
      print(
vList[i][0] ": " oV.", " oV.", " oV.z);
      print(
"");
     

     oVertexMesh
.finishEdit();
     
oNode.update();
    
}
   }
  }
 }
 Signature 

You can follow my work on the following sites:
http://www.sharecg.com/p…p?pf_user_name=semicharm
http://semicharm.deviantart.com/

Profile
 
 
Posted: 02 June 2013 12:17 AM   [ Ignore ]   [ # 1 ]
Member
Avatar
Rank
Total Posts:  187
Joined  2007-10-30

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(); 
 Signature 

You can follow my work on the following sites:
http://www.sharecg.com/p…p?pf_user_name=semicharm
http://semicharm.deviantart.com/

Profile
 
 
Posted: 02 June 2013 01:56 AM   [ Ignore ]   [ # 2 ]
Member
Avatar
Rank
Total Posts:  187
Joined  2007-10-30

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.

 Signature 

You can follow my work on the following sites:
http://www.sharecg.com/p…p?pf_user_name=semicharm
http://semicharm.deviantart.com/

Profile
 
 
Posted: 02 June 2013 05:13 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13690
Joined  2003-10-09

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.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 02 June 2013 10:32 AM   [ Ignore ]   [ # 4 ]
Member
Avatar
Rank
Total Posts:  187
Joined  2007-10-30

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

 Signature 

You can follow my work on the following sites:
http://www.sharecg.com/p…p?pf_user_name=semicharm
http://semicharm.deviantart.com/

Profile
 
 
Posted: 02 June 2013 12:16 PM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  13690
Joined  2003-10-09

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.

 Signature 

DAZ Studio Frequently Asked Questions

Index of free DAZ Studio scripts and plugins list

Profile
 
 
Posted: 02 June 2013 06:18 PM   [ Ignore ]   [ # 6 ]
Active Member
Avatar
RankRank
Total Posts:  894
Joined  2007-01-04

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.

 Signature 

**shuffles of with a new headache** tongue wink

Profile