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 31st December 2003, 09:44 AM   #1
AndrewFernie
Junior Member
Member
 
Join Date: Dec 2003
Posts: 12
Default Selection mode and hidden status detection

Hi,
A couple of questions related to the SDK with 4.0.

1. I would like to be able to detect the selection mode. One of the examples (centre.c) used "ac_get_selection". It seems to be gone in 4.0, and the nearest equivalent I can find in 4.0 is "ac_get_current_selection", but there is a "do not use" comment. Is there a way to do this in 4.0?

2. My plugins are for selecting all objects/surfaces with the same texture/material. I would like to be able to select only those objects/surfaces that are not hidden. I can see funtions to set the hidden status, but not to retrieve it. Is there a way to do this?

Thanks,
Andrew
AndrewFernie is offline   Reply With Quote
Old 31st December 2003, 11:37 AM   #2
Andy
Administrator
Professional user
 
Andy's Avatar
 
Join Date: Jun 2003
Posts: 4,563
Default Re: Selection mode and hidden status detection

Select mode - sorry, an oversight.

Code:
Prototype int ac_get_current_selection(List **vertexlist, List **surfacelist, List **objectlist)
WILL return the correct select mode but will also print out a warning about it being a depecated function.

Until a new function is added, use:

Code:
extern int selectmode;
and access select mode (read only)


To get the current selection, use these:

Code:
Prototype List *ac_selection_get_vertices(); // call in vertex select mode, free list after
Prototype List *ac_selection_get_surfaces(); // call in surface select mode, free list after
Prototype List *ac_selection_get_objects(); // call in object or group select mode, free list after
Prototype List *ac_selection_get_groups(); // gets all selected toplevel obs, call in object or group select mode, free returned list
Prototype List *ac_selection_get_whole_surfaces_all(void); // any select mode, free the list when you've finished with it
Prototype List *ac_selection_get_vertices_all(); // in vertex/surface modes et all selected vertices
Prototype List *ac_selection_get_poly_objects(); // call in object or group select mode, free returned list
To change the selection, use:

Code:
Prototype void ac_selection_select_objectlist(List *obs);
Prototype void ac_selection_select_vertexlist(List *l);
Prototype void ac_selection_select_surfacelist(List *l);
Prototype void ac_selection_select_by_surfaces(List *surfacelist);
Prototype void ac_selection_select_by_surface(Surface *s);
(and clear_selection())
If you are making your function Undoable (which you really should), use:

Code:
Prototype ACSelection *ac_selection_get_snapshot();
Prototype void ac_selection_restore_from_snapshot(ACSelection *replacement);
to save/restore the selection.

Let me know if you have any problems making this work.

Objects that are hidden or locked will not be selectable (i.e. it should be safe to try and select them, and it will be ignored). There are currently no exported functions that check visibility apart from within tcl (object_is_visible) but I'll ensure that these are added to the next release.

Andy
Andy is offline   Reply With Quote
Old 5th January 2004, 02:34 PM   #3
AndrewFernie
Junior Member
Member
 
Join Date: Dec 2003
Posts: 12
Default Re: Selection mode and hidden status detection

Thanks Andy.

I tried "extern int selectmode;", but I get an unresolved symbol when I link. For the moment, I will use "ac_get_current_selection(List **vertexlist, List **surfacelist, List **objectlist)" to access the select mode and put up with the message. I use the function only to access the mode (I use the new functions to access the lists of selected objects and surfaces), so it will be easy to update it later on.

The behavior of hidden status seems to depend on whether it is objects or surfaces that are being selected.
1. Assume that there is a model being displayed with a bunch of objects and surfaces. Select part of the model in either object or surface select mode, then hide the selected objects/surfaces. Select "surface select" mode, then have a plugin traverse the model recursively starting from "ac_get_world()", and use "ac_selection_select_by_surface(s)" to try to select some surfaces that are visible and some that are hidden. Even the hidden ones will be selected, and their edges will become visible in the display.
2. On the other hand, if you traverse the model and use "ac_select_object(ob)" to try to select some hidden and some visible objects, only the ones that are visible will be selected.

All this came up when I was writing two plugins to select all surfaces using a specified material, and to select all objects using a specified texture. After getting them running I found that there was already a way of tracking down all the surfaces using a specific material, so the selection of hidden surfaces became a non-issue for me. Oh well, it was an interesting little project to learn how the SDK works...

As for the plugin to select all objects using a specified texture, it works fine and I find it useful in trying to impose some structure on models whose structure did not survive conversion from odd formats. If you think that it would be useful to others I can send it along. I have no way of posting it myself.

Andrew
AndrewFernie 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 04:21 AM.


AC3D Forum
(C) Inivis Limited 2020