[Bf-blender-cvs] [78944dcaddc] soc-2020-outliner: Outliner: Add activation and toggle to left column buttons
Nathan Craddock
noreply at git.blender.org
Thu Jun 11 17:12:25 CEST 2020
Commit: 78944dcaddcda119768bdad86a824bb9cea708a6
Author: Nathan Craddock
Date: Thu Jun 11 09:11:14 2020 -0600
Branches: soc-2020-outliner
https://developer.blender.org/rB78944dcaddcda119768bdad86a824bb9cea708a6
Outliner: Add activation and toggle to left column buttons
The buttons in the left column didn't work, and in the first step that
they did work, I only added support for camera objects. This adds
support for edit mode toggling and collections and scene activation.
Previously clicking in the column for those types would crash.
===================================================================
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/editors/space_outliner/outliner_intern.h
M source/blender/editors/space_outliner/outliner_select.c
===================================================================
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 0c4d65a4582..f8ae15f0192 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1902,11 +1902,19 @@ static void outliner_buttons(const bContext *C,
}
}
-static void outliner_set_active_data_fn(bContext *C, void *tselem_poin, void *UNUSED(arg2))
+static void outliner_left_column_fn(bContext *C, void *tselem_poin, void *UNUSED(arg2))
{
+ SpaceOutliner *soops = CTX_wm_space_outliner(C);
Scene *scene = CTX_data_scene(C);
+ TreeStoreElem *tselem = (TreeStoreElem *)tselem_poin;
- outliner_set_active_camera(C, scene, tselem_poin);
+ /* TODO: Try to pass necessary data instead of searching for tree elem */
+ TreeElement *te = outliner_find_tree_element(&soops->tree, tselem);
+ if (!te) {
+ return;
+ }
+
+ outliner_left_column_click(C, soops, te);
}
/* Draw icons for setting activation when in object mode */
@@ -1953,8 +1961,7 @@ static void outliner_draw_left_column_activation(const bContext *C,
0.0,
0.0,
TIP_("Set active camera"));
- /* TODO: adding functions to these buttons doesn't work well */
- UI_but_func_set(but, outliner_set_active_data_fn, tselem, NULL);
+ UI_but_func_set(but, outliner_left_column_fn, tselem, NULL);
}
}
}
@@ -1992,7 +1999,7 @@ static void outliner_draw_left_column_activation(const bContext *C,
0.0,
0.0,
TIP_("Set active scene"));
- UI_but_func_set(but, outliner_set_active_data_fn, tselem, NULL);
+ UI_but_func_set(but, outliner_left_column_fn, tselem, NULL);
}
}
else if (ELEM(tselem->type, TSE_VIEW_COLLECTION_BASE, TSE_LAYER_COLLECTION)) {
@@ -2031,7 +2038,7 @@ static void outliner_draw_left_column_activation(const bContext *C,
0.0,
0.0,
TIP_("Set active collection"));
- UI_but_func_set(but, outliner_set_active_data_fn, tselem, NULL);
+ UI_but_func_set(but, outliner_left_column_fn, tselem, NULL);
}
}
}
@@ -2065,6 +2072,7 @@ static void outliner_draw_left_column_mode_toggle(const bContext *C,
0.0,
0.0,
TIP_(""));
+ UI_but_func_set(but, outliner_left_column_fn, tselem, NULL);
}
else {
/* Draw dot for objects that are compatible with the current edit mode */
@@ -2081,7 +2089,8 @@ static void outliner_draw_left_column_mode_toggle(const bContext *C,
0.0,
0.0,
0.0,
- TIP_(""));
+ TIP_("Toggle edit mode"));
+ UI_but_func_set(but, outliner_left_column_fn, tselem, NULL);
}
}
}
diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h
index 93fcf84928d..232e670257f 100644
--- a/source/blender/editors/space_outliner/outliner_intern.h
+++ b/source/blender/editors/space_outliner/outliner_intern.h
@@ -291,8 +291,7 @@ void outliner_set_walk_element(struct SpaceOutliner *soops, struct TreeStoreElem
bool outliner_item_is_co_over_name_icons(const TreeElement *te, float view_co_x);
bool outliner_item_is_co_within_close_toggle(const TreeElement *te, float view_co_x);
-/* TODO: Temporary while testing */
-void outliner_set_active_camera(struct bContext *C, Scene *scene, struct TreeStoreElem *tselem);
+void outliner_left_column_click(struct bContext *C, struct SpaceOutliner *soops, TreeElement *te);
/* outliner_edit.c ---------------------------------------------- */
typedef void (*outliner_operation_cb)(struct bContext *C,
diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index f7c567fe559..2107c5e1d75 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -1141,7 +1141,7 @@ eOLDrawState tree_element_type_active(bContext *C,
}
/* TODO: Temporary while testing */
-void outliner_set_active_camera(bContext *C, Scene *scene, TreeStoreElem *tselem)
+static void outliner_set_active_camera(bContext *C, Scene *scene, TreeStoreElem *tselem)
{
Object *ob = (Object *)tselem->id;
@@ -1178,7 +1178,7 @@ static void outliner_set_active_data(bContext *C,
}
}
-static void outliner_left_column_click(bContext *C, SpaceOutliner *soops, TreeElement *te)
+void outliner_left_column_click(bContext *C, SpaceOutliner *soops, TreeElement *te)
{
TreeStoreElem *tselem = TREESTORE(te);
TreeViewContext tvc;
More information about the Bf-blender-cvs
mailing list