60 return "value_float_vector_2d";
62 return "value_float_vector_3d";
73 return "value_int_vector_2d";
91 "value_float_vector_2d",
101 "value_float_vector_3d",
110 RNA_def_int(&srna,
"value_int", 0, INT_MIN, INT_MAX,
"Value",
"", INT_MIN, INT_MAX);
112 &srna,
"value_int_vector_2d", 2,
nullptr, INT_MIN, INT_MAX,
"Value",
"", INT_MIN, INT_MAX);
114 &srna,
"value_color", 4, color_default, -
FLT_MAX,
FLT_MAX,
"Value",
"", 0.0f, 1.0f);
223 if (
ELEM(meta_data->data_type,
253 const ID *
data = (ob) ?
static_cast<const ID *
>(ob->
data) :
nullptr;
267 ID *
data = (ob) ?
static_cast<ID *
>(ob->
data) :
nullptr;
297 ID *
id =
static_cast<ID *
>(ob->
data);
331 if (layer ==
nullptr) {
374 ot->name =
"Add Attribute";
375 ot->description =
"Add attribute to geometry";
376 ot->idname =
"GEOMETRY_OT_attribute_add";
400 "Type of element that attribute is stored on");
409 "Type of data stored in attribute");
416 ID *
id =
static_cast<ID *
>(ob->
data);
425 if (*active_index > 0) {
438 ot->name =
"Remove Attribute";
439 ot->description =
"Remove attribute from geometry";
440 ot->idname =
"GEOMETRY_OT_attribute_remove";
453 ID *
id =
static_cast<ID *
>(ob->
data);
465 if (layer ==
nullptr) {
495 IFACE_(
"Add Color Attribute"),
542 const std::string name_copy =
name;
549 attributes.
remove(name_copy);
566 ID *ob_data =
static_cast<ID *
>(ob->
data);
601 const float weight = src_weights[
i];
608 if (*active_index > 0) {
621 curves.attributes_for_write(),
669 ot->name =
"Add Color Attribute";
670 ot->description =
"Add color attribute to geometry";
671 ot->idname =
"GEOMETRY_OT_color_attribute_add";
689 ot->srna,
"name",
nullptr,
MAX_NAME,
"Name",
"Name of new color attribute");
697 "Type of element that attribute is stored on");
704 "Type of data stored in attribute");
706 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
709 ot->srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
717 ID *
id =
static_cast<ID *
>(ob->
data);
737 ot->name =
"Set Render Color";
738 ot->description =
"Set default color attribute used for rendering";
739 ot->idname =
"GEOMETRY_OT_color_attribute_render_set";
758 ID *
id =
static_cast<ID *
>(ob->
data);
760 if (active_name.empty()) {
793 ot->name =
"Remove Color Attribute";
794 ot->description =
"Remove color attribute from geometry";
795 ot->idname =
"GEOMETRY_OT_color_attribute_remove";
808 ID *
id =
static_cast<ID *
>(ob->
data);
816 if (new_layer ==
nullptr) {
851 ot->name =
"Duplicate Color Attribute";
852 ot->description =
"Duplicate color attribute";
853 ot->idname =
"GEOMETRY_OT_color_attribute_duplicate";
868 ID *
id =
static_cast<ID *
>(ob->
data);
884 C, op, 300,
IFACE_(
"Convert Attribute Domain"),
IFACE_(
"Convert"));
913 {0,
nullptr, 0,
nullptr,
nullptr},
959 ID *
id =
static_cast<ID *
>(ob->
data);
964 const char *
name =
mesh->active_color_attribute;
987 mesh->attributes_for_write(),
988 mesh->active_color_attribute,
1003 const char *
name =
mesh->active_color_attribute;
1016 C, op, 300,
IFACE_(
"Convert Color Attribute Domain"),
IFACE_(
"Convert"));
1031 ot->name =
"Convert Color Attribute";
1032 ot->description =
"Change how the color attribute is stored";
1033 ot->idname =
"GEOMETRY_OT_color_attribute_convert";
1049 "Type of element that attribute is stored on");
1057 "Type of data stored in attribute");
1063 ot->name =
"Convert Attribute";
1064 ot->description =
"Change how the attribute is stored";
1065 ot->idname =
"GEOMETRY_OT_attribute_convert";
1089 "Which geometry element to move the attribute to");
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< blender::StringRef > name)
struct CustomDataLayer * BKE_attribute_new(AttributeOwner &owner, blender::StringRef name, eCustomDataType type, blender::bke::AttrDomain domain, struct ReportList *reports)
std::optional< blender::StringRefNull > BKE_attributes_active_name_get(AttributeOwner &owner)
std::optional< blender::StringRef > BKE_id_attributes_default_color_name(const struct ID *id)
bool BKE_attribute_remove(AttributeOwner &owner, blender::StringRef name, struct ReportList *reports)
void BKE_attributes_active_set(AttributeOwner &owner, blender::StringRef name)
const struct CustomDataLayer * BKE_attribute_search(const AttributeOwner &owner, blender::StringRef name, eCustomDataMask type, AttrDomainMask domain_mask)
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
int * BKE_attributes_active_index_p(AttributeOwner &owner)
std::optional< blender::StringRef > BKE_id_attributes_active_color_name(const struct ID *id)
#define ATTR_DOMAIN_MASK_COLOR
#define ATTR_DOMAIN_AS_MASK(domain)
struct CustomDataLayer * BKE_attribute_duplicate(AttributeOwner &owner, blender::StringRef name, struct ReportList *reports)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< blender::StringRef > name)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
Object * CTX_data_edit_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
Low-level operations for curves.
CustomData interface, see also DNA_customdata_types.h.
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_unreachable()
void BLI_kdtree_nd_ free(KDTree *tree)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_OPERATOR_DEFAULT
void DEG_id_tag_update(ID *id, unsigned int flags)
#define CD_MASK_COLOR_ALL
Read Guarded memory(de)allocation.
const EnumPropertyItem * rna_enum_attribute_domain_itemf(const AttributeOwner &owner, bool include_instances, bool *r_free)
BMesh const char void * data
AttributeOwnerType type() const
std::optional< blender::bke::MutableAttributeAccessor > get_accessor() const
static AttributeOwner from_id(ID *id)
blender::bke::AttributeStorage * get_storage() const
const CPPType * type() const
const CPPType & type() const
void materialize_to_uninitialized(void *dst) const
constexpr const char * c_str() const
void materialize(MutableSpan< T > r_span) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef attribute_id) const
static std::optional< AttributeAccessor > from_id(const ID &id)
bool domain_supported(const AttrDomain domain) const
int domain_size(const AttrDomain domain) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef attribute_id) const
Attribute & add(std::string name, bke::AttrDomain domain, bke::AttrType data_type, Attribute::DataVariant data)
std::string unique_name_calc(StringRef name) const
StringRefNull name() const
bool add(const StringRef attribute_id, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
bool remove(const StringRef attribute_id)
void * MEM_mallocN_aligned(size_t len, size_t alignment, const char *str)
void MEM_freeN(void *vmemh)
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
std::optional< AttrType > custom_data_type_to_attr_type(eCustomDataType data_type)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
AttrType cpp_type_to_attribute_type(const CPPType &type)
const CPPType & attribute_type_to_cpp_type(AttrType type)
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode(const ColorSceneLinear4f< Alpha > &color)
static bool geometry_attributes_poll(bContext *C)
void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
PropertyRNA * rna_property_for_type(PointerRNA &ptr, const bke::AttrType type)
static const EnumPropertyItem * geometry_attribute_domain_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static wmOperatorStatus geometry_color_attribute_add_exec(bContext *C, wmOperator *op)
static wmOperatorStatus geometry_color_attribute_set_render_exec(bContext *C, wmOperator *op)
static EnumPropertyItem convert_attribute_mode_items[]
void GEOMETRY_OT_color_attribute_add(wmOperatorType *ot)
static wmOperatorStatus geometry_color_attribute_duplicate_exec(bContext *C, wmOperator *op)
GPointer rna_property_for_attribute_type_retrieve_value(PointerRNA &ptr, const bke::AttrType type, void *buffer)
void GEOMETRY_OT_attribute_convert(wmOperatorType *ot)
StringRefNull rna_property_name_for_type(const bke::AttrType type)
void GEOMETRY_OT_color_attribute_duplicate(wmOperatorType *ot)
static void geometry_attribute_convert_ui(bContext *C, wmOperator *op)
void GEOMETRY_OT_color_attribute_convert(wmOperatorType *ot)
static bool geometry_attributes_remove_poll(bContext *C)
static wmOperatorStatus geometry_color_attribute_remove_exec(bContext *C, wmOperator *op)
static void geometry_color_attribute_convert_ui(bContext *, wmOperator *op)
void register_rna_properties_for_attribute_types(StructRNA &srna)
void GEOMETRY_OT_attribute_remove(wmOperatorType *ot)
void GEOMETRY_OT_color_attribute_render_set(wmOperatorType *ot)
void rna_property_for_attribute_type_set_value(PointerRNA &ptr, PropertyRNA &prop, const GPointer value)
bool attribute_set_poll(bContext &C, const ID &object_data)
static bool geometry_color_attributes_remove_poll(bContext *C)
static bool geometry_attribute_convert_poll(bContext *C)
static const EnumPropertyItem * geometry_attribute_convert_mode_itemf(bContext *C, PointerRNA *, PropertyRNA *, bool *r_free)
static void geometry_color_attribute_add_ui(bContext *, wmOperator *op)
static wmOperatorStatus geometry_color_attribute_convert_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool geometry_color_attribute_convert_poll(bContext *C)
static wmOperatorStatus geometry_color_attribute_convert_exec(bContext *C, wmOperator *op)
static wmOperatorStatus geometry_attribute_remove_exec(bContext *C, wmOperator *op)
bool convert_attribute(AttributeOwner &owner, bke::MutableAttributeAccessor attributes, const StringRef name, const bke::AttrDomain dst_domain, const bke::AttrType dst_type, ReportList *reports)
static bool geometry_color_attributes_duplicate_poll(bContext *C)
static wmOperatorStatus geometry_attribute_add_exec(bContext *C, wmOperator *op)
static wmOperatorStatus geometry_attribute_convert_invoke(bContext *C, wmOperator *op, const wmEvent *)
void GEOMETRY_OT_color_attribute_remove(wmOperatorType *ot)
static wmOperatorStatus geometry_attribute_convert_exec(bContext *C, wmOperator *op)
static wmOperatorStatus geometry_color_attribute_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus geometry_attribute_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Object * context_object(const bContext *C)
bool object_active_color_fill(Object &ob, const float fill_color[4], bool only_selected)
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
blender::VecBase< int16_t, 2 > short2
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_property_enum_items(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
const EnumPropertyItem rna_enum_color_attribute_domain_items[]
const EnumPropertyItem rna_enum_attribute_domain_items[]
const EnumPropertyItem rna_enum_attribute_type_items[]
const EnumPropertyItem rna_enum_color_attribute_type_items[]
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_dummy_NULL_items[]
static ArrayData from_default_value(const CPPType &type, int64_t domain_size)
void use_property_decorate_set(bool is_sep)
void use_property_split_set(bool value)
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)
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message)
wmOperatorStatus WM_operator_props_popup_confirm_ex(bContext *C, wmOperator *op, const wmEvent *, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message)