From 16dededdf399b0fcb62f8e062d2877873ed52b34 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 12 Jun 2012 18:36:49 +0000 Subject: remove input socket of mask node, this wasnt used. --- source/blender/blenkernel/BKE_mask.h | 2 +- source/blender/blenkernel/intern/mask.c | 22 ++----------------- source/blender/blenkernel/intern/sequencer.c | 4 ++-- source/blender/compositor/nodes/COM_MaskNode.cpp | 10 ++------- .../compositor/operations/COM_MaskOperation.cpp | 15 +++---------- .../nodes/composite/nodes/node_composite_mask.c | 25 ++++++---------------- 6 files changed, 16 insertions(+), 62 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index ec2eb82a9eb..345a2190e89 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -169,7 +169,7 @@ void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, i /* rasterization */ int BKE_mask_get_duration(struct Mask *mask); void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer, - const short do_aspect_correct, const short do_linear); + const short do_aspect_correct); #define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT) #define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT) diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index bb2940091e4..a28ff3a175d 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -2061,19 +2061,6 @@ static void m_invert_vn_vn(float *array, const float f, const int size) } } -static void clamp_vn_vn_linear(float *array, const int size) -{ - float *arr = array + (size - 1); - - int i = size; - while (i--) { - if (*arr <= 0.0f) *arr = 0.0f; - else if (*arr >= 1.0f) *arr = 1.0f; - else *arr = srgb_to_linearrgb(*arr); - arr--; - } -} - static void clamp_vn_vn(float *array, const int size) { float *arr = array + (size - 1); @@ -2093,7 +2080,7 @@ int BKE_mask_get_duration(Mask *mask) /* rasterization */ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, - const short do_aspect_correct, const short do_linear) + const short do_aspect_correct) { MaskLayer *masklay; @@ -2213,12 +2200,7 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer, } /* clamp at the end */ - if (do_linear) { - clamp_vn_vn_linear(buffer, buffer_size); - } - else { - clamp_vn_vn(buffer, buffer_size); - } + clamp_vn_vn(buffer, buffer_size); } MEM_freeN(buffer_tmp); diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index af5b7716bbc..889eee25d6b 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2081,7 +2081,7 @@ static ImBuf *seq_render_mask_strip( BKE_mask_rasterize(seq->mask, context.rectx, context.recty, maskbuf, - TRUE, FALSE); + TRUE); fp_src = maskbuf; fp_dst = ibuf->rect_float; @@ -2104,7 +2104,7 @@ static ImBuf *seq_render_mask_strip( BKE_mask_rasterize(seq->mask, context.rectx, context.recty, maskbuf, - TRUE, FALSE); + TRUE); fp_src = maskbuf; ub_dst = (unsigned char *)ibuf->rect; diff --git a/source/blender/compositor/nodes/COM_MaskNode.cpp b/source/blender/compositor/nodes/COM_MaskNode.cpp index 991c3f75e05..e26756cfc5b 100644 --- a/source/blender/compositor/nodes/COM_MaskNode.cpp +++ b/source/blender/compositor/nodes/COM_MaskNode.cpp @@ -37,7 +37,6 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c { const RenderData *data = &context->getScene()->r; - InputSocket *inputImage = this->getInputSocket(0); OutputSocket *outputMask = this->getOutputSocket(0); bNode *editorNode = this->getbNode(); @@ -46,13 +45,8 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c // always connect the output image MaskOperation *operation = new MaskOperation(); - if (inputImage->isConnected()) { - inputImage->relinkConnections(operation->getInputSocket(0), 0, graph); - } - else { - operation->setMaskWidth(data->xsch * data->size / 100.0f); - operation->setMaskHeight(data->ysch * data->size / 100.0f); - } + operation->setMaskWidth(data->xsch * data->size / 100.0f); + operation->setMaskHeight(data->ysch * data->size / 100.0f); if (outputMask->isConnected()) { outputMask->relinkConnections(operation->getOutputSocket()); diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp index a7c1de323f1..35174349a63 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.cpp +++ b/source/blender/compositor/operations/COM_MaskOperation.cpp @@ -36,8 +36,7 @@ extern "C" { MaskOperation::MaskOperation(): NodeOperation() { - this->addInputSocket(COM_DT_COLOR); - this->addOutputSocket(COM_DT_COLOR); + this->addOutputSocket(COM_DT_VALUE); this->mask = NULL; this->maskWidth = 0; this->maskHeight = 0; @@ -75,7 +74,7 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers float *buffer; buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask"); - BKE_mask_rasterize(mask, width, height, buffer, TRUE, TRUE); + BKE_mask_rasterize(mask, width, height, buffer, TRUE); this->rasterizedMask = buffer; } @@ -105,20 +104,12 @@ void MaskOperation::determineResolution(unsigned int resolution[], unsigned int void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data) { if (!data) { - color[0] = 0; - color[1] = 0; - color[2] = 0; - color[3] = 1.0f; + color[0] = 0.0f; } else { float *buffer = (float*) data; int index = (y * this->getWidth() + x); color[0] = buffer[index]; - color[1] = buffer[index]; - color[2] = buffer[index]; - color[3] = 1.0f; } } - - diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c index 01461aec08d..dbe3c11ab55 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.c +++ b/source/blender/nodes/composite/nodes/node_composite_mask.c @@ -40,17 +40,12 @@ /* **************** Translate ******************** */ -static bNodeSocketTemplate cmp_node_mask_in[] = { - { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - { -1, 0, "" } -}; - static bNodeSocketTemplate cmp_node_mask_out[] = { - { SOCK_RGBA, 0, "Image"}, + { SOCK_FLOAT, 0, "Mask"}, { -1, 0, "" } }; -static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) +static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **out) { if (node->id) { Mask *mask = (Mask *)node->id; @@ -66,22 +61,14 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out) return; } - if (in[0]->hasinput && in[0]->data) { - CompBuf *cbuf = typecheck_compbuf(in[0]->data, CB_RGBA); - - sx = cbuf->x; - sy = cbuf->y; - } - else { - sx = (rd->size * rd->xsch) / 100; - sy = (rd->size * rd->ysch) / 100; - } + sx = (rd->size * rd->xsch) / 100; + sy = (rd->size * rd->ysch) / 100; /* allocate the output buffer */ stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE); res = stackbuf->rect; - BKE_mask_rasterize(mask, sx, sy, res, TRUE, TRUE); + BKE_mask_rasterize(mask, sx, sy, res, TRUE); /* pass on output and free */ out[0]->data = stackbuf; @@ -93,7 +80,7 @@ void register_node_type_cmp_mask(bNodeTreeType *ttype) static bNodeType ntype; node_type_base(ttype, &ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, NODE_OPTIONS); - node_type_socket_templates(&ntype, cmp_node_mask_in, cmp_node_mask_out); + node_type_socket_templates(&ntype, NULL, cmp_node_mask_out); node_type_size(&ntype, 140, 100, 320); node_type_exec(&ntype, exec); -- cgit v1.2.3