52 static const mf::Signature
signature = []() {
54 mf::SignatureBuilder builder{
"Separate Color",
signature};
56 builder.single_output<
float>(
"Red", mf::ParamFlag::SupportsUnusedOutput);
57 builder.single_output<
float>(
"Green", mf::ParamFlag::SupportsUnusedOutput);
58 builder.single_output<
float>(
"Blue", mf::ParamFlag::SupportsUnusedOutput);
59 builder.single_output<
float>(
"Alpha", mf::ParamFlag::SupportsUnusedOutput);
75 std::array<MutableSpan<float>, 4>
outputs = {red, green, blue, alpha};
77 if (!red.is_empty()) {
80 if (!green.is_empty()) {
83 if (!blue.is_empty()) {
86 if (!alpha.is_empty()) {
91 mask.foreach_segment_optimized([&](
const auto segment) {
92 const int used_outputs_num = used_outputs.
size();
93 const int *used_outputs_data = used_outputs.
data();
97 for (
const int out_i :
IndexRange(used_outputs_num)) {
98 const int channel = used_outputs_data[out_i];
111 static const mf::Signature
signature = []() {
113 mf::SignatureBuilder builder{
"Separate Color",
signature};
115 builder.single_output<
float>(
"Hue");
116 builder.single_output<
float>(
"Saturation");
117 builder.single_output<
float>(
"Value");
118 builder.single_output<
float>(
"Alpha", mf::ParamFlag::SupportsUnusedOutput);
134 rgb_to_hsv(colors[
i].r, colors[
i].g, colors[
i].
b, &hue[
i], &saturation[
i], &value[
i]);
137 if (!alpha.is_empty()) {
147 static const mf::Signature
signature = []() {
149 mf::SignatureBuilder builder{
"Separate Color",
signature};
151 builder.single_output<
float>(
"Hue");
152 builder.single_output<
float>(
"Saturation");
153 builder.single_output<
float>(
"Lightness");
154 builder.single_output<
float>(
"Alpha", mf::ParamFlag::SupportsUnusedOutput);
170 rgb_to_hsl(colors[
i].r, colors[
i].g, colors[
i].
b, &hue[
i], &saturation[
i], &lightness[
i]);
173 if (!alpha.is_empty()) {
183 switch (storage.
mode) {
211 "Mode of color processing",
221 ntype.
ui_name =
"Separate Color";
222 ntype.
ui_description =
"Split a color into separate channels, based on a particular color model";
#define NODE_CLASS_CONVERTER
#define NODE_STORAGE_FUNCS(StorageT)
#define FN_NODE_SEPARATE_COLOR
#define BLI_assert_unreachable()
void rgb_to_hsl(float r, float g, float b, float *r_h, float *r_s, float *r_l)
void rgb_to_hsv(float r, float g, float b, float *r_h, float *r_s, float *r_v)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
BMesh const char void * data
void append(const T &value)
const Signature & signature() const
void set_signature(const Signature *signature)
void set_matching_fn(const mf::MultiFunction *fn)
ColorGeometry4f default_value
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
void call(const IndexMask &mask, mf::Params params, mf::Context) const override
void * MEM_callocN(size_t len, const char *str)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
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 void node_rna(StructRNA *srna)
static void node_register()
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_init(bNodeTree *, bNode *node)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_update(bNodeTree *, bNode *node)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
void devirtualize_varray(const VArray< T > &varray, const Func &func, bool enable=true)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
static blender::bke::bNodeSocketTemplate outputs[]
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode)
const EnumPropertyItem rna_enum_node_combsep_color_items[]
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeMultiFunctionBuildFunction build_multi_function
const char * enum_name_legacy
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
void(* updatefunc)(bNodeTree *ntree, bNode *node)
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)