Nodes: Add bNodeInstanceKey to DerivedNodeTree #108900

Merged
Omar Emara merged 1 commits from OmarEmaraDev/blender:derived-node-tree-instance-key into main 2023-06-21 05:04:03 +02:00
Member

This patch adds support for bNodeInstanceKey to DerivedNodeTree. The
keys are computed and cached in the DContext at construction time, and
various utilities are added to return the instance keys of contexts,
nodes, as well as find the active context in the tree.

This patch adds support for bNodeInstanceKey to DerivedNodeTree. The keys are computed and cached in the DContext at construction time, and various utilities are added to return the instance keys of contexts, nodes, as well as find the active context in the tree.
Omar Emara added the
Module
Nodes & Physics
label 2023-06-12 15:41:17 +02:00
Omar Emara added 1 commit 2023-06-12 15:41:29 +02:00
7311b79bc7 Nodes: Add bNodeInstanceKey to DerivedNodeTree
This patch adds support for bNodeInstanceKey to DerivedNodeTree. The
keys are computed and cached in the DContext at construction time, and
various utilities are added to return the instance keys of contexts,
nodes, as well as find the active context in the tree.
Omar Emara requested review from Jacques Lucke 2023-06-12 15:41:54 +02:00
Omar Emara requested review from Hans Goudey 2023-06-12 15:42:03 +02:00
Jacques Lucke reviewed 2023-06-12 16:06:57 +02:00
@ -194,0 +201,4 @@
* a representation of the node tree of that node group. Note that the context also stores the
* group node that the user selected to edit the node tree, so the context fully represents a
* particular instance of the node group. */
const DTreeContext &active_context() const;
Member

active_context sounds a bit like a wrong abstraction to me, mainly because you can have multiple node editors open at the same time.

`active_context` sounds a bit like a wrong abstraction to me, mainly because you can have multiple node editors open at the same time.
Author
Member

@JacquesLucke But there is still a concept of an active context even in that case, right?
Otherwise, what do you propose?

@JacquesLucke But there is still a concept of an active context even in that case, right? Otherwise, what do you propose?
Member

It might just be a matter of naming or improving the comment. The comment makes it sounds like the active context is the one that the user is currently editing, but that definition doesn't really work when there are multiple node editors. Instead, it seems like you derive the active context from the active viewer, which is probably only indirectly related to the context that the user is editing right now.

It might just be a matter of naming or improving the comment. The comment makes it sounds like the active context is the one that the user is currently editing, but that definition doesn't really work when there are multiple node editors. Instead, it seems like you derive the active context from the active viewer, which is probably only indirectly related to the context that the user is editing right now.
Author
Member

@JacquesLucke Your former definition which the comment implies is actually the more correct one as far as I can see. It is not actually derived from the active viewer, the name is probably misleading in that case. If you have multiple editors open with different context, the active one will be the one that the user is editing or is interacting with. You can try that by selecting a node in of the editors, which will make that context active.

@JacquesLucke Your former definition which the comment implies is actually the more correct one as far as I can see. It is not actually derived from the active viewer, the name is probably misleading in that case. If you have multiple editors open with different context, the active one will be the one that the user is editing or is interacting with. You can try that by selecting a node in of the editors, which will make that context active.
Member

Code seems ok. I wouldn't have done this mainly because it adds additional responsibilities to the DerivedNodeTree structure which was only concerned with providing an inlined view of the bNodeTree before. But since the data structure is only used in one place, it should be fine to specialize it for that use case a bit.

Code seems ok. I wouldn't have done this mainly because it adds additional responsibilities to the `DerivedNodeTree` structure which was only concerned with providing an inlined view of the `bNodeTree` before. But since the data structure is only used in one place, it should be fine to specialize it for that use case a bit.
Jacques Lucke refused to review 2023-06-13 09:22:40 +02:00
Omar Emara requested review from Brecht Van Lommel 2023-06-20 17:32:34 +02:00
Brecht Van Lommel approved these changes 2023-06-20 17:38:53 +02:00
Omar Emara merged commit 740baefb16 into main 2023-06-21 05:04:03 +02:00
Omar Emara deleted branch derived-node-tree-instance-key 2023-06-21 05:04:05 +02: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
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#108900
No description provided.