[Bf-blender-cvs] [e6739ed91d5] blender-v2.91-release: Fix T82407: Negative number input gives syntax error for velocities and accelerations

Philipp Oeser noreply at git.blender.org
Fri Nov 6 11:59:50 CET 2020


Commit: e6739ed91d5c4f34f6fbac88734ee1ba71bc6b6f
Author: Philipp Oeser
Date:   Thu Nov 5 11:32:04 2020 +0100
Branches: blender-v2.91-release
https://developer.blender.org/rBe6739ed91d5c4f34f6fbac88734ee1ba71bc6b6f

Fix T82407: Negative number input gives syntax error for velocities and
accelerations

Caused by rB45dbc38a8b15.

Above commit would place parentheses surrounding a block until the next
operator was found.
For velocities and accelerations though, the '/' in 'm/s' or 'ft/s'
should not be considered an operator.

Maniphest Tasks: T82407

Differential Revision: https://developer.blender.org/D9467

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

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

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

diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index a5418b8b8c5..73bf149bf2a 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -815,6 +815,12 @@ static char *find_next_op(const char *str, char *remaining_str, int len_max)
 
       /* Make sure we don't look backwards before the start of the string. */
       if (remaining_str != str && i != 0) {
+        /* Check for velocity or acceleration (e.g. '/' in 'ft/s' is not an op). */
+        if ((remaining_str[i] == '/') && ELEM(remaining_str[i - 1], 't', 'T', 'm', 'M') &&
+            ELEM(remaining_str[i + 1], 's', 'S')) {
+          continue;
+        }
+
         /* Check for scientific notation. */
         if (remaining_str[i - 1] == 'e' || remaining_str[i - 1] == 'E') {
           scientific_notation = true;



More information about the Bf-blender-cvs mailing list