forked from bartvdbraak/blender
option to disable feather, since its so slow - for interactively editing masks its useful to be able to disable.
also rename RNA to 'use_antialiasing'
This commit is contained in:
parent
ff998e15a7
commit
54156e2b82
@ -240,6 +240,7 @@ print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBU
|
|||||||
if 'blenderlite' in B.targets:
|
if 'blenderlite' in B.targets:
|
||||||
target_env_defs = {}
|
target_env_defs = {}
|
||||||
target_env_defs['WITH_BF_GAMEENGINE'] = False
|
target_env_defs['WITH_BF_GAMEENGINE'] = False
|
||||||
|
target_env_defs['WITH_BF_CYCLES'] = False
|
||||||
target_env_defs['WITH_BF_OPENAL'] = False
|
target_env_defs['WITH_BF_OPENAL'] = False
|
||||||
target_env_defs['WITH_BF_OPENEXR'] = False
|
target_env_defs['WITH_BF_OPENEXR'] = False
|
||||||
target_env_defs['WITH_BF_OPENMP'] = False
|
target_env_defs['WITH_BF_OPENMP'] = False
|
||||||
|
@ -170,7 +170,8 @@ void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, i
|
|||||||
/* rasterization */
|
/* rasterization */
|
||||||
int BKE_mask_get_duration(struct Mask *mask);
|
int BKE_mask_get_duration(struct Mask *mask);
|
||||||
void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
|
void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
|
||||||
const short do_aspect_correct, int do_mask_aa);
|
const short do_aspect_correct, const short do_mask_aa,
|
||||||
|
const short do_feather);
|
||||||
|
|
||||||
#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
|
#define MASKPOINT_ISSEL_ANY(p) ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
|
||||||
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
|
#define MASKPOINT_ISSEL_KNOT(p) ( (p)->bezt.f2 & SELECT)
|
||||||
|
@ -2090,7 +2090,8 @@ int BKE_mask_get_duration(Mask *mask)
|
|||||||
|
|
||||||
/* rasterization */
|
/* rasterization */
|
||||||
void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
|
void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
|
||||||
const short do_aspect_correct, int do_mask_aa)
|
const short do_aspect_correct, const short do_mask_aa,
|
||||||
|
const short do_feather)
|
||||||
{
|
{
|
||||||
MaskLayer *masklay;
|
MaskLayer *masklay;
|
||||||
|
|
||||||
@ -2119,9 +2120,15 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
|
|||||||
&tot_diff_point);
|
&tot_diff_point);
|
||||||
|
|
||||||
if (tot_diff_point) {
|
if (tot_diff_point) {
|
||||||
diff_feather_points =
|
if (do_feather) {
|
||||||
BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
|
diff_feather_points =
|
||||||
&tot_diff_feather_points);
|
BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
|
||||||
|
&tot_diff_feather_points);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tot_diff_feather_points = 0;
|
||||||
|
diff_feather_points = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (do_aspect_correct) {
|
if (do_aspect_correct) {
|
||||||
if (width != height) {
|
if (width != height) {
|
||||||
|
@ -2082,7 +2082,9 @@ static ImBuf *seq_render_mask_strip(
|
|||||||
context.rectx, context.recty,
|
context.rectx, context.recty,
|
||||||
maskbuf,
|
maskbuf,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE /*XXX- TODO: make on/off for anti-aliasing*/);
|
FALSE, /*XXX- TODO: make on/off for anti-aliasing */
|
||||||
|
TRUE /*XXX- TODO: make on/off for feather */
|
||||||
|
);
|
||||||
|
|
||||||
fp_src = maskbuf;
|
fp_src = maskbuf;
|
||||||
fp_dst = ibuf->rect_float;
|
fp_dst = ibuf->rect_float;
|
||||||
@ -2106,7 +2108,9 @@ static ImBuf *seq_render_mask_strip(
|
|||||||
context.rectx, context.recty,
|
context.rectx, context.recty,
|
||||||
maskbuf,
|
maskbuf,
|
||||||
TRUE,
|
TRUE,
|
||||||
FALSE /*XXX- TODO: mask on/off for anti-aliasing*/);
|
FALSE, /*XXX- TODO: make on/off for anti-aliasing */
|
||||||
|
TRUE /*XXX- TODO: make on/off for feather */
|
||||||
|
);
|
||||||
|
|
||||||
fp_src = maskbuf;
|
fp_src = maskbuf;
|
||||||
ub_dst = (unsigned char *)ibuf->rect;
|
ub_dst = (unsigned char *)ibuf->rect;
|
||||||
|
@ -55,7 +55,8 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
|
|||||||
|
|
||||||
operation->setMask(mask);
|
operation->setMask(mask);
|
||||||
operation->setFramenumber(context->getFramenumber());
|
operation->setFramenumber(context->getFramenumber());
|
||||||
operation->setSmooth((bool)editorNode->custom1);
|
operation->setSmooth((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_AA) != 0);
|
||||||
|
operation->setFeather((bool)(editorNode->custom1 & CMP_NODEFLAG_MASK_FEATHER) != 0);
|
||||||
|
|
||||||
graph->addOperation(operation);
|
graph->addOperation(operation);
|
||||||
}
|
}
|
||||||
|
@ -75,8 +75,8 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers
|
|||||||
float *buffer;
|
float *buffer;
|
||||||
|
|
||||||
buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask");
|
buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask");
|
||||||
BKE_mask_rasterize(mask, width, height, buffer, TRUE, this->smooth);
|
BKE_mask_rasterize(mask, width, height, buffer, TRUE, this->do_smooth, this->do_feather);
|
||||||
if (this->smooth) {
|
if (this->do_smooth) {
|
||||||
PLX_antialias_buffer(buffer, width, height);
|
PLX_antialias_buffer(buffer, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,8 @@ protected:
|
|||||||
int maskWidth;
|
int maskWidth;
|
||||||
int maskHeight;
|
int maskHeight;
|
||||||
int framenumber;
|
int framenumber;
|
||||||
bool smooth;
|
bool do_smooth;
|
||||||
|
bool do_feather;
|
||||||
float *rasterizedMask;
|
float *rasterizedMask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,8 @@ public:
|
|||||||
void setMaskWidth(int width) { this->maskWidth = width; }
|
void setMaskWidth(int width) { this->maskWidth = width; }
|
||||||
void setMaskHeight(int height) { this->maskHeight = height; }
|
void setMaskHeight(int height) { this->maskHeight = height; }
|
||||||
void setFramenumber(int framenumber) { this->framenumber = framenumber; }
|
void setFramenumber(int framenumber) { this->framenumber = framenumber; }
|
||||||
void setSmooth(bool smooth) { this->smooth = smooth; }
|
void setSmooth(bool smooth) { this->do_smooth = smooth; }
|
||||||
|
void setFeather(bool feather) { this->do_feather = feather; }
|
||||||
|
|
||||||
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
void executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data);
|
||||||
};
|
};
|
||||||
|
@ -1894,7 +1894,7 @@ static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), Poi
|
|||||||
static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
uiItemR(layout, ptr, "index", 0, NULL, ICON_NONE);
|
uiItemR(layout, ptr, "index", 0, NULL, ICON_NONE);
|
||||||
uiItemR(layout, ptr, "use_smooth_mask", 0, NULL, ICON_NONE);
|
uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw function for file output node sockets, displays only sub-path and format, no value button */
|
/* draw function for file output node sockets, displays only sub-path and format, no value button */
|
||||||
@ -2431,7 +2431,8 @@ static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C),
|
|||||||
static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||||
{
|
{
|
||||||
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL);
|
uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL);
|
||||||
uiItemR(layout, ptr, "smooth_mask", 0, NULL, ICON_NONE);
|
uiItemR(layout, ptr, "use_antialiasing", 0, NULL, ICON_NONE);
|
||||||
|
uiItemR(layout, ptr, "use_feather", 0, NULL, ICON_NONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,21 +347,31 @@ typedef struct bNodeSocketValueRGBA {
|
|||||||
|
|
||||||
|
|
||||||
/* data structs, for node->storage */
|
/* data structs, for node->storage */
|
||||||
|
enum {
|
||||||
|
CMP_NODE_MASKTYPE_ADD = 0,
|
||||||
|
CMP_NODE_MASKTYPE_SUBTRACT = 1,
|
||||||
|
CMP_NODE_MASKTYPE_MULTIPLY = 2,
|
||||||
|
CMP_NODE_MASKTYPE_NOT = 3
|
||||||
|
};
|
||||||
|
|
||||||
#define CMP_NODE_MASKTYPE_ADD 0
|
enum {
|
||||||
#define CMP_NODE_MASKTYPE_SUBTRACT 1
|
CMP_NODE_LENSFLARE_GHOST = 1,
|
||||||
#define CMP_NODE_MASKTYPE_MULTIPLY 2
|
CMP_NODE_LENSFLARE_GLOW = 2,
|
||||||
#define CMP_NODE_MASKTYPE_NOT 3
|
CMP_NODE_LENSFLARE_CIRCLE = 4,
|
||||||
|
CMP_NODE_LENSFLARE_STREAKS = 8
|
||||||
|
};
|
||||||
|
|
||||||
#define CMP_NODE_LENSFLARE_GHOST 1
|
enum {
|
||||||
#define CMP_NODE_LENSFLARE_GLOW 2
|
CMP_NODE_DILATEERODE_STEP = 0,
|
||||||
#define CMP_NODE_LENSFLARE_CIRCLE 4
|
CMP_NODE_DILATEERODE_DISTANCE_THRESH = 1,
|
||||||
#define CMP_NODE_LENSFLARE_STREAKS 8
|
CMP_NODE_DILATEERODE_DISTANCE = 2,
|
||||||
|
CMP_NODE_DILATEERODE_DISTANCE_FEATHER = 3
|
||||||
|
};
|
||||||
|
|
||||||
#define CMP_NODE_DILATEERODE_STEP 0
|
enum {
|
||||||
#define CMP_NODE_DILATEERODE_DISTANCE_THRESH 1
|
CMP_NODEFLAG_MASK_AA = (1 << 0),
|
||||||
#define CMP_NODE_DILATEERODE_DISTANCE 2
|
CMP_NODEFLAG_MASK_FEATHER = (1 << 1)
|
||||||
#define CMP_NODE_DILATEERODE_DISTANCE_FEATHER 3
|
};
|
||||||
|
|
||||||
typedef struct NodeFrame {
|
typedef struct NodeFrame {
|
||||||
short flag;
|
short flag;
|
||||||
|
@ -2466,9 +2466,9 @@ static void def_cmp_id_mask(StructRNA *srna)
|
|||||||
RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
|
RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
|
||||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "use_smooth_mask", PROP_BOOLEAN, PROP_NONE);
|
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
|
RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
|
||||||
RNA_def_property_ui_text(prop, "Smooth Mask", "Apply an anti-aliasing filter to the mask");
|
RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
|
||||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3119,16 +3119,21 @@ static void def_cmp_mask(StructRNA *srna)
|
|||||||
{
|
{
|
||||||
PropertyRNA *prop;
|
PropertyRNA *prop;
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "smooth_mask", PROP_BOOLEAN, PROP_NONE);
|
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
|
|
||||||
RNA_def_property_ui_text(prop, "Anti-Alias", "Apply an anti-aliasing filter to the mask");
|
|
||||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
|
||||||
|
|
||||||
prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
|
prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
|
||||||
RNA_def_property_pointer_sdna(prop, NULL, "id");
|
RNA_def_property_pointer_sdna(prop, NULL, "id");
|
||||||
RNA_def_property_struct_type(prop, "Mask");
|
RNA_def_property_struct_type(prop, "Mask");
|
||||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||||
RNA_def_property_ui_text(prop, "Mask", "");
|
RNA_def_property_ui_text(prop, "Mask", "");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_MASK_AA);
|
||||||
|
RNA_def_property_ui_text(prop, "Anti-Alias", "Apply an anti-aliasing filter to the mask");
|
||||||
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||||
|
|
||||||
|
prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
|
||||||
|
RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODE_MASK_ELLIPSE);
|
||||||
|
RNA_def_property_ui_text(prop, "Feather", "Apply an anti-aliasing filter to the mask");
|
||||||
|
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dev_cmd_transform(StructRNA *srna)
|
static void dev_cmd_transform(StructRNA *srna)
|
||||||
|
@ -70,7 +70,9 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
|
|||||||
stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE);
|
stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE);
|
||||||
res = stackbuf->rect;
|
res = stackbuf->rect;
|
||||||
|
|
||||||
BKE_mask_rasterize(mask, sx, sy, res, TRUE, node->custom1);
|
BKE_mask_rasterize(mask, sx, sy, res, TRUE,
|
||||||
|
(node->custom1 & CMP_NODEFLAG_MASK_AA) != 0,
|
||||||
|
(node->custom1 & CMP_NODEFLAG_MASK_FEATHER) != 0);
|
||||||
|
|
||||||
if (node->custom1) {
|
if (node->custom1) {
|
||||||
PLX_antialias_buffer(res,sx,sy);
|
PLX_antialias_buffer(res,sx,sy);
|
||||||
|
@ -370,7 +370,7 @@ static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args
|
|||||||
PyDoc_STRVAR(bpy_bm_utils_face_split_doc,
|
PyDoc_STRVAR(bpy_bm_utils_face_split_doc,
|
||||||
".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n"
|
".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n"
|
||||||
"\n"
|
"\n"
|
||||||
" Split an edge, return the newly created data.\n"
|
" Face split with optional intermediate points.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" :arg face: The face to cut.\n"
|
" :arg face: The face to cut.\n"
|
||||||
" :type face: :class:`bmesh.types.BMFace`\n"
|
" :type face: :class:`bmesh.types.BMFace`\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user