When changing the width of frame, it also changes frame location. #72904

Open
opened 2020-01-04 22:24:52 +01:00 by Kalle-Samuli Riihikoski · 11 comments

If you create frame and set it into (0,0) location. Then grab right side of the frame node and make frames width bigger. Now using python read the frame
location again and it is not (0,0) anymore.

loca1.jpg

If you create frame and set it into (0,0) location. Then grab right side of the frame node and make frames width bigger. Now using python read the frame location again and it is not (0,0) anymore. ![loca1.jpg](https://archive.blender.org/developer/F8260778/loca1.jpg)
Author
Member

Added subscriber: @Kalle-SamuliRiihikoski

Added subscriber: @Kalle-SamuliRiihikoski
Author
Member
https://blenderartists.org/t/how-frame-location-is-calculated/1199582/3
Kalle-Samuli Riihikoski changed title from Frame location with python has issues. to When changing the width of frame, it also changes frame location. 2020-01-05 13:19:44 +01:00
Author
Member

I found out that if I delete this part from node_edit.c line 983

  if (node->type == NODE_FRAME) {
          /* keep the offset symmetric around center point */
          if (nsw->directions & NODE_RESIZE_LEFT) {
            node->locx = nsw->oldlocx + 0.5f * dx;
            node->offsetx = nsw->oldoffsetx + 0.5f * dx;
          }
          if (nsw->directions & NODE_RESIZE_RIGHT) {
            node->locx = nsw->oldlocx + 0.5f * dx;
            node->offsetx = nsw->oldoffsetx - 0.5f * dx;
          }
          if (nsw->directions & NODE_RESIZE_TOP) {
            node->locy = nsw->oldlocy + 0.5f * dy;
            node->offsety = nsw->oldoffsety + 0.5f * dy;
          }
          if (nsw->directions & NODE_RESIZE_BOTTOM) {
            node->locy = nsw->oldlocy + 0.5f * dy;
            node->offsety = nsw->oldoffsety - 0.5f * dy;
          }
        }

deleting this part of code gives better result when you read frame location . It still dosen't give correct values thou. It would be nice know why this code part is there because in my tests frame node works without this code part just okey.

I found out that if I delete this part from node_edit.c line 983 ``` if (node->type == NODE_FRAME) { /* keep the offset symmetric around center point */ if (nsw->directions & NODE_RESIZE_LEFT) { node->locx = nsw->oldlocx + 0.5f * dx; node->offsetx = nsw->oldoffsetx + 0.5f * dx; } if (nsw->directions & NODE_RESIZE_RIGHT) { node->locx = nsw->oldlocx + 0.5f * dx; node->offsetx = nsw->oldoffsetx - 0.5f * dx; } if (nsw->directions & NODE_RESIZE_TOP) { node->locy = nsw->oldlocy + 0.5f * dy; node->offsety = nsw->oldoffsety + 0.5f * dy; } if (nsw->directions & NODE_RESIZE_BOTTOM) { node->locy = nsw->oldlocy + 0.5f * dy; node->offsety = nsw->oldoffsety - 0.5f * dy; } } ``` deleting this part of code gives better result when you read frame location . It still dosen't give correct values thou. It would be nice know why this code part is there because in my tests frame node works without this code part just okey.
Member

Added subscribers: @JacquesLucke, @brecht, @lichtwerk

Added subscribers: @JacquesLucke, @brecht, @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'

Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
Member

Yeah, this is a bit strange (since - from the python visible side - you can run into 2 frames having the exact same width, height & location, nevertheless they dont appear at the same spot).

This is caused by the node also having an offset [used in C, transform/drawing code etc], but this is not exposed to python, so no access there...

The offset was implemented in 53b01d9002.
In theory, I think frame nodes could even live without this (and only rely on location, width & height), but this would require a bit of refactor.

So maybe a solution is to just expose this offset to python?

However, this doesnt really look like a bug, it is more of an improvement to a [incomplete/annoying] implementation.
For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests
For more information on why this might not be considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug

Hesitating to close though, this might be added as TODO to #66307 (Nodes & Physics Module), will let @JacquesLucke or @brecht decide...

Yeah, this is a bit strange (since - from the python visible side - you can run into 2 frames having the exact same width, height & location, nevertheless they dont appear at the same spot). This is caused by the node also having an offset [used in C, transform/drawing code etc], but this is not exposed to python, so no access there... The offset was implemented in 53b01d9002. In theory, I think frame nodes could even live without this (and only rely on location, width & height), but this would require a bit of refactor. So maybe a solution is to just expose this offset to python? However, this doesnt really look like a bug, it is more of an improvement to a [incomplete/annoying] implementation. For user requests and feedback, please use other channels: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests For more information on why this might not be considered a bug, visit: https://wiki.blender.org/wiki/Reference/Not_a_bug Hesitating to close though, this might be added as TODO to #66307 (Nodes & Physics Module), will let @JacquesLucke or @brecht decide...
Author
Member

This would be import for me because I coding NodeCustomBuilder addon where nodetree is transferred into json file. I have had some difficult times to save frames exact location (including nodes that are inside of the frame) locations. I would be willing to work with issues if get some guidance what would be the best fix for this annoying issue.

In theory, I think frame nodes could even live without this (and only rely on location, width & height), but this would require a bit of refactor.

This for me sounds the most logical way but I really don't everything what going on under the hood.

This would be import for me because I coding NodeCustomBuilder addon where nodetree is transferred into json file. I have had some difficult times to save frames exact location (including nodes that are inside of the frame) locations. I would be willing to work with issues if get some guidance what would be the best fix for this annoying issue. >In theory, I think frame nodes could even live without this (and only rely on location, width & height), but this would require a bit of refactor. This for me sounds the most logical way but I really don't everything what going on under the hood.

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Setting as TODO since this works as intended.

Setting as TODO since this works as intended.

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Added subscriber: @RayMairlot

Added subscriber: @RayMairlot
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:47:08 +01:00
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
4 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#72904
No description provided.