diff options
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r-- | source/blender/editors/object/object_select.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 440c9d01487..6b53807ce1c 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -83,7 +83,7 @@ * 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! (or +/* 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) @@ -104,15 +104,15 @@ void ED_base_object_select(Base *base, short mode) void ED_base_object_activate(bContext *C, Base *base) { Scene *scene = CTX_data_scene(C); - + /* sets scene->basact */ BASACT = base; - + if (base) { - + /* XXX old signals, remember to handle notifiers now! */ // select_actionchannel_by_name(base->object->action, "Object", 1); - + WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } else @@ -131,7 +131,7 @@ static int objects_selectable_poll(bContext *C) return 0; if (obact && obact->mode) return 0; - + return 1; } @@ -140,10 +140,10 @@ static int objects_selectable_poll(bContext *C) static int object_select_by_type_exec(bContext *C, wmOperator *op) { short obtype, extend; - + obtype = RNA_enum_get(op->ptr, "type"); extend = RNA_boolean_get(op->ptr, "extend"); - + if (extend == 0) { CTX_DATA_BEGIN (C, Base *, base, visible_bases) { @@ -151,7 +151,7 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op) } CTX_DATA_END; } - + CTX_DATA_BEGIN (C, Base *, base, visible_bases) { if (base->object->type == obtype) { @@ -159,9 +159,9 @@ static int object_select_by_type_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); - + return OPERATOR_FINISHED; } @@ -171,15 +171,15 @@ void OBJECT_OT_select_by_type(wmOperatorType *ot) ot->name = "Select By Type"; ot->description = "Select all visible objects that are of a type"; ot->idname = "OBJECT_OT_select_by_type"; - + /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_select_by_type_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_object_type_items, 1, "Type", ""); @@ -324,7 +324,7 @@ static bool object_select_all_by_particle(bContext *C, Object *ob) if ((base->flag & SELECT) == 0) { /* loop through other particles*/ ParticleSystem *psys; - + for (psys = base->object->particlesystem.first; psys; psys = psys->next) { if (psys->part == psys_act->part) { base->flag |= SELECT; @@ -413,7 +413,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) bool changed = false, extend; extend = RNA_boolean_get(op->ptr, "extend"); - + if (extend == 0) { CTX_DATA_BEGIN (C, Base *, base, visible_bases) { @@ -421,13 +421,13 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) } CTX_DATA_END; } - + ob = OBACT; if (ob == NULL) { BKE_report(op->reports, RPT_ERROR, "No active object"); return OPERATOR_CANCELLED; } - + if (nr == OBJECT_SELECT_LINKED_IPO) { // XXX old animation system //if (ob->ipo == 0) return OPERATOR_CANCELLED; @@ -485,7 +485,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); return OPERATOR_FINISHED; } - + return OPERATOR_CANCELLED; } @@ -495,15 +495,15 @@ void OBJECT_OT_select_linked(wmOperatorType *ot) ot->name = "Select Linked"; ot->description = "Select all visible objects that are linked"; ot->idname = "OBJECT_OT_select_linked"; - + /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_select_linked_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); ot->prop = RNA_def_enum(ot->srna, "type", prop_select_linked_types, 0, "Type", ""); @@ -781,7 +781,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList { KeyingSet *ks = ANIM_scene_get_active_keyingset(CTX_data_scene(C)); bool changed = false; - + /* firstly, validate KeyingSet */ if (ks == NULL) { BKE_report(reports, RPT_ERROR, "No active Keying Set to use"); @@ -790,7 +790,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList else if (ANIM_validate_keyingset(C, NULL, ks) != 0) { if (ks->paths.first == NULL) { if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) { - BKE_report(reports, RPT_ERROR, + BKE_report(reports, RPT_ERROR, "Use another Keying Set, as the active one depends on the currently " "selected objects or cannot find any targets due to unsuitable context"); } @@ -800,7 +800,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList } return false; } - + /* select each object that Keying Set refers to */ /* TODO: perhaps to be more in line with the rest of these, we should only take objects * if the passed in object is included in this too */ @@ -809,8 +809,8 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList /* only check for this object if it isn't selected already, to limit time wasted */ if ((base->flag & SELECT) == 0) { KS_Path *ksp; - - /* this is the slow way... we could end up with > 500 items here, + + /* this is the slow way... we could end up with > 500 items here, * with none matching, but end up doing this on 1000 objects... */ for (ksp = ks->paths.first; ksp; ksp = ksp->next) { @@ -824,7 +824,7 @@ static bool select_grouped_keyingset(bContext *C, Object *UNUSED(ob), ReportList } } CTX_DATA_END; - + return changed; } @@ -914,15 +914,15 @@ void OBJECT_OT_select_grouped(wmOperatorType *ot) ot->name = "Select Grouped"; ot->description = "Select all visible objects grouped by various properties"; ot->idname = "OBJECT_OT_select_grouped"; - + /* api callbacks */ ot->invoke = WM_menu_invoke; ot->exec = object_select_grouped_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); ot->prop = RNA_def_enum(ot->srna, "type", prop_select_grouped_types, 0, "Type", ""); @@ -939,11 +939,11 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) unsigned int layernum; bool extend; int match; - + extend = RNA_boolean_get(op->ptr, "extend"); layernum = RNA_int_get(op->ptr, "layers"); match = RNA_enum_get(op->ptr, "match"); - + if (extend == false) { CTX_DATA_BEGIN (C, Base *, base, visible_bases) { @@ -951,7 +951,7 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) } CTX_DATA_END; } - + CTX_DATA_BEGIN (C, Base *, base, visible_bases) { bool ok = false; @@ -973,10 +973,10 @@ static int object_select_by_layer_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - + /* undo? */ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); - + return OPERATOR_FINISHED; } @@ -992,15 +992,15 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) 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 = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ RNA_def_enum(ot->srna, "match", match_items, OB_SEL_LAYERMATCH_EXACT, "Match", ""); RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection instead of deselecting everything first"); @@ -1012,7 +1012,7 @@ void OBJECT_OT_select_by_layer(wmOperatorType *ot) static int object_select_all_exec(bContext *C, wmOperator *op) { int action = RNA_enum_get(op->ptr, "action"); - + /* passthrough if no objects are visible */ if (CTX_DATA_COUNT(C, visible_bases) == 0) return OPERATOR_PASS_THROUGH; @@ -1048,24 +1048,24 @@ static int object_select_all_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - + WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); - + return OPERATOR_FINISHED; } void OBJECT_OT_select_all(wmOperatorType *ot) { - + /* identifiers */ ot->name = "(De)select All"; ot->description = "Change selection of all visible objects in scene"; ot->idname = "OBJECT_OT_select_all"; - + /* api callbacks */ ot->exec = object_select_all_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1099,22 +1099,22 @@ static int object_select_same_group_exec(bContext *C, wmOperator *op) CTX_DATA_END; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); - + return OPERATOR_FINISHED; } void OBJECT_OT_select_same_group(wmOperatorType *ot) { - + /* identifiers */ 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 = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1127,15 +1127,15 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); bool extend; - + extend = RNA_boolean_get(op->ptr, "extend"); - + CTX_DATA_BEGIN (C, Base *, primbase, selected_bases) { char name_flip[MAXBONENAME]; BLI_string_flip_side_name(name_flip, primbase->object->id.name + 2, true, sizeof(name_flip)); - + if (!STREQ(name_flip, primbase->object->id.name + 2)) { Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name_flip); if (ob) { @@ -1146,33 +1146,33 @@ static int object_select_mirror_exec(bContext *C, wmOperator *op) } } } - + if (extend == false) ED_base_object_select(primbase, BA_DESELECT); - + } CTX_DATA_END; - + /* undo? */ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); - + return OPERATOR_FINISHED; } void OBJECT_OT_select_mirror(wmOperatorType *ot) { - + /* identifiers */ ot->name = "Select Mirror"; ot->description = "Select the Mirror objects of the selected object eg. L.sword -> R.sword"; ot->idname = "OBJECT_OT_select_mirror"; - + /* api callbacks */ ot->exec = object_select_mirror_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first"); } @@ -1297,7 +1297,7 @@ void OBJECT_OT_select_less(wmOperatorType *ot) /**************************** Select Random ****************************/ static int object_select_random_exec(bContext *C, wmOperator *op) -{ +{ const float randfac = RNA_float_get(op->ptr, "percent") / 100.0f; const int seed = WM_operator_properties_select_random_seed_increment_get(op); const bool select = (RNA_enum_get(op->ptr, "action") == SEL_SELECT); @@ -1315,7 +1315,7 @@ static int object_select_random_exec(bContext *C, wmOperator *op) BLI_rng_free(rng); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C)); - + return OPERATOR_FINISHED; } @@ -1325,15 +1325,15 @@ void OBJECT_OT_select_random(wmOperatorType *ot) ot->name = "Select Random"; ot->description = "Set select on random visible objects"; ot->idname = "OBJECT_OT_select_random"; - + /* api callbacks */ /*ot->invoke = object_select_random_invoke XXX - need a number popup ;*/ ot->exec = object_select_random_exec; ot->poll = objects_selectable_poll; - + /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - + /* properties */ WM_operator_properties_select_random(ot); } |