28 b.use_custom_socket_order();
29 b.allow_any_socket_order();
30 b.add_default_layout();
32 .supported_type(GeometryComponent::Type::GreasePencil)
33 .align_with_previous()
34 .
description(
"Grease Pencil to change the color of");
35 b.add_output<
decl::Geometry>(
"Grease Pencil").propagate_all().align_with_previous();
41 b.add_input<
decl::Float>(
"Opacity").default_value(1.0f).min(0.0f).max(1.0f).field_on_all();
64 const StringRef color_attr_name = domain == AttrDomain::Point ?
"vertex_color" :
"fill_color";
65 const StringRef opacity_attr_name = domain == AttrDomain::Point ?
"opacity" :
"fill_opacity";
70 for (
const int layer_index : grease_pencil->layers().index_range()) {
71 Drawing *drawing = grease_pencil->get_eval_drawing(grease_pencil->layer(layer_index));
72 if (drawing ==
nullptr) {
79 *grease_pencil, domain, layer_index);
92 {color_attr_name, opacity_attr_name},
95 {color_field, opacity_field});
100 params.set_output(
"Grease Pencil", std::move(geometry_set));
110 "Set the color and opacity for the points of the stroke"},
115 "Set the color and opacity for the stroke fills"},
116 {0,
nullptr, 0,
nullptr,
nullptr},
127 ntype.
ui_name =
"Set Grease Pencil Color";
128 ntype.
ui_description =
"Set color and opacity attributes on Grease Pencil geometry";
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_CLASS_GEOMETRY
constexpr int NODE_DEFAULT_MAX_WIDTH
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_inline_enum_accessors(member)
static VArray from_single(T value, const int64_t size)
bool contains(StringRef attribute_id) const
int domain_size(const AttrDomain domain) const
MutableAttributeAccessor attributes_for_write()
AttributeAccessor attributes() const
bool add(const StringRef attribute_id, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
bke::CurvesGeometry & strokes_for_write()
void node_type_size(bNodeType &ntype, int width, int minwidth, int maxwidth)
void node_register_type(bNodeType &ntype)
bool try_capture_fields_on_geometry(MutableAttributeAccessor attributes, const fn::FieldContext &field_context, Span< StringRef > attribute_ids, AttrDomain domain, const fn::Field< bool > &selection, Span< fn::GField > fields)
void foreach_real_geometry(bke::GeometrySet &geometry, FunctionRef< void(bke::GeometrySet &geometry_set)> fn)
static void node_rna(StructRNA *srna)
static void node_register()
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_init(bNodeTree *, bNode *node)
static void node_geo_exec(GeoNodeExecParams params)
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)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
std::string ui_description
void(* initfunc)(bNodeTree *ntree, bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare
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)