Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-12-28 15:24:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-28 15:24:07 +0400
commit5e4bc5a4f8d1fd5fa6e10afe4091fed77a39768e (patch)
treee52d315f7d5a615a79d511c6e8f61299af8b882d /source/blender/editors/object/object_select.c
parent6522aba6151949785d64aa36aac637153399eef1 (diff)
patch [#33687] select similar lamp
by Saurabh Wankhade (sauraedron), with some edits.
Diffstat (limited to 'source/blender/editors/object/object_select.c')
-rw-r--r--source/blender/editors/object/object_select.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 2aa737d204d..07eca749a74 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -42,6 +42,7 @@
#include "DNA_property_types.h"
#include "DNA_scene_types.h"
#include "DNA_armature_types.h"
+#include "DNA_lamp_types.h"
#include "BLI_math.h"
#include "BLI_listbase.h"
@@ -525,6 +526,7 @@ static EnumPropertyItem prop_select_grouped_types[] = {
{10, "COLOR", 0, "Color", "Object Color"},
{11, "PROPERTIES", 0, "Properties", "Game Properties"},
{12, "KEYINGSET", 0, "Keying Set", "Objects included in active Keying Set"},
+ {13, "LAMP_TYPE", 0, "Lamp Type", "Matching lamp types"},
{0, NULL, 0, NULL, NULL}
};
@@ -656,7 +658,25 @@ static short select_grouped_siblings(bContext *C, Object *ob)
CTX_DATA_END;
return changed;
}
+static short select_similar_lamps(bContext *C, Object *ob)
+{
+ Lamp *la = ob->data;
+
+ short changed = 0;
+ CTX_DATA_BEGIN (C, Base *, base, selectable_bases)
+ {
+ if (base->object->type == OB_LAMP) {
+ Lamp *la_test = base->object->data;
+ if ((la->type == la_test->type) && !(base->flag & SELECT)) {
+ ED_base_object_select(base, BA_SELECT);
+ changed = 1;
+ }
+ }
+ }
+ CTX_DATA_END;
+ return changed;
+}
static short select_grouped_type(bContext *C, Object *ob)
{
short changed = 0;
@@ -803,7 +823,12 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No active object");
return OPERATOR_CANCELLED;
}
-
+
+ if (nr == 13 && ob->type != OB_LAMP) {
+ BKE_report(op->reports, RPT_ERROR, "Active object must be a lamp");
+ return OPERATOR_CANCELLED;
+ }
+
if (nr == 1) changed |= select_grouped_children(C, ob, 1);
else if (nr == 2) changed |= select_grouped_children(C, ob, 0);
else if (nr == 3) changed |= select_grouped_parent(C);
@@ -816,6 +841,7 @@ static int object_select_grouped_exec(bContext *C, wmOperator *op)
else if (nr == 10) changed |= select_grouped_color(C, ob);
else if (nr == 11) changed |= select_grouped_gameprops(C, ob);
else if (nr == 12) changed |= select_grouped_keyingset(C, ob);
+ else if (nr == 13) changed |= select_similar_lamps(C, ob);
if (changed) {
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));