Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Author Topic: Deleting and recreating faces.  (Read 2291 times)

Claude

  • Full Member
  • ***
  • Posts: 248
    • View Profile
Deleting and recreating faces.
« on: April 05, 2009, 12:10:59 am »

Steve

Lets say you want to add a side to a few faces.
You have to store all the data of these faces:point indexes,material
indexes, etc, then delete the faces and finally recreate them.

The problem is that if you delete the last face using a material,
Anim8or removes the material from the material list.
The faces are all created,but some  end up transparent
since their material index points at a non existing material.

Would it be possible to let the responsability of cleaning up to the
script using the RemoveUnusedMaterials(void)
or the RemoveUnusedData(void) function ?

Thanks
Claude

P.S.
Small detail,the spec says:
"OpenFace() begins the definition of a new face.  It returns the index of the newly created face.  If an error occurs it returns 0 and no new face is added. "
It seems problematic that the error returns a valid index value 0 .
Logged

Claude

  • Full Member
  • ***
  • Posts: 248
    • View Profile
Re: Deleting and recreating faces.
« Reply #1 on: April 05, 2009, 10:55:25 pm »

To continue working on the script,I added materials to other faces and
selected a point that wouldn't force Anim8or to delete a material from
the material list.It worked,but something else showed up.

Here's the face description before the script is run:
The faces marked with a X are deleted by the script.

Code: [Select]
   faces {
      4 4 1 -1 ( (0 0) (4 4) (6 6) (2 2) )
      4 4 1 -1 ( (1 1) (3 3) (7 7) (5 5) )             X
      4 4 2 -1 ( (0 0) (2 2) (3 3) (1 1) )
      4 4 2 -1 ( (4 4) (5 5) (7 7) (6 6) )             X
      4 4 3 -1 ( (2 2) (6 6) (7 7) (3 3) )             X
      4 4 3 -1 ( (0 0) (1 1) (5 5) (4 4) )
    }

As expected,the undeleted faces become the first 3 faces.
The point and texture index are  correct,but the face material
index are modified for no reason.
The recreated faces are correct except that one doesn't show
up.

Code: [Select]
    faces {
      4 4 0 -1 ( (0 0) (4 4) (6 6) (2 2) )
      4 4 1 -1 ( (0 0) (2 2) (3 3) (1 1) )
      4 4 2 -1 ( (0 0) (1 1) (5 5) (4 4) )
      4 0 1 -1 ( (1) (3) (8) (5) )
      4 0 2 -1 ( (4) (5) (9) (6) )
      4 0 3 -1 ( (2) (6) (10) (3) )
    }

Attached are the complete files.

Hope it helps.
Bye
Claude
Logged