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
This commit is contained in:
Philipp Oeser 2020-11-05 11:32:04 +01:00
parent 28e703b0a1
commit e6739ed91d
Notes: blender-bot 2023-02-14 05:28:01 +01:00
Referenced by issue #82407, Negative number input gives syntax error for velocities and accelerations
1 changed files with 6 additions and 0 deletions

View File

@ -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;