Revision: 60234 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60234 Author: lukastoenne Date: 2013-09-19 08:21:55 +0000 (Thu, 19 Sep 2013) Log Message: ----------- Fix #36755, EXR Layers are not fully updated on scene load or image refresh. After discussion with Brecht decided that automatically updating the sockets of the node based on externally modified data (removed EXR file passes) is not desirable behavior. But at least making sure the correct passes are assigned to the output sockets of the Image node is possible. Now the passes are matched by name instead of using the faulty index stored in the socket data, which is more reliable. Still may break if changing pass names externally, but an image reload is highly recommended anyway and will fix that.
Modified Paths: -------------- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp trunk/blender/source/blender/compositor/nodes/COM_ImageNode.h trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.h Modified: trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp =================================================================== --- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2013-09-19 08:21:53 UTC (rev 60233) +++ trunk/blender/source/blender/compositor/nodes/COM_ImageNode.cpp 2013-09-19 08:21:55 UTC (rev 60234) @@ -38,19 +38,19 @@ /* pass */ } -NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype) +NodeOperation *ImageNode::doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int passindex, DataType datatype) { OutputSocket *outputSocket = this->getOutputSocket(outputsocketIndex); MultilayerBaseOperation *operation = NULL; switch (datatype) { case COM_DT_VALUE: - operation = new MultilayerValueOperation(pass); + operation = new MultilayerValueOperation(passindex); break; case COM_DT_VECTOR: - operation = new MultilayerVectorOperation(pass); + operation = new MultilayerVectorOperation(passindex); break; case COM_DT_COLOR: - operation = new MultilayerColorOperation(pass); + operation = new MultilayerColorOperation(passindex); break; default: break; @@ -93,10 +93,19 @@ socket = this->getOutputSocket(index); if (socket->isConnected() || index == 0) { bNodeSocket *bnodeSocket = socket->getbNodeSocket(); - NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage; - int passindex = storage->pass_index; - + /* Passes in the file can differ from passes stored in sockets (#36755). + * Look up the correct file pass using the socket identifier instead. + */ + #if 0 + NodeImageLayer *storage = (NodeImageLayer *)bnodeSocket->storage;*/ + int passindex = storage->pass_index;*/ RenderPass *rpass = (RenderPass *)BLI_findlink(&rl->passes, passindex); + #endif + int passindex; + RenderPass *rpass; + for (rpass = (RenderPass *)rl->passes.first, passindex = 0; rpass; rpass = rpass->next, ++passindex) + if (STREQ(rpass->name, bnodeSocket->identifier)) + break; if (rpass) { imageuser->pass = passindex; switch (rpass->channels) { Modified: trunk/blender/source/blender/compositor/nodes/COM_ImageNode.h =================================================================== --- trunk/blender/source/blender/compositor/nodes/COM_ImageNode.h 2013-09-19 08:21:53 UTC (rev 60233) +++ trunk/blender/source/blender/compositor/nodes/COM_ImageNode.h 2013-09-19 08:21:55 UTC (rev 60234) @@ -35,7 +35,7 @@ */ class ImageNode : public Node { private: - NodeOperation *doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int pass, DataType datatype); + NodeOperation *doMultilayerCheck(ExecutionSystem *system, RenderLayer *rl, Image *image, ImageUser *user, int framenumber, int outputsocketIndex, int passindex, DataType datatype); public: ImageNode(bNode *editorNode); void convertToOperations(ExecutionSystem *graph, CompositorContext *context); Modified: trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp =================================================================== --- trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp 2013-09-19 08:21:53 UTC (rev 60233) +++ trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.cpp 2013-09-19 08:21:55 UTC (rev 60234) @@ -27,16 +27,15 @@ #include "IMB_imbuf_types.h" } -MultilayerBaseOperation::MultilayerBaseOperation(int pass) : BaseImageOperation() +MultilayerBaseOperation::MultilayerBaseOperation(int passindex) : BaseImageOperation() { - this->m_passId = pass; + this->m_passId = passindex; } ImBuf *MultilayerBaseOperation::getImBuf() { - RenderPass *rpass; - rpass = (RenderPass *)BLI_findlink(&this->m_renderlayer->passes, this->m_passId); + RenderPass *rpass = (RenderPass *)BLI_findlink(&this->m_renderlayer->passes, this->m_passId); if (rpass) { - this->m_imageUser->pass = this->m_passId; + this->m_imageUser->pass = m_passId; BKE_image_multilayer_index(this->m_image->rr, this->m_imageUser); return BaseImageOperation::getImBuf(); } Modified: trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.h =================================================================== --- trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.h 2013-09-19 08:21:53 UTC (rev 60233) +++ trunk/blender/source/blender/compositor/operations/COM_MultilayerImageOperation.h 2013-09-19 08:21:55 UTC (rev 60234) @@ -37,13 +37,13 @@ /** * Constructor */ - MultilayerBaseOperation(int pass); + MultilayerBaseOperation(int passindex); void setRenderLayer(RenderLayer *renderlayer) { this->m_renderlayer = renderlayer; } }; class MultilayerColorOperation : public MultilayerBaseOperation { public: - MultilayerColorOperation(int pass) : MultilayerBaseOperation(pass) { + MultilayerColorOperation(int passindex) : MultilayerBaseOperation(passindex) { this->addOutputSocket(COM_DT_COLOR); } void executePixel(float output[4], float x, float y, PixelSampler sampler); @@ -51,7 +51,7 @@ class MultilayerValueOperation : public MultilayerBaseOperation { public: - MultilayerValueOperation(int pass) : MultilayerBaseOperation(pass) { + MultilayerValueOperation(int passindex) : MultilayerBaseOperation(passindex) { this->addOutputSocket(COM_DT_VALUE); } void executePixel(float output[4], float x, float y, PixelSampler sampler); @@ -59,7 +59,7 @@ class MultilayerVectorOperation : public MultilayerBaseOperation { public: - MultilayerVectorOperation(int pass) : MultilayerBaseOperation(pass) { + MultilayerVectorOperation(int passindex) : MultilayerBaseOperation(passindex) { this->addOutputSocket(COM_DT_VECTOR); } void executePixel(float output[4], float x, float y, PixelSampler sampler); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs