Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / Plugins - Extensions / mesh->setNumFaces(1); makes my plugin to crash 3DS!
  RSS 2.0 ATOM  

mesh->setNumFaces(1); makes my plugin to crash 3DS!
Rate this thread
 
23172
 
Permlink of this thread  
avatar
  • Total Posts: 4
  • Joined: 23 February 2009 05:52 PM

Hello, I am learning 3D Studio MAX plugin development by programming a little dummy modifier which converts an input mesh into a single triangle. The problem is that I am not able to construct that single triangle without making 3D Studio to crash.

I hope anyone of you can help me or point me to some useful resource.

This is my code:

TriObject *obj = (TriObject *) os->obj;
    
Mesh *mesh = &obj->mesh;

    
mesh->setNumVerts(1);
    
mesh->setVert(0,Point3(0.0f,0.0f,0.0f));

    
mesh->setNumFaces(1,TRUE);

    if (
mesh->tvFace)
    
{
        mesh
->setNumTVerts(1);
        
mesh->setTVert(0,0.0f,0.0f,0.0f);
    
}

    
if(mesh->tvFacemesh->setNumTVFaces(1);
    if(
mesh->vcFacemesh->setNumVCFaces(1);
    for(
int i=0;i<1;i++) {
        Face 
*f= &(mesh->faces[i]);
        
f->v[0] 0;
        
f->v[1] 1;
        
f->v[2] 2;
        
f->smGroup 0
        
f->flags EDGE_ALL;

        if(
mesh->tvFace{
            TVFace 
*tvf = &(mesh->tvFace[i]);
            
tvf->setTVerts(0,1,2);            
        
}
        
if(mesh->vcFace{
            TVFace 
*tvf = &(mesh->vcFace[i]);
            
tvf->setTVerts(0,1,2);            
        
}
    }
    mesh
->InvalidateGeomCache();
    
mesh->InvalidateTopologyCache();


Replies: 0