bpy.types.View2D.view_to_region returns wrong values #62132

Closed
opened 2019-03-02 17:44:00 +01:00 by evgenvasilev · 5 comments

System Information
Operating system: ubuntu 18.04

Blender Version
Broken: blender-2.80-9e4d561a8b7d-linux-glibc224-x86_64

Short description of error
If image is moved or scaled in image editor and it's point is outside image editor, view_to_region will return wrong values for that point. In my case (12000, 12000), should be negative values or values bigger than image editor width or height to allow (for example) drawing rectangle along image border with gpu python module.

Exact steps for others to reproduce the error
test2.blend

  1. Open test2.blend
  2. Paste this to console:
  bpy.data.workspaces['Layout'].screens[0].areas[0].regions[4].view2d.view_to_region(0, 0)
  1. Notice that values are wrong.
  2. Move image to have bottom left corner inside image editor, repeat 2, notice that values are right.
**System Information** Operating system: ubuntu 18.04 **Blender Version** Broken: blender-2.80-9e4d561a8b7d-linux-glibc224-x86_64 **Short description of error** If image is moved or scaled in image editor and it's point is outside image editor, view_to_region will return wrong values for that point. In my case (12000, 12000), should be negative values or values bigger than image editor width or height to allow (for example) drawing rectangle along image border with gpu python module. **Exact steps for others to reproduce the error** [test2.blend](https://archive.blender.org/developer/F6746746/test2.blend) 1. Open test2.blend 2. Paste this to console: ``` bpy.data.workspaces['Layout'].screens[0].areas[0].regions[4].view2d.view_to_region(0, 0) ``` 3. Notice that values are wrong. 4. Move image to have bottom left corner inside image editor, repeat 2, notice that values are right.
Author

Added subscriber: @nthyjrn

Added subscriber: @nthyjrn
Member

Added subscriber: @JoshuaLeung

Added subscriber: @JoshuaLeung
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Joshua Leung self-assigned this 2019-03-04 02:52:04 +01:00
Member

What you're seeing here is actually an error code to indicate coordinates that are out of bounds - i.e. #define V2D_IS_CLIPPED 12000 (see UI_view2d.h:37)

IIRC, the Image Editor's view2d is configured to strictly show things only within 0.0 - 1.0 and the x, y axes.

What you're seeing here is actually an error code to indicate coordinates that are out of bounds - i.e. `#define V2D_IS_CLIPPED 12000` (see `UI_view2d.h:37`) IIRC, the Image Editor's view2d is configured to strictly show things only within 0.0 - 1.0 and the x, y axes.
Author

How should api users draw rectangle along image border with gpu python module? (it works only if image was not moved or scaled too much)

How should api users draw rectangle along image border with gpu python module? (it works only if image was not moved or scaled too much)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
2 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#62132
No description provided.