Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-12-07 15:52:12 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-01-26 17:20:13 +0300
commitac58a7fa190de82ee8265cfe9f1b7a7323b86982 (patch)
treec5f7ab63e5fcbec65426742e46540bfc161974b6 /source/blender/compositor
parent18cf3e1a38a3cf50a182ef8ae764ccd3b37216aa (diff)
Compositor: Make HSV node inputs a real sockets
This is much more flexible solution which will allow doing some more procedural features. Reviewers: brecht, dfelinto, mont29 Reviewed By: mont29 Subscribers: Severin Differential Revision: https://developer.blender.org/D2403
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp15
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.cpp19
-rw-r--r--source/blender/compositor/operations/COM_ChangeHSVOperation.h11
3 files changed, 28 insertions, 17 deletions
diff --git a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
index 29c296a896d..b8971fffe3e 100644
--- a/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
+++ b/source/blender/compositor/nodes/COM_HueSaturationValueNode.cpp
@@ -37,8 +37,11 @@ HueSaturationValueNode::HueSaturationValueNode(bNode *editorNode) : Node(editorN
void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
- NodeInput *valueSocket = this->getInputSocket(0);
- NodeInput *colorSocket = this->getInputSocket(1);
+ NodeInput *colorSocket = this->getInputSocket(0);
+ NodeInput *hueSocket = this->getInputSocket(1);
+ NodeInput *saturationSocket = this->getInputSocket(2);
+ NodeInput *valueSocket = this->getInputSocket(3);
+ NodeInput *facSocket = this->getInputSocket(4);
NodeOutput *outputSocket = this->getOutputSocket(0);
bNode *editorsnode = getbNode();
NodeHueSat *storage = (NodeHueSat *)editorsnode->storage;
@@ -50,9 +53,9 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const
converter.addOperation(hsvToRGB);
ChangeHSVOperation *changeHSV = new ChangeHSVOperation();
- changeHSV->setHue(storage->hue);
- changeHSV->setSaturation(storage->sat);
- changeHSV->setValue(storage->val);
+ converter.mapInputSocket(hueSocket, changeHSV->getInputSocket(1));
+ converter.mapInputSocket(saturationSocket, changeHSV->getInputSocket(2));
+ converter.mapInputSocket(valueSocket, changeHSV->getInputSocket(3));
converter.addOperation(changeHSV);
MixBlendOperation *blend = new MixBlendOperation();
@@ -64,6 +67,6 @@ void HueSaturationValueNode::convertToOperations(NodeConverter &converter, const
converter.addLink(changeHSV->getOutputSocket(), hsvToRGB->getInputSocket(0));
converter.addLink(hsvToRGB->getOutputSocket(), blend->getInputSocket(2));
converter.mapInputSocket(colorSocket, blend->getInputSocket(1));
- converter.mapInputSocket(valueSocket, blend->getInputSocket(0));
+ converter.mapInputSocket(facSocket, blend->getInputSocket(0));
converter.mapOutputSocket(outputSocket, blend->getOutputSocket());
}
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
index 964f1d64667..7ea974a41dc 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.cpp
@@ -25,6 +25,9 @@
ChangeHSVOperation::ChangeHSVOperation() : NodeOperation()
{
this->addInputSocket(COM_DT_COLOR);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
+ this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(COM_DT_COLOR);
this->m_inputOperation = NULL;
}
@@ -32,24 +35,34 @@ ChangeHSVOperation::ChangeHSVOperation() : NodeOperation()
void ChangeHSVOperation::initExecution()
{
this->m_inputOperation = getInputSocketReader(0);
+ this->m_hueOperation = getInputSocketReader(1);
+ this->m_saturationOperation = getInputSocketReader(2);
+ this->m_valueOperation = getInputSocketReader(3);
}
void ChangeHSVOperation::deinitExecution()
{
this->m_inputOperation = NULL;
+ this->m_hueOperation = NULL;
+ this->m_saturationOperation = NULL;
+ this->m_valueOperation = NULL;
}
void ChangeHSVOperation::executePixelSampled(float output[4], float x, float y, PixelSampler sampler)
{
float inputColor1[4];
+ float hue[4], saturation[4], value[4];
this->m_inputOperation->readSampled(inputColor1, x, y, sampler);
+ this->m_hueOperation->readSampled(hue, x, y, sampler);
+ this->m_saturationOperation->readSampled(saturation, x, y, sampler);
+ this->m_valueOperation->readSampled(value, x, y, sampler);
- output[0] = inputColor1[0] + (this->m_hue - 0.5f);
+ output[0] = inputColor1[0] + (hue[0] - 0.5f);
if (output[0] > 1.0f) output[0] -= 1.0f;
else if (output[0] < 0.0f) output[0] += 1.0f;
- output[1] = inputColor1[1] * this->m_saturation;
- output[2] = inputColor1[2] * this->m_value;
+ output[1] = inputColor1[1] * saturation[0];
+ output[2] = inputColor1[2] * value[0];
output[3] = inputColor1[3];
}
diff --git a/source/blender/compositor/operations/COM_ChangeHSVOperation.h b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
index 76025e86b7a..800c09c05ff 100644
--- a/source/blender/compositor/operations/COM_ChangeHSVOperation.h
+++ b/source/blender/compositor/operations/COM_ChangeHSVOperation.h
@@ -32,10 +32,9 @@
class ChangeHSVOperation : public NodeOperation {
private:
SocketReader *m_inputOperation;
-
- float m_hue;
- float m_saturation;
- float m_value;
+ SocketReader *m_hueOperation;
+ SocketReader *m_saturationOperation;
+ SocketReader *m_valueOperation;
public:
/**
@@ -51,9 +50,5 @@ public:
*/
void executePixelSampled(float output[4], float x, float y, PixelSampler sampler);
- void setHue(float hue) { this->m_hue = hue; }
- void setSaturation(float saturation) { this->m_saturation = saturation; }
- void setValue(float value) { this->m_value = value; }
-
};
#endif