diff options
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index fa9a97f4e74..3cb20ebbac0 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -42,6 +42,7 @@ #include "BLI_listbase.h" #include "BLI_rand.h" #include "BLI_string.h" +#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_group.h" @@ -51,6 +52,7 @@ #include "BKE_property.h" #include "BKE_report.h" #include "BKE_scene.h" +#include "BKE_library.h" #include "BKE_deform.h" #include "WM_api.h" @@ -72,7 +74,8 @@ * this takes into account the 'restrict selection in 3d view' flag. * deselect works always, the restriction just prevents selection */ -/* Note: send a NC_SCENE|ND_OB_SELECT notifier yourself! */ +/* Note: send a NC_SCENE|ND_OB_SELECT notifier yourself! (or + * or a NC_SCENE|ND_OB_VISIBLE in case of visibility toggling */ void ED_base_object_select(Base *base, short mode) { @@ -147,7 +150,7 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_by_type_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -329,7 +332,7 @@ void OBJECT_OT_select_linked(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_linked_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -429,7 +432,7 @@ static short select_grouped_group(bContext *C, Object *ob) /* Select objects in } /* build the menu. */ - pup= uiPupMenuBegin(C, "Select Group", 0); + pup= uiPupMenuBegin(C, "Select Group", ICON_NULL); layout= uiPupMenuLayout(pup); for (i=0; i<group_count; i++) { @@ -617,7 +620,7 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) /* api callbacks */ ot->invoke= WM_menu_invoke; ot->exec= object_select_grouped_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -659,14 +662,14 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) void OBJECT_OT_select_by_layer(wmOperatorType *ot) { /* identifiers */ - ot->name= "select by layer"; + ot->name= "Select by Layer"; ot->description = "Select all visible objects on a layer"; ot->idname= "OBJECT_OT_select_by_layer"; /* api callbacks */ /*ot->invoke = XXX - need a int grid popup*/ ot->exec= object_select_by_layer_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -678,7 +681,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) /************************** Select Inverse *************************/ -static int object_select_inverse_exec(bContext *C, wmOperator *op) +static int object_select_inverse_exec(bContext *C, wmOperator *UNUSED(op)) { CTX_DATA_BEGIN(C, Base*, base, visible_bases) { if (base->flag & SELECT) @@ -704,7 +707,7 @@ void OBJECT_OT_select_inverse(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_inverse_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -765,7 +768,7 @@ void OBJECT_OT_select_all(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_all_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -808,13 +811,13 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) { /* identifiers */ - ot->name= "select same group"; + ot->name= "Select Same Group"; ot->description = "Select object in the same group"; ot->idname= "OBJECT_OT_select_same_group"; /* api callbacks */ ot->exec= object_select_same_group_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -825,21 +828,26 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) /**************************** Select Mirror ****************************/ static int object_select_mirror_exec(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); short extend; extend= RNA_boolean_get(op->ptr, "extend"); CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) { - char tmpname[32]; + flip_side_name(tmpname, primbase->object->id.name+2, TRUE); + + if(strcmp(tmpname, primbase->object->id.name+2)!=0) { /* names differ */ + Object *ob= (Object *)find_id("OB", tmpname); + if(ob) { + Base *secbase= object_in_scene(ob, scene); - CTX_DATA_BEGIN(C, Base*, secbase, visible_bases) { - if(!strcmp(secbase->object->id.name+2, tmpname)) { - ED_base_object_select(secbase, BA_SELECT); + if(secbase) { + ED_base_object_select(secbase, BA_SELECT); + } } } - CTX_DATA_END; if (extend == 0) ED_base_object_select(primbase, BA_DESELECT); @@ -862,7 +870,7 @@ void OBJECT_OT_select_mirror(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_mirror_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -878,8 +886,11 @@ static int object_select_name_exec(bContext *C, wmOperator *op) short changed = 0; if(!extend) { - CTX_DATA_BEGIN(C, Base*, base, visible_bases) { - ED_base_object_select(base, BA_DESELECT); + CTX_DATA_BEGIN(C, Base*, base, selectable_bases) { + if((base->flag & SELECT) == 0) { + ED_base_object_select(base, BA_DESELECT); + changed= 1; + } } CTX_DATA_END; } @@ -916,7 +927,7 @@ void OBJECT_OT_select_name(wmOperatorType *ot) /* api callbacks */ ot->exec= object_select_name_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; @@ -964,7 +975,7 @@ void OBJECT_OT_select_random(wmOperatorType *ot) /* api callbacks */ /*ot->invoke= object_select_random_invoke XXX - need a number popup ;*/ ot->exec = object_select_random_exec; - ot->poll= ED_operator_scene_editable; + ot->poll= ED_operator_objectmode; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; |