32 b.use_custom_socket_order();
37 layout->
label(
IFACE_(
"Despill Channel:"), ICON_NONE);
46 col->label(
IFACE_(
"Limiting Channel:"), ICON_NONE);
47 row = &
col->row(
false);
63 .description(
"Specifies the limiting strength of the limit channel");
66 b.add_panel(
"Spill Strength").default_closed(
true);
71 "If enabled, the spill strength for each color channel can be specified. If disabled, "
72 "the spill channel will have a unit scale, while other channels will be zero");
75 .description(
"Specifies the spilling strength of each color channel");
103 return node_storage(node).limchan;
124 return limit_channels;
138 "node_composite_color_spill",
146 const float4 &spill_strength,
147 const int spill_channel)
149 if (use_spill_strength) {
151 scale[spill_channel] *= -1.0f;
156 scale[spill_channel] = -1.0f;
166 return mf::build::SI5_SO<float4, float, float, bool, float4, float4>(
170 const float &limit_scale,
171 const bool &use_spill_strength,
173 float average_limit = (
color[limit_channels.x] +
color[limit_channels.y]) / 2.0f;
174 float map = factor *
color[spill_channel] - limit_scale * average_limit;
176 use_spill_strength, spill_strength, spill_channel);
179 mf::build::exec_presets::SomeSpanOrSingle<0>());
194 "Remove colors from a blue or green screen, by reducing one RGB channel compared to the "
198 ntype.
declare = file_ns::cmp_node_color_spill_declare;
199 ntype.
initfunc = file_ns::node_composit_init_color_spill;
202 ntype.
gpu_fn = file_ns::node_gpu_material;
#define NODE_STORAGE_FUNCS(StorageT)
#define CMP_NODE_COLOR_SPILL
CMPNodeColorSpillLimitAlgorithm
@ CMP_NODE_COLOR_SPILL_LIMIT_ALGORITHM_AVERAGE
@ CMP_NODE_COLOR_SPILL_LIMIT_ALGORITHM_SINGLE
bool GPU_stack_link(GPUMaterial *mat, const bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out,...)
GPUNodeLink * GPU_constant(const float *num)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
DeclType::Builder & add_input(StringRef name, StringRef identifier="")
void construct_and_set_matching_fn_cb(Fn &&create_multi_function)
ColorGeometry4f default_value
void * MEM_callocN(size_t len, const char *str)
void node_register_type(bNodeType &ntype)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static int node_gpu_material(GPUMaterial *material, bNode *node, bNodeExecData *, GPUNodeStack *inputs, GPUNodeStack *outputs)
static void node_composit_init_color_spill(bNodeTree *, bNode *node)
static float3 compute_spill_scale(const bool &use_spill_strength, const float4 &spill_strength, const int spill_channel)
static void node_build_multi_function(blender::nodes::NodeMultiFunctionBuilder &builder)
static int2 get_limit_channels(const bNode &node)
static int get_spill_channel(const bNode &node)
static int get_limit_channel(const bNode &node)
static void cmp_node_color_spill_declare(NodeDeclarationBuilder &b)
static CMPNodeColorSpillLimitAlgorithm get_limit_algorithm(const bNode &node)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< float, 3 > float3
static void register_node_type_cmp_color_spill()
void cmp_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
static blender::bke::bNodeSocketTemplate outputs[]
static blender::bke::bNodeSocketTemplate inputs[]
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
int RNA_enum_get(PointerRNA *ptr, const char *name)
VecBase< T, 3 > xyz() const
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGPUExecFunction gpu_fn
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
NodeDeclareFunction declare
void label(blender::StringRef name, int icon)
uiLayout & column(bool align)
uiLayout & row(bool align)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)