From 6e208ee887b003d0480a298812f279af525b1d0a Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 1 Aug 2012 14:48:46 +0000 Subject: Replace scene pointer with scene name to prevent possible misusages of scene in node in future. --- source/blender/compositor/nodes/COM_CompositorNode.cpp | 2 +- source/blender/compositor/operations/COM_CompositorOperation.cpp | 6 ++++-- source/blender/compositor/operations/COM_CompositorOperation.h | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp index 338741ebe79..d0d66a81c77 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cpp +++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp @@ -38,7 +38,7 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte InputSocket *depthSocket = this->getInputSocket(2); CompositorOperation *compositorOperation = new CompositorOperation(); - compositorOperation->setScene((Scene *) editorNode->id); + compositorOperation->setSceneName(editorNode->id->name); compositorOperation->setRenderData(context->getRenderData()); compositorOperation->setbNodeTree(context->getbNodeTree()); imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph); diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 600ee5e1d7e..be9989fe2ab 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -49,6 +49,8 @@ CompositorOperation::CompositorOperation() : NodeOperation() this->m_imageInput = NULL; this->m_alphaInput = NULL; this->m_depthInput = NULL; + + this->m_sceneName[0] = '\0'; } void CompositorOperation::initExecution() @@ -68,7 +70,7 @@ void CompositorOperation::initExecution() void CompositorOperation::deinitExecution() { if (!isBreaked()) { - Render *re = RE_GetRender(this->m_scene->id.name); + Render *re = RE_GetRender(this->m_sceneName); RenderResult *rr = RE_AcquireResultWrite(re); if (rr) { @@ -164,7 +166,7 @@ void CompositorOperation::determineResolution(unsigned int resolution[], unsigne // 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_scene->id.name); + Render *re = RE_GetRender(this->m_sceneName); if (re) { RenderResult *rr = RE_AcquireResultRead(re); if (rr) { diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 51a31105d5c..435e06152a6 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -25,13 +25,14 @@ #include "COM_NodeOperation.h" #include "DNA_scene_types.h" #include "BLI_rect.h" +#include "BLI_string.h" /** * @brief Compositor output operation */ class CompositorOperation : public NodeOperation { private: - const Scene *m_scene; + char m_sceneName[MAX_ID_NAME]; /** * @brief local reference to the scene @@ -65,7 +66,7 @@ private: public: CompositorOperation(); void executeRegion(rcti *rect, unsigned int tileNumber); - void setScene(const Scene *scene) { this->m_scene = scene; } + void setSceneName(const char *sceneName) { BLI_strncpy(this->m_sceneName, sceneName, sizeof(this->m_sceneName)); } void setRenderData(const RenderData *rd) { this->m_rd = rd; } bool isOutputOperation(bool rendering) const { return true; } void initExecution(); -- cgit v1.2.3