Fix T52653: Render output of linked scenes conflicts with other scenes with the same name
The issue was caused by render result identifier only consist of scene name, which could indeed cause conflicts. On the one hand, there are quite some areas in Blender where we need identifier to be unique to properly address things. Usually this is required for sub-data of IDs, like bones. On another hand, it's not that hard to support this particular case and avoid possible frustration. The idea is, we add library name to render identifier for linked scenes. We use library name and not pointer so we preserve render results through undo stack. Reviewers: campbellbarton, mont29, brecht Reviewed By: mont29 Differential Revision: https://developer.blender.org/D2836
This commit is contained in:
@@ -41,6 +41,7 @@ void CompositorNode::convertToOperations(NodeConverter &converter, const Composi
|
||||
NodeInput *depthSocket = this->getInputSocket(2);
|
||||
|
||||
CompositorOperation *compositorOperation = new CompositorOperation();
|
||||
compositorOperation->setScene(context.getScene());
|
||||
compositorOperation->setSceneName(context.getScene()->id.name);
|
||||
compositorOperation->setRenderData(context.getRenderData());
|
||||
compositorOperation->setViewName(context.getViewName());
|
||||
|
||||
@@ -176,7 +176,7 @@ void RenderLayersNode::convertToOperations(NodeConverter &converter,
|
||||
const CompositorContext &context) const
|
||||
{
|
||||
Scene *scene = (Scene *)this->getbNode()->id;
|
||||
Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
|
||||
Render *re = (scene) ? RE_GetSceneRender(scene) : NULL;
|
||||
|
||||
if (re != NULL) {
|
||||
testRenderLink(converter, context, re);
|
||||
|
||||
@@ -51,6 +51,7 @@ CompositorOperation::CompositorOperation() : NodeOperation()
|
||||
this->m_useAlphaInput = false;
|
||||
this->m_active = false;
|
||||
|
||||
this->m_scene = NULL;
|
||||
this->m_sceneName[0] = '\0';
|
||||
this->m_viewName = NULL;
|
||||
}
|
||||
@@ -78,7 +79,7 @@ void CompositorOperation::deinitExecution()
|
||||
return;
|
||||
|
||||
if (!isBreaked()) {
|
||||
Render *re = RE_GetRender(this->m_sceneName);
|
||||
Render *re = RE_GetSceneRender(this->m_scene);
|
||||
RenderResult *rr = RE_AcquireResultWrite(re);
|
||||
|
||||
if (rr) {
|
||||
@@ -217,7 +218,7 @@ void CompositorOperation::determineResolution(unsigned int resolution[2], unsign
|
||||
|
||||
// check actual render resolution with cropping it may differ with cropped border.rendering
|
||||
// FIX for: [31777] Border Crop gives black (easy)
|
||||
Render *re = RE_GetRender(this->m_sceneName);
|
||||
Render *re = RE_GetSceneRender(this->m_scene);
|
||||
if (re) {
|
||||
RenderResult *rr = RE_AcquireResultRead(re);
|
||||
if (rr) {
|
||||
|
||||
@@ -26,11 +26,14 @@
|
||||
#include "BLI_rect.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
struct Scene;
|
||||
|
||||
/**
|
||||
* @brief Compositor output operation
|
||||
*/
|
||||
class CompositorOperation : public NodeOperation {
|
||||
private:
|
||||
const struct Scene *m_scene;
|
||||
/**
|
||||
* @brief Scene name, used for getting the render output, includes 'SC' prefix.
|
||||
*/
|
||||
@@ -84,6 +87,7 @@ public:
|
||||
CompositorOperation();
|
||||
const bool isActiveCompositorOutput() const { return this->m_active; }
|
||||
void executeRegion(rcti *rect, unsigned int tileNumber);
|
||||
void setScene(const struct Scene *scene) { m_scene = scene; }
|
||||
void setSceneName(const char *sceneName) { BLI_strncpy(this->m_sceneName, sceneName, sizeof(this->m_sceneName)); }
|
||||
void setViewName(const char *viewName) { this->m_viewName = viewName; }
|
||||
void setRenderData(const RenderData *rd) { this->m_rd = rd; }
|
||||
|
||||
@@ -48,7 +48,7 @@ RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elem
|
||||
void RenderLayersProg::initExecution()
|
||||
{
|
||||
Scene *scene = this->getScene();
|
||||
Render *re = (scene) ? RE_GetRender(scene->id.name) : NULL;
|
||||
Render *re = (scene) ? RE_GetSceneRender(scene) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
if (re)
|
||||
@@ -179,7 +179,7 @@ void RenderLayersProg::deinitExecution()
|
||||
void RenderLayersProg::determineResolution(unsigned int resolution[2], unsigned int /*preferredResolution*/[2])
|
||||
{
|
||||
Scene *sce = this->getScene();
|
||||
Render *re = (sce) ? RE_GetRender(sce->id.name) : NULL;
|
||||
Render *re = (sce) ? RE_GetSceneRender(sce) : NULL;
|
||||
RenderResult *rr = NULL;
|
||||
|
||||
resolution[0] = 0;
|
||||
|
||||
Reference in New Issue
Block a user