Page MenuHome

When changing the width of frame, it also changes frame location.
Confirmed, NormalPublicTO DO

Description

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.

Event Timeline

Kalle-Samuli Riihikoski (haikalle) renamed this task from Frame location with python has issues. to When changing the width of frame, it also changes frame location..Sun, Jan 5, 1:19 PM

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.

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Needs Developer to Reproduce.Mon, Jan 6, 12:17 PM

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 rB53b01d90023a.
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 T66307: Nodes & Physics Module, will let @Jacques Lucke (JacquesLucke) or @Brecht Van Lommel (brecht) decide...

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.

Campbell Barton (campbellbarton) changed the subtype of this task from "Report" to "To Do".Tue, Jan 14, 10:26 AM

Setting as TODO since this works as intended.

Campbell Barton (campbellbarton) changed the task status from Needs Developer to Reproduce to Confirmed.Tue, Jan 14, 10:26 AM