Fix node auto-offset to left broken
authorJulian Eisel <eiseljulian@gmail.com>
Fri, 25 Sep 2015 15:08:33 +0000 (17:08 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Fri, 25 Sep 2015 15:08:33 +0000 (17:08 +0200)
Own, really stupid mistake in rBc653077bf56 :| Kids, don't commit at night!

source/blender/editors/space_node/node_relationships.c

index a9f126a75e209fa48c2b6b941eb4aa7ef1896c3d..4097db29e5a75cc3f17ada9b42380d74ab1706a0 100644 (file)
@@ -1646,10 +1646,15 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w
        for (node = snode->edittree->nodes.first; node; node = node->next) {
                if (UNLIKELY(node->anim_ofsx)) {
                        const float endval = node->anim_init_locx + node->anim_ofsx;
-                       if (node->locx < endval) {
+                       if (IS_EQF(node->locx, endval) == false) {
                                node->locx = BLI_easing_cubic_ease_in_out(duration, node->anim_init_locx, node->anim_ofsx,
                                                                          NODE_INSOFS_ANIM_DURATION);
-                               CLAMP_MAX(node->locx, endval);
+                               if (node->anim_ofsx < 0) {
+                                       CLAMP_MIN(node->locx, endval);
+                               }
+                               else {
+                                       CLAMP_MAX(node->locx, endval);
+                               }
                                redraw = true;
                        }
                }