remove input socket of mask node, this wasnt used.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 12 Jun 2012 18:36:49 +0000 (18:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 12 Jun 2012 18:36:49 +0000 (18:36 +0000)
source/blender/blenkernel/BKE_mask.h
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/sequencer.c
source/blender/compositor/nodes/COM_MaskNode.cpp
source/blender/compositor/operations/COM_MaskOperation.cpp
source/blender/nodes/composite/nodes/node_composite_mask.c

index ec2eb82a9eb4c1ab030b8b2fd7fda0f11ad69632..345a2190e896fc8c57cd3693d04886ecc69ec33e 100644 (file)
@@ -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)
index bb2940091e462752716801f7aba13f0a5eb20d0b..a28ff3a175d9f3789a2e63a8e3acfd03e98d03b5 100644 (file)
@@ -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);
index af5b7716bbcca41288dd5eba29119249973129ed..889eee25d6bec1fe9c13f624a83102eed6c500db 100644 (file)
@@ -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;
index 991c3f75e05f3bb41d72a2b56ed106e519c114b8..e26756cfc5b6666a9d5673085dfc548412f8c8ad 100644 (file)
@@ -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());
index a7c1de323f1d4f7463f27483696046376d575ae4..35174349a63fc2b633f55abbf664242defe5314d 100644 (file)
@@ -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;
        }
 }
-
-
index 01461aec08d832444d8fed3fe51145d5fe61a8e1..dbe3c11ab55a22d9f2b9ed3f289ac5bc9b067693 100644 (file)
 
 /* **************** 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);