Fix T103564: creating a color attribute doesn't make it active
This was the case when done via the py-API. Now also set active_color_attribute / default_color_attribute on newly created attributes (in case none exist yet). Maniphest Tasks: T103564 Differential Revision: https://developer.blender.org/D16898
This commit is contained in:
parent
e438e8e04e
commit
101d04f41f
Notes:
blender-bot
2024-02-16 15:39:38 +01:00
Referenced by issue #103761, Regression: Creating the first vertex color on a mesh does not always make it active/default Referenced by issue #103564, Scripting: creating a corner-domain color attribute doesn't make it active Referenced by pull request #105020, Fix #103761: creating a color attribute doesn't make it active Referenced by commitacfafeed88
, Fix #103761: creating a color attribute doesn't make it active Referenced by pull request #109910, Fix #103410: name collisions between vertex groups and attributes Referenced by commit12ef20990b
, Fix #103410: name collisions between vertex groups and attributes Referenced by pull request #118378, Fix #107228: AttributeGroup.new crash when layer cannot be created Referenced by commit745d2e18dc
, Fix #107228: AttributeGroup.new crash when layer cannot be created
|
@ -389,6 +389,17 @@ static PointerRNA rna_AttributeGroup_new(
|
|||
ID *id, ReportList *reports, const char *name, const int type, const int domain)
|
||||
{
|
||||
CustomDataLayer *layer = BKE_id_attribute_new(id, name, type, domain, reports);
|
||||
|
||||
if ((GS(id->name) == ID_ME) && ELEM(layer->type, CD_PROP_COLOR, CD_PROP_BYTE_COLOR)) {
|
||||
Mesh *mesh = (Mesh *)id;
|
||||
if (!mesh->active_color_attribute) {
|
||||
mesh->active_color_attribute = BLI_strdup(layer->name);
|
||||
}
|
||||
if (!mesh->default_color_attribute) {
|
||||
mesh->default_color_attribute = BLI_strdup(layer->name);
|
||||
}
|
||||
}
|
||||
|
||||
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
|
||||
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
||||
|
||||
|
|
Loading…
Reference in New Issue