GPv3: Python API for frame, drawing and drawing attributes #124787

Merged
Falk David merged 22 commits from filedescriptor/blender:gpv3-drawing-python-api into main 2024-07-26 16:30:21 +02:00
Showing only changes of commit 721509d8bf - Show all commits

View File

@ -677,12 +677,12 @@ static void rna_AttributeGroupID_active_index_range(
*softmax = *max;
}
static void rna_AttributeGroupID_update_active(Main *bmain, Scene *scene, PointerRNA *ptr)
static void rna_AttributeGroup_update_active(Main *bmain, Scene *scene, PointerRNA *ptr)
{
rna_Attribute_update_data(bmain, scene, ptr);
}
static void rna_AttributeGroupID_update_active_color(Main * /*bmain*/,
static void rna_AttributeGroup_update_active_color(Main * /*bmain*/,
Scene * /*scene*/,
PointerRNA *ptr)
{
@ -1476,7 +1476,7 @@ static void rna_def_attribute_group_id_common(StructRNA *srna)
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active");
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");
@ -1485,7 +1485,7 @@ static void rna_def_attribute_group_id_common(StructRNA *srna)
"rna_AttributeGroupID_active_index_get",
"rna_AttributeGroupID_active_index_set",
"rna_AttributeGroupID_active_index_range");
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active");
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
}
static void rna_def_attribute_group_mesh(BlenderRNA *brna)
@ -1510,7 +1510,7 @@ static void rna_def_attribute_group_mesh(BlenderRNA *brna)
nullptr,
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active_color");
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");
@ -1519,7 +1519,7 @@ static void rna_def_attribute_group_mesh(BlenderRNA *brna)
"rna_AttributeGroupMesh_active_color_index_get",
"rna_AttributeGroupMesh_active_color_index_set",
"rna_AttributeGroupMesh_active_color_index_range");
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active_color");
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,
@ -1530,7 +1530,7 @@ static void rna_def_attribute_group_mesh(BlenderRNA *brna)
"rna_AttributeGroupMesh_render_color_index_get",
"rna_AttributeGroupMesh_render_color_index_set",
"rna_AttributeGroupMesh_render_color_index_range");
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active_color");
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active_color");
prop = RNA_def_property(srna, "default_color_name", PROP_STRING, PROP_NONE);
RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX);
@ -1638,7 +1638,7 @@ static void rna_def_attribute_group_grease_pencil_drawing(BlenderRNA *brna)
nullptr,
"rna_AttributeGroupGreasePencilDrawing_active_poll");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active");
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
filedescriptor marked this conversation as resolved Outdated

I find it weird to use a function named rna_AttributeGroupID_update_active for non-ID-owned attribute data?

Would suggest to either rename that one to a generic rna_AttributeGroup_update_activename, or to add a rna_AttributeGroupGreasePencilDrawing_update_active one (which could then call rna_AttributeGroupID_update_active if it's fine to do so)?

I find it weird to use a function named `rna_AttributeGroupID_update_active` for non-ID-owned attribute data? Would suggest to either rename that one to a generic `rna_AttributeGroup_update_active`name, or to add a `rna_AttributeGroupGreasePencilDrawing_update_active` one (which could then call `rna_AttributeGroupID_update_active` if it's fine to do so)?
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
RNA_def_property_ui_text(prop, "Active Attribute Index", "Active attribute index");
@ -1647,7 +1647,7 @@ static void rna_def_attribute_group_grease_pencil_drawing(BlenderRNA *brna)
"rna_AttributeGroupGreasePencilDrawing_active_index_get",
"rna_AttributeGroupGreasePencilDrawing_active_index_set",
"rna_AttributeGroupGreasePencilDrawing_active_index_range");
RNA_def_property_update(prop, 0, "rna_AttributeGroupID_update_active");
RNA_def_property_update(prop, 0, "rna_AttributeGroup_update_active");
}
void rna_def_attributes_common(StructRNA *srna, const AttributeOwnerType type)