Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/node_draw.c
| Show First 20 Lines • Show All 1,685 Lines • ▼ Show 20 Lines | void drawnodespace(const bContext *C, ARegion *ar) | ||||
| UI_view2d_region_to_view(&ar->v2d, | UI_view2d_region_to_view(&ar->v2d, | ||||
| win->eventstate->x - ar->winrct.xmin, | win->eventstate->x - ar->winrct.xmin, | ||||
| win->eventstate->y - ar->winrct.ymin, | win->eventstate->y - ar->winrct.ymin, | ||||
| &snode->cursor[0], | &snode->cursor[0], | ||||
| &snode->cursor[1]); | &snode->cursor[1]); | ||||
| snode->cursor[0] /= UI_DPI_FAC; | snode->cursor[0] /= UI_DPI_FAC; | ||||
| snode->cursor[1] /= UI_DPI_FAC; | snode->cursor[1] /= UI_DPI_FAC; | ||||
| int grid_levels = UI_GetThemeValueType(TH_NODE_GRID_LEVELS, SPACE_NODE); | |||||
| ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); | ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW); | ||||
| /* only set once */ | /* only set once */ | ||||
| GPU_blend_set_func_separate( | GPU_blend_set_func_separate( | ||||
| GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); | GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); | ||||
| /* nodes */ | /* nodes */ | ||||
| snode_set_context(C); | snode_set_context(C); | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (snode->treepath.last) { | ||||
| } | } | ||||
| /* top-level edit tree */ | /* top-level edit tree */ | ||||
| ntree = path->nodetree; | ntree = path->nodetree; | ||||
| if (ntree) { | if (ntree) { | ||||
| snode_setup_v2d(snode, ar, center); | snode_setup_v2d(snode, ar, center); | ||||
| /* grid, uses theme color based on node path depth */ | /* grid, uses theme color based on node path depth */ | ||||
| UI_view2d_multi_grid_draw( | UI_view2d_multi_grid_draw(v2d, | ||||
| v2d, (depth > 0 ? TH_NODE_GROUP : TH_BACK), ED_node_grid_size(), NODE_GRID_STEPS, 2); | (depth > 0 ? TH_NODE_GROUP : TH_BACK), | ||||
| ED_node_grid_size(), | |||||
| NODE_GRID_STEPS, | |||||
| grid_levels); | |||||
| /* backdrop */ | /* backdrop */ | ||||
| draw_nodespace_back_pix(C, ar, snode, path->parent_key); | draw_nodespace_back_pix(C, ar, snode, path->parent_key); | ||||
| { | { | ||||
| float original_proj[4][4]; | float original_proj[4][4]; | ||||
| GPU_matrix_projection_get(original_proj); | GPU_matrix_projection_get(original_proj); | ||||
| Show All 24 Lines | if (snode->treepath.last) { | ||||
| if (snode->flag & SNODE_SHOW_GPENCIL) { | if (snode->flag & SNODE_SHOW_GPENCIL) { | ||||
| /* draw grease-pencil ('canvas' strokes) */ | /* draw grease-pencil ('canvas' strokes) */ | ||||
| ED_annotation_draw_view2d(C, true); | ED_annotation_draw_view2d(C, true); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* default grid */ | /* default grid */ | ||||
| UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, 2); | UI_view2d_multi_grid_draw(v2d, TH_BACK, ED_node_grid_size(), NODE_GRID_STEPS, grid_levels); | ||||
| /* backdrop */ | /* backdrop */ | ||||
| draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE); | draw_nodespace_back_pix(C, ar, snode, NODE_INSTANCE_KEY_NONE); | ||||
| } | } | ||||
| ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); | ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); | ||||
| /* reset view matrix */ | /* reset view matrix */ | ||||
| Show All 17 Lines | |||||