Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManuel Castilla <manzanilla>2021-03-23 14:04:34 +0300
committerJeroen Bakker <jeroen@blender.org>2021-03-23 14:04:51 +0300
commit9fb5559a0fb55d8b009d0df38323798be6647a44 (patch)
treea87eb3b49fa21025cb13629075ee3752a0eb305d /source/blender/compositor/operations/COM_ViewerOperation.cc
parent8cac85abfe41fdbe8286a73b94a143390a52e61c (diff)
Compositor: Display generated inputs in Viewers and Previews
Currently viewers and previews only display node trees that have at least one node with fixed resolution size. When all inputs are generated, nothing is displayed in most cases (RGB Node is displayed as a single pixel on previews). By generated I mean inputs not having resolution on their own, they create content dynamically given an output resolution. This patch adds support for those cases by using an appropriate preferred resolution on Viewers/Previews which propagates to generated inputs as output resolution. Now: - Viewers will display generated inputs with scene render resolution. - Previews will display them with scene aspect ratio. This is consistent with final render result and respects relative space. The benefit for the user is being able to compose images without any input source. For example for creating mask images or simple backgrounds. Reviewed By: Jeroen Bakker Differential Revision: https://developer.blender.org/D10611
Diffstat (limited to 'source/blender/compositor/operations/COM_ViewerOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_ViewerOperation.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_ViewerOperation.cc b/source/blender/compositor/operations/COM_ViewerOperation.cc
index e31f7ad8eba..ea5937d8afb 100644
--- a/source/blender/compositor/operations/COM_ViewerOperation.cc
+++ b/source/blender/compositor/operations/COM_ViewerOperation.cc
@@ -118,6 +118,17 @@ void ViewerOperation::executeRegion(rcti *rect, unsigned int /*tileNumber*/)
updateImage(rect);
}
+void ViewerOperation::determineResolution(unsigned int resolution[2],
+ unsigned int /*preferredResolution*/[2])
+{
+ const int sceneRenderWidth = this->m_rd->xsch * this->m_rd->size / 100;
+ const int sceneRenderHeight = this->m_rd->ysch * this->m_rd->size / 100;
+
+ unsigned int localPrefRes[2] = {static_cast<unsigned int>(sceneRenderWidth),
+ static_cast<unsigned int>(sceneRenderHeight)};
+ NodeOperation::determineResolution(resolution, localPrefRes);
+}
+
void ViewerOperation::initImage()
{
Image *ima = this->m_image;