Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 2,952 Lines • ▼ Show 20 Lines | if ((te->flag & TE_ICONROW) == 0 && (te->flag & TE_ICONROW_MERGED) == 0) { | ||||
| te->xend = 0; | te->xend = 0; | ||||
| } | } | ||||
| LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) { | LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) { | ||||
| outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty); | outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty); | ||||
| } | } | ||||
| } | } | ||||
| static bool element_should_draw_faded(const TreeViewContext *tvc, | |||||
Severin: Reads like an action, not like a query. `element_should_draw_faded()`? | |||||
| const TreeElement *te, | |||||
| const TreeStoreElem *tselem) | |||||
| { | |||||
| if (tselem->type == 0) { | |||||
| switch (te->idcode) { | |||||
| case ID_OB: { | |||||
| const Object *ob = (const Object *)tselem->id; | |||||
| /* Lookup in view layer is logically const as it only checks a cache. */ | |||||
| const Base *base = (te->directdata) ? (const Base *)te->directdata : | |||||
| BKE_view_layer_base_find( | |||||
| (ViewLayer *)tvc->view_layer, (Object *)ob); | |||||
| const bool is_visible = (base != NULL) && (base->flag & BASE_VISIBLE_VIEWLAYER); | |||||
| if (!is_visible) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| switch (tselem->type) { | |||||
| case TSE_LAYER_COLLECTION: { | |||||
| const LayerCollection *layer_collection = (const LayerCollection *)te->directdata; | |||||
| const bool is_visibe = layer_collection->runtime_flag & LAYER_COLLECTION_VISIBLE_VIEW_LAYER; | |||||
Done Inline ActionsTypo is_visible :) natecraddock: Typo `is_visible` :) | |||||
| const bool is_excluded = layer_collection->flag & LAYER_COLLECTION_EXCLUDE; | |||||
| return !is_visibe || is_excluded; | |||||
| } | |||||
| } | |||||
| if (te->flag & TE_CHILD_NOT_IN_COLLECTION) { | |||||
| return true; | |||||
| } | |||||
| return false; | |||||
| } | |||||
| static void outliner_draw_tree_element(bContext *C, | static void outliner_draw_tree_element(bContext *C, | ||||
| uiBlock *block, | uiBlock *block, | ||||
| const uiFontStyle *fstyle, | const uiFontStyle *fstyle, | ||||
| const TreeViewContext *tvc, | const TreeViewContext *tvc, | ||||
| ARegion *region, | ARegion *region, | ||||
| SpaceOutliner *space_outliner, | SpaceOutliner *space_outliner, | ||||
| TreeElement *te, | TreeElement *te, | ||||
| bool draw_grayed_out, | bool draw_grayed_out, | ||||
| int startx, | int startx, | ||||
| int *starty, | int *starty, | ||||
| const float restrict_column_width, | const float restrict_column_width, | ||||
| TreeElement **te_edit) | TreeElement **te_edit) | ||||
| { | { | ||||
| TreeStoreElem *tselem = TREESTORE(te); | TreeStoreElem *tselem = TREESTORE(te); | ||||
| float ufac = UI_UNIT_X / 20.0f; | float ufac = UI_UNIT_X / 20.0f; | ||||
| int offsx = 0; | int offsx = 0; | ||||
| eOLDrawState active = OL_DRAWSEL_NONE; | eOLDrawState active = OL_DRAWSEL_NONE; | ||||
| uchar text_color[4]; | uchar text_color[4]; | ||||
| UI_GetThemeColor4ubv(TH_TEXT, text_color); | UI_GetThemeColor4ubv(TH_TEXT, text_color); | ||||
| float icon_bgcolor[4], icon_border[4]; | float icon_bgcolor[4], icon_border[4]; | ||||
| outliner_icon_background_colors(icon_bgcolor, icon_border); | outliner_icon_background_colors(icon_bgcolor, icon_border); | ||||
| if (*starty + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && *starty <= region->v2d.cur.ymax) { | if (*starty + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && *starty <= region->v2d.cur.ymax) { | ||||
| const float alpha_fac = ((te->flag & TE_DISABLED) || (te->flag & TE_CHILD_NOT_IN_COLLECTION) || | const float alpha_fac = element_should_draw_faded(tvc, te, tselem) ? 0.5f : 1.0f; | ||||
| draw_grayed_out) ? | |||||
| 0.5f : | |||||
| 1.0f; | |||||
| int xmax = region->v2d.cur.xmax; | int xmax = region->v2d.cur.xmax; | ||||
| if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) { | if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) { | ||||
| *te_edit = te; | *te_edit = te; | ||||
| } | } | ||||
| /* icons can be ui buts, we don't want it to overlap with restrict */ | /* icons can be ui buts, we don't want it to overlap with restrict */ | ||||
| if (restrict_column_width > 0) { | if (restrict_column_width > 0) { | ||||
| ▲ Show 20 Lines • Show All 717 Lines • Show Last 20 Lines | |||||
Reads like an action, not like a query. element_should_draw_faded()?