diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 127 |
1 files changed, 69 insertions, 58 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 28e233b6dd2..fbef3aa07d7 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -182,7 +182,7 @@ static void restrictbutton_bone_visibility_fn(bContext *C, void *poin, void *UNU { Bone *bone = (Bone *)poin; - if (CTX_wm_window(C)->eventstate->ctrl) { + if (CTX_wm_window(C)->eventstate->shift) { restrictbutton_recursive_bone(bone, BONE_HIDDEN_P, (bone->flag & BONE_HIDDEN_P) != 0); } } @@ -194,7 +194,7 @@ static void restrictbutton_bone_select_fn(bContext *C, void *UNUSED(poin), void bone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } - if (CTX_wm_window(C)->eventstate->ctrl) { + if (CTX_wm_window(C)->eventstate->shift) { restrictbutton_recursive_bone(bone, BONE_UNSELECTABLE, (bone->flag & BONE_UNSELECTABLE) != 0); } @@ -209,7 +209,7 @@ static void restrictbutton_ebone_select_fn(bContext *C, void *UNUSED(poin), void ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } - if (CTX_wm_window(C)->eventstate->ctrl) { + if (CTX_wm_window(C)->eventstate->shift) { restrictbutton_recursive_ebone( C, ebone, BONE_UNSELECTABLE, (ebone->flag & BONE_UNSELECTABLE) != 0); } @@ -224,7 +224,7 @@ static void restrictbutton_ebone_visibility_fn(bContext *C, void *UNUSED(poin), ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); } - if (CTX_wm_window(C)->eventstate->ctrl) { + if (CTX_wm_window(C)->eventstate->shift) { restrictbutton_recursive_ebone(C, ebone, BONE_HIDDEN_A, (ebone->flag & BONE_HIDDEN_A) != 0); } @@ -1300,7 +1300,8 @@ static void outliner_draw_restrictbuts(uiBlock *block, 0, -1, -1, - TIP_("Restrict visibility in the 3D View")); + TIP_("Restrict visibility in the 3D View\n" + "* Shift to set children")); UI_but_func_set(bt, restrictbutton_bone_visibility_fn, bone, NULL); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); @@ -1321,7 +1322,8 @@ static void outliner_draw_restrictbuts(uiBlock *block, 0, 0, 0, - TIP_("Restrict selection in the 3D View")); + TIP_("Restrict selection in the 3D View\n" + "* Shift to set children")); UI_but_func_set(bt, restrictbutton_bone_select_fn, ob->data, bone); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); @@ -1345,7 +1347,8 @@ static void outliner_draw_restrictbuts(uiBlock *block, 0, 0, 0, - TIP_("Restrict visibility in the 3D View")); + TIP_("Restrict visibility in the 3D View\n" + "* Shift to set children")); UI_but_func_set(bt, restrictbutton_ebone_visibility_fn, NULL, ebone); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); @@ -1366,7 +1369,8 @@ static void outliner_draw_restrictbuts(uiBlock *block, 0, 0, 0, - TIP_("Restrict selection in the 3D View")); + TIP_("Restrict selection in the 3D View\n" + "* Shift to set children")); UI_but_func_set(bt, restrictbutton_ebone_select_fn, NULL, ebone); UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); @@ -2188,7 +2192,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) GpencilModifierData *md = BLI_findlink(&ob->greasepencil_modifiers, tselem->nr); switch ((GpencilModifierType)md->type) { case eGpencilModifierType_Noise: - data.icon = ICON_RNDCURVE; + data.icon = ICON_MOD_NOISE; break; case eGpencilModifierType_Subdiv: data.icon = ICON_MOD_SUBSURF; @@ -2232,6 +2236,15 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) case eGpencilModifierType_Armature: data.icon = ICON_MOD_ARMATURE; break; + case eGpencilModifierType_Multiply: + data.icon = ICON_GP_MULTIFRAME_EDITING; + break; + case eGpencilModifierType_Time: + data.icon = ICON_MOD_TIME; + break; + case eGpencilModifierType_Texture: + data.icon = ICON_TEXTURE; + break; /* Default */ default: @@ -2354,6 +2367,11 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te) data.icon = ICON_OUTLINER_DATA_GP_LAYER; break; } + case TSE_GPENCIL_EFFECT_BASE: + case TSE_GPENCIL_EFFECT: + data.drag_id = tselem->id; + data.icon = ICON_SHADERFX; + break; default: data.icon = ICON_DOT; break; @@ -2729,7 +2747,7 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle, number_text, text_col); UI_fontstyle_set(fstyle); - GPU_blend(true); /* Roundbox and text drawing disables. */ + GPU_blend(GPU_BLEND_ALPHA); /* Roundbox and text drawing disables. */ } static void outliner_icon_background_colors(float icon_color[4], float icon_border[4]) @@ -2743,6 +2761,23 @@ static void outliner_icon_background_colors(float icon_color[4], float icon_bord icon_border[3] = 0.2f; } +/* Draw a rounded rectangle behind icons of active elements. */ +static void outliner_draw_active_indicator(const float minx, + const float miny, + const float maxx, + const float maxy, + const float icon_color[4], + const float icon_border[4]) +{ + const float ufac = UI_UNIT_X / 20.0f; + const float radius = UI_UNIT_Y / 4.0f; + + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_aa(true, minx, miny + ufac, maxx, maxy - ufac, radius, icon_color); + UI_draw_roundbox_aa(false, minx, miny + ufac, maxx, maxy - ufac, radius, icon_border); + GPU_blend(GPU_BLEND_ALPHA); /* Roundbox disables. */ +} + static void outliner_draw_iconrow_doit(uiBlock *block, TreeElement *te, const uiFontStyle *fstyle, @@ -2756,31 +2791,19 @@ static void outliner_draw_iconrow_doit(uiBlock *block, TreeStoreElem *tselem = TREESTORE(te); if (active != OL_DRAWSEL_NONE) { - float ufac = UI_UNIT_X / 20.0f; float icon_color[4], icon_border[4]; outliner_icon_background_colors(icon_color, icon_border); if (active == OL_DRAWSEL_ACTIVE) { UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_color); icon_border[3] = 0.3f; } - UI_draw_roundbox_corner_set(UI_CNR_ALL); - - UI_draw_roundbox_aa(true, - (float)*offsx, - (float)ys + ufac, - (float)*offsx + UI_UNIT_X, - (float)ys + UI_UNIT_Y - ufac, - (float)UI_UNIT_Y / 4.0f, - icon_color); - /* border around it */ - UI_draw_roundbox_aa(false, - (float)*offsx, - (float)ys + ufac, - (float)*offsx + UI_UNIT_X, - (float)ys + UI_UNIT_Y - ufac, - (float)UI_UNIT_Y / 4.0f, - icon_border); - GPU_blend(true); /* Roundbox disables. */ + + outliner_draw_active_indicator((float)*offsx, + (float)ys, + (float)*offsx + UI_UNIT_X, + (float)ys + UI_UNIT_Y, + icon_color, + icon_border); } if (tselem->flag & TSE_HIGHLIGHTED) { @@ -2981,7 +3004,7 @@ static void outliner_draw_tree_element(bContext *C, xmax -= restrict_column_width + UI_UNIT_X; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* colors for active/selected data */ if (tselem->type == 0) { @@ -3052,23 +3075,12 @@ static void outliner_draw_tree_element(bContext *C, /* active circle */ if (active != OL_DRAWSEL_NONE) { - UI_draw_roundbox_corner_set(UI_CNR_ALL); - UI_draw_roundbox_aa(true, - (float)startx + offsx + UI_UNIT_X, - (float)*starty + ufac, - (float)startx + offsx + 2.0f * UI_UNIT_X, - (float)*starty + UI_UNIT_Y - ufac, - UI_UNIT_Y / 4.0f, - icon_bgcolor); - /* border around it */ - UI_draw_roundbox_aa(false, - (float)startx + offsx + UI_UNIT_X, - (float)*starty + ufac, - (float)startx + offsx + 2.0f * UI_UNIT_X, - (float)*starty + UI_UNIT_Y - ufac, - UI_UNIT_Y / 4.0f, - icon_border); - GPU_blend(true); /* roundbox disables it */ + outliner_draw_active_indicator((float)startx + offsx + UI_UNIT_X, + (float)*starty, + (float)startx + offsx + 2.0f * UI_UNIT_X, + (float)*starty + UI_UNIT_Y, + icon_bgcolor, + icon_border); te->flag |= TE_ACTIVE; /* For lookup in display hierarchies. */ } @@ -3116,7 +3128,7 @@ static void outliner_draw_tree_element(bContext *C, offsx += UI_UNIT_X + 4 * ufac; } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* name */ if ((tselem->flag & TSE_TEXTBUT) == 0) { @@ -3140,7 +3152,7 @@ static void outliner_draw_tree_element(bContext *C, else if (tselem->type != TSE_R_LAYER) { int tempx = startx + offsx; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); MergedIconRow merged = {{0}}; outliner_draw_iconrow(C, @@ -3156,7 +3168,7 @@ static void outliner_draw_tree_element(bContext *C, alpha_fac, &merged); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -3315,9 +3327,9 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner, UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.4f, col); col[3] = 255; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); outliner_draw_hierarchy_lines_recursive(pos, space_outliner, lb, startx, col, false, starty); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } @@ -3464,7 +3476,7 @@ static void outliner_draw_highlights(ARegion *region, UI_GetThemeColor4fv(TH_MATCH, col_searchmatch); col_searchmatch[3] = 0.5f; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3479,7 +3491,7 @@ static void outliner_draw_highlights(ARegion *region, startx, starty); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void outliner_draw_tree(bContext *C, @@ -3493,8 +3505,7 @@ static void outliner_draw_tree(bContext *C, const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; int starty, startx; - GPU_blend_set_func_separate( - GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* Only once. */ + GPU_blend(GPU_BLEND_ALPHA); /* Only once. */ if (space_outliner->outlinevis == SO_DATA_API) { /* struct marks */ @@ -3508,12 +3519,12 @@ static void outliner_draw_tree(bContext *C, outliner_draw_highlights(region, space_outliner, startx, &starty); /* set scissor so tree elements or lines can't overlap restriction icons */ - float scissor[4] = {0}; + int scissor[4] = {0}; if (restrict_column_width > 0.0f) { int mask_x = BLI_rcti_size_x(®ion->v2d.mask) - (int)restrict_column_width + 1; CLAMP_MIN(mask_x, 0); - GPU_scissor_get_f(scissor); + GPU_scissor_get(scissor); GPU_scissor(0, 0, mask_x, region->winy); } |