aboutsummaryrefslogtreecommitdiffstats
path: root/generat3d/evaluate.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-28 10:46:17 +0100
committerDanilo M. <danix@danix.xyz>2026-10-28 10:46:17 +0100
commit2f823a78162d3b77727a5eb440c25aa7524d81c3 (patch)
treee078fcc407c6314bbb8e9268b6639463ae17d3e8 /generat3d/evaluate.py
parentd9ed29956b111c0881f546d7f6beddf9af26dc48 (diff)
downloadgenerat3D-2f823a78162d3b77727a5eb440c25aa7524d81c3.tar.gz
generat3D-2f823a78162d3b77727a5eb440c25aa7524d81c3.zip
Fail on non-finite dial values and results
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'generat3d/evaluate.py')
-rw-r--r--generat3d/evaluate.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/generat3d/evaluate.py b/generat3d/evaluate.py
index c1a9f1b..173a78f 100644
--- a/generat3d/evaluate.py
+++ b/generat3d/evaluate.py
@@ -15,6 +15,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import math
+
+import numpy as np
+
+from . import Error
from .scene import AXES, REST_CHANNELS, key
@@ -26,8 +31,12 @@ def evaluate(scene):
for k, (idx, deltas) in fig.morphs.items():
w = values.get(k, 0.0)
if w:
- verts[idx] += w * deltas # indices are unique within one morph
+ with np.errstate(all="ignore"):
+ verts[idx] += w * deltas # indices are unique within one morph
rest = {n.id: {ch: [values[key(n.id, n.id, f"{ch}/{a}")] for a in AXES]
for ch in REST_CHANNELS}
for n in fig.nodes}
+ if (not np.isfinite(verts).all()
+ or not all(math.isfinite(v) for r in rest.values() for c in r.values() for v in c)):
+ raise Error("evaluation produced non-finite values")
return verts, rest