[Bf-blender-cvs] [00d476976e8] master: Fix T50973: Directional blur node doesn't clamp value if using driver

Sergey Sharybin noreply at git.blender.org
Fri Jul 7 12:21:14 CEST 2017


Commit: 00d476976e88052e8410916fca1d86d5f12529ca
Author: Sergey Sharybin
Date:   Fri Jul 7 12:08:14 2017 +0200
Branches: master
https://developer.blender.org/rB00d476976e88052e8410916fca1d86d5f12529ca

Fix T50973: Directional blur node doesn't clamp value if using driver

The issue was caused by combination of following factors:

- Blender Internal viewport render can not distinguish between which parts of
  main database changed, so it does full database re-sync when anything is
  tagged for an update.

  This way, if any NodeTree (including compositor) is changed, Blender Internal
  viewport is tagged for full render database update.

- With old dependency graph, scene-level drivers are evaluated on every
  iteration of scene_update_tagged, even if nothing is tagged for an update.

  This causes compositor drivers be evaluated quite often.

- Driver evaluation checks whether value was changed, and if so it tags
  corresponding ID type as updated (this is what was telling viewport to do
  render database update).

  This check was quite stupid: current property value was checked against the
  one coming from driver expression. This means, if driver value is outside
  of the hard limit range of the property, the property will always be
  considered updated.

The fix is to compare current property value against clamped value from the
driver.

===================================================================

M	source/blender/blenkernel/intern/anim_sys.c

===================================================================

diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index bcc0d1aeacb..539901a59d5 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1519,7 +1519,8 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
 		}
 		case PROP_INT:
 		{
-			const int value_coerce = (int)value;
+			int value_coerce = (int)value;
+			RNA_property_int_clamp(ptr, prop, &value_coerce);
 			if (array_index != -1) {
 				if (RNA_property_int_get_index(ptr, prop, array_index) != value_coerce) {
 					RNA_property_int_set_index(ptr, prop, array_index, value_coerce);
@@ -1536,15 +1537,17 @@ static bool animsys_write_rna_setting(PathResolvedRNA *anim_rna, const float val
 		}
 		case PROP_FLOAT:
 		{
+			float value_coerce = value;
+			RNA_property_float_clamp(ptr, prop, &value_coerce);
 			if (array_index != -1) {
-				if (RNA_property_float_get_index(ptr, prop, array_index) != value) {
-					RNA_property_float_set_index(ptr, prop, array_index, value);
+				if (RNA_property_float_get_index(ptr, prop, array_index) != value_coerce) {
+					RNA_property_float_set_index(ptr, prop, array_index, value_coerce);
 					written = true;
 				}
 			}
 			else {
-				if (RNA_property_float_get(ptr, prop) != value) {
-					RNA_property_float_set(ptr, prop, value);
+				if (RNA_property_float_get(ptr, prop) != value_coerce) {
+					RNA_property_float_set(ptr, prop, value_coerce);
 					written = true;
 				}
 			}




More information about the Bf-blender-cvs mailing list