Ejemplo n.º 1
0
void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
	

	
	

	bNode *editorsnode = getbNode();
	NodeColorBalance *n = (NodeColorBalance *)editorsnode->storage;

	NodeInput *inputSocketImage = this->getInputSocket(0);
	NodeInput *inputSocketKey = this->getInputSocket(1);
	NodeOutput *outputSocketImage = this->getOutputSocket(0);
	NodeOutput *outputSocketMatte = this->getOutputSocket(1);
	
	ConvertRGBToHSVOperation *operationRGBToHSV_Image = new ConvertRGBToHSVOperation();
	ConvertRGBToHSVOperation *operationRGBToHSV_Key = new ConvertRGBToHSVOperation();
	converter.addOperation(operationRGBToHSV_Image);
	converter.addOperation(operationRGBToHSV_Key);
	
	NodeOperation *operation;
	ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
	operationLGG->setGain(n->gain);
	operation = operationLGG;
	converter.addOperation(operation);
	
	SetAlphaOperation *operationAlpha = new SetAlphaOperation();
	converter.addOperation(operationAlpha);
	
	converter.mapInputSocket(inputSocketImage, operationRGBToHSV_Image->getInputSocket(0));
	converter.mapInputSocket(inputSocketKey, operationRGBToHSV_Key->getInputSocket(0));
	converter.addLink(operationRGBToHSV_Image->getOutputSocket(), operation->getInputSocket(0));
	converter.addLink(operationRGBToHSV_Key->getOutputSocket(), operation->getInputSocket(1));
	converter.mapOutputSocket(outputSocketMatte, operation->getOutputSocket(0));
	
	converter.mapInputSocket(inputSocketImage, operationAlpha->getInputSocket(0));
	converter.addLink(operation->getOutputSocket(), operationAlpha->getInputSocket(1));
	converter.mapOutputSocket(outputSocketImage, operationAlpha->getOutputSocket());
	
	converter.addPreview(operationAlpha->getOutputSocket());

}
Ejemplo n.º 2
0
void ColorBalanceNode::convertToOperations(NodeConverter &converter, const CompositorContext &/*context*/) const
{
	bNode *node = this->getbNode();
	NodeColorBalance *n = (NodeColorBalance *)node->storage;

	NodeInput *inputSocket = this->getInputSocket(0);
	NodeInput *inputImageSocket = this->getInputSocket(1);
	NodeOutput *outputSocket = this->getOutputSocket(0);

	NodeOperation *operation;
	if (node->custom1 == 0) {
		ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();

		float lift_lgg[3], gamma_inv[3];
		for (int c = 0; c < 3; c++) {
			lift_lgg[c] = 2.0f - n->lift[c];
			gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
		}

		operationLGG->setGain(n->gain);
		operationLGG->setLift(lift_lgg);
		operationLGG->setGammaInv(gamma_inv);
		operation = operationLGG;
	}
	else {
		ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();

		float offset[3];
		copy_v3_fl(offset, n->offset_basis);
		add_v3_v3(offset, n->offset);

		operationCDL->setOffset(offset);
		operationCDL->setPower(n->power);
		operationCDL->setSlope(n->slope);
		operation = operationCDL;
	}
	converter.addOperation(operation);

	converter.mapInputSocket(inputSocket, operation->getInputSocket(0));
	converter.mapInputSocket(inputImageSocket, operation->getInputSocket(1));
	converter.mapOutputSocket(outputSocket, operation->getOutputSocket(0));
}
Ejemplo n.º 3
0
void ColorBalanceNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
	InputSocket *inputSocket = this->getInputSocket(0);
	InputSocket *inputImageSocket = this->getInputSocket(1);
	OutputSocket *outputSocket = this->getOutputSocket(0);
	
	bNode *node = this->getbNode();
	NodeColorBalance *n = (NodeColorBalance *)node->storage;
	NodeOperation *operation;
	if (node->custom1 == 0) {
		ColorBalanceLGGOperation *operationLGG = new ColorBalanceLGGOperation();
		{
			int c;
	
			for (c = 0; c < 3; c++) {
				n->lift_lgg[c] = 2.0f - n->lift[c];
				n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f / n->gamma[c] : 1000000.0f;
			}
		}
	
		operationLGG->setGain(n->gain);
		operationLGG->setLift(n->lift_lgg);
		operationLGG->setGammaInv(n->gamma_inv);
		operation = operationLGG;
	}
	else {
		ColorBalanceASCCDLOperation *operationCDL = new ColorBalanceASCCDLOperation();
		operationCDL->setGain(n->gain);
		operationCDL->setLift(n->lift);
		operationCDL->setGamma(n->gamma);
		operation = operationCDL;
	}
	
	inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
	inputImageSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
	outputSocket->relinkConnections(operation->getOutputSocket(0));
	graph->addOperation(operation);
}