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:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_select.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_select.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index d50a097e6f6..fa8422573ab 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -308,10 +308,11 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
bool recursive)
{
TreeStoreElem *tselem = TREESTORE(te);
- TreeStoreElem *parent_tselem;
+ TreeStoreElem *parent_tselem = NULL;
Scene *sce;
Base *base;
Object *ob = NULL;
+ TreeElement *te_ob = NULL;
/* if id is not object, we search back */
if (te->idcode == ID_OB) {
@@ -355,17 +356,25 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
}
}
- parent_tselem = TREESTORE(outliner_find_id(soops, &soops->tree, (ID *)ob));
+ te_ob = outliner_find_id(soops, &soops->tree, (ID *)ob);
+ if (te_ob != NULL && te_ob != te) {
+ parent_tselem = TREESTORE(te_ob);
+ }
+
if (base) {
if (set == OL_SETSEL_EXTEND) {
/* swap select */
if (base->flag & BASE_SELECTED) {
ED_object_base_select(base, BA_DESELECT);
- parent_tselem->flag &= ~TSE_SELECTED;
+ if (parent_tselem) {
+ parent_tselem->flag &= ~TSE_SELECTED;
+ }
}
else {
ED_object_base_select(base, BA_SELECT);
- parent_tselem->flag |= TSE_SELECTED;
+ if (parent_tselem) {
+ parent_tselem->flag |= TSE_SELECTED;
+ }
}
}
else {
@@ -381,7 +390,9 @@ static eOLDrawState tree_element_set_active_object(bContext *C,
BKE_view_layer_base_deselect_all(view_layer);
}
ED_object_base_select(base, BA_SELECT);
- parent_tselem->flag |= TSE_SELECTED;
+ if (parent_tselem) {
+ parent_tselem->flag |= TSE_SELECTED;
+ }
}
if (recursive) {
@@ -1252,7 +1263,7 @@ static bool do_outliner_range_select_recursive(ListBase *lb,
TreeElement *cursor,
bool selecting)
{
- for (TreeElement *te = lb->first; te; te = te->next) {
+ LISTBASE_FOREACH (TreeElement *, te, lb) {
TreeStoreElem *tselem = TREESTORE(te);
if (selecting) {
@@ -1412,9 +1423,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
ED_region_tag_redraw_no_rebuild(region);
}
- if (soops->flag & SO_SYNC_SELECT) {
- ED_outliner_select_sync_from_outliner(C, soops);
- }
+ ED_outliner_select_sync_from_outliner(C, soops);
}
return OPERATOR_FINISHED;
@@ -1496,7 +1505,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
WM_operator_properties_border_to_rctf(op, &rectf);
UI_view2d_region_to_view_rctf(&region->v2d, &rectf, &rectf);
- for (TreeElement *te = soops->tree.first; te; te = te->next) {
+ LISTBASE_FOREACH (TreeElement *, te, &soops->tree) {
outliner_item_box_select(soops, scene, &rectf, te, select);
}
@@ -1504,9 +1513,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw(region);
- if (soops->flag & SO_SYNC_SELECT) {
- ED_outliner_select_sync_from_outliner(C, soops);
- }
+ ED_outliner_select_sync_from_outliner(C, soops);
return OPERATOR_FINISHED;
}
@@ -1744,9 +1751,7 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
/* Scroll outliner to focus on walk element */
outliner_walk_scroll(region, walk_element);
- if (soops->flag & SO_SYNC_SELECT) {
- ED_outliner_select_sync_from_outliner(C, soops);
- }
+ ED_outliner_select_sync_from_outliner(C, soops);
ED_region_tag_redraw(region);
return OPERATOR_FINISHED;