2 * Copyright 2011, Blender Foundation.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "COM_TextureNode.h"
24 #include "COM_ExecutionSystem.h"
25 #include "COM_TextureOperation.h"
27 TextureNode::TextureNode(bNode *editorNode) : Node(editorNode)
32 void TextureNode::convertToOperations(NodeConverter &converter, const CompositorContext &context) const
34 bNode *editorNode = this->getbNode();
35 Tex *texture = (Tex *)editorNode->id;
36 TextureOperation *operation = new TextureOperation();
37 const ColorManagedDisplaySettings *displaySettings = context.getDisplaySettings();
38 bool sceneColorManage = !STREQ(displaySettings->display_device, "None");
39 operation->setTexture(texture);
40 operation->setRenderData(context.getRenderData());
41 operation->setSceneColorManage(sceneColorManage);
42 converter.addOperation(operation);
44 converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));
45 converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1));
46 converter.mapOutputSocket(getOutputSocket(1), operation->getOutputSocket());
48 converter.addPreview(operation->getOutputSocket());
50 TextureAlphaOperation *alphaOperation = new TextureAlphaOperation();
51 alphaOperation->setTexture(texture);
52 alphaOperation->setRenderData(context.getRenderData());
53 alphaOperation->setSceneColorManage(sceneColorManage);
54 converter.addOperation(alphaOperation);
56 converter.mapInputSocket(getInputSocket(0), alphaOperation->getInputSocket(0));
57 converter.mapInputSocket(getInputSocket(1), alphaOperation->getInputSocket(1));
58 converter.mapOutputSocket(getOutputSocket(0), alphaOperation->getOutputSocket());