View Single Post
Old 28th May 2004, 11:05 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,565
Default

Thanks Ben.

Use these - they will work on any platform:

Code:
Prototype char *ac_get_load_filename(char *title, char **suffix);
Prototype char *ac_get_import_filename(char *title, char **suffix);
Prototype char *ac_get_save_filename(char *title, char **suffix);
Prototype char *ac_get_export_filename(char *title, char **suffix);
e.g.

Code:
static void savepng_go()
{
char *filter[] = { "PNG files", "*.png", "All files", "*", NULL };

    char *fname = ac_get_export_filename("Save 3d win as png", filter);
    if (STRINGISEMPTY(fname))
        return;
    save_image(fname);
}
For linked lists, look in the plugin header - a comment at the prototype will tell you if you need to free the thing that's returned. Most of the functions don't, since they just return the pointer to the linked list e.g.

Code:
Prototype List *ac_object_get_vertexlist(ACObject *ob);
freeing this list would causes a swift crash.

If you are adding or removing stuff from objects - always use the other functions e.g. ac_object_add/remove... because they may do other stuff (like change vertex counters etc) - don't edit the lists directly - treat them as read only.

Andy
Andy is offline   Reply With Quote