From 77a0b90cdf5d42b774f75b392aa0e3aeb7ed3452 Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Thu, 10 Oct 2013 11:33:20 +0000 Subject: Cleanup: Consistent names for draw callbacks in bNodeType. This aims to establish a common pattern for the various confusing draw callback function pointers in bNodeType: draw__[_ex] Currently there are 4 different types of draw callbacks: * draw_nodetype, draw_nodetype_prepare: Main draw functions, allows specialized node drawing for things like frames and reroute nodes. Not exposed in the API. * draw_buttons, draw_buttons_ex: Optional non-socket buttons, most commonly used callback. Extended version used in sidebar for verbose buttons that don't fit into a node. * draw_backdrop: Draw elements in the backdrop (compositor only). Not exposed in the API. * draw_input, draw_output: Specialized socket drawing for some nodes, only for OutputFile node. Should not be used any further and be removed at some point. Not exposed in the API. --- source/blender/blenkernel/BKE_node.h | 30 +- source/blender/editors/space_node/drawnode.c | 326 ++++++++++----------- source/blender/editors/space_node/node_draw.c | 16 +- source/blender/editors/space_node/node_edit.c | 4 +- source/blender/editors/space_node/node_templates.c | 8 +- source/blender/makesrna/intern/rna_nodetree.c | 16 +- 6 files changed, 201 insertions(+), 199 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 7f19a867093..6ede274b4c3 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -162,24 +162,26 @@ typedef struct bNodeType { char storagename[64]; /* struct name for DNA */ - /// Main draw function for the node. - void (*drawfunc)(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, + /* Main draw function for the node */ + void (*draw_nodetype)(const struct bContext *C, struct ARegion *ar, struct SpaceNode *snode, struct bNodeTree *ntree, struct bNode *node, bNodeInstanceKey key); - /// Updates the node geometry attributes according to internal state before actual drawing. - void (*drawupdatefunc)(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node); - /// Draw the option buttons on the node. - void (*uifunc)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); - /// Additional parameters in the side panel. - void (*uifuncbut)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); - /// Additional drawing on backdrop. - void (*uibackdropfunc)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y); - - /// Draw a node socket. Default draws the input value button. + /* Updates the node geometry attributes according to internal state before actual drawing */ + void (*draw_nodetype_prepare)(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node); + + /* Draw the option buttons on the node */ + void (*draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + /* Additional parameters in the side panel */ + void (*draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr); + + /* Additional drawing on backdrop */ + void (*draw_backdrop)(struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y); + + /* Draw a node socket. Default draws the input value button. */ /* XXX deprecated, only used for the OutputFile node, * should be removed at some point. */ - NodeSocketDrawFunction drawinputfunc; - NodeSocketDrawFunction drawoutputfunc; + NodeSocketDrawFunction draw_input; + NodeSocketDrawFunction draw_output; /// Optional custom label function for the node header. const char *(*labelfunc)(struct bNode *); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f562212f1e2..b348156bc1f 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -339,7 +339,7 @@ static int node_resize_area_default(bNode *node, int x, int y) /* ****************** BUTTON CALLBACKS FOR COMMON NODES ***************** */ -static void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_draw_buttons_group(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL); } @@ -348,7 +348,7 @@ static void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr) * Not ideal to do this in every draw call, but doing as transform callback doesn't work, * since the child node totr rects are not updated properly at that point. */ -static void node_update_frame(const bContext *UNUSED(C), bNodeTree *ntree, bNode *node) +static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree, bNode *node) { const float margin = 1.5f * U.widget_unit; NodeFrame *data = (NodeFrame *)node->storage; @@ -511,7 +511,7 @@ static int node_resize_area_frame(bNode *node, int x, int y) return dir; } -static void node_buts_frame_details(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_buts_frame_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "label_size", 0, IFACE_("Label Size"), ICON_NONE); uiItemR(layout, ptr, "shrink", 0, IFACE_("Shrink"), ICON_NONE); @@ -520,7 +520,7 @@ static void node_buts_frame_details(uiLayout *layout, bContext *UNUSED(C), Point #define NODE_REROUTE_SIZE 8.0f -static void node_update_reroute(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree), bNode *node) +static void node_draw_reroute_prepare(const bContext *UNUSED(C), bNodeTree *UNUSED(ntree), bNode *node) { bNodeSocket *nsock; float locx, locy; @@ -632,17 +632,17 @@ static void node_common_set_butfunc(bNodeType *ntype) { switch (ntype->type) { case NODE_GROUP: - ntype->uifunc = node_uifunc_group; + ntype->draw_buttons = node_draw_buttons_group; break; case NODE_FRAME: - ntype->drawfunc = node_draw_frame; - ntype->drawupdatefunc = node_update_frame; - ntype->uifuncbut = node_buts_frame_details; + ntype->draw_nodetype = node_draw_frame; + ntype->draw_nodetype_prepare = node_draw_frame_prepare; + ntype->draw_buttons_ex = node_buts_frame_ex; ntype->resize_area_func = node_resize_area_frame; break; case NODE_REROUTE: - ntype->drawfunc = node_draw_reroute; - ntype->drawupdatefunc = node_update_reroute; + ntype->draw_nodetype = node_draw_reroute; + ntype->draw_nodetype_prepare = node_draw_reroute_prepare; ntype->tweak_area_func = node_tweak_area_reroute; break; } @@ -792,7 +792,7 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr); } -static void node_shader_buts_tex_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_tex_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user"); uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0); @@ -953,7 +953,7 @@ static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), Point uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update"); } -static void node_shader_buts_script_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiItemS(layout); @@ -971,110 +971,110 @@ static void node_shader_set_butfunc(bNodeType *ntype) switch (ntype->type) { case SH_NODE_MATERIAL: case SH_NODE_MATERIAL_EXT: - ntype->uifunc = node_shader_buts_material; + ntype->draw_buttons = node_shader_buts_material; break; case SH_NODE_TEXTURE: - ntype->uifunc = node_buts_texture; + ntype->draw_buttons = node_buts_texture; break; case SH_NODE_NORMAL: - ntype->uifunc = node_buts_normal; + ntype->draw_buttons = node_buts_normal; break; case SH_NODE_CURVE_VEC: - ntype->uifunc = node_buts_curvevec; + ntype->draw_buttons = node_buts_curvevec; break; case SH_NODE_CURVE_RGB: - ntype->uifunc = node_buts_curvecol; + ntype->draw_buttons = node_buts_curvecol; break; case SH_NODE_MAPPING: - ntype->uifunc = node_shader_buts_mapping; + ntype->draw_buttons = node_shader_buts_mapping; break; case SH_NODE_VALUE: - ntype->uifunc = node_buts_value; + ntype->draw_buttons = node_buts_value; break; case SH_NODE_RGB: - ntype->uifunc = node_buts_rgb; + ntype->draw_buttons = node_buts_rgb; break; case SH_NODE_MIX_RGB: - ntype->uifunc = node_buts_mix_rgb; + ntype->draw_buttons = node_buts_mix_rgb; break; case SH_NODE_VALTORGB: - ntype->uifunc = node_buts_colorramp; + ntype->draw_buttons = node_buts_colorramp; break; case SH_NODE_MATH: - ntype->uifunc = node_buts_math; + ntype->draw_buttons = node_buts_math; break; case SH_NODE_VECT_MATH: - ntype->uifunc = node_shader_buts_vect_math; + ntype->draw_buttons = node_shader_buts_vect_math; break; case SH_NODE_VECT_TRANSFORM: - ntype->uifunc = node_shader_buts_vect_transform; + ntype->draw_buttons = node_shader_buts_vect_transform; break; case SH_NODE_GEOMETRY: - ntype->uifunc = node_shader_buts_geometry; + ntype->draw_buttons = node_shader_buts_geometry; break; case SH_NODE_ATTRIBUTE: - ntype->uifunc = node_shader_buts_attribute; + ntype->draw_buttons = node_shader_buts_attribute; break; case SH_NODE_WIREFRAME: - ntype->uifunc = node_shader_buts_wireframe; + ntype->draw_buttons = node_shader_buts_wireframe; break; case SH_NODE_TEX_SKY: - ntype->uifunc = node_shader_buts_tex_sky; + ntype->draw_buttons = node_shader_buts_tex_sky; break; case SH_NODE_TEX_IMAGE: - ntype->uifunc = node_shader_buts_tex_image; - ntype->uifuncbut = node_shader_buts_tex_image_details; + ntype->draw_buttons = node_shader_buts_tex_image; + ntype->draw_buttons_ex = node_shader_buts_tex_image_ex; break; case SH_NODE_TEX_ENVIRONMENT: - ntype->uifunc = node_shader_buts_tex_environment; + ntype->draw_buttons = node_shader_buts_tex_environment; break; case SH_NODE_TEX_GRADIENT: - ntype->uifunc = node_shader_buts_tex_gradient; + ntype->draw_buttons = node_shader_buts_tex_gradient; break; case SH_NODE_TEX_MAGIC: - ntype->uifunc = node_shader_buts_tex_magic; + ntype->draw_buttons = node_shader_buts_tex_magic; break; case SH_NODE_TEX_BRICK: - ntype->uifunc = node_shader_buts_tex_brick; + ntype->draw_buttons = node_shader_buts_tex_brick; break; case SH_NODE_TEX_WAVE: - ntype->uifunc = node_shader_buts_tex_wave; + ntype->draw_buttons = node_shader_buts_tex_wave; break; case SH_NODE_TEX_MUSGRAVE: - ntype->uifunc = node_shader_buts_tex_musgrave; + ntype->draw_buttons = node_shader_buts_tex_musgrave; break; case SH_NODE_TEX_VORONOI: - ntype->uifunc = node_shader_buts_tex_voronoi; + ntype->draw_buttons = node_shader_buts_tex_voronoi; break; case SH_NODE_TEX_COORD: - ntype->uifunc = node_shader_buts_tex_coord; + ntype->draw_buttons = node_shader_buts_tex_coord; break; case SH_NODE_BUMP: - ntype->uifunc = node_shader_buts_bump; + ntype->draw_buttons = node_shader_buts_bump; break; case SH_NODE_NORMAL_MAP: - ntype->uifunc = node_shader_buts_normal_map; + ntype->draw_buttons = node_shader_buts_normal_map; break; case SH_NODE_TANGENT: - ntype->uifunc = node_shader_buts_tangent; + ntype->draw_buttons = node_shader_buts_tangent; break; case SH_NODE_BSDF_GLOSSY: case SH_NODE_BSDF_GLASS: case SH_NODE_BSDF_REFRACTION: - ntype->uifunc = node_shader_buts_glossy; + ntype->draw_buttons = node_shader_buts_glossy; break; case SH_NODE_SUBSURFACE_SCATTERING: - ntype->uifunc = node_shader_buts_subsurface; + ntype->draw_buttons = node_shader_buts_subsurface; break; case SH_NODE_BSDF_TOON: - ntype->uifunc = node_shader_buts_toon; + ntype->draw_buttons = node_shader_buts_toon; break; case SH_NODE_BSDF_HAIR: - ntype->uifunc = node_shader_buts_hair; + ntype->draw_buttons = node_shader_buts_hair; break; case SH_NODE_SCRIPT: - ntype->uifunc = node_shader_buts_script; - ntype->uifuncbut = node_shader_buts_script_details; + ntype->draw_buttons = node_shader_buts_script; + ntype->draw_buttons_ex = node_shader_buts_script_ex; break; } } @@ -1096,7 +1096,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr); } -static void node_composit_buts_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; PointerRNA iuserptr; @@ -1629,7 +1629,7 @@ static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C) uiItemL(layout, IFACE_("Base Path:"), ICON_NONE); uiItemR(layout, ptr, "base_path", 0, "", ICON_NONE); } -static void node_composit_buts_file_output_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA imfptr = RNA_pointer_get(ptr, "format"); PointerRNA active_input_ptr, op_ptr; @@ -1787,7 +1787,7 @@ static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C } } -static void node_composit_buts_colorbalance_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_colorbalance_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "correction_method", 0, NULL, ICON_NONE); @@ -1841,7 +1841,7 @@ static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerR uiTemplateID(layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL); } -static void node_composit_buts_movieclip_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; PointerRNA clipptr; @@ -1945,7 +1945,7 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, bContext *UNUSE uiItemR(row, ptr, "midtones_end", UI_ITEM_R_SLIDER, NULL, ICON_NONE); } -static void node_composit_buts_colorcorrection_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_colorcorrection_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *row; @@ -2147,7 +2147,7 @@ static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), Poi uiItemR(layout, ptr, "use_alpha", 0, NULL, ICON_NONE); } -static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_viewer_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; @@ -2295,222 +2295,222 @@ static void node_composit_set_butfunc(bNodeType *ntype) { switch (ntype->type) { case CMP_NODE_IMAGE: - ntype->uifunc = node_composit_buts_image; - ntype->uifuncbut = node_composit_buts_image_details; + ntype->draw_buttons = node_composit_buts_image; + ntype->draw_buttons_ex = node_composit_buts_image_ex; break; case CMP_NODE_R_LAYERS: - ntype->uifunc = node_composit_buts_renderlayers; + ntype->draw_buttons = node_composit_buts_renderlayers; break; case CMP_NODE_NORMAL: - ntype->uifunc = node_buts_normal; + ntype->draw_buttons = node_buts_normal; break; case CMP_NODE_CURVE_VEC: - ntype->uifunc = node_buts_curvevec; + ntype->draw_buttons = node_buts_curvevec; break; case CMP_NODE_CURVE_RGB: - ntype->uifunc = node_buts_curvecol; + ntype->draw_buttons = node_buts_curvecol; break; case CMP_NODE_VALUE: - ntype->uifunc = node_buts_value; + ntype->draw_buttons = node_buts_value; break; case CMP_NODE_RGB: - ntype->uifunc = node_buts_rgb; + ntype->draw_buttons = node_buts_rgb; break; case CMP_NODE_FLIP: - ntype->uifunc = node_composit_buts_flip; + ntype->draw_buttons = node_composit_buts_flip; break; case CMP_NODE_SPLITVIEWER: - ntype->uifunc = node_composit_buts_splitviewer; + ntype->draw_buttons = node_composit_buts_splitviewer; break; case CMP_NODE_MIX_RGB: - ntype->uifunc = node_buts_mix_rgb; + ntype->draw_buttons = node_buts_mix_rgb; break; case CMP_NODE_VALTORGB: - ntype->uifunc = node_buts_colorramp; + ntype->draw_buttons = node_buts_colorramp; break; case CMP_NODE_CROP: - ntype->uifunc = node_composit_buts_crop; + ntype->draw_buttons = node_composit_buts_crop; break; case CMP_NODE_BLUR: - ntype->uifunc = node_composit_buts_blur; + ntype->draw_buttons = node_composit_buts_blur; break; case CMP_NODE_DBLUR: - ntype->uifunc = node_composit_buts_dblur; + ntype->draw_buttons = node_composit_buts_dblur; break; case CMP_NODE_BILATERALBLUR: - ntype->uifunc = node_composit_buts_bilateralblur; + ntype->draw_buttons = node_composit_buts_bilateralblur; break; case CMP_NODE_DEFOCUS: - ntype->uifunc = node_composit_buts_defocus; + ntype->draw_buttons = node_composit_buts_defocus; break; case CMP_NODE_GLARE: - ntype->uifunc = node_composit_buts_glare; + ntype->draw_buttons = node_composit_buts_glare; break; case CMP_NODE_TONEMAP: - ntype->uifunc = node_composit_buts_tonemap; + ntype->draw_buttons = node_composit_buts_tonemap; break; case CMP_NODE_LENSDIST: - ntype->uifunc = node_composit_buts_lensdist; + ntype->draw_buttons = node_composit_buts_lensdist; break; case CMP_NODE_VECBLUR: - ntype->uifunc = node_composit_buts_vecblur; + ntype->draw_buttons = node_composit_buts_vecblur; break; case CMP_NODE_FILTER: - ntype->uifunc = node_composit_buts_filter; + ntype->draw_buttons = node_composit_buts_filter; break; case CMP_NODE_MAP_VALUE: - ntype->uifunc = node_composit_buts_map_value; + ntype->draw_buttons = node_composit_buts_map_value; break; case CMP_NODE_MAP_RANGE: - ntype->uifunc = node_composit_buts_map_range; + ntype->draw_buttons = node_composit_buts_map_range; break; case CMP_NODE_TIME: - ntype->uifunc = node_buts_time; + ntype->draw_buttons = node_buts_time; break; case CMP_NODE_ALPHAOVER: - ntype->uifunc = node_composit_buts_alphaover; + ntype->draw_buttons = node_composit_buts_alphaover; break; case CMP_NODE_HUE_SAT: - ntype->uifunc = node_composit_buts_hue_sat; + ntype->draw_buttons = node_composit_buts_hue_sat; break; case CMP_NODE_TEXTURE: - ntype->uifunc = node_buts_texture; + ntype->draw_buttons = node_buts_texture; break; case CMP_NODE_DILATEERODE: - ntype->uifunc = node_composit_buts_dilateerode; + ntype->draw_buttons = node_composit_buts_dilateerode; break; case CMP_NODE_INPAINT: - ntype->uifunc = node_composit_buts_inpaint; + ntype->draw_buttons = node_composit_buts_inpaint; break; case CMP_NODE_DESPECKLE: - ntype->uifunc = node_composit_buts_despeckle; + ntype->draw_buttons = node_composit_buts_despeckle; break; case CMP_NODE_OUTPUT_FILE: - ntype->uifunc = node_composit_buts_file_output; - ntype->uifuncbut = node_composit_buts_file_output_details; - ntype->drawinputfunc = node_draw_input_file_output; + ntype->draw_buttons = node_composit_buts_file_output; + ntype->draw_buttons_ex = node_composit_buts_file_output_ex; + ntype->draw_input = node_draw_input_file_output; break; case CMP_NODE_DIFF_MATTE: - ntype->uifunc = node_composit_buts_diff_matte; + ntype->draw_buttons = node_composit_buts_diff_matte; break; case CMP_NODE_DIST_MATTE: - ntype->uifunc = node_composit_buts_distance_matte; + ntype->draw_buttons = node_composit_buts_distance_matte; break; case CMP_NODE_COLOR_SPILL: - ntype->uifunc = node_composit_buts_color_spill; + ntype->draw_buttons = node_composit_buts_color_spill; break; case CMP_NODE_CHROMA_MATTE: - ntype->uifunc = node_composit_buts_chroma_matte; + ntype->draw_buttons = node_composit_buts_chroma_matte; break; case CMP_NODE_COLOR_MATTE: - ntype->uifunc = node_composit_buts_color_matte; + ntype->draw_buttons = node_composit_buts_color_matte; break; case CMP_NODE_SCALE: - ntype->uifunc = node_composit_buts_scale; + ntype->draw_buttons = node_composit_buts_scale; break; case CMP_NODE_ROTATE: - ntype->uifunc = node_composit_buts_rotate; + ntype->draw_buttons = node_composit_buts_rotate; break; case CMP_NODE_CHANNEL_MATTE: - ntype->uifunc = node_composit_buts_channel_matte; + ntype->draw_buttons = node_composit_buts_channel_matte; break; case CMP_NODE_LUMA_MATTE: - ntype->uifunc = node_composit_buts_luma_matte; + ntype->draw_buttons = node_composit_buts_luma_matte; break; case CMP_NODE_MAP_UV: - ntype->uifunc = node_composit_buts_map_uv; + ntype->draw_buttons = node_composit_buts_map_uv; break; case CMP_NODE_ID_MASK: - ntype->uifunc = node_composit_buts_id_mask; + ntype->draw_buttons = node_composit_buts_id_mask; break; case CMP_NODE_DOUBLEEDGEMASK: - ntype->uifunc = node_composit_buts_double_edge_mask; + ntype->draw_buttons = node_composit_buts_double_edge_mask; break; case CMP_NODE_MATH: - ntype->uifunc = node_buts_math; + ntype->draw_buttons = node_buts_math; break; case CMP_NODE_INVERT: - ntype->uifunc = node_composit_buts_invert; + ntype->draw_buttons = node_composit_buts_invert; break; case CMP_NODE_PREMULKEY: - ntype->uifunc = node_composit_buts_premulkey; + ntype->draw_buttons = node_composit_buts_premulkey; break; case CMP_NODE_VIEW_LEVELS: - ntype->uifunc = node_composit_buts_view_levels; + ntype->draw_buttons = node_composit_buts_view_levels; break; case CMP_NODE_COLORBALANCE: - ntype->uifunc = node_composit_buts_colorbalance; - ntype->uifuncbut = node_composit_buts_colorbalance_but; + ntype->draw_buttons = node_composit_buts_colorbalance; + ntype->draw_buttons_ex = node_composit_buts_colorbalance_ex; break; case CMP_NODE_HUECORRECT: - ntype->uifunc = node_composit_buts_huecorrect; + ntype->draw_buttons = node_composit_buts_huecorrect; break; case CMP_NODE_ZCOMBINE: - ntype->uifunc = node_composit_buts_zcombine; + ntype->draw_buttons = node_composit_buts_zcombine; break; case CMP_NODE_COMBYCCA: case CMP_NODE_SEPYCCA: - ntype->uifunc = node_composit_buts_ycc; + ntype->draw_buttons = node_composit_buts_ycc; break; case CMP_NODE_MOVIECLIP: - ntype->uifunc = node_composit_buts_movieclip; - ntype->uifuncbut = node_composit_buts_movieclip_details; + ntype->draw_buttons = node_composit_buts_movieclip; + ntype->draw_buttons_ex = node_composit_buts_movieclip_ex; break; case CMP_NODE_STABILIZE2D: - ntype->uifunc = node_composit_buts_stabilize2d; + ntype->draw_buttons = node_composit_buts_stabilize2d; break; case CMP_NODE_TRANSFORM: - ntype->uifunc = node_composit_buts_transform; + ntype->draw_buttons = node_composit_buts_transform; break; case CMP_NODE_TRANSLATE: - ntype->uifunc = node_composit_buts_translate; + ntype->draw_buttons = node_composit_buts_translate; break; case CMP_NODE_MOVIEDISTORTION: - ntype->uifunc = node_composit_buts_moviedistortion; + ntype->draw_buttons = node_composit_buts_moviedistortion; break; case CMP_NODE_COLORCORRECTION: - ntype->uifunc = node_composit_buts_colorcorrection; - ntype->uifuncbut = node_composit_buts_colorcorrection_but; + ntype->draw_buttons = node_composit_buts_colorcorrection; + ntype->draw_buttons_ex = node_composit_buts_colorcorrection_ex; break; case CMP_NODE_SWITCH: - ntype->uifunc = node_composit_buts_switch; + ntype->draw_buttons = node_composit_buts_switch; break; case CMP_NODE_MASK_BOX: - ntype->uifunc = node_composit_buts_boxmask; - ntype->uibackdropfunc = node_composit_backdrop_boxmask; + ntype->draw_buttons = node_composit_buts_boxmask; + ntype->draw_backdrop = node_composit_backdrop_boxmask; break; case CMP_NODE_MASK_ELLIPSE: - ntype->uifunc = node_composit_buts_ellipsemask; - ntype->uibackdropfunc = node_composit_backdrop_ellipsemask; + ntype->draw_buttons = node_composit_buts_ellipsemask; + ntype->draw_backdrop = node_composit_backdrop_ellipsemask; break; case CMP_NODE_BOKEHIMAGE: - ntype->uifunc = node_composit_buts_bokehimage; + ntype->draw_buttons = node_composit_buts_bokehimage; break; case CMP_NODE_BOKEHBLUR: - ntype->uifunc = node_composit_buts_bokehblur; + ntype->draw_buttons = node_composit_buts_bokehblur; break; case CMP_NODE_VIEWER: - ntype->uifunc = node_composit_buts_viewer; - ntype->uifuncbut = node_composit_buts_viewer_but; - ntype->uibackdropfunc = node_composit_backdrop_viewer; + ntype->draw_buttons = node_composit_buts_viewer; + ntype->draw_buttons_ex = node_composit_buts_viewer_ex; + ntype->draw_backdrop = node_composit_backdrop_viewer; break; case CMP_NODE_COMPOSITE: - ntype->uifunc = node_composit_buts_composite; + ntype->draw_buttons = node_composit_buts_composite; break; case CMP_NODE_MASK: - ntype->uifunc = node_composit_buts_mask; + ntype->draw_buttons = node_composit_buts_mask; break; case CMP_NODE_KEYINGSCREEN: - ntype->uifunc = node_composit_buts_keyingscreen; + ntype->draw_buttons = node_composit_buts_keyingscreen; break; case CMP_NODE_KEYING: - ntype->uifunc = node_composit_buts_keying; + ntype->draw_buttons = node_composit_buts_keying; break; case CMP_NODE_TRACKPOS: - ntype->uifunc = node_composit_buts_trackpos; + ntype->draw_buttons = node_composit_buts_trackpos; break; case CMP_NODE_PLANETRACKDEFORM: - ntype->uifunc = node_composit_buts_planetrackdeform; + ntype->draw_buttons = node_composit_buts_planetrackdeform; break; } } @@ -2615,7 +2615,7 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL); } -static void node_texture_buts_image_details(uiLayout *layout, bContext *C, PointerRNA *ptr) +static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { bNode *node = ptr->data; PointerRNA iuserptr; @@ -2633,46 +2633,46 @@ static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), Poin static void node_texture_set_butfunc(bNodeType *ntype) { if (ntype->type >= TEX_NODE_PROC && ntype->type < TEX_NODE_PROC_MAX) { - ntype->uifunc = node_texture_buts_proc; + ntype->draw_buttons = node_texture_buts_proc; } else { switch (ntype->type) { case TEX_NODE_MATH: - ntype->uifunc = node_buts_math; + ntype->draw_buttons = node_buts_math; break; case TEX_NODE_MIX_RGB: - ntype->uifunc = node_buts_mix_rgb; + ntype->draw_buttons = node_buts_mix_rgb; break; case TEX_NODE_VALTORGB: - ntype->uifunc = node_buts_colorramp; + ntype->draw_buttons = node_buts_colorramp; break; case TEX_NODE_CURVE_RGB: - ntype->uifunc = node_buts_curvecol; + ntype->draw_buttons = node_buts_curvecol; break; case TEX_NODE_CURVE_TIME: - ntype->uifunc = node_buts_time; + ntype->draw_buttons = node_buts_time; break; case TEX_NODE_TEXTURE: - ntype->uifunc = node_buts_texture; + ntype->draw_buttons = node_buts_texture; break; case TEX_NODE_BRICKS: - ntype->uifunc = node_texture_buts_bricks; + ntype->draw_buttons = node_texture_buts_bricks; break; case TEX_NODE_IMAGE: - ntype->uifunc = node_texture_buts_image; - ntype->uifuncbut = node_texture_buts_image_details; + ntype->draw_buttons = node_texture_buts_image; + ntype->draw_buttons_ex = node_texture_buts_image_ex; break; case TEX_NODE_OUTPUT: - ntype->uifunc = node_texture_buts_output; + ntype->draw_buttons = node_texture_buts_output; break; } } @@ -2746,14 +2746,14 @@ void ED_node_init_butfuncs(void) extern bNodeSocketType NodeSocketTypeUndefined; /* default ui functions */ - NodeTypeUndefined.drawfunc = node_draw_default; - NodeTypeUndefined.drawupdatefunc = node_update_default; + NodeTypeUndefined.draw_nodetype = node_draw_default; + NodeTypeUndefined.draw_nodetype_prepare = node_update_default; NodeTypeUndefined.select_area_func = node_select_area_default; NodeTypeUndefined.tweak_area_func = node_tweak_area_default; - NodeTypeUndefined.uifunc = NULL; - NodeTypeUndefined.uifuncbut = NULL; - NodeTypeUndefined.drawinputfunc = node_draw_input_default; - NodeTypeUndefined.drawoutputfunc = node_draw_output_default; + NodeTypeUndefined.draw_buttons = NULL; + NodeTypeUndefined.draw_buttons_ex = NULL; + NodeTypeUndefined.draw_input = node_draw_input_default; + NodeTypeUndefined.draw_output = node_draw_output_default; NodeTypeUndefined.resize_area_func = node_resize_area_default; NodeSocketTypeUndefined.draw = node_socket_undefined_draw; @@ -2764,14 +2764,14 @@ void ED_node_init_butfuncs(void) /* node type ui functions */ NODE_TYPES_BEGIN(ntype) /* default ui functions */ - ntype->drawfunc = node_draw_default; - ntype->drawupdatefunc = node_update_default; + ntype->draw_nodetype = node_draw_default; + ntype->draw_nodetype_prepare = node_update_default; ntype->select_area_func = node_select_area_default; ntype->tweak_area_func = node_tweak_area_default; - ntype->uifunc = NULL; - ntype->uifuncbut = NULL; - ntype->drawinputfunc = node_draw_input_default; - ntype->drawoutputfunc = node_draw_output_default; + ntype->draw_buttons = NULL; + ntype->draw_buttons_ex = NULL; + ntype->draw_input = node_draw_input_default; + ntype->draw_output = node_draw_output_default; ntype->resize_area_func = node_resize_area_default; node_common_set_butfunc(ntype); @@ -2793,10 +2793,10 @@ void ED_node_init_butfuncs(void) void ED_init_custom_node_type(bNodeType *ntype) { /* default ui functions */ - ntype->drawfunc = node_draw_default; - ntype->drawupdatefunc = node_update_default; - ntype->drawinputfunc = node_draw_input_default; - ntype->drawoutputfunc = node_draw_output_default; + ntype->draw_nodetype = node_draw_default; + ntype->draw_nodetype_prepare = node_update_default; + ntype->draw_input = node_draw_input_default; + ntype->draw_output = node_draw_output_default; ntype->resize_area_func = node_resize_area_default; ntype->select_area_func = node_select_area_default; ntype->tweak_area_func = node_tweak_area_default; @@ -3053,8 +3053,8 @@ void draw_nodespace_back_pix(const bContext *C, ARegion *ar, SpaceNode *snode, b rctf *viewer_border = &snode->nodetree->viewer_border; while (node) { if (node->flag & NODE_SELECT) { - if (node->typeinfo->uibackdropfunc) { - node->typeinfo->uibackdropfunc(snode, ibuf, node, x, y); + if (node->typeinfo->draw_backdrop) { + node->typeinfo->draw_backdrop(snode, ibuf, node, x, y); } } node = node->next; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index b991a2c3b5f..3196e4cc6af 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -351,7 +351,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) row = uiLayoutRow(layout, 1); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_RIGHT); - node->typeinfo->drawoutputfunc((bContext *)C, row, &sockptr, &nodeptr); + node->typeinfo->draw_output((bContext *)C, row, &sockptr, &nodeptr); uiBlockEndAlign(node->block); uiBlockLayoutResolve(node->block, NULL, &buty); @@ -402,7 +402,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) } /* buttons rect? */ - if (node->typeinfo->uifunc && (node->flag & NODE_OPTIONS)) { + if (node->typeinfo->draw_buttons && (node->flag & NODE_OPTIONS)) { dy -= NODE_DYS / 2; /* set this for uifunc() that don't use layout engine yet */ @@ -416,7 +416,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) locx + NODE_DYS, dy, node->butr.xmax, 0, UI_GetStyle()); uiLayoutSetContextPointer(layout, "node", &nodeptr); - node->typeinfo->uifunc(layout, (bContext *)C, &nodeptr); + node->typeinfo->draw_buttons(layout, (bContext *)C, &nodeptr); uiBlockEndAlign(node->block); uiBlockLayoutResolve(node->block, NULL, &buty); @@ -437,7 +437,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) uiLayoutSetContextPointer(layout, "node", &nodeptr); uiLayoutSetContextPointer(layout, "socket", &sockptr); - node->typeinfo->drawinputfunc((bContext *)C, layout, &sockptr, &nodeptr); + node->typeinfo->draw_input((bContext *)C, layout, &sockptr, &nodeptr); uiBlockEndAlign(node->block); uiBlockLayoutResolve(node->block, NULL, &buty); @@ -1115,8 +1115,8 @@ void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTr static void node_update(const bContext *C, bNodeTree *ntree, bNode *node) { - if (node->typeinfo->drawupdatefunc) - node->typeinfo->drawupdatefunc(C, ntree, node); + if (node->typeinfo->draw_nodetype_prepare) + node->typeinfo->draw_nodetype_prepare(C, ntree, node); } void node_update_nodetree(const bContext *C, bNodeTree *ntree) @@ -1131,8 +1131,8 @@ void node_update_nodetree(const bContext *C, bNodeTree *ntree) static void node_draw(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node, bNodeInstanceKey key) { - if (node->typeinfo->drawfunc) - node->typeinfo->drawfunc(C, ar, snode, ntree, node, key); + if (node->typeinfo->draw_nodetype) + node->typeinfo->draw_nodetype(C, ar, snode, ntree, node, key); } #define USE_DRAW_TOT_UPDATE diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index bc0a518b1b0..1d93fe65c09 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1419,7 +1419,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag) if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0) continue; - if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->uifunc || node->typeinfo->uifuncbut)) + if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->draw_buttons || node->typeinfo->draw_buttons_ex)) continue; if (node->flag & toggle_flag) @@ -1433,7 +1433,7 @@ static void node_flag_toggle_exec(SpaceNode *snode, int toggle_flag) if (toggle_flag == NODE_PREVIEW && (node->typeinfo->flag & NODE_PREVIEW) == 0) continue; - if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->uifunc || node->typeinfo->uifuncbut)) + if (toggle_flag == NODE_OPTIONS && !(node->typeinfo->draw_buttons || node->typeinfo->draw_buttons_ex)) continue; if ((tot_eq && tot_neq) || tot_eq == 0) diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 83c11e69d84..a67a8791a64 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -207,7 +207,7 @@ static void node_socket_add_replace(const bContext *C, bNodeTree *ntree, bNode * break; if (node_from) - if (node_from->inputs.first || node_from->typeinfo->uifunc || node_from->typeinfo->uifuncbut) + if (node_from->inputs.first || node_from->typeinfo->draw_buttons || node_from->typeinfo->draw_buttons_ex) node_from = NULL; if (node_prev && node_prev->type == type && node_link_item_compare(node_prev, item)) { @@ -586,13 +586,13 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b RNA_pointer_create(&ntree->id, &RNA_Node, node, &nodeptr); - if (node->typeinfo->uifunc) { + if (node->typeinfo->draw_buttons) { if (node->type != NODE_GROUP) { split = uiLayoutSplit(layout, 0.35f, FALSE); col = uiLayoutColumn(split, FALSE); col = uiLayoutColumn(split, FALSE); - node->typeinfo->uifunc(col, C, &nodeptr); + node->typeinfo->draw_buttons(col, C, &nodeptr); } } @@ -639,7 +639,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, if (depth > 0) { uiBlockSetEmboss(block, UI_EMBOSSN); - if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) { + if (lnode && (lnode->inputs.first || (lnode->typeinfo->draw_buttons && lnode->type != NODE_GROUP))) { int icon = (input->flag & SOCK_COLLAPSED) ? ICON_DISCLOSURE_TRI_RIGHT : ICON_DISCLOSURE_TRI_DOWN; uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 8ad19735517..e8f393efc98 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1377,8 +1377,8 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc nt->initfunc_api = (have_function[3]) ? rna_Node_init : NULL; nt->copyfunc_api = (have_function[4]) ? rna_Node_copy : NULL; nt->freefunc_api = (have_function[5]) ? rna_Node_free : NULL; - nt->uifunc = (have_function[6]) ? rna_Node_draw_buttons : NULL; - nt->uifuncbut = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL; + nt->draw_buttons = (have_function[6]) ? rna_Node_draw_buttons : NULL; + nt->draw_buttons_ex = (have_function[7]) ? rna_Node_draw_buttons_ext : NULL; /* sanitize size values in case not all have been registered */ if (nt->maxwidth < nt->minwidth) @@ -2336,24 +2336,24 @@ static void rna_NodeInternal_update(ID *id, bNode *node) static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout) { - if (node->typeinfo->uifunc) { + if (node->typeinfo->draw_buttons) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifunc(layout, C, &ptr); + node->typeinfo->draw_buttons(layout, C, &ptr); } } static void rna_NodeInternal_draw_buttons_ext(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout) { - if (node->typeinfo->uifuncbut) { + if (node->typeinfo->draw_buttons_ex) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifuncbut(layout, C, &ptr); + node->typeinfo->draw_buttons_ex(layout, C, &ptr); } - else if (node->typeinfo->uifunc) { + else if (node->typeinfo->draw_buttons) { PointerRNA ptr; RNA_pointer_create(id, &RNA_Node, node, &ptr); - node->typeinfo->uifunc(layout, C, &ptr); + node->typeinfo->draw_buttons(layout, C, &ptr); } } -- cgit v1.2.3