31st December 2003, 09:44 AM | #1 |
Junior Member
Member
Join Date: Dec 2003
Posts: 12
|
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 |
31st December 2003, 11:37 AM | #2 |
Administrator
Professional user
Join Date: Jun 2003
Posts: 4,565
|
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) Until a new function is added, use: Code:
extern int selectmode; 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 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()) Code:
Prototype ACSelection *ac_selection_get_snapshot(); Prototype void ac_selection_restore_from_snapshot(ACSelection *replacement); 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 |
5th January 2004, 02:34 PM | #3 |
Junior Member
Member
Join Date: Dec 2003
Posts: 12
|
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 |
|
|