From 1b9e17fb9a814799411778c8a8b51f981efcf0da Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Mar 2013 18:01:41 +0000 Subject: [PATCH] When using border rendering, use the same border for compositor This makes compositing as fast as it's possible in this case. The only thing is border render+crop will still give funcy results. This is the next thing to be solved in compositor. --- .../blender/compositor/intern/COM_ExecutionGroup.cpp | 10 ++++++++++ .../blender/compositor/intern/COM_ExecutionGroup.h | 2 ++ .../compositor/intern/COM_ExecutionSystem.cpp | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp index 14fd7e0b6cf..82d1c7883e1 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp +++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp @@ -633,3 +633,13 @@ void ExecutionGroup::setViewerBorder(float xmin, float xmax, float ymin, float y ymin * this->m_height, ymax * this->m_height); } } + +void ExecutionGroup::setRenderBorder(float xmin, float xmax, float ymin, float ymax) +{ + NodeOperation *operation = this->getOutputNodeOperation(); + + if (operation->isOutputOperation(true) && !(operation->isViewerOperation() || operation->isPreviewOperation())) { + BLI_rcti_init(&this->m_viewerBorder, xmin * this->m_width, xmax * this->m_width, + ymin * this->m_height, ymax * this->m_height); + } +} diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index b5f02e05be1..537dcb5974a 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -417,6 +417,8 @@ public: */ void setViewerBorder(float xmin, float xmax, float ymin, float ymax); + void setRenderBorder(float xmin, float xmax, float ymin, float ymax); + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:ExecutionGroup") #endif diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 2d87845d254..76381261576 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -95,6 +95,18 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re ExecutionGroup *executionGroup = this->m_groups[index]; executionGroup->determineResolution(resolution); + if (rendering) { + /* TODO: would be nice to support cropping as well, but for now + * don't use border for compo when crop is enabled, + * otherwise area of interest will be a way off from rendered + * stuff + */ + if ((rd->mode & R_BORDER) && !(rd->mode & R_CROP)) { + executionGroup->setRenderBorder(rd->border.xmin, rd->border.xmax, + rd->border.ymin, rd->border.ymax); + } + } + if (use_viewer_border) { executionGroup->setViewerBorder(viewer_border->xmin, viewer_border->xmax, viewer_border->ymin, viewer_border->ymax);