Compositor: Make split viewer a regular split node #114245
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#114245
Loading…
Reference in New Issue
No description provided.
Delete Branch "zazizizou/blender:com-split-node"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Behavior:
Changes:
Utilities
(similar to Switch node)Todo after submitting the patch:
Compositor: Make split viewer a regular split nodeto WIP: Compositor: Make split viewer a regular split nodeI am aware this is still a WIP, but the domain of the node should no longer be dependent on the render region size. For the realtime compositor, to correct that, the
compute_domain
method should just be removed.@OmarEmaraDev I see thanks.
I am not sure how to unify behaviors here. For me, the tiled/full frame behavior seems more reasonable because
factor = 50%
always cuts both inputs in half, whereas for GPU compositor seems to compute the 50% threshold based on the output size, not the input image sizes.I'm curious... Does computing the domain based on the input size and the output size align well with the GPU compositor
Domain
design?What do you mean by the output size here? The render size?
Yes, I mean render or viewer size (where viewer size can be different from final render size - at least for full frame compositor)
compute_domain
method.Thanks for clarifying :)
I agree here, I was just wondering about the design in general.
That might be the case, but I think it makes sense to unify behaviors when possible, especially between viewport and final render.
Definitely. I was talking about the 50% difference you mentioned in your previous comment.
To me it does not seem that the missing translation is an intrinsic part of this PR.
There is already plenty of calls
Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node");
which does not interact with the translation mechanism. I think those should becomeBKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, IFACE_("Viewer Node"))
, (and similar thing for the render result). But that's a bigger change, and best to not mix it with the split node implementation.@blender-bot build
@blender-bot build
WIP: Compositor: Make split viewer a regular split nodeto Compositor: Make split viewer a regular split node@ -419,0 +471,4 @@
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
if (ntree->type == NTREE_COMPOSIT) {
versioning_replace_splitviewer(ntree);
Not sure this belongs here inside
do_versions_after_linking_400()
or insideblo_do_versions_400()
or in both. From testing it doesn't seem to make any difference.Put it in
blo_do_versions_400
, so that we can do the stuff I mentioned above.@ -0,0 +1,144 @@
/* SPDX-FileCopyrightText: 2006 Blender Authors
It looks like a new file has been added but it has just been renamed. Do we update the copyright date in this case?
I would just update that.
This seems to be wrong. The GPU compositor uses the domain of the first linked input, the Full Frame Compositor was also designed like this from the start, so this is how it should be done.
This doesn't make sense to me for though, at least for this node. But looking more into the other nodes (especially mix/overlay node) I can see this behavior is different. I will update it in the next patch.
@blender-bot build
@ -327,0 +336,4 @@
continue;
}
bNodeType *node_type_info = new bNodeType();
node->typeinfo = node_type_info;
Change the type of the node directly. Most of other code can be removed then.
I'm not sure how to achieve that.
node
doesn't have an output socket so linking to viewer node doesn't work. So I tookversion_geometry_nodes_replace_transfer_attribute_node()
fromversioning_300.cc
as a reference.Can you try adding the socket using
nodeAddStaticSocket
?Change type, manually free storage and add output socket.... isn't deleting and constructing a new node cleaner at this point? :)
You would still need to manually delete the existing node and its storage. But the main advantage is that you will not have to relink the inputs, transfer the data, or mess with typeinfo; which is most of the versioning code you have now.
Ok, I don't mind either way
@ -0,0 +20,4 @@
SplitOperation *split_operation = new SplitOperation();
split_operation->set_split_percentage(node->custom1);
split_operation->set_xsplit(!node->custom2);
Prefer explicit comparison with the enum.
@ -169,3 +169,3 @@
DefNode(CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" )
DefNode(CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" )
DefNode(CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" )
DefNode(CompositorNode, CMP_NODE_SPLIT, def_cmp_split, "SPLITNODE", Split, "Split Node", "" )
Omit "Node" from the names.
@ -101,7 +101,7 @@ static void local_merge(Main *bmain, bNodeTree *localtree, bNodeTree *ntree)
LISTBASE_FOREACH (bNode *, lnode, &localtree->nodes) {
if (bNode *orig_node = nodeFindNodebyName(ntree, lnode->name)) {
if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
Replace
ELEM
by a simple comparison, same for the rest of the patch.@ -0,0 +33,4 @@
static void node_composit_init_split(bNodeTree * /*ntree*/, bNode *node)
{
ImageUser *iuser = MEM_cnew<ImageUser>(__func__);
Remove storage.
@ -0,0 +113,4 @@
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_SPLIT, "Split Node", NODE_CLASS_LAYOUT);
Omit "Node" from the name.
NODE_CLASS_LAYOUT
seems wrong here, maybe justNODE_CLASS_CONVERTER
orNODE_CLASS_OP_FILTER
.CONVERTER
andFILTER
don't sound right either... Switch node also usesNODE_CLASS_LAYOUT
. Do you suggest I change that as well (in a separate patch) ?Switch node could pass as a layout node to me, it doesn't really process anything.
Classes don't make sense for many nodes, so I wouldn't worry too much about it.
@ -0,0 +118,4 @@
ntype.draw_buttons = file_ns::node_composit_buts_split;
ntype.flag |= NODE_PREVIEW;
ntype.initfunc = file_ns::node_composit_init_split;
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
The node storage can be removed.
@ -1019,2 +1019,3 @@
#define CMP_NODE_FLIP 239
#define CMP_NODE_SPLITVIEWER 240
#define CMP_NODE_SPLITVIEWER__DEPRECATED \
240 /* Split viewer node is now a regular split node: CMP_NODE_SPLIT */
Put the comment above the define. I know other places do it the current way, but that shouldn't be.
@ -3451,7 +3450,7 @@ void ntreeSetOutput(bNodeTree *ntree)
if (ELEM(node->type, CMP_NODE_OUTPUT_FILE, GEO_NODE_VIEWER)) {
continue;
}
const bool node_is_output = ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER);
There are still uses of
ELEM
here and in many other places.ELEM
is used in other places for single element comparison. I'm leaving outnode_gizmo.cc
, to better conform with the coding style rule "When making changes, conform to the style and conventions of the surrounding code."That file also uses simple comparisons for single values, so I don't think this is a convention really. But don't have a strong opinion, you can leave it as is.
👍
@blender-bot build
It seems there are some bad formatting, can you clang format?
Looks good, except for those two comments.
@ -328,0 +337,4 @@
STRNCPY(node->idname, "CompositorNodeSplit");
node->type = CMP_NODE_SPLIT;
MEM_freeN(node->storage);
@ -328,0 +342,4 @@
bNode *viewer_node = nodeAddStaticNode(nullptr, ntree, CMP_NODE_VIEWER);
/* Nodes are created stacked on top of each other, so separate them a bit. */
viewer_node->locx = node->locx + node->width + viewer_node->width / 4.0f;
viewer_node->locy = node->locy;
@blender-bot build
@zazizizou My two comments above weren't handled.
I fixed the comments in main.
The word Node in the name is redundant since all of them are nodes. It should be just Split.
Edit: Just built latest and it's corrected already :)