Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-24 12:13:52 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-24 13:23:00 +0300
commit27da305a404f72a75a37892e1ac080c6531d059b (patch)
tree3fb809530c31b63882e95fa6c4ed1d9d6577e13f /source/blender/makesrna/intern/rna_mesh.c
parent67b352f9c5317c81c8e862a49be656c56e8f0743 (diff)
Depsgraph: support flushing parameters without a full COW update
Avoid computationally expensive copying operations when only some settings have been modified. This is done by adding support for updating parameters without tagging for copy-on-write. Currently only mesh data blocks are supported, other data-blocks can be added individually. This prepares for changing values such as edit-mesh auto-smooth angle in edit-mode without duplicating all mesh-data. The benefit will only be seen when the user interface no longer tags all ID's for copy on write updates. ID_RECALC_GEOMETRY_ALL_MODES has been added to support situations where non edit-mode geometry is modified in edit-mode. While this isn't something user are likely to do, Python scripts may change the underlying mesh. Reviewed By: sergey Ref D11377
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 77eed95d5be..2229fca1b45 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -239,6 +239,19 @@ static void rna_Mesh_update_data_legacy_deg_tag_all(Main *UNUSED(bmain),
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
+static void rna_Mesh_update_geom_and_params(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
+{
+ ID *id = ptr->owner_id;
+ if (id->us <= 0) { /* See note in section heading. */
+ return;
+ }
+
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PARAMETERS);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+}
+
static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
{
BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
@@ -3333,7 +3346,7 @@ static void rna_def_mesh(BlenderRNA *brna)
"Auto Smooth",
"Auto smooth (based on smooth/sharp faces/edges and angle between faces), "
"or use custom split normals data if available");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_float_sdna(prop, NULL, "smoothresh");
@@ -3342,7 +3355,7 @@ static void rna_def_mesh(BlenderRNA *brna)
"Auto Smooth Angle",
"Maximum angle between face normals that will be considered as smooth "
"(unused if custom split normals data are available)");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
RNA_define_verify_sdna(false);
prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE);
@@ -3373,7 +3386,7 @@ static void rna_def_mesh(BlenderRNA *brna)
prop,
"Auto Texture Space",
"Adjust active object's texture space automatically when transforming object");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params");
# if 0
prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);