diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 234 |
1 files changed, 125 insertions, 109 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 4271eaded99..28e233b6dd2 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -86,7 +86,7 @@ /* ****************************************************** */ /* Tree Size Functions */ -static void outliner_tree_dimensions_impl(SpaceOutliner *soops, +static void outliner_tree_dimensions_impl(SpaceOutliner *space_outliner, ListBase *lb, int *width, int *height) @@ -98,20 +98,20 @@ static void outliner_tree_dimensions_impl(SpaceOutliner *soops, } TreeStoreElem *tselem = TREESTORE(te); - if (TSELEM_OPEN(tselem, soops)) { - outliner_tree_dimensions_impl(soops, &te->subtree, width, height); + if (TSELEM_OPEN(tselem, space_outliner)) { + outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, height); } else { - outliner_tree_dimensions_impl(soops, &te->subtree, width, NULL); + outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, NULL); } } } -static void outliner_tree_dimensions(SpaceOutliner *soops, int *r_width, int *r_height) +static void outliner_tree_dimensions(SpaceOutliner *space_outliner, int *r_width, int *r_height) { *r_width = 0; *r_height = 0; - outliner_tree_dimensions_impl(soops, &soops->tree, r_width, r_height); + outliner_tree_dimensions_impl(space_outliner, &space_outliner->tree, r_width, r_height); } /** @@ -667,13 +667,13 @@ static void scenes__collection_set_flag_recursive_fn(bContext *C, void *poin, vo static void namebutton_fn(bContext *C, void *tsep, char *oldname) { Main *bmain = CTX_data_main(C); - SpaceOutliner *soops = CTX_wm_space_outliner(C); + SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); Object *obedit = CTX_data_edit_object(C); - BLI_mempool *ts = soops->treestore; + BLI_mempool *ts = space_outliner->treestore; TreeStoreElem *tselem = tsep; if (ts && tselem) { - TreeElement *te = outliner_find_tree_element(&soops->tree, tselem); + TreeElement *te = outliner_find_tree_element(&space_outliner->tree, tselem); if (tselem->type == 0) { BLI_libblock_ensure_unique_name(bmain, tselem->id->name); @@ -760,7 +760,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) char newname[sizeof(bone->name)]; /* always make current object active */ - tree_element_active(C, &tvc, soops, te, OL_SETSEL_NORMAL, true); + tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true); /* restore bone name */ BLI_strncpy(newname, bone->name, sizeof(bone->name)); @@ -778,7 +778,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname) char newname[sizeof(pchan->name)]; /* always make current pose-bone active */ - tree_element_active(C, &tvc, soops, te, OL_SETSEL_NORMAL, true); + tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true); BLI_assert(ob->type == OB_ARMATURE); @@ -980,7 +980,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ViewLayer *view_layer, ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, ListBase *lb, RestrictPropertiesActive props_active_parent) { @@ -1022,28 +1022,28 @@ static void outliner_draw_restrictbuts(uiBlock *block, int restrict_column_offset = 0; /* This will determine the order of drawing from RIGHT to LEFT. */ - if (soops->outlinevis == SO_VIEW_LAYER) { - if (soops->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) { + if (space_outliner->outlinevis == SO_VIEW_LAYER) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) { restrict_offsets.indirect_only = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH; } - if (soops->show_restrict_flags & SO_RESTRICT_HOLDOUT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HOLDOUT) { restrict_offsets.holdout = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH; } } - if (soops->show_restrict_flags & SO_RESTRICT_RENDER) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) { restrict_offsets.render = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH; } - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { restrict_offsets.viewport = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH; } - if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) { restrict_offsets.hide = (++restrict_column_offset) * UI_UNIT_X + V2D_SCROLL_WIDTH; } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { restrict_offsets.select = (++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)); + outliner_restrict_columns_width(space_outliner)); /* Create buttons. */ uiBut *bt; @@ -1053,8 +1053,8 @@ static void outliner_draw_restrictbuts(uiBlock *block, RestrictPropertiesActive props_active = props_active_parent; if (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && te->ys <= region->v2d.cur.ymax) { - if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) { - if (soops->show_restrict_flags & SO_RESTRICT_RENDER) { + if (tselem->type == TSE_R_LAYER && (space_outliner->outlinevis == SO_SCENES)) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) { /* View layer render toggle. */ ViewLayer *layer = te->directdata; @@ -1087,7 +1087,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Object *ob = (Object *)tselem->id; RNA_id_pointer_create(&ob->id, &ptr); - if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) { Base *base = (te->directdata) ? (Base *)te->directdata : BKE_view_layer_base_find(view_layer, ob); if (base) { @@ -1119,7 +1119,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1144,7 +1144,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1169,7 +1169,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_RENDER) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1200,7 +1200,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, PointerRNA ptr; RNA_pointer_create(tselem->id, &RNA_Constraint, con, &ptr); - if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1229,7 +1229,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, PointerRNA ptr; RNA_pointer_create(tselem->id, &RNA_Modifier, md, &ptr); - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1252,7 +1252,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_RENDER) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1284,7 +1284,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, RNA_pointer_create(&arm->id, &RNA_Bone, bone, &ptr); - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1306,7 +1306,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, @@ -1330,7 +1330,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, else if (tselem->type == TSE_EBONE) { EditBone *ebone = (EditBone *)te->directdata; - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_A, @@ -1351,7 +1351,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, @@ -1376,7 +1376,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, ID *id = tselem->id; bGPDlayer *gpl = (bGPDlayer *)te->directdata; - if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) { bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, @@ -1397,7 +1397,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE); } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_LOCKED, @@ -1430,7 +1430,7 @@ 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_HIDE) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HIDE) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1459,7 +1459,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_HOLDOUT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_HOLDOUT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1488,7 +1488,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_INDIRECT_ONLY) { bt = uiDefIconButR_prop( block, UI_BTYPE_ICON_TOGGLE, @@ -1521,7 +1521,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_VIEWPORT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1558,7 +1558,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_RENDER) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_RENDER) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1593,7 +1593,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, } } - if (soops->show_restrict_flags & SO_RESTRICT_SELECT) { + if (space_outliner->show_restrict_flags & SO_RESTRICT_SELECT) { bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, @@ -1637,16 +1637,16 @@ static void outliner_draw_restrictbuts(uiBlock *block, scene, te, &collection_ptr, &layer_collection_ptr, &props, &props_active); } - if (TSELEM_OPEN(tselem, soops)) { + if (TSELEM_OPEN(tselem, space_outliner)) { outliner_draw_restrictbuts( - block, scene, view_layer, region, soops, &te->subtree, props_active); + block, scene, view_layer, region, space_outliner, &te->subtree, props_active); } } } static void outliner_draw_userbuts(uiBlock *block, ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, ListBase *lb) { @@ -1707,8 +1707,8 @@ static void outliner_draw_userbuts(uiBlock *block, } } - if (TSELEM_OPEN(tselem, soops)) { - outliner_draw_userbuts(block, region, soops, &te->subtree); + if (TSELEM_OPEN(tselem, space_outliner)) { + outliner_draw_userbuts(block, region, space_outliner, &te->subtree); } } } @@ -1742,7 +1742,7 @@ static void outliner_draw_rnacols(ARegion *region, int sizex) } static void outliner_draw_rnabuts( - uiBlock *block, ARegion *region, SpaceOutliner *soops, int sizex, ListBase *lb) + uiBlock *block, ARegion *region, SpaceOutliner *space_outliner, int sizex, ListBase *lb) { PointerRNA *ptr; PropertyRNA *prop; @@ -1754,7 +1754,7 @@ static void outliner_draw_rnabuts( ptr = &te->rnaptr; prop = te->directdata; - if (!TSELEM_OPEN(tselem, soops)) { + if (!TSELEM_OPEN(tselem, space_outliner)) { if (RNA_property_type(prop) == PROP_POINTER) { uiBut *but = uiDefAutoButR(block, ptr, @@ -1811,8 +1811,8 @@ static void outliner_draw_rnabuts( } } - if (TSELEM_OPEN(tselem, soops)) { - outliner_draw_rnabuts(block, region, soops, sizex, &te->subtree); + if (TSELEM_OPEN(tselem, space_outliner)) { + outliner_draw_rnabuts(block, region, space_outliner, sizex, &te->subtree); } } } @@ -1823,7 +1823,7 @@ static void outliner_buttons(const bContext *C, const float restrict_column_width, TreeElement *te) { - SpaceOutliner *soops = CTX_wm_space_outliner(C); + SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); uiBut *bt; TreeStoreElem *tselem; int spx, dx, len; @@ -1850,7 +1850,7 @@ static void outliner_buttons(const bContext *C, spx = te->xs + 1.8f * UI_UNIT_X; if ((tselem->type == TSE_LAYER_COLLECTION) && - (soops->show_restrict_flags & SO_RESTRICT_ENABLE)) { + (space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE)) { spx += UI_UNIT_X; } dx = region->v2d.cur.xmax - (spx + restrict_column_width + 0.2f * UI_UNIT_X); @@ -2833,7 +2833,7 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, const uiFontStyle *fstyle, const TreeViewContext *tvc, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, ListBase *lb, int level, int xmax, @@ -2858,7 +2858,7 @@ static void outliner_draw_iconrow(bContext *C, active = OL_DRAWSEL_ACTIVE; } else { - active = tree_element_active(C, tvc, soops, te, OL_SETSEL_NONE, false); + active = tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false); } } else if (tselem->type == TSE_GP_LAYER) { @@ -2866,7 +2866,8 @@ static void outliner_draw_iconrow(bContext *C, active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE; } else { - active = tree_element_type_active(C, tvc, soops, te, tselem, OL_SETSEL_NONE, false); + active = tree_element_type_active( + C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false); } if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) { @@ -2888,7 +2889,7 @@ static void outliner_draw_iconrow(bContext *C, block, fstyle, tvc, - soops, + space_outliner, &te->subtree, level + 1, xmax, @@ -2947,7 +2948,7 @@ static void outliner_draw_tree_element(bContext *C, const uiFontStyle *fstyle, const TreeViewContext *tvc, ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, TreeElement *te, bool draw_grayed_out, int startx, @@ -3021,7 +3022,7 @@ static void outliner_draw_tree_element(bContext *C, active = OL_DRAWSEL_ACTIVE; } else { - if (tree_element_active(C, tvc, soops, te, OL_SETSEL_NONE, false)) { + if (tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false)) { /* active items like camera or material */ icon_bgcolor[3] = 0.2f; active = OL_DRAWSEL_ACTIVE; @@ -3036,14 +3037,14 @@ static void outliner_draw_tree_element(bContext *C, } } else { - active = tree_element_type_active(C, tvc, soops, te, tselem, OL_SETSEL_NONE, false); + active = tree_element_type_active(C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false); /* active collection*/ icon_bgcolor[3] = 0.2f; } /* Checkbox to enable collections. */ if ((tselem->type == TSE_LAYER_COLLECTION) && - (soops->show_restrict_flags & SO_RESTRICT_ENABLE)) { + (space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE)) { tselem_draw_layer_collection_enable_icon( tvc->scene, block, xmax, (float)startx + offsx + UI_UNIT_X, (float)*starty, te, 0.8f); offsx += UI_UNIT_X; @@ -3081,7 +3082,7 @@ static void outliner_draw_tree_element(bContext *C, int icon_x = startx; /* Icons a bit higher. */ - if (TSELEM_OPEN(tselem, soops)) { + if (TSELEM_OPEN(tselem, space_outliner)) { UI_icon_draw_alpha((float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_DOWN, @@ -3130,7 +3131,7 @@ static void outliner_draw_tree_element(bContext *C, offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name)); /* closed item, we draw the icons, not when it's a scene, or master-server list though */ - if (!TSELEM_OPEN(tselem, soops)) { + if (!TSELEM_OPEN(tselem, space_outliner)) { if (te->subtree.first) { if (tselem->type == 0 && te->idcode == ID_SCE) { /* pass */ @@ -3146,7 +3147,7 @@ static void outliner_draw_tree_element(bContext *C, block, fstyle, tvc, - soops, + space_outliner, &te->subtree, 0, xmax, @@ -3165,7 +3166,7 @@ static void outliner_draw_tree_element(bContext *C, te->ys = *starty; te->xend = startx + offsx; - if (TSELEM_OPEN(tselem, soops)) { + if (TSELEM_OPEN(tselem, space_outliner)) { *starty -= UI_UNIT_Y; LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) { @@ -3177,7 +3178,7 @@ static void outliner_draw_tree_element(bContext *C, fstyle, tvc, region, - soops, + space_outliner, ten, draw_children_grayed_out, startx + UI_UNIT_X, @@ -3196,7 +3197,7 @@ static void outliner_draw_tree_element(bContext *C, } static void outliner_draw_hierarchy_lines_recursive(uint pos, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, ListBase *lb, int startx, const uchar col[4], @@ -3264,9 +3265,14 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos, *starty -= UI_UNIT_Y; - if (TSELEM_OPEN(tselem, soops)) { - outliner_draw_hierarchy_lines_recursive( - pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_children_grayed_out, starty); + if (TSELEM_OPEN(tselem, space_outliner)) { + outliner_draw_hierarchy_lines_recursive(pos, + space_outliner, + &te->subtree, + startx + UI_UNIT_X, + col, + draw_children_grayed_out, + starty); } } @@ -3296,7 +3302,7 @@ static void outliner_draw_hierarchy_lines_recursive(uint pos, } } -static void outliner_draw_hierarchy_lines(SpaceOutliner *soops, +static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner, ListBase *lb, int startx, int *starty) @@ -3310,14 +3316,14 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *soops, col[3] = 255; GPU_blend(true); - outliner_draw_hierarchy_lines_recursive(pos, soops, lb, startx, col, false, starty); + outliner_draw_hierarchy_lines_recursive(pos, space_outliner, lb, startx, col, false, starty); GPU_blend(false); immUnbindProgram(); } static void outliner_draw_struct_marks(ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, ListBase *lb, int *starty) { @@ -3325,7 +3331,7 @@ static void outliner_draw_struct_marks(ARegion *region, TreeStoreElem *tselem = TREESTORE(te); /* selection status */ - if (TSELEM_OPEN(tselem, soops)) { + if (TSELEM_OPEN(tselem, space_outliner)) { if (tselem->type == TSE_RNA_STRUCT) { GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -3337,8 +3343,8 @@ static void outliner_draw_struct_marks(ARegion *region, } *starty -= UI_UNIT_Y; - if (TSELEM_OPEN(tselem, soops)) { - outliner_draw_struct_marks(region, soops, &te->subtree, starty); + if (TSELEM_OPEN(tselem, space_outliner)) { + outliner_draw_struct_marks(region, space_outliner, &te->subtree, starty); if (tselem->type == TSE_RNA_STRUCT) { GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -3358,7 +3364,7 @@ static void outliner_draw_struct_marks(ARegion *region, static void outliner_draw_highlights_recursive(uint pos, const ARegion *region, - const SpaceOutliner *soops, + const SpaceOutliner *space_outliner, const ListBase *lb, const float col_selection[4], const float col_active[4], @@ -3367,8 +3373,9 @@ static void outliner_draw_highlights_recursive(uint pos, int start_x, int *io_start_y) { - const bool is_searching = (SEARCHING_OUTLINER(soops) || - (soops->outlinevis == SO_DATA_API && soops->search_string[0] != 0)); + const bool is_searching = (SEARCHING_OUTLINER(space_outliner) || + (space_outliner->outlinevis == SO_DATA_API && + space_outliner->search_string[0] != 0)); LISTBASE_FOREACH (TreeElement *, te, lb) { const TreeStoreElem *tselem = TREESTORE(te); @@ -3427,10 +3434,10 @@ static void outliner_draw_highlights_recursive(uint pos, } *io_start_y -= UI_UNIT_Y; - if (TSELEM_OPEN(tselem, soops)) { + if (TSELEM_OPEN(tselem, space_outliner)) { outliner_draw_highlights_recursive(pos, region, - soops, + space_outliner, &te->subtree, col_selection, col_active, @@ -3443,7 +3450,7 @@ static void outliner_draw_highlights_recursive(uint pos, } static void outliner_draw_highlights(ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, int startx, int *starty) { @@ -3463,8 +3470,8 @@ static void outliner_draw_highlights(ARegion *region, immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); outliner_draw_highlights_recursive(pos, region, - soops, - &soops->tree, + space_outliner, + &space_outliner->tree, col_selection, col_active, col_highlight, @@ -3479,7 +3486,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, const TreeViewContext *tvc, ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, const float restrict_column_width, TreeElement **te_edit) { @@ -3489,16 +3496,16 @@ static void outliner_draw_tree(bContext *C, GPU_blend_set_func_separate( GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* Only once. */ - if (soops->outlinevis == SO_DATA_API) { + if (space_outliner->outlinevis == SO_DATA_API) { /* struct marks */ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET; - outliner_draw_struct_marks(region, soops, &soops->tree, &starty); + outliner_draw_struct_marks(region, space_outliner, &space_outliner->tree, &starty); } /* draw highlights before hierarchy */ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET; startx = 0; - outliner_draw_highlights(region, soops, startx, &starty); + outliner_draw_highlights(region, space_outliner, startx, &starty); /* set scissor so tree elements or lines can't overlap restriction icons */ float scissor[4] = {0}; @@ -3513,18 +3520,18 @@ static void outliner_draw_tree(bContext *C, /* Gray hierarchy lines. */ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET; startx = UI_UNIT_X / 2 - (U.pixelsize + 1) / 2; - outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty); + outliner_draw_hierarchy_lines(space_outliner, &space_outliner->tree, startx, &starty); /* Items themselves. */ starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET; startx = 0; - LISTBASE_FOREACH (TreeElement *, te, &soops->tree) { + LISTBASE_FOREACH (TreeElement *, te, &space_outliner->tree) { outliner_draw_tree_element(C, block, fstyle, tvc, region, - soops, + space_outliner, te, (te->flag & TE_DRAGGING) != 0, startx, @@ -3582,21 +3589,23 @@ static int outliner_data_api_buttons_start_x(int max_tree_width) return max_ii(OL_RNA_COLX, max_tree_width + OL_RNA_COL_SPACEX); } -static int outliner_width(SpaceOutliner *soops, int max_tree_width, float restrict_column_width) +static int outliner_width(SpaceOutliner *space_outliner, + int max_tree_width, + float restrict_column_width) { - if (soops->outlinevis == SO_DATA_API) { + if (space_outliner->outlinevis == SO_DATA_API) { return outliner_data_api_buttons_start_x(max_tree_width) + OL_RNA_COL_SIZEX + 10 * UI_DPI_FAC; } return max_tree_width + restrict_column_width; } static void outliner_update_viewable_area(ARegion *region, - SpaceOutliner *soops, + SpaceOutliner *space_outliner, int tree_width, int tree_height, float restrict_column_width) { - int sizex = outliner_width(soops, tree_width, restrict_column_width); + int sizex = outliner_width(space_outliner, tree_width, restrict_column_width); int sizey = tree_height; /* extend size to allow for horizontal scrollbar and extra offset */ @@ -3613,14 +3622,14 @@ void draw_outliner(const bContext *C) Main *mainvar = CTX_data_main(C); ARegion *region = CTX_wm_region(C); View2D *v2d = ®ion->v2d; - SpaceOutliner *soops = CTX_wm_space_outliner(C); + SpaceOutliner *space_outliner = CTX_wm_space_outliner(C); uiBlock *block; TreeElement *te_edit = NULL; TreeViewContext tvc; outliner_viewcontext_init(C, &tvc); - outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, region); /* Always. */ + outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, space_outliner, region); /* Always. */ /* If global sync select is dirty, flag other outliners */ if (ED_outliner_select_sync_is_dirty(C)) { @@ -3628,9 +3637,9 @@ void draw_outliner(const bContext *C) } /* Sync selection state from view layer */ - if (!ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS) && - soops->flag & SO_SYNC_SELECT) { - outliner_sync_selection(C, soops); + if (!ELEM(space_outliner->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS) && + space_outliner->flag & SO_SYNC_SELECT) { + outliner_sync_selection(C, space_outliner); } /* force display to pixel coords */ @@ -3639,37 +3648,43 @@ void draw_outliner(const bContext *C) UI_view2d_view_ortho(v2d); /* draw outliner stuff (background, hierarchy lines and names) */ - const float restrict_column_width = outliner_restrict_columns_width(soops); + const float restrict_column_width = outliner_restrict_columns_width(space_outliner); outliner_back(region); block = UI_block_begin(C, region, __func__, UI_EMBOSS); - outliner_draw_tree((bContext *)C, block, &tvc, region, soops, restrict_column_width, &te_edit); + outliner_draw_tree( + (bContext *)C, block, &tvc, region, space_outliner, restrict_column_width, &te_edit); /* Compute outliner dimensions after it has been drawn. */ int tree_width, tree_height; - outliner_tree_dimensions(soops, &tree_width, &tree_height); + outliner_tree_dimensions(space_outliner, &tree_width, &tree_height); /* Default to no emboss for outliner UI. */ UI_block_emboss_set(block, UI_EMBOSS_NONE); - if (soops->outlinevis == SO_DATA_API) { + if (space_outliner->outlinevis == SO_DATA_API) { int buttons_start_x = outliner_data_api_buttons_start_x(tree_width); /* draw rna buttons */ outliner_draw_rnacols(region, buttons_start_x); UI_block_emboss_set(block, UI_EMBOSS); - outliner_draw_rnabuts(block, region, soops, buttons_start_x, &soops->tree); + outliner_draw_rnabuts(block, region, space_outliner, buttons_start_x, &space_outliner->tree); UI_block_emboss_set(block, UI_EMBOSS_NONE); } - else if (soops->outlinevis == SO_ID_ORPHANS) { + else if (space_outliner->outlinevis == SO_ID_ORPHANS) { /* draw user toggle columns */ - outliner_draw_userbuts(block, region, soops, &soops->tree); + outliner_draw_userbuts(block, region, space_outliner, &space_outliner->tree); } else if (restrict_column_width > 0.0f) { /* draw restriction columns */ RestrictPropertiesActive props_active; memset(&props_active, 1, sizeof(RestrictPropertiesActive)); - outliner_draw_restrictbuts( - block, tvc.scene, tvc.view_layer, region, soops, &soops->tree, props_active); + outliner_draw_restrictbuts(block, + tvc.scene, + tvc.view_layer, + region, + space_outliner, + &space_outliner->tree, + props_active); } UI_block_emboss_set(block, UI_EMBOSS); @@ -3683,5 +3698,6 @@ void draw_outliner(const bContext *C) UI_block_draw(C, block); /* Update total viewable region. */ - outliner_update_viewable_area(region, soops, tree_width, tree_height, restrict_column_width); + outliner_update_viewable_area( + region, space_outliner, tree_width, tree_height, restrict_column_width); } |