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:
authorNathan Craddock <nzcraddock@gmail.com>2020-07-28 00:55:47 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-07-28 00:55:47 +0300
commit814771e316da89cabbccf70e0f0b6ff7c98af6f1 (patch)
treec2d801f2d5f87522ad3a9ac69d094af06ceedd75 /source/blender/editors/space_outliner/outliner_draw.c
parent14f1a0ae7c9b7f85e2957d65713711ec5c07ff33 (diff)
Outliner: Move collection enable icon to restrict column
The checkbox behaves as a restriction button, and drawing it vertically in the restriction column allows easier click+drag support. This also removes clutter from the mode column.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c96
1 files changed, 31 insertions, 65 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index e5316ae9d49..f5ccbd3433a 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -849,8 +849,8 @@ typedef struct RestrictProperties {
PropertyRNA *object_hide_viewport, *object_hide_select, *object_hide_render;
PropertyRNA *base_hide_viewport;
PropertyRNA *collection_hide_viewport, *collection_hide_select, *collection_hide_render;
- PropertyRNA *layer_collection_holdout, *layer_collection_indirect_only,
- *layer_collection_hide_viewport;
+ PropertyRNA *layer_collection_exclude, *layer_collection_holdout,
+ *layer_collection_indirect_only, *layer_collection_hide_viewport;
PropertyRNA *modifier_show_viewport, *modifier_show_render;
PropertyRNA *constraint_enable;
PropertyRNA *bone_hide_viewport;
@@ -866,6 +866,7 @@ typedef struct RestrictPropertiesActive {
bool collection_hide_viewport;
bool collection_hide_select;
bool collection_hide_render;
+ bool layer_collection_exclude;
bool layer_collection_holdout;
bool layer_collection_indirect_only;
bool layer_collection_hide_viewport;
@@ -955,8 +956,7 @@ static bool outliner_restrict_properties_collection_set(Scene *scene,
NULL;
Collection *collection = outliner_collection_from_tree_element(te);
- if ((collection->flag & COLLECTION_IS_MASTER) ||
- (layer_collection && ((layer_collection->flag & LAYER_COLLECTION_EXCLUDE) != 0))) {
+ if (collection->flag & COLLECTION_IS_MASTER) {
return false;
}
@@ -996,6 +996,8 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"hide_viewport");
props.collection_hide_select = RNA_struct_type_find_property(&RNA_Collection, "hide_select");
props.collection_hide_render = RNA_struct_type_find_property(&RNA_Collection, "hide_render");
+ props.layer_collection_exclude = RNA_struct_type_find_property(&RNA_LayerCollection,
+ "exclude");
props.layer_collection_holdout = RNA_struct_type_find_property(&RNA_LayerCollection,
"holdout");
props.layer_collection_indirect_only = RNA_struct_type_find_property(&RNA_LayerCollection,
@@ -1013,6 +1015,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
}
struct {
+ int enable;
int select;
int hide;
int viewport;
@@ -1043,6 +1046,10 @@ static void outliner_draw_restrictbuts(uiBlock *block,
if (soops->show_restrict_flags & SO_RESTRICT_SELECT) {
restrict_offsets.select = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
}
+ if (soops->show_restrict_flags & SO_RESTRICT_ENABLE) {
+ restrict_offsets.enable = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH;
+ }
+
BLI_assert((restrict_column_offset * UI_UNIT_X + V2D_SCROLL_WIDTH) ==
outliner_restrict_columns_width(soops));
@@ -1431,6 +1438,26 @@ static void outliner_draw_restrictbuts(uiBlock *block,
Collection *collection = outliner_collection_from_tree_element(te);
if (layer_collection != NULL) {
+ if (soops->show_restrict_flags & SO_RESTRICT_ENABLE) {
+ bt = uiDefIconButR_prop(block,
+ UI_BTYPE_ICON_TOGGLE,
+ 0,
+ 0,
+ (int)(region->v2d.cur.xmax) - restrict_offsets.enable,
+ te->ys,
+ UI_UNIT_X,
+ UI_UNIT_Y,
+ &layer_collection_ptr,
+ props.layer_collection_exclude,
+ -1,
+ 0,
+ 0,
+ 0,
+ 0,
+ NULL);
+ UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
+ }
+
if (soops->show_restrict_flags & SO_RESTRICT_HIDE) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
@@ -2731,60 +2758,6 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
return data;
}
-static void tselem_draw_layer_collection_enable_icon(
- Scene *scene, uiBlock *block, int xmax, float x, float y, TreeElement *te, float alpha)
-{
- /* Get RNA property (once for speed). */
- static PropertyRNA *exclude_prop = NULL;
- if (exclude_prop == NULL) {
- exclude_prop = RNA_struct_type_find_property(&RNA_LayerCollection, "exclude");
- }
-
- if (x >= xmax) {
- /* Placement of icons, copied from interface_widgets.c. */
- float aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT;
- x += 2.0f * aspect;
- y += 2.0f * aspect;
-
- /* restrict column clip... it has been coded by simply overdrawing,
- * doesn't work for buttons */
- uchar color[4];
- int icon = RNA_property_ui_icon(exclude_prop);
- if (UI_icon_get_theme_color(icon, color)) {
- UI_icon_draw_ex(x, y, icon, U.inv_dpi_fac, alpha, 0.0f, color, true);
- }
- else {
- UI_icon_draw_ex(x, y, icon, U.inv_dpi_fac, alpha, 0.0f, NULL, false);
- }
- }
- else {
- LayerCollection *layer_collection = te->directdata;
- PointerRNA layer_collection_ptr;
- RNA_pointer_create(&scene->id, &RNA_LayerCollection, layer_collection, &layer_collection_ptr);
-
- char emboss = UI_block_emboss_get(block);
- UI_block_emboss_set(block, UI_EMBOSS_NONE);
- uiBut *bt = uiDefIconButR_prop(block,
- UI_BTYPE_ICON_TOGGLE,
- 0,
- 0,
- x,
- y,
- UI_UNIT_X,
- UI_UNIT_Y,
- &layer_collection_ptr,
- exclude_prop,
- -1,
- 0,
- 0,
- 0,
- 0,
- NULL);
- UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
- UI_block_emboss_set(block, emboss);
- }
-}
-
static void tselem_draw_icon(uiBlock *block,
int xmax,
float x,
@@ -3223,13 +3196,6 @@ static void outliner_draw_tree_element(bContext *C,
icon_bgcolor[3] = 0.2f;
}
- /* Checkbox to enable collections. */
- if ((tselem->type == TSE_LAYER_COLLECTION) &&
- (soops->show_restrict_flags & SO_RESTRICT_ENABLE)) {
- tselem_draw_layer_collection_enable_icon(
- tvc->scene, block, xmax, 0.0f, (float)*starty, te, 0.8f);
- }
-
/* active circle */
if (active != OL_DRAWSEL_NONE) {
UI_draw_roundbox_corner_set(UI_CNR_ALL);