Fix: 3D Viewport header missing update changing vertex groups #112227

Merged
Philipp Oeser merged 3 commits from lichtwerk/blender:112186_vertexgroups-update into main 2023-09-12 15:44:06 +02:00
2 changed files with 14 additions and 2 deletions

View File

@ -1620,6 +1620,11 @@ static void view3d_header_region_listener(const wmRegionListenerParams *params)
case NC_BRUSH:
ED_region_tag_redraw(region);
break;
case NC_GEOM:
if (wmn->data == ND_VERTEX_GROUP) {
lichtwerk marked this conversation as resolved Outdated

I think & is incorrect, these notifiers aren't flags. Pretty sure it should be =.

I think `&` is incorrect, these notifiers aren't flags. Pretty sure it should be `=`.
Review

I wonder if it's worth checking the context mode and not redrawing if we're not in weight paint mode? I guess that sort of optimization isn't so common, but seems nice to avoid the redraw when it's obvious. Up to you :)

I wonder if it's worth checking the context mode and not redrawing if we're not in weight paint mode? I guess that sort of optimization isn't so common, but seems nice to avoid the redraw when it's obvious. Up to you :)
Review

From quick glance, I dont see this being done elsewhere (if we only have wmRegionListenerParams at hand, I wouldnt actually know how to get to context mode from there)

From quick glance, I dont see this being done elsewhere (if we only have `wmRegionListenerParams` at hand, I wouldnt actually know how to get to context mode from there)
ED_region_tag_redraw(region);
}
break;
}
/* From top-bar, which ones are needed? split per header? */

View File

@ -861,6 +861,13 @@ static void rna_Object_dup_collection_set(PointerRNA *ptr,
}
}
static void rna_Object_vertex_groups_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
{
Object *ob = reinterpret_cast<Object *>(ptr->owner_id);
WM_main_add_notifier(NC_GEOM | ND_VERTEX_GROUP, ob->data);
rna_Object_internal_update_data_impl(ptr);
}
static void rna_Object_vertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Object *ob = static_cast<Object *>(ptr->data);
@ -2744,7 +2751,7 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
nullptr);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_vertex_groups_update");
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
@ -2754,7 +2761,7 @@ static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
"rna_Object_active_vertex_group_index_range");
RNA_def_property_ui_text(
prop, "Active Vertex Group Index", "Active index in vertex group array");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_vertex_groups_update");
/* vertex groups */ /* add_vertex_group */
func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");