forked from bartvdbraak/blender
remove input socket of mask node, this wasnt used.
This commit is contained in:
parent
ca6290228f
commit
16dededdf3
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user