diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-09-16 05:15:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-09-16 05:15:30 +0400 |
commit | 51f1e822900fbae5b239ddfcfd488eccbbbcc31b (patch) | |
tree | f997d60918f40fbaf4f7bf7353de6555c122d9c6 /source/blender/editors/object/object_select.c | |
parent | be613fd9ddf02aca2d619b6aaa615fff5a02661b (diff) |
Object mode Selection options brought back for view3d.select
- 'center', while Ctrl is held select objects from their center location
- 'enumerate', while Alt is held, give a list of objects under the mouse
- Object selection menu now uses icons with names
- operator object.select_name(name, extend=False)
- keybindings so combinations of Ctrl/Alt/Shift can be used (like in 2.4x)
- logic text input field was using deprecated ID_SCRIPT rather then ID_TXT
details
- added comments to DNA_ID.h ID types
- removed unused ID types Sector and Life
- added uiIconFromID() to get an icon from the object.
- using name for selection is weak but currently there isnt a really good way to do this.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 50ba4ab2934..cfd65ad18ec 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -923,6 +923,59 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot) RNA_def_enum(ot->srna, "seltype", prop_select_types, 1, "Selection", "Extend selection or clear selection then select"); } + +static int object_select_name_exec(bContext *C, wmOperator *op) +{ + char *name= RNA_string_get_alloc(op->ptr, "name", NULL, 0); + short extend= RNA_boolean_get(op->ptr, "extend"); + short changed = 0; + + if(!extend) { + CTX_DATA_BEGIN(C, Base*, base, visible_bases) { + ED_base_object_select(base, BA_DESELECT); + } + CTX_DATA_END; + } + + CTX_DATA_BEGIN(C, Base*, base, selectable_bases) { + if(strcmp(name, base->object->id.name+2)==0) { + ED_base_object_select(base, BA_SELECT); + changed= 1; + } + } + CTX_DATA_END; + + MEM_freeN(name); + + /* undo? */ + if(changed) { + WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); + return OPERATOR_FINISHED; + } + else { + return OPERATOR_CANCELLED; + } +} + +void OBJECT_OT_select_name(wmOperatorType *ot) +{ + + /* identifiers */ + ot->name= "Select Name"; + ot->description = "Select an object with this name"; + ot->idname= "OBJECT_OT_select_name"; + + /* api callbacks */ + ot->exec= object_select_name_exec; + ot->poll= ED_operator_scene_editable; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + RNA_def_string(ot->srna, "name", "", 0, "Name", "Object name to select."); + RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first."); +} + /**************************** Select Random ****************************/ static int object_select_random_exec(bContext *C, wmOperator *op) |