Skip to content

Instantly share code, notes, and snippets.

@niraami
Last active January 18, 2022 23:06
Show Gist options
  • Save niraami/f70201632c5418984fa0d7ebeaee3fbd to your computer and use it in GitHub Desktop.
Save niraami/f70201632c5418984fa0d7ebeaee3fbd to your computer and use it in GitHub Desktop.
Enable Blender's compositing viewer node in background mode
## SOURCE: https://blender.stackexchange.com/a/81240
diff --git a/source/blender/compositor/operations/COM_PreviewOperation.h b/source/blender/compositor/operations/COM_PreviewOperation.h
index 97d1884c9a7..1ccc570bac9 100644
--- a/source/blender/compositor/operations/COM_PreviewOperation.h
+++ b/source/blender/compositor/operations/COM_PreviewOperation.h
@@ -51,7 +51,7 @@ class PreviewOperation : public MultiThreadedOperation {
bool is_output_operation(bool /*rendering*/) const override
{
- return !G.background;
+ return true;
}
void init_execution() override;
void deinit_execution() override;
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.h b/source/blender/compositor/operations/COM_ViewerOperation.h
index 7fc5ae36ad9..5ad1434fbd9 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.h
+++ b/source/blender/compositor/operations/COM_ViewerOperation.h
@@ -61,9 +61,11 @@ class ViewerOperation : public MultiThreadedOperation {
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
bool is_output_operation(bool /*rendering*/) const override
{
+ /*
if (G.background) {
return false;
}
+ */
return is_active_viewer_output();
}
void set_image(Image *image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment