PDA

View Full Version : Adding Vertices(in list) to and Object.


LiveWire
5th December 2004, 08:01 PM
take a look at:

List *VertList;
for(loop...)
{
Vertex *temp_vert = new_vertex_set(x, y, z);
list_add_item(&VertexList, temp_vert);
}
object_add_vertices(return_Object, VertexList);


it always brings up the error:
Exception occured in command load_file_select.
Last Error(not necessarily the problem): The operation completed successfully.

but it works when i use:

for(loop...)
{
Vertex *temp_vert = new_vertex_set(x, y, z);
object_add_vertex(return_Object, temp_vert);
}



im trying to get my code to run faster.
any help?
--Phil

Thaellin
5th December 2004, 09:10 PM
I assume vertlist and vertexlist are actually the same variable in your real code. I think the problem is your "List *" is used before you are giving it a new list object. Initialize the list (can't remember the function) and then use it.

Make sure to free the list afterwards...

List management is a little awkward, I'm afraid. I don't remember the details right now, but I hope that helps a little.

-- Jeff

LiveWire
5th December 2004, 11:48 PM
ah ha, thanx ill try that.

and yes, i missed that code error.
--Phil

Andy
6th December 2004, 04:08 AM
You must set the list to NULL before you start - otherwise it looks like there's something in it already and it will mess up.

Use object_add_vertex_head for speed.

Andy

LiveWire
6th December 2004, 05:33 AM
thanx andy, that add_vertex_head makes it run much faster.