|
|
|
@@ -27,8 +27,12 @@ const EnumPropertyItem rna_enum_attribute_type_items[] = {
|
|
|
|
|
{CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
|
|
|
|
|
{CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
|
|
|
|
|
{CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
|
|
|
|
|
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
|
|
|
|
|
{CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
|
|
|
|
|
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with 32-bit floating-point values"},
|
|
|
|
|
{CD_PROP_BYTE_COLOR,
|
|
|
|
|
"BYTE_COLOR",
|
|
|
|
|
0,
|
|
|
|
|
"Byte Color",
|
|
|
|
|
"RGBA color with 8-bit positive integer values"},
|
|
|
|
|
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
|
|
|
|
|
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
|
|
|
|
|
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
|
|
|
|
@@ -41,8 +45,12 @@ const EnumPropertyItem rna_enum_attribute_type_with_auto_items[] = {
|
|
|
|
|
{CD_PROP_FLOAT, "FLOAT", 0, "Float", "Floating-point value"},
|
|
|
|
|
{CD_PROP_INT32, "INT", 0, "Integer", "32-bit integer"},
|
|
|
|
|
{CD_PROP_FLOAT3, "FLOAT_VECTOR", 0, "Vector", "3D vector with floating-point values"},
|
|
|
|
|
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color with floating-point values"},
|
|
|
|
|
{CD_PROP_BYTE_COLOR, "BYTE_COLOR", 0, "Byte Color", "RGBA color with 8-bit values"},
|
|
|
|
|
{CD_PROP_COLOR, "FLOAT_COLOR", 0, "Color", "RGBA color 32-bit floating-point values"},
|
|
|
|
|
{CD_PROP_BYTE_COLOR,
|
|
|
|
|
"BYTE_COLOR",
|
|
|
|
|
0,
|
|
|
|
|
"Byte Color",
|
|
|
|
|
"RGBA color with 8-bit positive integer values"},
|
|
|
|
|
{CD_PROP_STRING, "STRING", 0, "String", "Text string"},
|
|
|
|
|
{CD_PROP_BOOL, "BOOLEAN", 0, "Boolean", "True or false"},
|
|
|
|
|
{CD_PROP_FLOAT2, "FLOAT2", 0, "2D Vector", "2D vector with floating-point values"},
|
|
|
|
@@ -143,7 +151,7 @@ static int rna_Attribute_name_editable(PointerRNA *ptr, const char **r_info)
|
|
|
|
|
{
|
|
|
|
|
CustomDataLayer *layer = ptr->data;
|
|
|
|
|
if (BKE_id_attribute_required(ptr->owner_id, layer)) {
|
|
|
|
|
*r_info = N_("Can't modify name of required geometry attribute");
|
|
|
|
|
*r_info = N_("Cannot modify name of required geometry attribute");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -586,7 +594,8 @@ static void rna_def_attribute_float(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "FloatAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Float Attribute", "Geometry attribute with floating-point values");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Float Attribute", "Geometry attribute that stores floating-point values");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "FloatAttributeValue");
|
|
|
|
@@ -618,7 +627,7 @@ static void rna_def_attribute_float_vector(BlenderRNA *brna)
|
|
|
|
|
srna = RNA_def_struct(brna, "FloatVectorAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Float Vector Attribute", "Vector geometry attribute, with floating-point values");
|
|
|
|
|
srna, "Float Vector Attribute", "Geometry attribute that stores floating-point 3D vectors");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "FloatVectorAttributeValue");
|
|
|
|
@@ -653,8 +662,10 @@ static void rna_def_attribute_float_color(BlenderRNA *brna)
|
|
|
|
|
/* Float Color Attribute */
|
|
|
|
|
srna = RNA_def_struct(brna, "FloatColorAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Float Color Attribute", "Color geometry attribute, with floating-point values");
|
|
|
|
|
RNA_def_struct_ui_text(srna,
|
|
|
|
|
"Float Color Attribute",
|
|
|
|
|
"Geometry attribute that stores RGBA colors as floating-point values "
|
|
|
|
|
"using 32-bits per channel");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "FloatColorAttributeValue");
|
|
|
|
@@ -688,8 +699,10 @@ static void rna_def_attribute_byte_color(BlenderRNA *brna)
|
|
|
|
|
/* Byte Color Attribute */
|
|
|
|
|
srna = RNA_def_struct(brna, "ByteColorAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Byte Color Attribute", "Color geometry attribute, with 8-bit values");
|
|
|
|
|
RNA_def_struct_ui_text(srna,
|
|
|
|
|
"Byte Color Attribute",
|
|
|
|
|
"Geometry attribute that stores RGBA colors as positive integer values "
|
|
|
|
|
"using 8-bits per channel");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ByteColorAttributeValue");
|
|
|
|
@@ -726,7 +739,8 @@ static void rna_def_attribute_int(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "IntAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Int Attribute", "Integer geometry attribute");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Integer Attribute", "Geometry attribute that stores integer values");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "IntAttributeValue");
|
|
|
|
@@ -755,7 +769,7 @@ static void rna_def_attribute_string(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "StringAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "String Attribute", "String geometry attribute");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "String Attribute", "Geometry attribute that stores strings");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "StringAttributeValue");
|
|
|
|
@@ -784,7 +798,7 @@ static void rna_def_attribute_bool(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "BoolAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Bool Attribute", "Bool geometry attribute");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "Bool Attribute", "Geometry attribute that stores booleans");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "BoolAttributeValue");
|
|
|
|
@@ -812,7 +826,8 @@ static void rna_def_attribute_int8(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
srna = RNA_def_struct(brna, "ByteIntAttribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(srna, "8-bit Int Attribute", "8-bit int geometry attribute");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "8-bit Integer Attribute", "Geometry attribute that stores 8-bit integers");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "ByteIntAttributeValue");
|
|
|
|
@@ -844,7 +859,7 @@ static void rna_def_attribute_float2(BlenderRNA *brna)
|
|
|
|
|
srna = RNA_def_struct(brna, "Float2Attribute", "Attribute");
|
|
|
|
|
RNA_def_struct_sdna(srna, "CustomDataLayer");
|
|
|
|
|
RNA_def_struct_ui_text(
|
|
|
|
|
srna, "Float2 Attribute", "2D vector geometry attribute, with floating-point values");
|
|
|
|
|
srna, "Float2 Attribute", "Geometry attribute that stores floating-point 2D vectors");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Float2AttributeValue");
|
|
|
|
@@ -927,13 +942,15 @@ static void rna_def_attribute_group(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
/* API */
|
|
|
|
|
func = RNA_def_function(srna, "new", "rna_AttributeGroup_new");
|
|
|
|
|
RNA_def_function_ui_description(func, "Add an attribute");
|
|
|
|
|
RNA_def_function_ui_description(func, "Add attribute to geometry");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
|
parm = RNA_def_string(func, "name", "Attribute", 0, "", "Attribute name");
|
|
|
|
|
parm = RNA_def_string(func, "name", "Attribute", 0, "Name", "Name of geometry attribute");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
parm = RNA_def_enum(
|
|
|
|
|
func, "type", rna_enum_attribute_type_items, CD_PROP_FLOAT, "Type", "Attribute type");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
parm = RNA_def_enum(func,
|
|
|
|
|
"domain",
|
|
|
|
|
rna_enum_attribute_domain_items,
|
|
|
|
@@ -941,12 +958,13 @@ static void rna_def_attribute_group(BlenderRNA *brna)
|
|
|
|
|
"Domain",
|
|
|
|
|
"Type of element that attribute is stored on");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
|
|
|
|
|
|
|
|
|
parm = RNA_def_pointer(func, "attribute", "Attribute", "", "New geometry attribute");
|
|
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
|
|
|
|
|
RNA_def_function_return(func, parm);
|
|
|
|
|
|
|
|
|
|
func = RNA_def_function(srna, "remove", "rna_AttributeGroup_remove");
|
|
|
|
|
RNA_def_function_ui_description(func, "Remove an attribute");
|
|
|
|
|
RNA_def_function_ui_description(func, "Remove attribute from geometry");
|
|
|
|
|
RNA_def_function_flag(func, FUNC_USE_REPORTS);
|
|
|
|
|
parm = RNA_def_pointer(func, "attribute", "Attribute", "", "Geometry Attribute");
|
|
|
|
|
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
|
|
|
|
@@ -955,13 +973,14 @@ static void rna_def_attribute_group(BlenderRNA *brna)
|
|
|
|
|
/* Active */
|
|
|
|
|
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Attribute");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Attribute", "Active attribute");
|
|
|
|
|
RNA_def_property_pointer_funcs(
|
|
|
|
|
prop, "rna_AttributeGroup_active_get", "rna_AttributeGroup_active_set", NULL, NULL);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Attribute", "Active attribute");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Attribute Index", "Active attribute index");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_int_funcs(prop,
|
|
|
|
|
"rna_AttributeGroup_active_index_get",
|
|
|
|
@@ -971,16 +990,17 @@ static void rna_def_attribute_group(BlenderRNA *brna)
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active_color", PROP_POINTER, PROP_NONE);
|
|
|
|
|
RNA_def_property_struct_type(prop, "Attribute");
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Color", "Active color attribute for display and editing");
|
|
|
|
|
RNA_def_property_pointer_funcs(prop,
|
|
|
|
|
"rna_AttributeGroup_active_color_get",
|
|
|
|
|
"rna_AttributeGroup_active_color_set",
|
|
|
|
|
NULL,
|
|
|
|
|
NULL);
|
|
|
|
|
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Color", "Active color attribute");
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "active_color_index", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Active Color Index", "Active color attribute index");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_int_funcs(prop,
|
|
|
|
|
"rna_AttributeGroup_active_color_index_get",
|
|
|
|
@@ -989,6 +1009,9 @@ static void rna_def_attribute_group(BlenderRNA *brna)
|
|
|
|
|
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
|
|
|
|
|
|
|
|
|
|
prop = RNA_def_property(srna, "render_color_index", PROP_INT, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop,
|
|
|
|
|
"Active Render Color Index",
|
|
|
|
|
"The index of the color attribute used as a fallback for rendering");
|
|
|
|
|
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
|
|
|
|
RNA_def_property_int_funcs(prop,
|
|
|
|
|
"rna_AttributeGroup_render_color_index_get",
|
|
|
|
|