[Bf-blender-cvs] [584af771015] temp-geometry-nodes-fields: Add assertion in FieldEvaluator for evaluation state

Hans Goudey noreply at git.blender.org
Mon Sep 6 19:30:48 CEST 2021


Commit: 584af77101500fdc76b96ed40e9be1595398374f
Author: Hans Goudey
Date:   Mon Sep 6 12:30:40 2021 -0500
Branches: temp-geometry-nodes-fields
https://developer.blender.org/rB584af77101500fdc76b96ed40e9be1595398374f

Add assertion in FieldEvaluator for evaluation state

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

M	source/blender/functions/FN_field.hh

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

diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh
index 5b12e662f55..7de88f6298a 100644
--- a/source/blender/functions/FN_field.hh
+++ b/source/blender/functions/FN_field.hh
@@ -336,6 +336,13 @@ class FieldEvaluator : NonMovable, NonCopyable {
   {
   }
 
+  ~FieldEvaluator()
+  {
+    /* While this assert isn't strictly necessary, and could be replaced with a warning,
+     * it will catch cases where someone forgets to call #evaluate() */
+    BLI_assert(is_evaluated_);
+  }
+
   /**
    * \param field: Field to add to the evaluator.
    * \param dst: Mutable virtual array that the evaluated result for this field is be written into.



More information about the Bf-blender-cvs mailing list