The “Frame” node has been in trunk for a few months now, but it is still in a somewhat unfinished state. So i’ve made a few additions that will make this node a lot more useful for organizing node layout. Thanks to Sebastian König for feedback and testing!
The general idea is that the Frame node can complement the already present Group nodes. Node groups are in fact separate data blocks, linked into a node tree by the node group (so the term “group” is a bit misleading: the internal nodes are completely separate from the surrounding nodes). The frame nodes on the other hand are really just a way of grouping nodes inside the same tree, without the need for additional interfaces.
Oh, and btw: We should change the name of this thing! “Frame” usually has a different meaning in Blender, but i still don’t have a convincing alternative … Time to get creative! 🙂
NOTE: I will upload the patch to the codereview tool soon, for now here is a simple pasteall.org link if you want to try it out:
NOTE 2: The patch is now submitted to the code review tool:
Potential changes before trunk merge will be uploaded there as well.
NOTE 3: COMMITTED TO TRUNK!
Frame Node Bounding Boxes
Frame nodes now behave as Bounding Boxes around the attached nodes. When moving a child node of a frame, the size will update automatically to make sure it is big enough for all children.
Frame nodes have an optional Shrink setting (accessible in the sidebar), which ensures that the bounding box is of minimal size. If disabled the frame will not change size when children are moved closer together.
Improved Node Resizing
Resizing nodes now has immediate visual feedback in the form of changing mouse cursors. When hovering the mouse over the border of a node, the cursor changes to indicate the possible directions in which a node border can be dragged.
Previously node borders could only be grabbed at the lower right corner. This was in fact restricted to resizing the node width, so having the resize widget in the corner is misleading (indicating a possible resize of height too). Any change of height is in fact purely automatic (for regular nodes), caused by resizing the preview with constant aspect ratio. Node borders can now be grabbed at both the left and right size instead for horizontal resizing.
Manual resizing of frame nodes only works if the Shrink option is disabled. Otherwise the frame size is determined fully automatic by the placement of child nodes. Unlike regular nodes, frame nodes can then also be resized in the vertical direction from both top and bottom border.
New Operators for Managing Frame Nodes
The frame node basically implements a parent/child relationship similar to that found in objects: The frame acts as the parent node for all attached children (including other frames). When moving the parent, the children move with it (transform hierarchy).
For changing this hierarchy a number operators and tools have been implemented:
Similar to object parenting, nodes can be attached and released from frames with directly operators:
- CTRL+p attaches a node to the active frame. The last selected (=active) node has to be a frame node.
- ALT+p releases a node from it’s current parent.
In addition, nodes can also be attached and released more conveniently using mouse dragging:
- Moving any number of nodes onto a frame (i.e. mouse cursor is over the frame when confirming) attaches them to the frame.
- ALT+f releases a node from it’s parent (like ALT+p) and immediately starts the modal transform operator
Note: We tried implementing a grabbing variant for this (grab+modifier key), but there is just no unused working combination left in the keymap …
Similar to Node Groups there are also ways to create new frames around a selection of nodes:
- ALT+j creates a new frame around the selected nodes (like ALT+g for creating a group)
- “ungrouping” can be done by simply deleting a frame node. All immediate child nodes are then released.
Theme Colors for Node Selection
Previously the active node and selected nodes were indicated using the “Text Highlight” theme color for both. Now this has been replaced by dedicated theme colors for the active node and for selection respectively, to allow better visual distinction of the selection state.
Custom Node Colors
Nodes can now have an optional custom color displayed on their “body” part (that is, the node background except the header bar and the outline). This is meant to be used primarily in combination with frame nodes, as a way to visually separate different sections of a node tree.
The colors have a preset system, like the one already in place for tracks in the clip editor. Colors can be stored as presets and can be applied to all selected nodes using the Copy Color button next to the preset menu.