59 return "value_float_vector_2d";
61 return "value_float_vector_3d";
72 return "value_int_vector_2d";
90 "value_float_vector_2d",
100 "value_float_vector_3d",
109 RNA_def_int(&srna,
"value_int", 0, INT_MIN, INT_MAX,
"Value",
"", INT_MIN, INT_MAX);
111 &srna,
"value_int_vector_2d", 2,
nullptr, INT_MIN, INT_MAX,
"Value",
"", INT_MIN, INT_MAX);
113 &srna,
"value_color", 4, color_default, -
FLT_MAX,
FLT_MAX,
"Value",
"", 0.0f, 1.0f);
233 const ID *
data = (ob) ?
static_cast<const ID *
>(ob->
data) :
nullptr;
247 ID *
data = (ob) ?
static_cast<ID *
>(ob->
data) :
nullptr;
277 ID *
id =
static_cast<ID *
>(ob->
data);
286 if (layer ==
nullptr) {
329 ot->name =
"Add Attribute";
330 ot->description =
"Add attribute to geometry";
331 ot->idname =
"GEOMETRY_OT_attribute_add";
355 "Type of element that attribute is stored on");
364 "Type of data stored in attribute");
371 ID *
id =
static_cast<ID *
>(ob->
data);
380 if (*active_index > 0) {
393 ot->name =
"Remove Attribute";
394 ot->description =
"Remove attribute from geometry";
395 ot->idname =
"GEOMETRY_OT_attribute_remove";
408 ID *
id =
static_cast<ID *
>(ob->
data);
420 if (layer ==
nullptr) {
450 IFACE_(
"Add Color Attribute"),
497 const std::string name_copy = name;
504 attributes.
remove(name_copy);
521 ID *ob_data =
static_cast<ID *
>(ob->
data);
555 const float weight = src_weights[
i];
562 if (*active_index > 0) {
575 curves.attributes_for_write(),
621 ot->name =
"Add Color Attribute";
622 ot->description =
"Add color attribute to geometry";
623 ot->idname =
"GEOMETRY_OT_color_attribute_add";
641 ot->srna,
"name",
nullptr,
MAX_NAME,
"Name",
"Name of new color attribute");
649 "Type of element that attribute is stored on");
656 "Type of data stored in attribute");
658 static float default_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
661 ot->srna,
"color", 4,
nullptr, 0.0f,
FLT_MAX,
"Color",
"Default fill color", 0.0f, 1.0f);
669 ID *
id =
static_cast<ID *
>(ob->
data);
689 ot->name =
"Set Render Color";
690 ot->description =
"Set default color attribute used for rendering";
691 ot->idname =
"GEOMETRY_OT_color_attribute_render_set";
710 ID *
id =
static_cast<ID *
>(ob->
data);
712 if (active_name.empty()) {
745 ot->name =
"Remove Color Attribute";
746 ot->description =
"Remove color attribute from geometry";
747 ot->idname =
"GEOMETRY_OT_color_attribute_remove";
760 ID *
id =
static_cast<ID *
>(ob->
data);
768 if (new_layer ==
nullptr) {
803 ot->name =
"Duplicate Color Attribute";
804 ot->description =
"Duplicate color attribute";
805 ot->idname =
"GEOMETRY_OT_color_attribute_duplicate";
820 ID *
id =
static_cast<ID *
>(ob->
data);
836 C, op, 300,
IFACE_(
"Convert Attribute Domain"),
IFACE_(
"Convert"));
865 {0,
nullptr, 0,
nullptr,
nullptr},
911 ID *
id =
static_cast<ID *
>(ob->
data);
916 const char *name =
mesh->active_color_attribute;
918 const std::optional<bke::AttributeMetaData> meta_data = attributes.
lookup_meta_data(name);
937 mesh->attributes_for_write(),
938 mesh->active_color_attribute,
953 const char *name =
mesh->active_color_attribute;
966 C, op, 300,
IFACE_(
"Convert Color Attribute Domain"),
IFACE_(
"Convert"));
981 ot->name =
"Convert Color Attribute";
982 ot->description =
"Change how the color attribute is stored";
983 ot->idname =
"GEOMETRY_OT_color_attribute_convert";
999 "Type of element that attribute is stored on");
1007 "Type of data stored in attribute");
1013 ot->name =
"Convert Attribute";
1014 ot->description =
"Change how the attribute is stored";
1015 ot->idname =
"GEOMETRY_OT_attribute_convert";
1039 "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.
#define CD_TYPE_AS_MASK(_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)
Read Guarded memory(de)allocation.
const EnumPropertyItem * rna_enum_attribute_domain_itemf(const AttributeOwner &owner, bool include_instances, bool *r_free)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
BMesh const char void * data
static AttributeOwner from_id(ID *id)
ColorSceneLinearByteEncoded4b< Alpha > encode() 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
bool contains(StringRef attribute_id) const
static std::optional< AttributeAccessor > from_id(const ID &id)
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef attribute_id) const
bool remove(const StringRef attribute_id)
bool add(const StringRef attribute_id, const AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
#define CD_MASK_COLOR_ALL
void * MEM_mallocN_aligned(size_t len, size_t alignment, const char *str)
void MEM_freeN(void *vmemh)
eCustomDataType cpp_type_to_custom_data_type(const CPPType &type)
const CPPType * custom_data_type_to_cpp_type(eCustomDataType type)
GPointer rna_property_for_attribute_type_retrieve_value(PointerRNA &ptr, const eCustomDataType type, void *buffer)
static bool geometry_attributes_poll(bContext *C)
void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
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)
StringRefNull rna_property_name_for_type(const eCustomDataType type)
void GEOMETRY_OT_attribute_convert(wmOperatorType *ot)
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 *)
PropertyRNA * rna_property_for_type(PointerRNA &ptr, const eCustomDataType type)
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)
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)
bool convert_attribute(AttributeOwner &owner, bke::MutableAttributeAccessor attributes, const StringRef name, const bke::AttrDomain dst_domain, const eCustomDataType dst_type, ReportList *reports)
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)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
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)
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[]
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_popup_confirm_ex(bContext *C, wmOperator *op, const wmEvent *, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default)
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)