Pasting angle value with minus sign results in error #117783

Closed
opened 2024-02-03 13:24:22 +01:00 by Serge Lyatin · 7 comments

System Information
Operating system: win10 64
Graphics card: 1050ti

Blender Version
Broken: 3.6, 4.0.3

Short description of error
Pasting angle value with minus sign results in error:
Error evaluating number, see Info editor for details: bad operand type for unary -: 'tuple'

Exact steps for others to reproduce the error
Set X rotation to -90 deg for a Cube and copy this value with ctrl+c via cursor hover or a click
Paste it to Y rotation with math input: click cursor in the field, type "-" (minus sign w/o quotation marks), press ctrl+v then enter

**System Information** Operating system: win10 64 Graphics card: 1050ti **Blender Version** Broken: 3.6, 4.0.3 **Short description of error** Pasting angle value with minus sign results in error: `Error evaluating number, see Info editor for details: bad operand type for unary -: 'tuple'` **Exact steps for others to reproduce the error** Set X rotation to -90 deg for a Cube and copy this value with ctrl+c via cursor hover or a click Paste it to Y rotation with math input: click cursor in the field, type "-" (minus sign w/o quotation marks), press ctrl+v then enter
4.4 KiB
Serge Lyatin added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2024-02-03 13:24:22 +01:00

But there are two - signs in your screenshot. Seems that this works with unitless numbers, but doesn't work when unit is used.
I assume, that numbers with units are parsed as tupple, and you are effectively doing expression -(-90, 'd') which is invalid expression. In such case this would work as expected

But there are two `-` signs in your screenshot. Seems that this works with unitless numbers, but doesn't work when unit is used. I assume, that numbers with units are parsed as tupple, and you are effectively doing expression `-(-90, 'd')` which is invalid expression. In such case this would work as expected

Actually, --1m is converted to (-()-(1*1 ))*1, so the invalid part is only -(). But the code expects a number after - sign. So this is still working as expected. I think, there could be "find double negative" string processing stage, since it would be more consistent and quite safe though. But then values like -(-5m) still couldn't be parsed properly.

Actually, `--1m` is converted to `(-()-(1*1 ))*1`, so the invalid part is only `-()`. But the code expects a number after `-` sign. So this is still working as expected. I think, there could be "find double negative" string processing stage, since it would be more consistent and quite safe though. But then values like -(-5m) still couldn't be parsed properly.

@harley Can you share your opinion here? Should at least double negative be handled here?

@harley Can you share your opinion here? Should at least double negative be handled here?
Member

@SergeL = "Pasting angle value with minus sign results in error"

What was your expected result? You weren't entering an "angle value with minus sign" but an angle with two minus signs. Were you expecting this would result in +90 degrees?

This error does not require any copying and pasting. You can see this result by typing values directly into the rotation input:

"90" = +90°
"-90" = -90°
"--90" = "+90°
"++90" = "+90°
"---90" = "-90°
"-------90" = -90°

The problem occurs when adding "d" or "r" after it. These work:
"90d" = +90°
"-90d" = -90°
"++90d" = +90°
"2r" = 114.592°
"-2r" = -114.592°

These do not:
"--90d" = error
"--2r" = error

Is this even something worth worrying about? It seems like an inconvenient way to enter +90° or +2r. What was the reason for pasting the negative value after entering a minus sign?

> @SergeL = "Pasting angle value with minus sign results in error" What was your expected result? You weren't entering an "angle value with minus sign" but an angle with **two minus signs**. Were you expecting this would result in +90 degrees? This error does not require any copying and pasting. You can see this result by typing values directly into the rotation input: "90" = +90° "-90" = -90° "--90" = "+90° "++90" = "+90° "---90" = "-90° "-------90" = -90° The problem occurs when adding "d" or "r" after it. These work: "90d" = +90° "-90d" = -90° "++90d" = +90° "2r" = 114.592° "-2r" = -114.592° These do not: "--90d" = error "--2r" = error Is this even something worth worrying about? It seems like an inconvenient way to enter +90° or +2r. What was the reason for pasting the negative value after entering a minus sign?
Member

This error is caused inside of unit_distribute_negatives

This routine puts "parentheses around blocks of values after negative signs to get rid of an implied "+" between numbers without an operation between them" The example given is this string:

"-1m50cm + 1 - 2m50cm"
becomes
"-(1m50cm) + 1 - (2m50cm)"

Guessing it was not made expecting to see multiple negatives in a row. Might be able to just repeatedly remove sequences of "--" until there are none?

This error is caused inside of `unit_distribute_negatives` This routine puts "parentheses around blocks of values after negative signs to get rid of an implied "+" between numbers without an operation between them" The example given is this string: "-1m50cm + 1 - 2m50cm" becomes "-(1m50cm) + 1 - (2m50cm)" Guessing it was not made expecting to see multiple negatives in a row. Might be able to just repeatedly remove sequences of "--" until there are none?
Member

I'll submit a PR for Campbell to look at

I'll submit a PR for Campbell to look at
Harley Acheson self-assigned this 2024-02-05 01:25:35 +01:00
Pratik Borhade added
Module
User Interface
Status
Confirmed
and removed
Status
Needs Triage
labels 2024-02-05 05:48:08 +01:00
Author

@SergeL = "Pasting angle value with minus sign results in error"

What was your expected result? You weren't entering an "angle value with minus sign" but an angle with two minus signs. Were you expecting this would result in +90 degrees?

Exactly this, it is the fastest way to make positive number when dealing with math input and copied values.

> > @SergeL = "Pasting angle value with minus sign results in error" > > What was your expected result? You weren't entering an "angle value with minus sign" but an angle with **two minus signs**. Were you expecting this would result in +90 degrees? > Exactly this, it is the fastest way to make positive number when dealing with math input and copied values.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-02-05 23:29:48 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser Project (Legacy)
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117783
No description provided.