From 4e98d974b596cdb7b04872b9c8fb43fc284696e9 Mon Sep 17 00:00:00 2001 From: Aaron Carlisle Date: Wed, 15 Dec 2021 21:30:04 -0500 Subject: Nodes: Begin splitting composite node buttons into individual files Currently, most node buttons are defined in `drawnode.cc` however, this is inconvenient because it requires editing many files when adding new nodes. The goal is to minimize the number of files needed to add or update a node. This commit moves most of the node layout functions for composite nodes into their respected `source/blender/nodes/composite/nodes` file. In the future, these functions will be simplified to `node_layout` once files have their own namespace. See {D13466} for more information. Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D13523 --- source/blender/editors/space_node/drawnode.cc | 1469 +------------------- .../composite/nodes/node_composite_alphaOver.cc | 13 + .../composite/nodes/node_composite_antialiasing.cc | 15 + .../nodes/node_composite_bilateralblur.cc | 16 + .../nodes/composite/nodes/node_composite_blur.cc | 47 + .../composite/nodes/node_composite_bokehblur.cc | 12 + .../composite/nodes/node_composite_bokehimage.cc | 19 + .../composite/nodes/node_composite_boxmask.cc | 20 + .../composite/nodes/node_composite_brightness.cc | 11 + .../composite/nodes/node_composite_channelMatte.cc | 47 + .../composite/nodes/node_composite_chromaMatte.cc | 20 + .../composite/nodes/node_composite_colorMatte.cc | 21 + .../composite/nodes/node_composite_colorSpill.cc | 52 + .../composite/nodes/node_composite_colorbalance.cc | 81 ++ .../nodes/node_composite_colorcorrection.cc | 221 +++ .../composite/nodes/node_composite_composite.cc | 10 +- .../nodes/composite/nodes/node_composite_crop.cc | 28 + .../nodes/composite/nodes/node_composite_curves.cc | 9 + .../composite/nodes/node_composite_defocus.cc | 49 +- .../composite/nodes/node_composite_denoise.cc | 22 + .../composite/nodes/node_composite_despeckle.cc | 13 + .../composite/nodes/node_composite_diffMatte.cc | 14 + .../nodes/composite/nodes/node_composite_dilate.cc | 20 + .../nodes/node_composite_directionalblur.cc | 28 + .../nodes/node_composite_distanceMatte.cc | 21 + .../nodes/node_composite_doubleEdgeMask.cc | 19 + .../composite/nodes/node_composite_ellipsemask.cc | 18 + .../nodes/composite/nodes/node_composite_filter.cc | 9 + .../nodes/composite/nodes/node_composite_flip.cc | 9 + .../nodes/composite/nodes/node_composite_glare.cc | 44 + .../nodes/composite/nodes/node_composite_idMask.cc | 10 + .../nodes/composite/nodes/node_composite_image.cc | 57 +- .../composite/nodes/node_composite_inpaint.cc | 9 + .../nodes/composite/nodes/node_composite_invert.cc | 13 + .../nodes/composite/nodes/node_composite_keying.cc | 24 +- .../composite/nodes/node_composite_keyingscreen.cc | 33 + .../composite/nodes/node_composite_lensdist.cc | 19 + .../nodes/composite/nodes/node_composite_levels.cc | 9 + .../composite/nodes/node_composite_lummaMatte.cc | 15 + .../composite/nodes/node_composite_mapRange.cc | 12 + .../nodes/composite/nodes/node_composite_mapUV.cc | 9 + .../composite/nodes/node_composite_mapValue.cc | 27 + .../nodes/composite/nodes/node_composite_mask.cc | 34 + .../composite/nodes/node_composite_movieclip.cc | 50 +- .../nodes/node_composite_moviedistortion.cc | 31 +- .../composite/nodes/node_composite_outputFile.cc | 162 +++ .../nodes/node_composite_planetrackdeform.cc | 55 + .../composite/nodes/node_composite_premulkey.cc | 9 + .../nodes/composite/nodes/node_composite_rotate.cc | 9 + .../nodes/composite/nodes/node_composite_scale.cc | 24 + .../composite/nodes/node_composite_setalpha.cc | 9 + .../composite/nodes/node_composite_splitViewer.cc | 18 +- .../composite/nodes/node_composite_stabilize2d.cc | 29 +- .../composite/nodes/node_composite_sunbeams.cc | 15 + .../nodes/composite/nodes/node_composite_switch.cc | 9 + .../composite/nodes/node_composite_switchview.cc | 20 +- .../composite/nodes/node_composite_tonemap.cc | 28 + .../composite/nodes/node_composite_trackpos.cc | 54 + .../composite/nodes/node_composite_transform.cc | 9 + .../composite/nodes/node_composite_translate.cc | 10 + .../composite/nodes/node_composite_vecBlur.cc | 20 + .../nodes/composite/nodes/node_composite_viewer.cc | 29 +- .../composite/nodes/node_composite_zcombine.cc | 13 + 63 files changed, 1778 insertions(+), 1473 deletions(-) diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 87f7bfdafb0..bbfd886ce56 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1095,1036 +1095,25 @@ static void node_composit_buts_image_ex(uiLayout *layout, bContext *C, PointerRN uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, true); } -static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - uiLayout *col, *row; - - uiTemplateID(layout, - C, - ptr, - "scene", - nullptr, - nullptr, - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (!node->id) { - return; - } - - col = uiLayoutColumn(layout, false); - row = uiLayoutRow(col, true); - uiItemR(row, ptr, "layer", DEFAULT_FLAGS, "", ICON_NONE); - - PropertyRNA *prop = RNA_struct_find_property(ptr, "layer"); - const char *layer_name; - if (!(RNA_property_enum_identifier( - C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name))) { - return; - } - - PointerRNA scn_ptr; - char scene_name[MAX_ID_NAME - 2]; - scn_ptr = RNA_pointer_get(ptr, "scene"); - RNA_string_get(&scn_ptr, "name", scene_name); - - PointerRNA op_ptr; - uiItemFullO( - row, "RENDER_OT_render", "", ICON_RENDER_STILL, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); - RNA_string_set(&op_ptr, "layer", layer_name); - RNA_string_set(&op_ptr, "scene", scene_name); -} - -static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col, *row; - - col = uiLayoutColumn(layout, false); - const int filter = RNA_enum_get(ptr, "filter_type"); - const int reference = RNA_boolean_get(ptr, "use_variable_size"); - - uiItemR(col, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); - if (filter != R_FILTER_FAST_GAUSS) { - uiItemR(col, ptr, "use_variable_size", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (!reference) { - uiItemR(col, ptr, "use_bokeh", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - uiItemR(col, ptr, "use_gamma_correction", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - - uiItemR(col, ptr, "use_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_boolean_get(ptr, "use_relative")) { - uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE); - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "aspect_correction", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "factor_x", DEFAULT_FLAGS, IFACE_("X"), ICON_NONE); - uiItemR(col, ptr, "factor_y", DEFAULT_FLAGS, IFACE_("Y"), ICON_NONE); - } - else { - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "size_x", DEFAULT_FLAGS, IFACE_("X"), ICON_NONE); - uiItemR(col, ptr, "size_y", DEFAULT_FLAGS, IFACE_("Y"), ICON_NONE); - } - uiItemR(col, ptr, "use_extended_bounds", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "use_wrap", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemL(col, IFACE_("Center:"), ICON_NONE); - uiItemR(col, ptr, "center_x", DEFAULT_FLAGS, IFACE_("X"), ICON_NONE); - uiItemR(col, ptr, "center_y", DEFAULT_FLAGS, IFACE_("Y"), ICON_NONE); - - uiItemS(layout); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiItemS(layout); - - uiItemR(layout, ptr, "spin", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "zoom", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_bilateralblur(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "sigma_color", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "sigma_space", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiLayout *sub, *col; - - col = uiLayoutColumn(layout, false); - uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE); - uiItemR(col, ptr, "bokeh", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(col, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiItemR(layout, ptr, "use_gamma_correction", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_zbuffer") == true); - uiItemR(col, ptr, "f_stop", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_preview", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiTemplateID(layout, - C, - ptr, - "scene", - nullptr, - nullptr, - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_zbuffer", DEFAULT_FLAGS, nullptr, ICON_NONE); - sub = uiLayoutColumn(col, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_zbuffer") == false); - uiItemR(sub, ptr, "z_scale", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_antialiasing(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - - uiItemR(col, ptr, "threshold", 0, nullptr, ICON_NONE); - uiItemR(col, ptr, "contrast_limit", 0, nullptr, ICON_NONE); - uiItemR(col, ptr, "corner_rounding", 0, nullptr, ICON_NONE); -} - -/* glare node */ -static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "glare_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "quality", DEFAULT_FLAGS, "", ICON_NONE); - - if (RNA_enum_get(ptr, "glare_type") != 1) { - uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "glare_type") != 0) { - uiItemR( - layout, ptr, "color_modulation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - } - } - - uiItemR(layout, ptr, "mix", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "glare_type") == 2) { - uiItemR(layout, ptr, "streaks", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "angle_offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - if (RNA_enum_get(ptr, "glare_type") == 0 || RNA_enum_get(ptr, "glare_type") == 2) { - uiItemR(layout, ptr, "fade", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "glare_type") == 0) { - uiItemR(layout, ptr, "use_rotate_45", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - } - if (RNA_enum_get(ptr, "glare_type") == 1) { - uiItemR(layout, ptr, "size", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "tonemap_type", DEFAULT_FLAGS, "", ICON_NONE); - if (RNA_enum_get(ptr, "tonemap_type") == 0) { - uiItemR(col, ptr, "key", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - else { - uiItemR(col, ptr, "intensity", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "adaptation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "correction", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_projector", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(col, false); - uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector") == false); - uiItemR(col, ptr, "use_jitter", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "use_fit", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "factor", DEFAULT_FLAGS, IFACE_("Blur"), ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemL(col, IFACE_("Speed:"), ICON_NONE); - uiItemR(col, ptr, "speed_min", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE); - uiItemR(col, ptr, "speed_max", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE); - - uiItemR(layout, ptr, "use_curved", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "axis", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - uiItemR(layout, ptr, "use_crop_size", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "relative", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - if (RNA_boolean_get(ptr, "relative")) { - uiItemR(col, ptr, "rel_min_x", DEFAULT_FLAGS, IFACE_("Left"), ICON_NONE); - uiItemR(col, ptr, "rel_max_x", DEFAULT_FLAGS, IFACE_("Right"), ICON_NONE); - uiItemR(col, ptr, "rel_min_y", DEFAULT_FLAGS, IFACE_("Up"), ICON_NONE); - uiItemR(col, ptr, "rel_max_y", DEFAULT_FLAGS, IFACE_("Down"), ICON_NONE); - } - else { - uiItemR(col, ptr, "min_x", DEFAULT_FLAGS, IFACE_("Left"), ICON_NONE); - uiItemR(col, ptr, "max_x", DEFAULT_FLAGS, IFACE_("Right"), ICON_NONE); - uiItemR(col, ptr, "min_y", DEFAULT_FLAGS, IFACE_("Up"), ICON_NONE); - uiItemR(col, ptr, "max_y", DEFAULT_FLAGS, IFACE_("Down"), ICON_NONE); - } -} - -static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row, *col; - - col = uiLayoutColumn(layout, false); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - uiItemR(col, ptr, "factor", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_double_edge_mask(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - - uiItemL(col, IFACE_("Inner Edge:"), ICON_NONE); - uiItemR(col, ptr, "inner_mode", DEFAULT_FLAGS, "", ICON_NONE); - uiItemL(col, IFACE_("Buffer Edge:"), ICON_NONE); - uiItemR(col, ptr, "edge_mode", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *sub, *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "size", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_min", DEFAULT_FLAGS, nullptr, ICON_NONE); - sub = uiLayoutColumn(col, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min")); - uiItemR(sub, ptr, "min", DEFAULT_FLAGS, "", ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_max", DEFAULT_FLAGS, nullptr, ICON_NONE); - sub = uiLayoutColumn(col, false); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); - uiItemR(sub, ptr, "max", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_premultiply", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "premul", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "use_antialias_z", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); - switch (RNA_enum_get(ptr, "mode")) { - case CMP_NODE_DILATEERODE_DISTANCE_THRESH: - uiItemR(layout, ptr, "edge", DEFAULT_FLAGS, nullptr, ICON_NONE); - break; - case CMP_NODE_DILATEERODE_DISTANCE_FEATHER: - uiItemR(layout, ptr, "falloff", DEFAULT_FLAGS, nullptr, ICON_NONE); - break; - } -} - -static void node_composit_buts_inpaint(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "threshold_neighbor", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_distance_matte(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *col, *row; - - col = uiLayoutColumn(layout, true); - - uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row, *col; - - uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "limit_method") == 0) { - uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - } - - uiItemR(col, ptr, "ratio", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "use_unspill", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (RNA_boolean_get(ptr, "use_unspill") == true) { - uiItemR(col, ptr, "unspill_red", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "unspill_green", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "unspill_blue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - /* Removed for now. */ - // uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - /* Removed for now. */ - // uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "color_hue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "color_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "color_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_channel_matte(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *col, *row; - - uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "color_space", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, false); - uiItemL(col, IFACE_("Key Channel:"), ICON_NONE); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "matte_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, false); - - uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (RNA_enum_get(ptr, "limit_method") == 0) { - uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - } - - uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "index", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "use_antialiasing", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - PointerRNA imfptr = RNA_pointer_get(ptr, "format"); - const bool multilayer = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER; - - if (multilayer) { - uiItemL(layout, IFACE_("Path:"), ICON_NONE); - } - else { - uiItemL(layout, IFACE_("Base Path:"), ICON_NONE); - } - uiItemR(layout, ptr, "base_path", DEFAULT_FLAGS, "", ICON_NONE); -} -static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - Scene *scene = CTX_data_scene(C); - PointerRNA imfptr = RNA_pointer_get(ptr, "format"); - PointerRNA active_input_ptr, op_ptr; - uiLayout *row, *col; - const bool multilayer = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER; - const bool is_exr = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_OPENEXR; - const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; - - node_composit_buts_file_output(layout, C, ptr); - uiTemplateImageSettings(layout, &imfptr, false); - - /* disable stereo output for multilayer, too much work for something that no one will use */ - /* if someone asks for that we can implement it */ - if (is_multiview) { - uiTemplateImageFormatViews(layout, &imfptr, nullptr); - } - - uiItemS(layout); - - uiItemO(layout, IFACE_("Add Input"), ICON_ADD, "NODE_OT_output_file_add_socket"); - - row = uiLayoutRow(layout, false); - col = uiLayoutColumn(row, true); - - const int active_index = RNA_int_get(ptr, "active_input_index"); - /* using different collection properties if multilayer format is enabled */ - if (multilayer) { - uiTemplateList(col, - C, - "UI_UL_list", - "file_output_node", - ptr, - "layer_slots", - ptr, - "active_input_index", - nullptr, - 0, - 0, - 0, - 0, - UI_TEMPLATE_LIST_FLAG_NONE); - RNA_property_collection_lookup_int( - ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr); - } - else { - uiTemplateList(col, - C, - "UI_UL_list", - "file_output_node", - ptr, - "file_slots", - ptr, - "active_input_index", - nullptr, - 0, - 0, - 0, - 0, - UI_TEMPLATE_LIST_FLAG_NONE); - RNA_property_collection_lookup_int( - ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr); - } - /* XXX collection lookup does not return the ID part of the pointer, - * setting this manually here */ - active_input_ptr.owner_id = ptr->owner_id; - - col = uiLayoutColumn(row, true); - wmOperatorType *ot = WM_operatortype_find("NODE_OT_output_file_move_active_socket", false); - uiItemFullO_ptr(col, ot, "", ICON_TRIA_UP, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); - RNA_enum_set(&op_ptr, "direction", 1); - uiItemFullO_ptr(col, ot, "", ICON_TRIA_DOWN, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); - RNA_enum_set(&op_ptr, "direction", 2); - - if (active_input_ptr.data) { - if (multilayer) { - col = uiLayoutColumn(layout, true); - - uiItemL(col, IFACE_("Layer:"), ICON_NONE); - row = uiLayoutRow(col, false); - uiItemR(row, &active_input_ptr, "name", DEFAULT_FLAGS, "", ICON_NONE); - uiItemFullO(row, - "NODE_OT_output_file_remove_active_socket", - "", - ICON_X, - nullptr, - WM_OP_EXEC_DEFAULT, - UI_ITEM_R_ICON_ONLY, - nullptr); - } - else { - col = uiLayoutColumn(layout, true); - - uiItemL(col, IFACE_("File Subpath:"), ICON_NONE); - row = uiLayoutRow(col, false); - uiItemR(row, &active_input_ptr, "path", DEFAULT_FLAGS, "", ICON_NONE); - uiItemFullO(row, - "NODE_OT_output_file_remove_active_socket", - "", - ICON_X, - nullptr, - WM_OP_EXEC_DEFAULT, - UI_ITEM_R_ICON_ONLY, - nullptr); - - /* format details for individual files */ - imfptr = RNA_pointer_get(&active_input_ptr, "format"); - - col = uiLayoutColumn(layout, true); - uiItemL(col, IFACE_("Format:"), ICON_NONE); - uiItemR(col, &active_input_ptr, "use_node_format", DEFAULT_FLAGS, nullptr, ICON_NONE); - - const bool is_socket_exr = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_OPENEXR; - const bool use_node_format = RNA_boolean_get(&active_input_ptr, "use_node_format"); - - if ((!is_exr && use_node_format) || (!is_socket_exr && !use_node_format)) { - uiItemR(col, &active_input_ptr, "save_as_render", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - - col = uiLayoutColumn(layout, false); - uiLayoutSetActive(col, use_node_format == false); - uiTemplateImageSettings(col, &imfptr, false); - - if (is_multiview) { - uiTemplateImageFormatViews(layout, &imfptr, nullptr); - } - } - } -} - -static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", ICON_NONE); - - if (RNA_enum_get(ptr, "space") == CMP_SCALE_RENDERPERCENT) { - uiLayout *row; - uiItemR(layout, ptr, "frame_method", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "offset_x", DEFAULT_FLAGS, "X", ICON_NONE); - uiItemR(row, ptr, "offset_y", DEFAULT_FLAGS, "Y", ICON_NONE); - } -} - -static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "invert_rgb", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "invert_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mapping", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "channel", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *split, *col, *row; - - uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "correction_method") == 0) { - - split = uiLayoutSplit(layout, 0.0f, false); - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "lift", true, true, false, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "lift", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "gamma", true, true, true, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "gain", true, true, true, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "gain", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - else { - - split = uiLayoutSplit(layout, 0.0f, false); - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "offset", true, true, false, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "offset_basis", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "power", true, true, false, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "power", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "slope", true, true, false, true); - row = uiLayoutRow(col, false); - uiItemR(row, ptr, "slope", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} -static void node_composit_buts_colorbalance_ex(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (RNA_enum_get(ptr, "correction_method") == 0) { - - uiTemplateColorPicker(layout, ptr, "lift", true, true, false, true); - uiItemR(layout, ptr, "lift", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiTemplateColorPicker(layout, ptr, "gamma", true, true, true, true); - uiItemR(layout, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiTemplateColorPicker(layout, ptr, "gain", true, true, true, true); - uiItemR(layout, ptr, "gain", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - else { - uiTemplateColorPicker(layout, ptr, "offset", true, true, false, true); - uiItemR(layout, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiTemplateColorPicker(layout, ptr, "power", true, true, false, true); - uiItemR(layout, ptr, "power", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiTemplateColorPicker(layout, ptr, "slope", true, true, false, true); - uiItemR(layout, ptr, "slope", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - CurveMapping *cumap = (CurveMapping *)node->storage; - - if (_sample_col[0] != SAMPLE_FLT_ISNONE) { - cumap->flag |= CUMA_DRAW_SAMPLE; - copy_v3_v3(cumap->sample, _sample_col); - } - else { - cumap->flag &= ~CUMA_DRAW_SAMPLE; - } - - uiTemplateCurveMapping(layout, ptr, "mapping", 'h', false, false, false, false); -} - -static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); -} - -static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - PointerRNA clipptr; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (!node->id) { - return; - } - - clipptr = RNA_pointer_get(ptr, "clip"); - - uiTemplateColorspaceSettings(layout, &clipptr, "colorspace_settings"); -} - -static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (!node->id) { - return; - } - - uiItemR(layout, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_translate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "wrap_axis", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (!node->id) { - return; - } - - uiItemR(layout, ptr, "distortion_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_composit_buts_colorcorrection(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *row; - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "red", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "green", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "blue", DEFAULT_FLAGS, nullptr, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemL(row, "", ICON_NONE); - uiItemL(row, IFACE_("Saturation"), ICON_NONE); - uiItemL(row, IFACE_("Contrast"), ICON_NONE); - uiItemL(row, IFACE_("Gamma"), ICON_NONE); - uiItemL(row, IFACE_("Gain"), ICON_NONE); - uiItemL(row, IFACE_("Lift"), ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemL(row, IFACE_("Master"), ICON_NONE); - uiItemR(row, ptr, "master_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "master_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "master_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "master_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "master_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemL(row, IFACE_("Highlights"), ICON_NONE); - uiItemR(row, ptr, "highlights_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "highlights_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "highlights_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "highlights_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "highlights_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemL(row, IFACE_("Midtones"), ICON_NONE); - uiItemR(row, ptr, "midtones_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "midtones_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "midtones_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "midtones_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "midtones_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemL(row, IFACE_("Shadows"), ICON_NONE); - uiItemR(row, ptr, "shadows_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "shadows_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "shadows_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "shadows_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - uiItemR(row, ptr, "shadows_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - -static void node_composit_buts_colorcorrection_ex(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiLayout *row; - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "red", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "green", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "blue", DEFAULT_FLAGS, nullptr, ICON_NONE); - row = layout; - uiItemL(row, IFACE_("Saturation"), ICON_NONE); - uiItemR(row, ptr, "master_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "highlights_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "shadows_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - uiItemL(row, IFACE_("Contrast"), ICON_NONE); - uiItemR(row, ptr, "master_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "highlights_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "shadows_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - uiItemL(row, IFACE_("Gamma"), ICON_NONE); - uiItemR(row, ptr, "master_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "highlights_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "shadows_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - uiItemL(row, IFACE_("Gain"), ICON_NONE); - uiItemR(row, ptr, "master_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "highlights_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "shadows_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - uiItemL(row, IFACE_("Lift"), ICON_NONE); - uiItemR(row, ptr, "master_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "highlights_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "shadows_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_set_alpha(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_switch(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "check", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_switch_view_ex(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *UNUSED(ptr)) -{ - uiItemFullO(layout, - "NODE_OT_switch_view_update", - "Update Views", - ICON_FILE_REFRESH, - nullptr, - WM_OP_INVOKE_DEFAULT, - 0, - nullptr); -} - -static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiLayout *row; - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "x", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "y", DEFAULT_FLAGS, nullptr, ICON_NONE); - - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + bNode *node = (bNode *)ptr->data; + CurveMapping *cumap = (CurveMapping *)node->storage; - uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, nullptr, ICON_NONE); -} + if (_sample_col[0] != SAMPLE_FLT_ISNONE) { + cumap->flag |= CUMA_DRAW_SAMPLE; + copy_v3_v3(cumap->sample, _sample_col); + } + else { + cumap->flag &= ~CUMA_DRAW_SAMPLE; + } -static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "flaps", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "rounding", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(layout, ptr, "catadioptric", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(layout, ptr, "shift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiTemplateCurveMapping(layout, ptr, "mapping", 'h', false, false, false, false); } -static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_variable_size", DEFAULT_FLAGS, nullptr, ICON_NONE); - // uiItemR(layout, ptr, "f_stop", DEFAULT_FLAGS, nullptr, ICON_NONE); /* UNUSED */ - uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "use_extended_bounds", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, "", ICON_NONE); } static void node_composit_backdrop_viewer( @@ -2246,221 +1235,6 @@ static void node_composit_backdrop_ellipsemask( immUnbindProgram(); } -static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row; - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "x", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(row, ptr, "y", DEFAULT_FLAGS, nullptr, ICON_NONE); - row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - - uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_composite(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_viewer_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "tile_order", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (RNA_enum_get(ptr, "tile_order") == 0) { - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "center_x", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "center_y", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - - uiTemplateID(layout, - C, - ptr, - "mask", - nullptr, - nullptr, - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - uiItemR(layout, ptr, "use_feather", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiItemR(layout, ptr, "size_source", DEFAULT_FLAGS, "", ICON_NONE); - - if (node->custom1 & (CMP_NODEFLAG_MASK_FIXED | CMP_NODEFLAG_MASK_FIXED_SCENE)) { - uiItemR(layout, ptr, "size_x", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "size_y", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - - uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (node->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) { - uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - nullptr, - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (node->id) { - MovieClip *clip = (MovieClip *)node->id; - uiLayout *col; - PointerRNA tracking_ptr; - - RNA_pointer_create(&clip->id, &RNA_MovieTracking, &clip->tracking, &tracking_ptr); - - col = uiLayoutColumn(layout, true); - uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); - } -} - -static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - /* bNode *node = (bNode*)ptr->data; */ /* UNUSED */ - - uiItemR(layout, ptr, "blur_pre", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "screen_balance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "despill_factor", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "despill_balance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "edge_kernel_radius", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "edge_kernel_tolerance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "clip_black", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "clip_white", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "dilate_distance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "feather_falloff", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "feather_distance", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "blur_post", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (node->id) { - MovieClip *clip = (MovieClip *)node->id; - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *object; - uiLayout *col; - PointerRNA tracking_ptr; - NodeTrackPosData *data = (NodeTrackPosData *)node->storage; - - RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr); - - col = uiLayoutColumn(layout, false); - uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); - - object = BKE_tracking_object_get_named(tracking, data->tracking_object); - if (object) { - PointerRNA object_ptr; - - RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr); - - uiItemPointerR(col, ptr, "track_name", &object_ptr, "tracks", "", ICON_ANIM_DATA); - } - else { - uiItemR(layout, ptr, "track_name", DEFAULT_FLAGS, "", ICON_ANIM_DATA); - } - - uiItemR(layout, ptr, "position", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (ELEM(node->custom1, CMP_TRACKPOS_RELATIVE_FRAME, CMP_TRACKPOS_ABSOLUTE_FRAME)) { - uiItemR(layout, ptr, "frame_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - } -} - -static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)node->storage; - - uiTemplateID(layout, - C, - ptr, - "clip", - nullptr, - "CLIP_OT_open", - nullptr, - UI_TEMPLATE_ID_FILTER_ALL, - false, - nullptr); - - if (node->id) { - MovieClip *clip = (MovieClip *)node->id; - MovieTracking *tracking = &clip->tracking; - MovieTrackingObject *object; - uiLayout *col; - PointerRNA tracking_ptr; - - RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr); - - col = uiLayoutColumn(layout, false); - uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); - - object = BKE_tracking_object_get_named(tracking, data->tracking_object); - if (object) { - PointerRNA object_ptr; - - RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr); - - uiItemPointerR( - col, ptr, "plane_track_name", &object_ptr, "plane_tracks", "", ICON_ANIM_DATA); - } - else { - uiItemR(layout, ptr, "plane_track_name", 0, "", ICON_ANIM_DATA); - } - } - - uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_composit_buts_sunbeams(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, "", ICON_NONE); - uiItemR(layout, ptr, "ray_length", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); -} - static void node_composit_buts_cryptomatte_legacy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -2536,31 +1310,6 @@ static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, Pointe uiTemplateCryptoPicker(row, ptr, "remove", ICON_REMOVE); } -static void node_composit_buts_brightcontrast(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_premultiply", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ -#ifndef WITH_OPENIMAGEDENOISE - uiItemL(layout, IFACE_("Disabled, built without OpenImageDenoise"), ICON_ERROR); -#else - /* Always supported through Accelerate framework BNNS on macOS. */ -# ifndef __APPLE__ - if (!BLI_cpu_support_sse41()) { - uiItemL(layout, IFACE_("Disabled, CPU with SSE4.1 is required"), ICON_ERROR); - } -# endif -#endif - - uiItemL(layout, IFACE_("Prefilter:"), ICON_NONE); - uiItemR(layout, ptr, "prefilter", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "use_hdr", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - /* only once called */ static void node_composit_set_butfunc(bNodeType *ntype) { @@ -2569,15 +1318,6 @@ static void node_composit_set_butfunc(bNodeType *ntype) ntype->draw_buttons = node_composit_buts_image; ntype->draw_buttons_ex = node_composit_buts_image_ex; break; - case CMP_NODE_R_LAYERS: - ntype->draw_buttons = node_composit_buts_viewlayers; - break; - case CMP_NODE_NORMAL: - ntype->draw_buttons = node_buts_normal; - break; - case CMP_NODE_CURVE_VEC: - ntype->draw_buttons = node_buts_curvevec; - break; case CMP_NODE_CURVE_RGB: ntype->draw_buttons = node_buts_curvecol; break; @@ -2587,210 +1327,34 @@ static void node_composit_set_butfunc(bNodeType *ntype) case CMP_NODE_RGB: ntype->draw_buttons = node_buts_rgb; break; - case CMP_NODE_FLIP: - ntype->draw_buttons = node_composit_buts_flip; - break; - case CMP_NODE_SPLITVIEWER: - ntype->draw_buttons = node_composit_buts_splitviewer; - break; case CMP_NODE_MIX_RGB: ntype->draw_buttons = node_buts_mix_rgb; break; case CMP_NODE_VALTORGB: ntype->draw_buttons = node_buts_colorramp; break; - case CMP_NODE_CROP: - ntype->draw_buttons = node_composit_buts_crop; - break; - case CMP_NODE_BLUR: - ntype->draw_buttons = node_composit_buts_blur; - break; - case CMP_NODE_DBLUR: - ntype->draw_buttons = node_composit_buts_dblur; - break; - case CMP_NODE_BILATERALBLUR: - ntype->draw_buttons = node_composit_buts_bilateralblur; - break; - case CMP_NODE_DEFOCUS: - ntype->draw_buttons = node_composit_buts_defocus; - break; - case CMP_NODE_ANTIALIASING: - ntype->draw_buttons = node_composit_buts_antialiasing; - break; - case CMP_NODE_GLARE: - ntype->draw_buttons = node_composit_buts_glare; - break; - case CMP_NODE_TONEMAP: - ntype->draw_buttons = node_composit_buts_tonemap; - break; - case CMP_NODE_LENSDIST: - ntype->draw_buttons = node_composit_buts_lensdist; - break; - case CMP_NODE_VECBLUR: - ntype->draw_buttons = node_composit_buts_vecblur; - break; - case CMP_NODE_FILTER: - ntype->draw_buttons = node_composit_buts_filter; - break; - case CMP_NODE_MAP_VALUE: - ntype->draw_buttons = node_composit_buts_map_value; - break; - case CMP_NODE_MAP_RANGE: - ntype->draw_buttons = node_composit_buts_map_range; - break; case CMP_NODE_TIME: ntype->draw_buttons = node_buts_time; break; - case CMP_NODE_ALPHAOVER: - ntype->draw_buttons = node_composit_buts_alphaover; - break; case CMP_NODE_TEXTURE: ntype->draw_buttons = node_buts_texture; break; - case CMP_NODE_DILATEERODE: - ntype->draw_buttons = node_composit_buts_dilateerode; - break; - case CMP_NODE_INPAINT: - ntype->draw_buttons = node_composit_buts_inpaint; - break; - case CMP_NODE_DESPECKLE: - ntype->draw_buttons = node_composit_buts_despeckle; - break; - case CMP_NODE_OUTPUT_FILE: - ntype->draw_buttons = node_composit_buts_file_output; - ntype->draw_buttons_ex = node_composit_buts_file_output_ex; - break; - case CMP_NODE_DIFF_MATTE: - ntype->draw_buttons = node_composit_buts_diff_matte; - break; - case CMP_NODE_DIST_MATTE: - ntype->draw_buttons = node_composit_buts_distance_matte; - break; - case CMP_NODE_COLOR_SPILL: - ntype->draw_buttons = node_composit_buts_color_spill; - break; - case CMP_NODE_CHROMA_MATTE: - ntype->draw_buttons = node_composit_buts_chroma_matte; - break; - case CMP_NODE_COLOR_MATTE: - ntype->draw_buttons = node_composit_buts_color_matte; - break; - case CMP_NODE_SCALE: - ntype->draw_buttons = node_composit_buts_scale; - break; - case CMP_NODE_ROTATE: - ntype->draw_buttons = node_composit_buts_rotate; - break; - case CMP_NODE_CHANNEL_MATTE: - ntype->draw_buttons = node_composit_buts_channel_matte; - break; - case CMP_NODE_LUMA_MATTE: - ntype->draw_buttons = node_composit_buts_luma_matte; - break; - case CMP_NODE_MAP_UV: - ntype->draw_buttons = node_composit_buts_map_uv; - break; - case CMP_NODE_ID_MASK: - ntype->draw_buttons = node_composit_buts_id_mask; - break; - case CMP_NODE_DOUBLEEDGEMASK: - ntype->draw_buttons = node_composit_buts_double_edge_mask; - break; case CMP_NODE_MATH: ntype->draw_buttons = node_buts_math; break; - case CMP_NODE_INVERT: - ntype->draw_buttons = node_composit_buts_invert; - break; - case CMP_NODE_PREMULKEY: - ntype->draw_buttons = node_composit_buts_premulkey; - break; - case CMP_NODE_VIEW_LEVELS: - ntype->draw_buttons = node_composit_buts_view_levels; - break; - case CMP_NODE_COLORBALANCE: - ntype->draw_buttons = node_composit_buts_colorbalance; - ntype->draw_buttons_ex = node_composit_buts_colorbalance_ex; - break; case CMP_NODE_HUECORRECT: ntype->draw_buttons = node_composit_buts_huecorrect; break; - case CMP_NODE_ZCOMBINE: - ntype->draw_buttons = node_composit_buts_zcombine; - break; case CMP_NODE_COMBYCCA: case CMP_NODE_SEPYCCA: ntype->draw_buttons = node_composit_buts_ycc; break; - case CMP_NODE_MOVIECLIP: - ntype->draw_buttons = node_composit_buts_movieclip; - ntype->draw_buttons_ex = node_composit_buts_movieclip_ex; - break; - case CMP_NODE_STABILIZE2D: - ntype->draw_buttons = node_composit_buts_stabilize2d; - break; - case CMP_NODE_TRANSFORM: - ntype->draw_buttons = node_composit_buts_transform; - break; - case CMP_NODE_TRANSLATE: - ntype->draw_buttons = node_composit_buts_translate; - break; - case CMP_NODE_MOVIEDISTORTION: - ntype->draw_buttons = node_composit_buts_moviedistortion; - break; - case CMP_NODE_COLORCORRECTION: - ntype->draw_buttons = node_composit_buts_colorcorrection; - ntype->draw_buttons_ex = node_composit_buts_colorcorrection_ex; - break; - case CMP_NODE_SETALPHA: - ntype->draw_buttons = node_composit_buts_set_alpha; - break; - case CMP_NODE_SWITCH: - ntype->draw_buttons = node_composit_buts_switch; - break; - case CMP_NODE_SWITCH_VIEW: - ntype->draw_buttons_ex = node_composit_buts_switch_view_ex; - break; case CMP_NODE_MASK_BOX: - ntype->draw_buttons = node_composit_buts_boxmask; ntype->draw_backdrop = node_composit_backdrop_boxmask; break; case CMP_NODE_MASK_ELLIPSE: - ntype->draw_buttons = node_composit_buts_ellipsemask; ntype->draw_backdrop = node_composit_backdrop_ellipsemask; break; - case CMP_NODE_BOKEHIMAGE: - ntype->draw_buttons = node_composit_buts_bokehimage; - break; - case CMP_NODE_BOKEHBLUR: - ntype->draw_buttons = node_composit_buts_bokehblur; - break; - case CMP_NODE_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->draw_buttons = node_composit_buts_composite; - break; - case CMP_NODE_MASK: - ntype->draw_buttons = node_composit_buts_mask; - break; - case CMP_NODE_KEYINGSCREEN: - ntype->draw_buttons = node_composit_buts_keyingscreen; - break; - case CMP_NODE_KEYING: - ntype->draw_buttons = node_composit_buts_keying; - break; - case CMP_NODE_TRACKPOS: - ntype->draw_buttons = node_composit_buts_trackpos; - break; - case CMP_NODE_PLANETRACKDEFORM: - ntype->draw_buttons = node_composit_buts_planetrackdeform; - break; - case CMP_NODE_SUNBEAMS: - ntype->draw_buttons = node_composit_buts_sunbeams; - break; case CMP_NODE_CRYPTOMATTE: ntype->draw_buttons = node_composit_buts_cryptomatte; break; @@ -2798,11 +1362,8 @@ static void node_composit_set_butfunc(bNodeType *ntype) ntype->draw_buttons = node_composit_buts_cryptomatte_legacy; ntype->draw_buttons_ex = node_composit_buts_cryptomatte_legacy_ex; break; - case CMP_NODE_BRIGHTCONTRAST: - ntype->draw_buttons = node_composit_buts_brightcontrast; - break; - case CMP_NODE_DENOISE: - ntype->draw_buttons = node_composit_buts_denoise; + case CMP_NODE_VIEWER: + ntype->draw_backdrop = node_composit_backdrop_viewer; break; } } diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc index b971b26aa6f..5e6d59edfd5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** ALPHAOVER ******************** */ @@ -42,12 +45,22 @@ static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) node->storage = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); } +static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "use_premultiply", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "premul", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_alphaover() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_alphaover_declare; + ntype.draw_buttons = node_composit_buts_alphaover; node_type_init(&ntype, node_alphaover_init); node_type_storage( &ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index a498033733f..02b2652ed6a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -23,6 +23,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Anti-Aliasing (SMAA 1x) ******************** */ @@ -49,6 +52,17 @@ static void node_composit_init_antialiasing(bNodeTree *UNUSED(ntree), bNode *nod node->storage = data; } +static void node_composit_buts_antialiasing(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + + uiItemR(col, ptr, "threshold", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "contrast_limit", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "corner_rounding", 0, nullptr, ICON_NONE); +} + void register_node_type_cmp_antialiasing() { static bNodeType ntype; @@ -56,6 +70,7 @@ void register_node_type_cmp_antialiasing() cmp_node_type_base( &ntype, CMP_NODE_ANTIALIASING, "Anti-Aliasing", NODE_CLASS_OP_FILTER, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_antialiasing_declare; + ntype.draw_buttons = node_composit_buts_antialiasing; node_type_size(&ntype, 170, 140, 200); node_type_init(&ntype, node_composit_init_antialiasing); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index 7ec28fba460..3f107a13a44 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** BILATERALBLUR ******************** */ @@ -46,12 +49,25 @@ static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *no nbbd->sigma_space = 5.0; } +static void node_composit_buts_bilateralblur(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "iterations", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "sigma_color", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "sigma_space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_bilateralblur() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BILATERALBLUR, "Bilateral Blur", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_bilateralblur_declare; + ntype.draw_buttons = node_composit_buts_bilateralblur; node_type_init(&ntype, node_composit_init_bilateralblur); node_type_storage( &ntype, "NodeBilateralBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index 274c2567749..bcc8c786ae5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -22,6 +22,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** BLUR ******************** */ @@ -44,12 +49,54 @@ static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col, *row; + + col = uiLayoutColumn(layout, false); + const int filter = RNA_enum_get(ptr, "filter_type"); + const int reference = RNA_boolean_get(ptr, "use_variable_size"); + + uiItemR(col, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + if (filter != R_FILTER_FAST_GAUSS) { + uiItemR(col, ptr, "use_variable_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (!reference) { + uiItemR(col, ptr, "use_bokeh", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + uiItemR(col, ptr, "use_gamma_correction", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + + uiItemR(col, ptr, "use_relative", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_boolean_get(ptr, "use_relative")) { + uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE); + row = uiLayoutRow(layout, true); + uiItemR(row, + ptr, + "aspect_correction", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "factor_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("X"), ICON_NONE); + uiItemR(col, ptr, "factor_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Y"), ICON_NONE); + } + else { + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "size_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("X"), ICON_NONE); + uiItemR(col, ptr, "size_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Y"), ICON_NONE); + } + uiItemR(col, ptr, "use_extended_bounds", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_blur() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BLUR, "Blur", NODE_CLASS_OP_FILTER, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_blur_declare; + ntype.draw_buttons = node_composit_buts_blur; node_type_init(&ntype, node_composit_init_blur); node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc index b5f3f7c9a1e..d0659f6a51e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehblur.cc @@ -22,6 +22,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** BLUR ******************** */ @@ -45,12 +48,21 @@ static void node_composit_init_bokehblur(bNodeTree *UNUSED(ntree), bNode *node) node->custom4 = 16.0f; } +static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_variable_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + // uiItemR(layout, ptr, "f_stop", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); /* UNUSED */ + uiItemR(layout, ptr, "blur_max", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_extended_bounds", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_bokehblur() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_bokehblur_declare; + ntype.draw_buttons = node_composit_buts_bokehblur; node_type_init(&ntype, node_composit_init_bokehblur); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc index ad4cbb47a77..8817a07a422 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** Bokeh image Tools ******************** */ @@ -45,12 +48,28 @@ static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "flaps", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "angle", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR( + layout, ptr, "rounding", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(layout, + ptr, + "catadioptric", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(layout, ptr, "shift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_bokehimage() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_bokehimage_declare; + ntype.draw_buttons = node_composit_buts_bokehimage; node_type_init(&ntype, node_composit_init_bokehimage); node_type_storage( &ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index e423bd051fe..40859922154 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** SCALAR MATH ******************** */ @@ -47,12 +50,29 @@ static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + + row = uiLayoutRow(layout, true); + uiItemR(row, ptr, "x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + row = uiLayoutRow(layout, true); + uiItemR(row, ptr, "width", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "height", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "rotation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_boxmask() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MASK_BOX, "Box Mask", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_boxmask_declare; + ntype.draw_buttons = node_composit_buts_boxmask; node_type_init(&ntype, node_composit_init_boxmask); node_type_storage(&ntype, "NodeBoxMask", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_brightness.cc b/source/blender/nodes/composite/nodes/node_composite_brightness.cc index 69af3fdca10..ca03a9b4fbf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_brightness.cc +++ b/source/blender/nodes/composite/nodes/node_composite_brightness.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Bright and Contrast ******************** */ @@ -42,12 +45,20 @@ static void node_composit_init_brightcontrast(bNodeTree *UNUSED(ntree), bNode *n node->custom1 = 1; } +static void node_composit_buts_brightcontrast(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_premultiply", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_brightcontrast() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_brightcontrast_declare; + ntype.draw_buttons = node_composit_buts_brightcontrast; node_type_init(&ntype, node_composit_init_brightcontrast); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc index ec569a27bf8..1b4be78c71b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Channel Matte Node ********************************* */ @@ -51,6 +56,47 @@ static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *no node->custom2 = 2; /* Green Channel. */ } +static void node_composit_buts_channel_matte(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *col, *row; + + uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiItemR( + row, ptr, "color_space", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemL(col, IFACE_("Key Channel:"), ICON_NONE); + row = uiLayoutRow(col, false); + uiItemR(row, + ptr, + "matte_channel", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + + col = uiLayoutColumn(layout, false); + + uiItemR(col, ptr, "limit_method", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (RNA_enum_get(ptr, "limit_method") == 0) { + uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); + row = uiLayoutRow(col, false); + uiItemR(row, + ptr, + "limit_channel", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + } + + uiItemR( + col, ptr, "limit_max", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR( + col, ptr, "limit_min", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_channel_matte() { static bNodeType ntype; @@ -58,6 +104,7 @@ void register_node_type_cmp_channel_matte() cmp_node_type_base( &ntype, CMP_NODE_CHANNEL_MATTE, "Channel Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_channel_matte_declare; + ntype.draw_buttons = node_composit_buts_channel_matte; node_type_init(&ntype, node_composit_init_channel_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc index 02e2a24989b..a7e3a1c148f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Chroma Key ********************************************************** */ @@ -48,12 +51,29 @@ static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *nod c->fstrength = 1.0f; } +static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, true); + /* Removed for now. */ + // uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + /* Removed for now. */ + // uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_chroma_matte() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CHROMA_MATTE, "Chroma Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_chroma_matte_declare; + ntype.draw_buttons = node_composit_buts_chroma_matte; node_type_init(&ntype, node_composit_init_chroma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc index 564e9dbbff4..367b046f3f6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Color Matte ********************************************************** */ @@ -48,12 +51,30 @@ static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node c->fstrength = 1.0f; } +static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR( + col, ptr, "color_hue", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, + ptr, + "color_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR( + col, ptr, "color_value", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_color_matte() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLOR_MATTE, "Color Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_color_matte_declare; + ntype.draw_buttons = node_composit_buts_color_matte; node_type_init(&ntype, node_composit_init_color_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc index 2e5735414bd..e136041cf6e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Color Spill Suppression ********************************* */ @@ -47,12 +52,59 @@ static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node ncs->unspill = 0; /* do not use unspill */ } +static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row, *col; + + uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "channel", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "limit_method", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "limit_method") == 0) { + uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); + row = uiLayoutRow(col, false); + uiItemR(row, + ptr, + "limit_channel", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + } + + uiItemR(col, ptr, "ratio", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_unspill", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (RNA_boolean_get(ptr, "use_unspill") == true) { + uiItemR(col, + ptr, + "unspill_red", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(col, + ptr, + "unspill_green", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(col, + ptr, + "unspill_blue", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + } +} + void register_node_type_cmp_color_spill() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLOR_SPILL, "Color Spill", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_color_spill_declare; + ntype.draw_buttons = node_composit_buts_color_spill; node_type_init(&ntype, node_composit_init_color_spill); node_type_storage( &ntype, "NodeColorspill", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc index 1de8c486afb..a35b3d813e6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Color Balance ********************************* */ @@ -79,12 +84,88 @@ static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *nod node->storage = n; } +static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *split, *col, *row; + + uiItemR(layout, ptr, "correction_method", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "correction_method") == 0) { + + split = uiLayoutSplit(layout, 0.0f, false); + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "lift", true, true, false, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "lift", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "gamma", true, true, true, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "gamma", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "gain", true, true, true, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "gain", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + else { + + split = uiLayoutSplit(layout, 0.0f, false); + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "offset", true, true, false, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "offset_basis", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "power", true, true, false, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "power", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(split, false); + uiTemplateColorPicker(col, ptr, "slope", true, true, false, true); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "slope", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + +static void node_composit_buts_colorbalance_ex(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "correction_method", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "correction_method") == 0) { + + uiTemplateColorPicker(layout, ptr, "lift", true, true, false, true); + uiItemR(layout, ptr, "lift", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiTemplateColorPicker(layout, ptr, "gamma", true, true, true, true); + uiItemR(layout, ptr, "gamma", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiTemplateColorPicker(layout, ptr, "gain", true, true, true, true); + uiItemR(layout, ptr, "gain", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + else { + uiTemplateColorPicker(layout, ptr, "offset", true, true, false, true); + uiItemR(layout, ptr, "offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiTemplateColorPicker(layout, ptr, "power", true, true, false, true); + uiItemR(layout, ptr, "power", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiTemplateColorPicker(layout, ptr, "slope", true, true, false, true); + uiItemR(layout, ptr, "slope", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_colorbalance() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLORBALANCE, "Color Balance", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_colorbalance_declare; + ntype.draw_buttons = node_composit_buts_colorbalance; + ntype.draw_buttons_ex = node_composit_buts_colorbalance_ex; node_type_size(&ntype, 400, 200, 400); node_type_init(&ntype, node_composit_init_colorbalance); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc index 32f4a7dc1ae..e3bba3b6c4f 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Color Correction ********************************* */ @@ -66,12 +69,230 @@ static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode * node->storage = n; } +static void node_composit_buts_colorcorrection(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *row; + + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "red", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "green", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "blue", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemL(row, "", ICON_NONE); + uiItemL(row, IFACE_("Saturation"), ICON_NONE); + uiItemL(row, IFACE_("Contrast"), ICON_NONE); + uiItemL(row, IFACE_("Gamma"), ICON_NONE); + uiItemL(row, IFACE_("Gain"), ICON_NONE); + uiItemL(row, IFACE_("Lift"), ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemL(row, IFACE_("Master"), ICON_NONE); + uiItemR( + row, ptr, "master_saturation", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR( + row, ptr, "master_contrast", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "master_gamma", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "master_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "master_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemL(row, IFACE_("Highlights"), ICON_NONE); + uiItemR(row, + ptr, + "highlights_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + "", + ICON_NONE); + uiItemR(row, + ptr, + "highlights_contrast", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + "", + ICON_NONE); + uiItemR( + row, ptr, "highlights_gamma", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR( + row, ptr, "highlights_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR( + row, ptr, "highlights_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemL(row, IFACE_("Midtones"), ICON_NONE); + uiItemR(row, + ptr, + "midtones_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + "", + ICON_NONE); + uiItemR( + row, ptr, "midtones_contrast", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR( + row, ptr, "midtones_gamma", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "midtones_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "midtones_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemL(row, IFACE_("Shadows"), ICON_NONE); + uiItemR(row, + ptr, + "shadows_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + "", + ICON_NONE); + uiItemR( + row, ptr, "shadows_contrast", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "shadows_gamma", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "shadows_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + uiItemR(row, ptr, "shadows_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, "", ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemR(row, + ptr, + "midtones_start", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR( + row, ptr, "midtones_end", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + +static void node_composit_buts_colorcorrection_ex(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *row; + + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "red", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "green", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "blue", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + row = layout; + uiItemL(row, IFACE_("Saturation"), ICON_NONE); + uiItemR(row, + ptr, + "master_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "highlights_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "midtones_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "shadows_saturation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + + uiItemL(row, IFACE_("Contrast"), ICON_NONE); + uiItemR(row, + ptr, + "master_contrast", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "highlights_contrast", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "midtones_contrast", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "shadows_contrast", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + + uiItemL(row, IFACE_("Gamma"), ICON_NONE); + uiItemR( + row, ptr, "master_gamma", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, + ptr, + "highlights_gamma", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "midtones_gamma", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "shadows_gamma", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + + uiItemL(row, IFACE_("Gain"), ICON_NONE); + uiItemR( + row, ptr, "master_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, + ptr, + "highlights_gain", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "midtones_gain", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR( + row, ptr, "shadows_gain", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + + uiItemL(row, IFACE_("Lift"), ICON_NONE); + uiItemR( + row, ptr, "master_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, + ptr, + "highlights_lift", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR(row, + ptr, + "midtones_lift", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + uiItemR( + row, ptr, "shadows_lift", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "midtones_start", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_end", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_colorcorrection() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COLORCORRECTION, "Color Correction", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_colorcorrection_declare; + ntype.draw_buttons = node_composit_buts_colorcorrection; + ntype.draw_buttons_ex = node_composit_buts_colorcorrection_ex; node_type_size(&ntype, 400, 200, 600); node_type_init(&ntype, node_composit_init_colorcorrection); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_composite.cc b/source/blender/nodes/composite/nodes/node_composite_composite.cc index d4558d717e8..547e5123579 100644 --- a/source/blender/nodes/composite/nodes/node_composite_composite.cc +++ b/source/blender/nodes/composite/nodes/node_composite_composite.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** COMPOSITE ******************** */ @@ -36,13 +39,18 @@ static void cmp_node_composite_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_composite(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_composite() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_COMPOSITE, "Composite", NODE_CLASS_OUTPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_composite_declare; - + ntype.draw_buttons = node_composit_buts_composite; ntype.no_muting = true; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc index 73c4eb85259..fa33caa4c0e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Crop ******************** */ @@ -45,12 +50,35 @@ static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) nxy->y2 = 0; } +static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + uiItemR(layout, ptr, "use_crop_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "relative", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, true); + if (RNA_boolean_get(ptr, "relative")) { + uiItemR(col, ptr, "rel_min_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Left"), ICON_NONE); + uiItemR(col, ptr, "rel_max_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Right"), ICON_NONE); + uiItemR(col, ptr, "rel_min_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Up"), ICON_NONE); + uiItemR(col, ptr, "rel_max_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Down"), ICON_NONE); + } + else { + uiItemR(col, ptr, "min_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Left"), ICON_NONE); + uiItemR(col, ptr, "max_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Right"), ICON_NONE); + uiItemR(col, ptr, "min_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Up"), ICON_NONE); + uiItemR(col, ptr, "max_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Down"), ICON_NONE); + } +} + void register_node_type_cmp_crop() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CROP, "Crop", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_crop_declare; + ntype.draw_buttons = node_composit_buts_crop; node_type_init(&ntype, node_composit_init_crop); node_type_storage(&ntype, "NodeTwoXYs", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_curves.cc b/source/blender/nodes/composite/nodes/node_composite_curves.cc index 53d721ce616..518b57dc405 100644 --- a/source/blender/nodes/composite/nodes/node_composite_curves.cc +++ b/source/blender/nodes/composite/nodes/node_composite_curves.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** CURVE Time ******************** */ @@ -72,12 +75,18 @@ static void node_composit_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) node->storage = BKE_curvemapping_add(3, -1.0f, -1.0f, 1.0f, 1.0f); } +static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiTemplateCurveMapping(layout, ptr, "mapping", 'v', false, false, false, false); +} + void register_node_type_cmp_curve_vec() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_CURVE_VEC, "Vector Curves", NODE_CLASS_OP_VECTOR, 0); ntype.declare = blender::nodes::cmp_node_curve_vec_declare; + ntype.draw_buttons = node_buts_curvevec; node_type_size(&ntype, 200, 140, 320); node_type_init(&ntype, node_composit_init_curve_vec); node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves); diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index 1d8a02e463c..0ee8a8da1e8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -21,10 +21,15 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" - #include +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "node_composite_util.hh" + /* ************ Defocus Node ****************** */ namespace blender::nodes { @@ -55,12 +60,52 @@ static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) node->storage = nbd; } +static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiLayout *sub, *col; + + col = uiLayoutColumn(layout, false); + uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE); + uiItemR(col, ptr, "bokeh", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(col, ptr, "angle", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "use_gamma_correction", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_zbuffer") == true); + uiItemR(col, ptr, "f_stop", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "blur_max", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "use_preview", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiTemplateID(layout, + C, + ptr, + "scene", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "use_zbuffer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_zbuffer") == false); + uiItemR(sub, ptr, "z_scale", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_defocus() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DEFOCUS, "Defocus", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_defocus_declare; + ntype.draw_buttons = node_composit_buts_defocus; node_type_init(&ntype, node_composit_init_defocus); node_type_storage(&ntype, "NodeDefocus", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index 2c07dbb3d81..f1e5388a7a3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -23,6 +23,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -49,12 +52,31 @@ static void node_composit_init_denonise(bNodeTree *UNUSED(ntree), bNode *node) node->storage = ndg; } +static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ +#ifndef WITH_OPENIMAGEDENOISE + uiItemL(layout, IFACE_("Disabled, built without OpenImageDenoise"), ICON_ERROR); +#else + /* Always supported through Accelerate framework BNNS on macOS. */ +# ifndef __APPLE__ + if (!BLI_cpu_support_sse41()) { + uiItemL(layout, IFACE_("Disabled, CPU with SSE4.1 is required"), ICON_ERROR); + } +# endif +#endif + + uiItemL(layout, IFACE_("Prefilter:"), ICON_NONE); + uiItemR(layout, ptr, "prefilter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_hdr", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_denoise() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DENOISE, "Denoise", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_denoise_declare; + ntype.draw_buttons = node_composit_buts_denoise; node_type_init(&ntype, node_composit_init_denonise); node_type_storage(&ntype, "NodeDenoise", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc index 070c38feaa8..411bad14f25 100644 --- a/source/blender/nodes/composite/nodes/node_composite_despeckle.cc +++ b/source/blender/nodes/composite/nodes/node_composite_despeckle.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** FILTER ******************** */ @@ -42,12 +45,22 @@ static void node_composit_init_despeckle(bNodeTree *UNUSED(ntree), bNode *node) node->custom4 = 0.5f; } +static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "threshold_neighbor", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_despeckle() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DESPECKLE, "Despeckle", NODE_CLASS_OP_FILTER, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_despeckle_declare; + ntype.draw_buttons = node_composit_buts_despeckle; node_type_init(&ntype, node_composit_init_despeckle); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc index bfec3dadd09..a9e3258c8fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* channel Difference Matte ********************************* */ @@ -45,6 +48,16 @@ static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) c->t2 = 0.1f; } +static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR( + col, ptr, "tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_diff_matte() { static bNodeType ntype; @@ -52,6 +65,7 @@ void register_node_type_cmp_diff_matte() cmp_node_type_base( &ntype, CMP_NODE_DIFF_MATTE, "Difference Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_diff_matte_declare; + ntype.draw_buttons = node_composit_buts_diff_matte; node_type_init(&ntype, node_composit_init_diff_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index 14e618435d1..1af2bb0433b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Dilate/Erode ******************** */ @@ -43,11 +48,26 @@ static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node node->storage = data; } +static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + switch (RNA_enum_get(ptr, "mode")) { + case CMP_NODE_DILATEERODE_DISTANCE_THRESH: + uiItemR(layout, ptr, "edge", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + break; + case CMP_NODE_DILATEERODE_DISTANCE_FEATHER: + uiItemR(layout, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + break; + } +} + void register_node_type_cmp_dilateerode() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DILATEERODE, "Dilate/Erode", NODE_CLASS_OP_FILTER, 0); + ntype.draw_buttons = node_composit_buts_dilateerode; ntype.declare = blender::nodes::cmp_node_dilate_declare; node_type_init(&ntype, node_composit_init_dilateerode); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index cbc2484ceb8..36b130d55a4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -42,12 +45,37 @@ static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node) ndbd->center_y = 0.5; } +static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + uiItemR(layout, ptr, "iterations", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_wrap", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemL(col, IFACE_("Center:"), ICON_NONE); + uiItemR(col, ptr, "center_x", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("X"), ICON_NONE); + uiItemR(col, ptr, "center_y", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Y"), ICON_NONE); + + uiItemS(layout); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "angle", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiItemS(layout); + + uiItemR(layout, ptr, "spin", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "zoom", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_dblur() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DBLUR, "Directional Blur", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_directional_blur_declare; + ntype.draw_buttons = node_composit_buts_dblur; node_type_init(&ntype, node_composit_init_dblur); node_type_storage( &ntype, "NodeDBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc index 302170081bb..47a48ed141e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* channel Distance Matte ********************************* */ @@ -46,12 +49,30 @@ static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *n c->t2 = 0.1f; } +static void node_composit_buts_distance_matte(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *col, *row; + + col = uiLayoutColumn(layout, true); + + uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "channel", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + + uiItemR( + col, ptr, "tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_distance_matte() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_DIST_MATTE, "Distance Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_distance_matte_declare; + ntype.draw_buttons = node_composit_buts_distance_matte; node_type_init(&ntype, node_composit_init_distance_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc index ce4532366a3..4fde539e6fb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_doubleEdgeMask.cc @@ -20,6 +20,10 @@ /** \file * \ingroup cmpnodes */ + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Double Edge Mask ******************** */ @@ -35,12 +39,27 @@ static void cmp_node_double_edge_mask_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_double_edge_mask(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + + uiItemL(col, IFACE_("Inner Edge:"), ICON_NONE); + uiItemR(col, ptr, "inner_mode", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemL(col, IFACE_("Buffer Edge:"), ICON_NONE); + uiItemR(col, ptr, "edge_mode", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_doubleedgemask() { static bNodeType ntype; /* Allocate a node type data structure. */ cmp_node_type_base(&ntype, CMP_NODE_DOUBLEEDGEMASK, "Double Edge Mask", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_double_edge_mask_declare; + ntype.draw_buttons = node_composit_buts_double_edge_mask; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index 5f49357107c..8eb89e53790 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** SCALAR MATH ******************** */ @@ -48,12 +51,27 @@ static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node node->storage = data; } +static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + row = uiLayoutRow(layout, true); + uiItemR(row, ptr, "x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(row, ptr, "y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + row = uiLayoutRow(layout, true); + uiItemR(row, ptr, "width", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "height", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "rotation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "mask_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_ellipsemask() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MASK_ELLIPSE, "Ellipse Mask", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_ellipsemask_declare; + ntype.draw_buttons = node_composit_buts_ellipsemask; node_type_size(&ntype, 260, 110, 320); node_type_init(&ntype, node_composit_init_ellipsemask); node_type_storage( diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc index 4258bd977e0..3671d502539 100644 --- a/source/blender/nodes/composite/nodes/node_composite_filter.cc +++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** FILTER ******************** */ @@ -36,12 +39,18 @@ static void cmp_node_filter_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_filter() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_filter_declare; + ntype.draw_buttons = node_composit_buts_filter; ntype.labelfunc = node_filter_label; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_flip.cc b/source/blender/nodes/composite/nodes/node_composite_flip.cc index 95a00dd58da..38bc0f8b855 100644 --- a/source/blender/nodes/composite/nodes/node_composite_flip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_flip.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Flip ******************** */ @@ -35,12 +38,18 @@ static void cmp_node_flip_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_flip(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "axis", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_flip() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_FLIP, "Flip", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_flip_declare; + ntype.draw_buttons = node_composit_buts_flip; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index d3a5fff0b68..adaf22395c3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -50,12 +55,51 @@ static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) node->storage = ndg; } +static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "glare_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "quality", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + + if (RNA_enum_get(ptr, "glare_type") != 1) { + uiItemR(layout, ptr, "iterations", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "glare_type") != 0) { + uiItemR(layout, + ptr, + "color_modulation", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); + } + } + + uiItemR(layout, ptr, "mix", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "threshold", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "glare_type") == 2) { + uiItemR(layout, ptr, "streaks", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "angle_offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + if (RNA_enum_get(ptr, "glare_type") == 0 || RNA_enum_get(ptr, "glare_type") == 2) { + uiItemR( + layout, ptr, "fade", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + + if (RNA_enum_get(ptr, "glare_type") == 0) { + uiItemR(layout, ptr, "use_rotate_45", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + } + if (RNA_enum_get(ptr, "glare_type") == 1) { + uiItemR(layout, ptr, "size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_glare() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_GLARE, "Glare", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_glare_declare; + ntype.draw_buttons = node_composit_buts_glare; node_type_init(&ntype, node_composit_init_glare); node_type_storage(&ntype, "NodeGlare", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_idMask.cc b/source/blender/nodes/composite/nodes/node_composite_idMask.cc index be7d4e22aba..f5b8cb6c567 100644 --- a/source/blender/nodes/composite/nodes/node_composite_idMask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_idMask.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** ID Mask ******************** */ @@ -35,12 +38,19 @@ static void cmp_node_idmask_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "index", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_antialiasing", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_idmask() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ID_MASK, "ID Mask", NODE_CLASS_CONVERTER, 0); ntype.declare = blender::nodes::cmp_node_idmask_declare; + ntype.draw_buttons = node_composit_buts_id_mask; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 18f919edbe9..8e3cc9bcd95 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -26,16 +26,21 @@ #include "BLI_linklist.h" #include "BLI_utildefines.h" -#include "DNA_scene_types.h" - -#include "RE_engine.h" - #include "BKE_context.h" #include "BKE_global.h" #include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_scene.h" +#include "DNA_scene_types.h" + +#include "RE_engine.h" + +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + /* **************** IMAGE (and RenderResult, multilayer image) ******************** */ static bNodeSocketTemplate cmp_node_rlayers_out[] = { @@ -555,12 +560,56 @@ static void cmp_node_rlayers_update(bNodeTree *ntree, bNode *node) cmp_node_update_default(ntree, node); } +static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + uiLayout *col, *row; + + uiTemplateID(layout, + C, + ptr, + "scene", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (!node->id) { + return; + } + + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, true); + uiItemR(row, ptr, "layer", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + + PropertyRNA *prop = RNA_struct_find_property(ptr, "layer"); + const char *layer_name; + if (!(RNA_property_enum_identifier( + C, ptr, prop, RNA_property_enum_get(ptr, prop), &layer_name))) { + return; + } + + PointerRNA scn_ptr; + char scene_name[MAX_ID_NAME - 2]; + scn_ptr = RNA_pointer_get(ptr, "scene"); + RNA_string_get(&scn_ptr, "name", scene_name); + + PointerRNA op_ptr; + uiItemFullO( + row, "RENDER_OT_render", "", ICON_RENDER_STILL, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + RNA_string_set(&op_ptr, "layer", layer_name); + RNA_string_set(&op_ptr, "scene", scene_name); +} + void register_node_type_cmp_rlayers() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_R_LAYERS, "Render Layers", NODE_CLASS_INPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, nullptr, cmp_node_rlayers_out); + ntype.draw_buttons = node_composit_buts_viewlayers; ntype.initfunc_api = node_composit_init_rlayers; ntype.poll = node_composit_poll_rlayers; node_type_storage(&ntype, nullptr, node_composit_free_rlayers, node_composit_copy_rlayers); diff --git a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc index c7674263b68..976b1cd5a15 100644 --- a/source/blender/nodes/composite/nodes/node_composite_inpaint.cc +++ b/source/blender/nodes/composite/nodes/node_composite_inpaint.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Inpaint/ ******************** */ @@ -35,12 +38,18 @@ static void cmp_node_inpaint_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_inpaint(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_inpaint() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_INPAINT, "Inpaint", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_inpaint_declare; + ntype.draw_buttons = node_composit_buts_inpaint; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_invert.cc b/source/blender/nodes/composite/nodes/node_composite_invert.cc index caf28d24b44..2243608d5c3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_invert.cc +++ b/source/blender/nodes/composite/nodes/node_composite_invert.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** INVERT ******************** */ @@ -41,6 +44,15 @@ static void node_composit_init_invert(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 |= CMP_CHAN_RGB; } +static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "invert_rgb", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "invert_alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + /* custom1 = mix type */ void register_node_type_cmp_invert() { @@ -48,6 +60,7 @@ void register_node_type_cmp_invert() cmp_node_type_base(&ntype, CMP_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_invert_declare; + ntype.draw_buttons = node_composit_buts_invert; node_type_init(&ntype, node_composit_init_invert); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index 6286c61b292..de1da3289f9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -21,11 +21,14 @@ * \ingroup cmpnodes */ +#include "BLI_math_base.h" + #include "BLT_translation.h" #include "DNA_movieclip_types.h" -#include "BLI_math_base.h" +#include "UI_interface.h" +#include "UI_resources.h" #include "node_composite_util.hh" @@ -60,12 +63,31 @@ static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + /* bNode *node = (bNode*)ptr->data; */ /* UNUSED */ + + uiItemR(layout, ptr, "blur_pre", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "screen_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_factor", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_balance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_tolerance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_black", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_white", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "dilate_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_distance", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "blur_post", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_keying() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_KEYING, "Keying", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_keying_declare; + ntype.draw_buttons = node_composit_buts_keying; node_type_init(&ntype, node_composit_init_keying); node_type_storage( &ntype, "NodeKeyingData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc index f0423497bed..d90fbe05211 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -26,6 +26,11 @@ #include "BLI_math_base.h" #include "BLI_math_color.h" +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Keying Screen ******************** */ @@ -46,12 +51,40 @@ static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *nod node->storage = data; } +static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (node->id) { + MovieClip *clip = (MovieClip *)node->id; + uiLayout *col; + PointerRNA tracking_ptr; + + RNA_pointer_create(&clip->id, &RNA_MovieTracking, &clip->tracking, &tracking_ptr); + + col = uiLayoutColumn(layout, true); + uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); + } +} + void register_node_type_cmp_keyingscreen() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_KEYINGSCREEN, "Keying Screen", NODE_CLASS_MATTE, 0); ntype.declare = blender::nodes::cmp_node_keyingscreen_declare; + ntype.draw_buttons = node_composit_buts_keyingscreen; node_type_init(&ntype, node_composit_init_keyingscreen); node_type_storage( &ntype, "NodeKeyingScreenData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index bd52328db0f..11ee0cf0aa3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -42,12 +47,26 @@ static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) node->storage = nld; } +static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "use_projector", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(col, false); + uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector") == false); + uiItemR(col, ptr, "use_jitter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_fit", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_lensdist() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_lensdist_declare; + ntype.draw_buttons = node_composit_buts_lensdist; node_type_init(&ntype, node_composit_init_lensdist); node_type_storage( &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.cc b/source/blender/nodes/composite/nodes/node_composite_levels.cc index c36e0153991..891f79f9bf9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.cc +++ b/source/blender/nodes/composite/nodes/node_composite_levels.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** LEVELS ******************** */ @@ -41,12 +44,18 @@ static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node node->custom1 = 1; /* All channels. */ } +static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "channel", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_view_levels() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_VIEW_LEVELS, "Levels", NODE_CLASS_OUTPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_levels_declare; + ntype.draw_buttons = node_composit_buts_view_levels; node_type_init(&ntype, node_composit_init_view_levels); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc index c951dfbcf37..f5193bd5df2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* ******************* Luma Matte Node ********************************* */ @@ -44,12 +47,24 @@ static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) c->t2 = 0.0f; } +static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR( + col, ptr, "limit_max", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR( + col, ptr, "limit_min", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); +} + void register_node_type_cmp_luma_matte() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_LUMA_MATTE, "Luminance Key", NODE_CLASS_MATTE, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_luma_matte_declare; + ntype.draw_buttons = node_composit_buts_luma_matte; node_type_init(&ntype, node_composit_init_luma_matte); node_type_storage(&ntype, "NodeChroma", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc index 8eefc9beb18..1ae80f68dfd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapRange.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapRange.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Map Range ******************** */ @@ -39,12 +42,21 @@ static void cmp_node_map_range_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "use_clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_map_range() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_RANGE, "Map Range", NODE_CLASS_OP_VECTOR, 0); ntype.declare = blender::nodes::cmp_node_map_range_declare; + ntype.draw_buttons = node_composit_buts_map_range; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc index 80e4db4bdf0..71446e3a3c4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapUV.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapUV.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Map UV ******************** */ @@ -36,12 +39,18 @@ static void cmp_node_map_uv_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_mapuv() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_UV, "Map UV", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_map_uv_declare; + ntype.draw_buttons = node_composit_buts_map_uv; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc index 1b34f987168..4bd9124fa68 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mapValue.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mapValue.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** MAP VALUE ******************** */ @@ -40,12 +45,34 @@ static void node_composit_init_map_value(bNodeTree *UNUSED(ntree), bNode *node) node->storage = BKE_texture_mapping_add(TEXMAP_TYPE_POINT); } +static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *sub, *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "use_min", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min")); + uiItemR(sub, ptr, "min", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "use_max", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + sub = uiLayoutColumn(col, false); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); + uiItemR(sub, ptr, "max", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_map_value() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MAP_VALUE, "Map Value", NODE_CLASS_OP_VECTOR, 0); ntype.declare = blender::nodes::cmp_node_map_value_declare; + ntype.draw_buttons = node_composit_buts_map_value; node_type_init(&ntype, node_composit_init_map_value); node_type_storage(&ntype, "TexMapping", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc index a1b76d8a423..8cbf526a289 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -23,6 +23,9 @@ #include "DNA_mask_types.h" +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Mask ******************** */ @@ -59,12 +62,43 @@ static void node_mask_label(const bNodeTree *UNUSED(ntree), } } +static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + + uiTemplateID(layout, + C, + ptr, + "mask", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + uiItemR(layout, ptr, "use_feather", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "size_source", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + + if (node->custom1 & (CMP_NODEFLAG_MASK_FIXED | CMP_NODEFLAG_MASK_FIXED_SCENE)) { + uiItemR(layout, ptr, "size_x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "size_y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + + uiItemR(layout, ptr, "use_motion_blur", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (node->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) { + uiItemR(layout, ptr, "motion_blur_samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_shutter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_mask() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0); ntype.declare = blender::nodes::cmp_node_mask_declare; + ntype.draw_buttons = node_composit_buts_mask; node_type_init(&ntype, node_composit_init_mask); ntype.labelfunc = node_mask_label; diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index 0d44671897b..47a2c89a2f9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -21,11 +21,16 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" - #include "BKE_context.h" #include "BKE_lib_id.h" +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "node_composite_util.hh" + namespace blender::nodes { static void cmp_node_movieclip_declare(NodeDeclarationBuilder &b) @@ -53,12 +58,53 @@ static void init(const bContext *C, PointerRNA *ptr) user->framenr = 1; } +static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); +} + +static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + PointerRNA clipptr; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (!node->id) { + return; + } + + clipptr = RNA_pointer_get(ptr, "clip"); + + uiTemplateColorspaceSettings(layout, &clipptr, "colorspace_settings"); +} + void register_node_type_cmp_movieclip() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_movieclip_declare; + ntype.draw_buttons = node_composit_buts_movieclip; + ntype.draw_buttons_ex = node_composit_buts_movieclip_ex; ntype.initfunc_api = init; node_type_storage( &ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc index b859d19c4a4..e7d9cac7c1a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc +++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc @@ -21,11 +21,14 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" - #include "BKE_context.h" #include "BKE_lib_id.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "node_composite_util.hh" + /* **************** Translate ******************** */ namespace blender::nodes { @@ -73,14 +76,36 @@ static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const } } +static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (!node->id) { + return; + } + + uiItemR(layout, ptr, "distortion_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_moviedistortion() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_moviedistortion_declare; + ntype.draw_buttons = node_composit_buts_moviedistortion; ntype.labelfunc = label; - ntype.initfunc_api = init; node_type_storage(&ntype, nullptr, storage_free, storage_copy); diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc index 6a1b83f657e..79074375a23 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc @@ -31,6 +31,11 @@ #include "RNA_access.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "WM_api.h" + #include "node_composite_util.hh" #include "intern/openexr/openexr_multi.h" @@ -277,12 +282,169 @@ static void update_output_file(bNodeTree *ntree, bNode *node) } } +static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + PointerRNA imfptr = RNA_pointer_get(ptr, "format"); + const bool multilayer = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER; + + if (multilayer) { + uiItemL(layout, IFACE_("Path:"), ICON_NONE); + } + else { + uiItemL(layout, IFACE_("Base Path:"), ICON_NONE); + } + uiItemR(layout, ptr, "base_path", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + +static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + Scene *scene = CTX_data_scene(C); + PointerRNA imfptr = RNA_pointer_get(ptr, "format"); + PointerRNA active_input_ptr, op_ptr; + uiLayout *row, *col; + const bool multilayer = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_MULTILAYER; + const bool is_exr = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_OPENEXR; + const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0; + + node_composit_buts_file_output(layout, C, ptr); + uiTemplateImageSettings(layout, &imfptr, false); + + /* disable stereo output for multilayer, too much work for something that no one will use */ + /* if someone asks for that we can implement it */ + if (is_multiview) { + uiTemplateImageFormatViews(layout, &imfptr, nullptr); + } + + uiItemS(layout); + + uiItemO(layout, IFACE_("Add Input"), ICON_ADD, "NODE_OT_output_file_add_socket"); + + row = uiLayoutRow(layout, false); + col = uiLayoutColumn(row, true); + + const int active_index = RNA_int_get(ptr, "active_input_index"); + /* using different collection properties if multilayer format is enabled */ + if (multilayer) { + uiTemplateList(col, + C, + "UI_UL_list", + "file_output_node", + ptr, + "layer_slots", + ptr, + "active_input_index", + nullptr, + 0, + 0, + 0, + 0, + UI_TEMPLATE_LIST_FLAG_NONE); + RNA_property_collection_lookup_int( + ptr, RNA_struct_find_property(ptr, "layer_slots"), active_index, &active_input_ptr); + } + else { + uiTemplateList(col, + C, + "UI_UL_list", + "file_output_node", + ptr, + "file_slots", + ptr, + "active_input_index", + nullptr, + 0, + 0, + 0, + 0, + UI_TEMPLATE_LIST_FLAG_NONE); + RNA_property_collection_lookup_int( + ptr, RNA_struct_find_property(ptr, "file_slots"), active_index, &active_input_ptr); + } + /* XXX collection lookup does not return the ID part of the pointer, + * setting this manually here */ + active_input_ptr.owner_id = ptr->owner_id; + + col = uiLayoutColumn(row, true); + wmOperatorType *ot = WM_operatortype_find("NODE_OT_output_file_move_active_socket", false); + uiItemFullO_ptr(col, ot, "", ICON_TRIA_UP, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + RNA_enum_set(&op_ptr, "direction", 1); + uiItemFullO_ptr(col, ot, "", ICON_TRIA_DOWN, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + RNA_enum_set(&op_ptr, "direction", 2); + + if (active_input_ptr.data) { + if (multilayer) { + col = uiLayoutColumn(layout, true); + + uiItemL(col, IFACE_("Layer:"), ICON_NONE); + row = uiLayoutRow(col, false); + uiItemR(row, &active_input_ptr, "name", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemFullO(row, + "NODE_OT_output_file_remove_active_socket", + "", + ICON_X, + nullptr, + WM_OP_EXEC_DEFAULT, + UI_ITEM_R_ICON_ONLY, + nullptr); + } + else { + col = uiLayoutColumn(layout, true); + + uiItemL(col, IFACE_("File Subpath:"), ICON_NONE); + row = uiLayoutRow(col, false); + uiItemR(row, &active_input_ptr, "path", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemFullO(row, + "NODE_OT_output_file_remove_active_socket", + "", + ICON_X, + nullptr, + WM_OP_EXEC_DEFAULT, + UI_ITEM_R_ICON_ONLY, + nullptr); + + /* format details for individual files */ + imfptr = RNA_pointer_get(&active_input_ptr, "format"); + + col = uiLayoutColumn(layout, true); + uiItemL(col, IFACE_("Format:"), ICON_NONE); + uiItemR(col, + &active_input_ptr, + "use_node_format", + UI_ITEM_R_SPLIT_EMPTY_NAME, + nullptr, + ICON_NONE); + + const bool is_socket_exr = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_OPENEXR; + const bool use_node_format = RNA_boolean_get(&active_input_ptr, "use_node_format"); + + if ((!is_exr && use_node_format) || (!is_socket_exr && !use_node_format)) { + uiItemR(col, + &active_input_ptr, + "save_as_render", + UI_ITEM_R_SPLIT_EMPTY_NAME, + nullptr, + ICON_NONE); + } + + col = uiLayoutColumn(layout, false); + uiLayoutSetActive(col, use_node_format == false); + uiTemplateImageSettings(col, &imfptr, false); + + if (is_multiview) { + uiTemplateImageFormatViews(layout, &imfptr, nullptr); + } + } + } +} + void register_node_type_cmp_output_file() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT, NODE_PREVIEW); node_type_socket_templates(&ntype, nullptr, nullptr); + ntype.draw_buttons = node_composit_buts_file_output; + ntype.draw_buttons_ex = node_composit_buts_file_output_ex; ntype.initfunc_api = init_output_file; node_type_storage(&ntype, "NodeImageMultiFile", free_output_file, copy_output_file); node_type_update(&ntype, update_output_file); diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc index 82738d70531..d9d362f5175 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -43,6 +48,55 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)node->storage; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (node->id) { + MovieClip *clip = (MovieClip *)node->id; + MovieTracking *tracking = &clip->tracking; + MovieTrackingObject *object; + uiLayout *col; + PointerRNA tracking_ptr; + + RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr); + + col = uiLayoutColumn(layout, false); + uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); + + object = BKE_tracking_object_get_named(tracking, data->tracking_object); + if (object) { + PointerRNA object_ptr; + + RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr); + + uiItemPointerR( + col, ptr, "plane_track_name", &object_ptr, "plane_tracks", "", ICON_ANIM_DATA); + } + else { + uiItemR(layout, ptr, "plane_track_name", 0, "", ICON_ANIM_DATA); + } + } + + uiItemR(layout, ptr, "use_motion_blur", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { + uiItemR(layout, ptr, "motion_blur_samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_shutter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_planetrackdeform() { static bNodeType ntype; @@ -50,6 +104,7 @@ void register_node_type_cmp_planetrackdeform() cmp_node_type_base( &ntype, CMP_NODE_PLANETRACKDEFORM, "Plane Track Deform", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_planetrackdeform_declare; + ntype.draw_buttons = node_composit_buts_planetrackdeform; node_type_init(&ntype, init); node_type_storage( &ntype, "NodePlaneTrackDeformData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc index 8dec90c875a..a70adf68692 100644 --- a/source/blender/nodes/composite/nodes/node_composite_premulkey.cc +++ b/source/blender/nodes/composite/nodes/node_composite_premulkey.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Premul and Key Alpha Convert ******************** */ @@ -35,12 +38,18 @@ static void cmp_node_premulkey_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "mapping", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_premulkey() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_PREMULKEY, "Alpha Convert", NODE_CLASS_CONVERTER, 0); ntype.declare = blender::nodes::cmp_node_premulkey_declare; + ntype.draw_buttons = node_composit_buts_premulkey; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.cc b/source/blender/nodes/composite/nodes/node_composite_rotate.cc index 8ddd62a6226..cc1589a47ca 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Rotate ******************** */ @@ -45,12 +48,18 @@ static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) node->custom1 = 1; /* Bilinear Filter. */ } +static void node_composit_buts_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_rotate() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ROTATE, "Rotate", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_rotate_declare; + ntype.draw_buttons = node_composit_buts_rotate; node_type_init(&ntype, node_composit_init_rotate); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.cc b/source/blender/nodes/composite/nodes/node_composite_scale.cc index 14890146818..98c9f6619f4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_scale.cc +++ b/source/blender/nodes/composite/nodes/node_composite_scale.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Scale ******************** */ @@ -50,12 +55,31 @@ static void node_composite_update_scale(bNodeTree *ntree, bNode *node) } } +static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + + if (RNA_enum_get(ptr, "space") == CMP_SCALE_RENDERPERCENT) { + uiLayout *row; + uiItemR(layout, + ptr, + "frame_method", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + row = uiLayoutRow(layout, true); + uiItemR(row, ptr, "offset_x", UI_ITEM_R_SPLIT_EMPTY_NAME, "X", ICON_NONE); + uiItemR(row, ptr, "offset_y", UI_ITEM_R_SPLIT_EMPTY_NAME, "Y", ICON_NONE); + } +} + void register_node_type_cmp_scale() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_scale_declare; + ntype.draw_buttons = node_composit_buts_scale; node_type_update(&ntype, node_composite_update_scale); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc index 04eb055f3b2..3e66f884efd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** SET ALPHA ******************** */ @@ -43,12 +46,18 @@ static void node_composit_init_setalpha(bNodeTree *UNUSED(ntree), bNode *node) settings->mode = CMP_NODE_SETALPHA_MODE_APPLY; } +static void node_composit_buts_set_alpha(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_setalpha() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SETALPHA, "Set Alpha", NODE_CLASS_CONVERTER, 0); ntype.declare = blender::nodes::cmp_node_setalpha_declare; + ntype.draw_buttons = node_composit_buts_set_alpha; node_type_init(&ntype, node_composit_init_setalpha); node_type_storage( &ntype, "NodeSetAlpha", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc index ad8dcd0d8e9..63772a52840 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -21,11 +21,14 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" - #include "BKE_global.h" #include "BKE_image.h" +#include "UI_interface.h" +#include "UI_resources.h" + +#include "node_composite_util.hh" + /* **************** SPLIT VIEWER ******************** */ namespace blender::nodes { @@ -48,6 +51,16 @@ static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); } +static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row, *col; + + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, false); + uiItemR(row, ptr, "axis", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + uiItemR(col, ptr, "factor", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_splitviewer() { static bNodeType ntype; @@ -55,6 +68,7 @@ void register_node_type_cmp_splitviewer() cmp_node_type_base( &ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_split_viewer_declare; + ntype.draw_buttons = node_composit_buts_splitviewer; node_type_init(&ntype, node_composit_init_splitviewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc index 841cc6a5da3..de6cc21ccd5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc +++ b/source/blender/nodes/composite/nodes/node_composite_stabilize2d.cc @@ -21,11 +21,14 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" #include "BKE_context.h" #include "BKE_lib_id.h" +#include "node_composite_util.hh" + /* **************** Stabilize 2D ******************** */ namespace blender::nodes { @@ -50,12 +53,36 @@ static void init(const bContext *C, PointerRNA *ptr) node->custom1 = 1; } +static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (!node->id) { + return; + } + + uiItemR(layout, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_stabilize2d() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_STABILIZE2D, "Stabilize 2D", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_stabilize2d_declare; + ntype.draw_buttons = node_composit_buts_stabilize2d; ntype.initfunc_api = init; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index 06d32569b0b..f5d69c7d17b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -42,12 +45,24 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_sunbeams(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "source", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, "", ICON_NONE); + uiItemR(layout, + ptr, + "ray_length", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + nullptr, + ICON_NONE); +} + void register_node_type_cmp_sunbeams() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SUNBEAMS, "Sun Beams", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_sunbeams_declare; + ntype.draw_buttons = node_composit_buts_sunbeams; node_type_init(&ntype, init); node_type_storage( &ntype, "NodeSunBeams", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_switch.cc b/source/blender/nodes/composite/nodes/node_composite_switch.cc index e8e7e7eb941..d13bcc28d10 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switch.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switch.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** Switch ******************** */ @@ -36,6 +39,11 @@ static void cmp_node_switch_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_switch(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "check", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + /* custom1 = mix type */ void register_node_type_cmp_switch() { @@ -43,6 +51,7 @@ void register_node_type_cmp_switch() cmp_node_type_base(&ntype, CMP_NODE_SWITCH, "Switch", NODE_CLASS_LAYOUT, 0); ntype.declare = blender::nodes::cmp_node_switch_declare; + ntype.draw_buttons = node_composit_buts_switch; node_type_size_preset(&ntype, NODE_SIZE_SMALL); nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_switchview.cc b/source/blender/nodes/composite/nodes/node_composite_switchview.cc index b452a894e7c..159d66fc6cc 100644 --- a/source/blender/nodes/composite/nodes/node_composite_switchview.cc +++ b/source/blender/nodes/composite/nodes/node_composite_switchview.cc @@ -25,9 +25,13 @@ #include "BKE_context.h" #include "BKE_lib_id.h" +#include "UI_interface.h" +#include "UI_resources.h" + #include "../node_composite_util.hh" /* **************** SWITCH VIEW ******************** */ + static bNodeSocketTemplate cmp_node_switch_view_out[] = { {SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, {-1, ""}, @@ -137,13 +141,27 @@ static void init_switch_view(const bContext *C, PointerRNA *ptr) cmp_node_switch_view_sanitycheck(ntree, node); } +static void node_composit_buts_switch_view_ex(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *UNUSED(ptr)) +{ + uiItemFullO(layout, + "NODE_OT_switch_view_update", + "Update Views", + ICON_FILE_REFRESH, + nullptr, + WM_OP_INVOKE_DEFAULT, + 0, + nullptr); +} + void register_node_type_cmp_switch_view() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_SWITCH_VIEW, "Switch View", NODE_CLASS_CONVERTER, 0); node_type_socket_templates(&ntype, nullptr, cmp_node_switch_view_out); - + ntype.draw_buttons_ex = node_composit_buts_switch_view_ex; ntype.initfunc_api = init_switch_view; node_type_update(&ntype, cmp_node_switch_view_update); diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc index e23243e9bee..c6015eda08c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -49,12 +54,35 @@ static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) node->storage = ntm; } +static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "tonemap_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + if (RNA_enum_get(ptr, "tonemap_type") == 0) { + uiItemR(col, ptr, "key", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "offset", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "gamma", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + else { + uiItemR(col, ptr, "intensity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR( + col, ptr, "contrast", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR( + col, ptr, "adaptation", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR( + col, ptr, "correction", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_tonemap() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TONEMAP, "Tonemap", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_tonemap_declare; + ntype.draw_buttons = node_composit_buts_tonemap; node_type_init(&ntype, node_composit_init_tonemap); node_type_storage(&ntype, "NodeTonemap", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc index 3780a7e1aa1..3be52820f15 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc @@ -21,6 +21,11 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" namespace blender::nodes { @@ -42,12 +47,61 @@ static void init(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + + if (node->id) { + MovieClip *clip = (MovieClip *)node->id; + MovieTracking *tracking = &clip->tracking; + MovieTrackingObject *object; + uiLayout *col; + PointerRNA tracking_ptr; + NodeTrackPosData *data = (NodeTrackPosData *)node->storage; + + RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr); + + col = uiLayoutColumn(layout, false); + uiItemPointerR(col, ptr, "tracking_object", &tracking_ptr, "objects", "", ICON_OBJECT_DATA); + + object = BKE_tracking_object_get_named(tracking, data->tracking_object); + if (object) { + PointerRNA object_ptr; + + RNA_pointer_create(&clip->id, &RNA_MovieTrackingObject, object, &object_ptr); + + uiItemPointerR(col, ptr, "track_name", &object_ptr, "tracks", "", ICON_ANIM_DATA); + } + else { + uiItemR(layout, ptr, "track_name", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_ANIM_DATA); + } + + uiItemR(layout, ptr, "position", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + if (ELEM(node->custom1, CMP_TRACKPOS_RELATIVE_FRAME, CMP_TRACKPOS_ABSOLUTE_FRAME)) { + uiItemR(layout, ptr, "frame_relative", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + } +} + void register_node_type_cmp_trackpos() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0); ntype.declare = blender::nodes::cmp_node_trackpos_declare; + ntype.draw_buttons = node_composit_buts_trackpos; node_type_init(&ntype, init); node_type_storage( &ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_transform.cc b/source/blender/nodes/composite/nodes/node_composite_transform.cc index 1acc671626a..ad1cc4cd308 100644 --- a/source/blender/nodes/composite/nodes/node_composite_transform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_transform.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Transform ******************** */ @@ -43,12 +46,18 @@ static void cmp_node_transform_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "filter_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} + void register_node_type_cmp_transform() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TRANSFORM, "Transform", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_transform_declare; + ntype.draw_buttons = node_composit_buts_transform; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index 2ad70b4a0e5..ce29cc55ca2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Translate ******************** */ @@ -44,12 +47,19 @@ static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) node->storage = data; } +static void node_composit_buts_translate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_relative", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "wrap_axis", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_translate() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_TRANSLATE, "Translate", NODE_CLASS_DISTORT, 0); ntype.declare = blender::nodes::cmp_node_translate_declare; + ntype.draw_buttons = node_composit_buts_translate; node_type_init(&ntype, node_composit_init_translate); node_type_storage( &ntype, "NodeTranslateData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc index 7c82001210d..c4bea269670 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** VECTOR BLUR ******************** */ @@ -49,6 +52,22 @@ static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node) nbd->fac = 1.0f; } +static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "factor", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Blur"), ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemL(col, IFACE_("Speed:"), ICON_NONE); + uiItemR(col, ptr, "speed_min", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Min"), ICON_NONE); + uiItemR(col, ptr, "speed_max", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Max"), ICON_NONE); + + uiItemR(layout, ptr, "use_curved", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + /* custom1: iterations, custom2: max_speed (0 = no_limit). */ void register_node_type_cmp_vecblur() { @@ -56,6 +75,7 @@ void register_node_type_cmp_vecblur() cmp_node_type_base(&ntype, CMP_NODE_VECBLUR, "Vector Blur", NODE_CLASS_OP_FILTER, 0); ntype.declare = blender::nodes::cmp_node_vec_blur_declare; + ntype.draw_buttons = node_composit_buts_vecblur; node_type_init(&ntype, node_composit_init_vecblur); node_type_storage( &ntype, "NodeBlurData", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc index ebac7d31c52..fcebda3b8a4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -21,11 +21,16 @@ * \ingroup cmpnodes */ -#include "node_composite_util.hh" - #include "BKE_global.h" #include "BKE_image.h" +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "node_composite_util.hh" + /* **************** VIEWER ******************** */ namespace blender::nodes { @@ -50,12 +55,32 @@ static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) node->id = (ID *)BKE_image_ensure_viewer(G.main, IMA_TYPE_COMPOSITE, "Viewer Node"); } +static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + +static void node_composit_buts_viewer_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + uiItemR(layout, ptr, "use_alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "tile_order", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (RNA_enum_get(ptr, "tile_order") == 0) { + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "center_x", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "center_y", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} + void register_node_type_cmp_viewer() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_VIEWER, "Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW); ntype.declare = blender::nodes::cmp_node_viewer_declare; + ntype.draw_buttons = node_composit_buts_viewer; + ntype.draw_buttons_ex = node_composit_buts_viewer_ex; node_type_init(&ntype, node_composit_init_viewer); node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc index 982714e030e..dd6872e4dd9 100644 --- a/source/blender/nodes/composite/nodes/node_composite_zcombine.cc +++ b/source/blender/nodes/composite/nodes/node_composite_zcombine.cc @@ -21,6 +21,9 @@ * \ingroup cmpnodes */ +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" /* **************** Z COMBINE ******************** */ @@ -39,12 +42,22 @@ static void cmp_node_zcombine_declare(NodeDeclarationBuilder &b) } // namespace blender::nodes +static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "use_alpha", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_antialias_z", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + void register_node_type_cmp_zcombine() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0); ntype.declare = blender::nodes::cmp_node_zcombine_declare; + ntype.draw_buttons = node_composit_buts_zcombine; nodeRegisterType(&ntype); } -- cgit v1.2.3