Rewrite some compositing nodes to using declarations #108728

Open
opened 2023-06-07 23:57:12 +02:00 by Iliya Katushenock · 21 comments

Dynamic declarations for some compositor nodes.

Goals:

Stop using operators to change node sockets directly. Delegate this to the node declaration system. This have a lot of benefits:

  1. Management of topology updates, drawing.
  2. Part of node updatings have to be exist only as part of main node trees update class.
  3. Handling old socket data and links from declaration code automatically.
  4. Using a newer, maintained API.

Way to do that:

  1. For CMP_NODE_OUTPUT_FILE node:
    1.1. Added in node.storage stucture linked list to contain metadata of each output socket.
    1.2. Added declare_dynamic function for generate sockets based on metadata. See blender::nodes::node_group_declare_dynamic as example implementation.
    1.3. Change node property operators to change only metadata.
  2. All bNodeSocketTemplate replace by static declarations. See ed9b21098d as example.

It is best to do this separately for each node in an individual PR.
Nodes to change:

  • CMP_NODE_OUTPUT_FILE.
  • CMP_NODE_R_LAYERS #114629.
  • CMP_NODE_CRYPTOMATTE ae739a6173.
    • CMP_NODE_CRYPTOMATTE_LEGACY ?
  • CMP_NODE_SWITCH_VIEW 5dd9e57878.
Dynamic declarations for some compositor nodes. ### Goals: Stop using operators to change node sockets directly. Delegate this to the node declaration system. This have a lot of benefits: 1. Management of topology updates, drawing. 2. Part of node updatings have to be exist only as part of main node trees update class. 3. Handling old socket data and links from declaration code automatically. 4. Using a newer, maintained API. ### Way to do that: 1. For `CMP_NODE_OUTPUT_FILE` node: 1.1. Added in node.storage stucture linked list to contain metadata of each output socket. 1.2. Added `declare_dynamic` function for generate sockets based on metadata. See `blender::nodes::node_group_declare_dynamic` as example implementation. 1.3. Change node property operators to change only metadata. 2. All `bNodeSocketTemplate` replace by static declarations. See https://projects.blender.org/blender/blender/commit/ed9b21098dd27bf9364397357f89b4c2648f40c2 as example. It is best to do this separately for each node in an individual PR. Nodes to change: - [ ] `CMP_NODE_OUTPUT_FILE`. - [ ] `CMP_NODE_R_LAYERS` #114629. - [X] `CMP_NODE_CRYPTOMATTE` ae739a6173a5a61a7db8cc64d924ea6e0ebadcc7. - [ ] `CMP_NODE_CRYPTOMATTE_LEGACY` ? - [x] `CMP_NODE_SWITCH_VIEW` 5dd9e578780f7dcc17134d20cac5748faf768eb2.
Iliya Katushenock added the
Interest
Compositing
Type
Design
labels 2023-06-07 23:57:12 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-06-07 23:57:14 +02:00
Iliya Katushenock added the
Meta
Good First Issue
label 2023-06-12 21:26:15 +02:00
Contributor

Can I take this issue?

Can I take this issue?
Author
Member

Yes, your welcome!

Yes, your welcome!
Contributor

I noticed that for CMP_NODE_R_LAYERS, there are also some operations for adding/removing sockets, does your 1 also applies for CMP_NODE_R_LAYERS besides CMP_NODE_OUTPUT_FILE?

I noticed that for `CMP_NODE_R_LAYERS`, there are also some operations for adding/removing sockets, does your 1 also applies for `CMP_NODE_R_LAYERS` besides `CMP_NODE_OUTPUT_FILE`?
Author
Member

As i know, CMP_NODE_R_LAYERS should display only sockets, declared by scene layers.
So, there is no operators (?) but only dynamic declaration should be added.
Tell me if I misunderstood something.

As i know, `CMP_NODE_R_LAYERS` should display only sockets, declared by scene layers. So, there is no operators (?) but only dynamic declaration should be added. Tell me if I misunderstood something.
Contributor

All bNodeSocketTemplate replace by static declarations. See ed9b21098d as example.

I thought you were saying static declarations instead o dynamic declarations for CMP_NODE_R_LAYERS.
So for your 2, we may need dynamic declarations?

Is your 1 an example and it applies to all of the 4 nodes? or 1 only applies to CMP_NODE_OUTPUT_FILE?

> All bNodeSocketTemplate replace by static declarations. See ed9b21098d as example. I thought you were saying static declarations instead o dynamic declarations for `CMP_NODE_R_LAYERS`. So for your 2, we may need dynamic declarations? Is your 1 an example and it applies to all of the 4 nodes? or 1 only applies to `CMP_NODE_OUTPUT_FILE`?
Author
Member

Yes, where necessary, declarations should be made dynamic.

Yes, where necessary, declarations should be made dynamic.
Contributor

I rewrote CMP_NODE_SWITCH_VIEW node. But I have no idea what new features are you expecting so I don't know how to test it. Do you have any ideas?

I rewrote `CMP_NODE_SWITCH_VIEW` node. But I have no idea what new features are you expecting so I don't know how to test it. Do you have any ideas?
Author
Member

It should not introduce new features. This is an internal refactoring that should not create behavioral changes.
There is a varniat, in theory, you should fix this bug #108719, so you can check it out.
But otherwise, probably the only option is to check the test runs (https://wiki.blender.org/wiki/Tools/Tests/Setup). It is also easy to manually check various cases of work.

It should not introduce new features. This is an internal refactoring that should not create behavioral changes. There is a varniat, in theory, you should fix this bug #108719, so you can check it out. But otherwise, probably the only option is to check the test runs (https://wiki.blender.org/wiki/Tools/Tests/Setup). It is also easy to manually check various cases of work.
Contributor

I started from an easier one, i.e. CMP_NODE_SWITCH_VIEW

I started from an easier one, i.e. `CMP_NODE_SWITCH_VIEW`

Hi @mod_moder , could I work on this issue as a first good issue? If it's available. Thank you.

Hi @mod_moder , could I work on this issue as a first good issue? If it's available. Thank you.
Author
Member

@Artur-Vieira Hi, yes, welcome

@Artur-Vieira Hi, yes, welcome

Hi @mod_moder! I would love to take one of these nodes as a first issue. Is it available? I see that @Weikang-Qiu already made CMP_NODE_SWITCH_VIEW and @Artur-Vieira also want to contribute here so @Artur-Vieira what node you've already taken if any? Also @Weikang-Qiu do you continue working on another node from this list so I can take the other one?

Hi @mod_moder! I would love to take one of these nodes as a first issue. Is it available? I see that @Weikang-Qiu already made `CMP_NODE_SWITCH_VIEW` and @Artur-Vieira also want to contribute here so @Artur-Vieira what node you've already taken if any? Also @Weikang-Qiu do you continue working on another node from this list so I can take the other one?
Contributor

Hi @petertretyakov . Yeah I am planning to take another one but I haven't started yet. you can pick the one you like first.

Hi @petertretyakov . Yeah I am planning to take another one but I haven't started yet. you can pick the one you like first.
Contributor

Also I am wondering what node did you choose @Artur-Vieira ? Since I am beginning to refractor the next one.

Also I am wondering what node did you choose @Artur-Vieira ? Since I am beginning to refractor the next one.

@Weikang-Qiu which one will you take?

@Weikang-Qiu which one will you take?

@Weikang-Qiu feel free to choose first, I am working on reviewing the code repository.

@Weikang-Qiu feel free to choose first, I am working on reviewing the code repository.

I'll take CMP_NODE_OUTPUT_FILE if nobody has taken it yet. @Weikang-Qiu @Artur-Vieira FYI

I'll take `CMP_NODE_OUTPUT_FILE` if nobody has taken it yet. @Weikang-Qiu @Artur-Vieira FYI
Author
Member

Rewriting of CMP_NODE_R_LAYERS node might not be a bad decision for any of you right now.

Rewriting of `CMP_NODE_R_LAYERS` node might not be a bad decision for any of you right now.

I spent several hours in last two days with output file node and looks like it would be better to start with another one, so I'll take render layers node and then return to output file if nobody has taken it yet. Also if somebody want to try with output file node it is free for now ))

I spent several hours in last two days with output file node and looks like it would be better to start with another one, so I'll take render layers node and then return to output file if nobody has taken it yet. Also if somebody want to try with output file node it is free for now ))
Contributor

Is the CMP_NODE_OUTPUT_FILE task taken by #118807?

Is the `CMP_NODE_OUTPUT_FILE` task taken by #118807?
Author
Member

Nope, #118807 is just fix of the bug. There is still might be other issues, and this refactor still should be done due to improvements listed in the description.

Nope, #118807 is just fix of the bug. There is still might be other issues, and this refactor still should be done due to improvements listed in the description.
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 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#108728
No description provided.