Refactor: Move pass name aliasing to context implementation

This patch moves the rules that alias Image to Combined for pass names
to the context implementations. This is because this only makes sense
for contexts that deal with passes, while it wouldn't make much sense
for other possible contexts like VSE modifiers.

Pull Request: https://projects.blender.org/blender/blender/pulls/143419
This commit is contained in:
Omar Emara
2025-07-28 10:00:20 +02:00
committed by Omar Emara
parent 4bffd43adc
commit 6f426f498a
3 changed files with 12 additions and 7 deletions

View File

@@ -128,8 +128,12 @@ class Context : public compositor::Context {
return result;
}
compositor::Result get_input(const Scene *scene, int view_layer, const char *pass_name) override
compositor::Result get_input(const Scene *scene, int view_layer, const char *name) override
{
/* Blender aliases the Image pass name to be the Combined pass, so we return the combined pass
* in that case. */
const char *pass_name = StringRef(name) == "Image" ? "Combined" : name;
if (DEG_get_original(scene) != DEG_get_original(scene_)) {
return compositor::Result(*this);
}

View File

@@ -32,10 +32,9 @@ class GroupInputOperation : public NodeOperation {
continue;
}
const char *name = StringRef(output->name) == "Image" ? "Combined" : output->name;
this->context().populate_meta_data_for_pass(&scene, 0, name, result.meta_data);
this->context().populate_meta_data_for_pass(&scene, 0, output->name, result.meta_data);
const Result pass = this->context().get_input(&scene, 0, name);
const Result pass = this->context().get_input(&scene, 0, output->name);
this->execute_pass(pass, result);
}
}

View File

@@ -216,10 +216,12 @@ class Context : public compositor::Context {
return viewer_output_result_;
}
compositor::Result get_input(const Scene *scene,
int view_layer_id,
const char *pass_name) override
compositor::Result get_input(const Scene *scene, int view_layer_id, const char *name) override
{
/* Blender aliases the Image pass name to be the Combined pass, so we return the combined pass
* in that case. */
const char *pass_name = StringRef(name) == "Image" ? "Combined" : name;
if (!scene) {
return compositor::Result(*this);
}