Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Oeser <info@graphics-engineer.com>2020-11-05 13:32:04 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-11-06 13:56:57 +0300
commite6739ed91d5c4f34f6fbac88734ee1ba71bc6b6f (patch)
tree34e2d169d24686967f89793629895a83e4d60c12 /source/blender/blenkernel/intern/unit.c
parent28e703b0a104f8c8c64dee835d9fd3e657ac86cf (diff)
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
Diffstat (limited to 'source/blender/blenkernel/intern/unit.c')
-rw-r--r--source/blender/blenkernel/intern/unit.c6
1 files changed, 6 insertions, 0 deletions
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;