Compositor: Avoid redundant executions for only previews

The compositor executes redundantly if previews are enabled but no
other output is computed. This shouldn't be the case because previews
are secondary outputs that need a primary output to compute with.

We improve this this by only executing the compositor if a primary
output is needed, regardless if previews are needed or not.

Pull Request: https://projects.blender.org/blender/blender/pulls/140920
This commit is contained in:
Omar Emara
2025-06-25 07:06:18 +02:00
committed by Omar Emara
parent 5d553e1dd0
commit 00d375755f

View File

@@ -38,6 +38,7 @@
#include "BLI_math_vector.hh"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
@@ -436,8 +437,14 @@ static blender::compositor::OutputTypes get_compositor_needed_outputs(const bCon
void ED_node_composite_job(const bContext *C, bNodeTree *nodetree, Scene *scene_owner)
{
/* None of the outputs are needed except maybe previews, so no need to execute the compositor.
* Previews are not considered because they are a secondary output that needs another output to
* be computed with. */
blender::compositor::OutputTypes needed_outputs = get_compositor_needed_outputs(C);
if (needed_outputs == blender::compositor::OutputTypes::None) {
if (ELEM(needed_outputs,
blender::compositor::OutputTypes::None,
blender::compositor::OutputTypes::Previews))
{
return;
}