[gegl] serialize: clamp animated doubles to pspec range



commit 722ea752aeab9939232e67116d2a4a4448caf183
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Aug 7 11:33:17 2017 +0200

    serialize: clamp animated doubles to pspec range

 gcut/gcut.c           |    2 +-
 gegl/gegl-serialize.c |   12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gcut/gcut.c b/gcut/gcut.c
index 568c3b9..390f9a2 100644
--- a/gcut/gcut.c
+++ b/gcut/gcut.c
@@ -1249,7 +1249,7 @@ static void gcut_start_sanity (void)
   }
   if (!gegl_has_operation ("gegl:ff-save"))
   {
-    fprintf (stderr, "gcut missing runtime dependenct: gegl:ff-save operation\n");
+    fprintf (stderr, "gcut missing runtime dependency: gegl:ff-save operation\n");
     fails ++;
   }
   if (fails)
diff --git a/gegl/gegl-serialize.c b/gegl/gegl-serialize.c
index 38ecc8f..a593fbd 100644
--- a/gegl/gegl-serialize.c
+++ b/gegl/gegl-serialize.c
@@ -152,9 +152,19 @@ gegl_create_chain_argv (char      **ops,
               anim_quark = g_quark_from_string (tmpbuf);
 
               if (time == 0.0) /* avoiding ugly start interpolation artifact */
-                time = 0.4;
+                time = 0.001;
               gegl_path_calc_y_for_x (g_object_get_qdata (G_OBJECT (new),
                                       anim_quark), time, &y);
+              /* TODO: switch on int/double, thus permitting animating ints */
+              {
+                GParamSpecDouble *spec = (void*)gegl_operation_find_property (
+                                gegl_node_get_operation (new),
+                                prop);
+                if (y < spec->minimum)
+                  y = spec->minimum;
+                if (y > spec->maximum)
+                  y = spec->maximum;
+              }
               gegl_node_set (new, prop, y, NULL);
 
               in_keyframes = 0;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]