Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 5th December 2004, 08:01 PM   #1
LiveWire
Senior Member
Professional user
 
Join Date: Nov 2003
Location: Eugene OR, USA
Posts: 212
Default Adding Vertices(in list) to and Object.

take a look at:
Code:
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:
Code:
Exception occured in command load_file_select.
Last Error(not necessarily the problem): The operation completed successfully.
but it works when i use:
Code:
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
LiveWire is offline   Reply With Quote
Old 5th December 2004, 09:10 PM   #2
Thaellin
Senior Member
Professional user
 
Join Date: Jun 2003
Location: British Columbia, Canada
Posts: 255
Default

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
Thaellin is offline   Reply With Quote
Old 5th December 2004, 11:48 PM   #3
LiveWire
Senior Member
Professional user
 
Join Date: Nov 2003
Location: Eugene OR, USA
Posts: 212
Default

ah ha, thanx ill try that.

and yes, i missed that code error.
--Phil
LiveWire is offline   Reply With Quote
Old 6th December 2004, 04:08 AM   #4
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default

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
Andy is offline   Reply With Quote
Old 6th December 2004, 05:33 AM   #5
LiveWire
Senior Member
Professional user
 
Join Date: Nov 2003
Location: Eugene OR, USA
Posts: 212
Default

thanx andy, that add_vertex_head makes it run much faster.
LiveWire is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 01:27 AM.


AC3D Forum
(C) Inivis Limited 2020