Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_node/drawnode.cc
| Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if (node->custom1 < node->custom2) { | ||||
| cumap->sample[0] = (float)(CFRA - node->custom1) / (float)(node->custom2 - node->custom1); | cumap->sample[0] = (float)(CFRA - node->custom1) / (float)(node->custom2 - node->custom1); | ||||
| } | } | ||||
| } | } | ||||
| #endif | #endif | ||||
| uiTemplateCurveMapping(layout, ptr, "curve", 's', false, false, false, false); | uiTemplateCurveMapping(layout, ptr, "curve", 's', false, false, false, false); | ||||
| uiLayout *row = uiLayoutRow(layout, true); | uiLayout *row = uiLayoutRow(layout, true); | ||||
| uiItemR(row, ptr, "frame_start", DEFAULT_FLAGS, IFACE_("Sta"), ICON_NONE); | uiItemR(row, ptr, "frame_start", DEFAULT_FLAGS, IFACE_("Start"), ICON_NONE); | ||||
| uiItemR(row, ptr, "frame_end", DEFAULT_FLAGS, IFACE_("End"), ICON_NONE); | uiItemR(row, ptr, "frame_end", DEFAULT_FLAGS, IFACE_("End"), ICON_NONE); | ||||
| } | } | ||||
| static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) | ||||
| { | { | ||||
| uiTemplateColorRamp(layout, ptr, "color_ramp", false); | uiTemplateColorRamp(layout, ptr, "color_ramp", false); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree, bNode *node) | ||||
| float xmax, ymax; | float xmax, ymax; | ||||
| node_from_view(node, rect.xmax, rect.ymin, &xmax, &ymax); | node_from_view(node, rect.xmax, rect.ymin, &xmax, &ymax); | ||||
| node->width = xmax - node->offsetx; | node->width = xmax - node->offsetx; | ||||
| node->height = -ymax + node->offsety; | node->height = -ymax + node->offsety; | ||||
| node->totr = rect; | node->totr = rect; | ||||
| } | } | ||||
| static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float aspect) | static void node_draw_frame_label(bNodeTree *ntree, bNode *node, SpaceNode *snode) | ||||
| { | { | ||||
| const float aspect = snode->runtime->aspect; | |||||
| /* XXX font id is crap design */ | /* XXX font id is crap design */ | ||||
| const int fontid = UI_style_get()->widgetlabel.uifont_id; | const int fontid = UI_style_get()->widgetlabel.uifont_id; | ||||
| NodeFrame *data = (NodeFrame *)node->storage; | NodeFrame *data = (NodeFrame *)node->storage; | ||||
| const float font_size = data->label_size / aspect; | const float font_size = data->label_size / aspect; | ||||
| char label[MAX_NAME]; | char label[MAX_NAME]; | ||||
| nodeLabel(ntree, node, label, sizeof(label)); | nodeLabel(ntree, node, label, sizeof(label)); | ||||
| ▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | if (node->flag & SELECT) { | ||||
| else { | else { | ||||
| UI_GetThemeColorShadeAlpha4fv(TH_SELECT, 0, -40, color); | UI_GetThemeColorShadeAlpha4fv(TH_SELECT, 0, -40, color); | ||||
| } | } | ||||
| UI_draw_roundbox_aa(rct, false, BASIS_RAD, color); | UI_draw_roundbox_aa(rct, false, BASIS_RAD, color); | ||||
| } | } | ||||
| /* label and text */ | /* label and text */ | ||||
| node_draw_frame_label(ntree, node, snode->runtime->aspect); | node_draw_frame_label(ntree, node, snode); | ||||
| node_draw_extra_info_panel(snode, node); | |||||
| UI_block_end(C, node->block); | UI_block_end(C, node->block); | ||||
| UI_block_draw(C, node->block); | UI_block_draw(C, node->block); | ||||
| node->block = nullptr; | node->block = nullptr; | ||||
| } | } | ||||
| static int node_resize_area_frame(bNode *node, int x, int y) | static int node_resize_area_frame(bNode *node, int x, int y) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 3,828 Lines • ▼ Show 20 Lines | if (node_link_bezier_handles(v2d, snode, link, vec)) { | ||||
| } | } | ||||
| /* Draw single link. */ | /* Draw single link. */ | ||||
| float colors[3][4] = {{0.0f}}; | float colors[3][4] = {{0.0f}}; | ||||
| if (th_col3 != -1) { | if (th_col3 != -1) { | ||||
| UI_GetThemeColor4fv(th_col3, colors[0]); | UI_GetThemeColor4fv(th_col3, colors[0]); | ||||
| } | } | ||||
| if (snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS && | if (snode->overlay.flag & SN_OVERLAY_SHOW_OVERLAYS && | ||||
| snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS && | snode->overlay.flag & SN_OVERLAY_SHOW_WIRE_COLORS) { | ||||
| ((link->fromsock == nullptr || link->fromsock->typeinfo->type >= 0) && | |||||
| (link->tosock == nullptr || link->tosock->typeinfo->type >= 0))) { | |||||
| PointerRNA from_node_ptr, to_node_ptr; | PointerRNA from_node_ptr, to_node_ptr; | ||||
| RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->fromnode, &from_node_ptr); | RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->fromnode, &from_node_ptr); | ||||
| RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->tonode, &to_node_ptr); | RNA_pointer_create((ID *)snode->edittree, &RNA_Node, link->tonode, &to_node_ptr); | ||||
| if (link->fromsock) { | if (link->fromsock) { | ||||
| node_socket_color_get(C, snode->edittree, &from_node_ptr, link->fromsock, colors[1]); | node_socket_color_get(C, snode->edittree, &from_node_ptr, link->fromsock, colors[1]); | ||||
| } | } | ||||
| else { | else { | ||||
| node_socket_color_get(C, snode->edittree, &to_node_ptr, link->tosock, colors[1]); | node_socket_color_get(C, snode->edittree, &to_node_ptr, link->tosock, colors[1]); | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | else { | ||||
| GPU_batch_uniform_1f(batch, "dash_factor", dash_factor); | GPU_batch_uniform_1f(batch, "dash_factor", dash_factor); | ||||
| GPU_batch_uniform_1f(batch, "dash_alpha", dash_alpha); | GPU_batch_uniform_1f(batch, "dash_alpha", dash_alpha); | ||||
| GPU_batch_draw(batch); | GPU_batch_draw(batch); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* NOTE: this is used for fake links in groups too. */ | /* NOTE: this is used for fake links in groups too. */ | ||||
| void node_draw_link(const bContext *C, View2D *v2d, SpaceNode *snode, bNodeLink *link) | void node_draw_link(const bContext *C, | ||||
| const View2D *v2d, | |||||
| const SpaceNode *snode, | |||||
| const bNodeLink *link) | |||||
| { | { | ||||
| int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE; | int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE; | ||||
| if (link->fromsock == nullptr && link->tosock == nullptr) { | if (link->fromsock == nullptr && link->tosock == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| /* new connection */ | /* new connection */ | ||||
| ▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines | |||||