Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-21 16:29:48 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-21 16:29:48 +0400
commit86f9f3e439b10007a844aba931276a870355f909 (patch)
tree6208ced17301a0b55ec67e824a123f21d5df0a53 /source
parent78b2f5df4743b52319e211e77d6ce1b0cd049afa (diff)
parent54156e2b824c9e5a4293060b194630630d1f9dc7 (diff)
svn merge ^/trunk/blender -r48153:48158
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_mask.h3
-rw-r--r--source/blender/blenkernel/intern/mask.c15
-rw-r--r--source/blender/blenkernel/intern/sequencer.c8
-rw-r--r--source/blender/compositor/nodes/COM_MaskNode.cpp3
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp4
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h6
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c26
-rw-r--r--source/blender/editors/space_node/drawnode.c5
-rw-r--r--source/blender/makesdna/DNA_node_types.h40
-rw-r--r--source/blender/makesdna/DNA_object_types.h1
-rw-r--r--source/blender/makesdna/intern/makesdna.c6
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c19
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.c4
-rw-r--r--source/blender/python/bmesh/bmesh_py_utils.c2
14 files changed, 100 insertions, 42 deletions
diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h
index 0e93869a8b0..ea50d0fac39 100644
--- a/source/blender/blenkernel/BKE_mask.h
+++ b/source/blender/blenkernel/BKE_mask.h
@@ -170,7 +170,8 @@ 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, 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_KNOT(p) ( (p)->bezt.f2 & SELECT)
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index b50356afcb5..3dc584c374e 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -2090,7 +2090,8 @@ 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, int do_mask_aa)
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather)
{
MaskLayer *masklay;
@@ -2119,9 +2120,15 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
&tot_diff_point);
if (tot_diff_point) {
- diff_feather_points =
- BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
- &tot_diff_feather_points);
+ if (do_feather) {
+ 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 (width != height) {
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index ddf30ecfa81..8cb47118e7d 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -2082,7 +2082,9 @@ static ImBuf *seq_render_mask_strip(
context.rectx, context.recty,
maskbuf,
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_dst = ibuf->rect_float;
@@ -2106,7 +2108,9 @@ static ImBuf *seq_render_mask_strip(
context.rectx, context.recty,
maskbuf,
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;
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 ed07e41a649..15917d4920b 100644
--- a/source/blender/compositor/nodes/COM_MaskNode.cpp
+++ b/source/blender/compositor/nodes/COM_MaskNode.cpp
@@ -55,7 +55,8 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operation->setMask(mask);
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_NODE_MASK_FEATHER) != 0);
graph->addOperation(operation);
}
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 0493bdee12c..3b7e98433e4 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -75,8 +75,8 @@ 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, this->smooth);
- if (this->smooth) {
+ BKE_mask_rasterize(mask, width, height, buffer, TRUE, this->do_smooth, this->do_feather);
+ if (this->do_smooth) {
PLX_antialias_buffer(buffer, width, height);
}
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index 8507cb994c0..6b6d9aa9eeb 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -40,7 +40,8 @@ protected:
int maskWidth;
int maskHeight;
int framenumber;
- bool smooth;
+ bool do_smooth;
+ bool do_feather;
float *rasterizedMask;
/**
@@ -60,7 +61,8 @@ public:
void setMaskWidth(int width) { this->maskWidth = width; }
void setMaskHeight(int height) { this->maskHeight = height; }
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);
};
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index f154aec2eb4..c1ad46d9d62 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -1468,6 +1468,8 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
if (cure && p) {
if (!kcd->ignore_edge_snapping || !(cure->e)) {
+ KnifeVert *edgesnap = NULL;
+
if (kcd->snap_midpoints) {
mid_v3_v3v3(p, cure->v1->co, cure->v2->co);
mid_v3_v3v3(cagep, cure->v1->cageco, cure->v2->cageco);
@@ -1479,6 +1481,13 @@ static KnifeEdge *knife_find_closest_edge(KnifeTool_OpData *kcd, float p[3], flo
d = len_v3v3(cagep, cure->v1->cageco) / len_v3v3(cure->v1->cageco, cure->v2->cageco);
interp_v3_v3v3(p, cure->v1->co, cure->v2->co, d);
}
+
+ /* update mouse coordinates to the snapped-to edge's screen coordinates
+ * this is important for angle snap, which uses the previous mouse position */
+ edgesnap = new_knife_vert(kcd, p, cagep);
+ kcd->cur.mval[0] = (int)edgesnap->sco[0];
+ kcd->cur.mval[1] = (int)edgesnap->sco[1];
+
}
else {
return NULL;
@@ -1557,6 +1566,11 @@ static KnifeVert *knife_find_closest_vert(KnifeTool_OpData *kcd, float p[3], flo
if (curv && p) {
copy_v3_v3(p, curv->co);
copy_v3_v3(cagep, curv->cageco);
+
+ /* update mouse coordinates to the snapped-to vertex's screen coordinates
+ * this is important for angle snap, which uses the previous mouse position */
+ kcd->cur.mval[0] = (int)curv->sco[0];
+ kcd->cur.mval[1] = (int)curv->sco[1];
}
return curv;
@@ -1617,9 +1631,15 @@ static int knife_update_active(KnifeTool_OpData *kcd)
kcd->cur.mval[0] = kcd->vc.mval[0];
kcd->cur.mval[1] = kcd->vc.mval[1];
- kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
- if (!kcd->cur.vert) {
- kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+ /* if angle snapping is enabled, don't snap to edges/vertices */
+ if (kcd->angle_snapping == ANGLE_FREE) {
+
+ kcd->cur.vert = knife_find_closest_vert(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+
+ if (!kcd->cur.vert) {
+ kcd->cur.edge = knife_find_closest_edge(kcd, kcd->cur.co, kcd->cur.cage, &kcd->cur.bmface, &kcd->cur.is_space);
+ }
+
}
/* if no hits are found this would normally default to (0, 0, 0) so instead
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 56b763d0773..e893e1180a1 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1895,7 +1895,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)
{
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 */
@@ -2432,7 +2432,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)
{
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);
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index b1045bf3c63..0205cc13ab7 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -347,21 +347,31 @@ typedef struct bNodeSocketValueRGBA {
/* data structs, for node->storage */
-
-#define CMP_NODE_MASKTYPE_ADD 0
-#define CMP_NODE_MASKTYPE_SUBTRACT 1
-#define CMP_NODE_MASKTYPE_MULTIPLY 2
-#define CMP_NODE_MASKTYPE_NOT 3
-
-#define CMP_NODE_LENSFLARE_GHOST 1
-#define CMP_NODE_LENSFLARE_GLOW 2
-#define CMP_NODE_LENSFLARE_CIRCLE 4
-#define CMP_NODE_LENSFLARE_STREAKS 8
-
-#define CMP_NODE_DILATEERODE_STEP 0
-#define CMP_NODE_DILATEERODE_DISTANCE_THRESH 1
-#define CMP_NODE_DILATEERODE_DISTANCE 2
-#define CMP_NODE_DILATEERODE_DISTANCE_FEATHER 3
+enum {
+ CMP_NODE_MASKTYPE_ADD = 0,
+ CMP_NODE_MASKTYPE_SUBTRACT = 1,
+ CMP_NODE_MASKTYPE_MULTIPLY = 2,
+ CMP_NODE_MASKTYPE_NOT = 3
+};
+
+enum {
+ CMP_NODE_LENSFLARE_GHOST = 1,
+ CMP_NODE_LENSFLARE_GLOW = 2,
+ CMP_NODE_LENSFLARE_CIRCLE = 4,
+ CMP_NODE_LENSFLARE_STREAKS = 8
+};
+
+enum {
+ CMP_NODE_DILATEERODE_STEP = 0,
+ CMP_NODE_DILATEERODE_DISTANCE_THRESH = 1,
+ CMP_NODE_DILATEERODE_DISTANCE = 2,
+ CMP_NODE_DILATEERODE_DISTANCE_FEATHER = 3
+};
+
+enum {
+ CMP_NODEFLAG_MASK_AA = (1 << 0),
+ CMP_NODEFLAG_MASK_FEATHER = (1 << 1)
+};
typedef struct NodeFrame {
short flag;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 83bfec3cc52..2e774e4ea84 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -258,6 +258,7 @@ typedef struct Object {
struct FluidsimSettings *fluidsimSettings; /* if fluidsim enabled, store additional settings */
struct DerivedMesh *derivedDeform, *derivedFinal;
+ int *pad;
uint64_t lastDataMask; /* the custom data layer mask that was last used to calculate derivedDeform and derivedFinal */
uint64_t customdata_mask; /* (extra) custom data layer mask to use for creating derivedmesh, set by depsgraph */
unsigned int state; /* bit masks of game controllers that are active */
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index b0f8f02ae9f..09cb22683a7 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -798,7 +798,11 @@ static int calculate_structlens(int firststruct)
}
}
- /* 2-4 aligned/ */
+ /* 2-4-8 aligned/ */
+ if (type < firststruct && typelens[type] > 4 && (len % 8)) {
+ printf("Align 8 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 8);
+ dna_error = 1;
+ }
if (typelens[type] > 3 && (len % 4) ) {
printf("Align 4 error in struct: %s %s (add %d padding bytes)\n", types[structtype], cp, len % 4);
dna_error = 1;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 31854413fa8..9192d1b191e 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -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_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_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");
}
@@ -3119,16 +3119,21 @@ static void def_cmp_mask(StructRNA *srna)
{
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);
RNA_def_property_pointer_sdna(prop, NULL, "id");
RNA_def_property_struct_type(prop, "Mask");
RNA_def_property_flag(prop, PROP_EDITABLE);
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)
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.c b/source/blender/nodes/composite/nodes/node_composite_mask.c
index 91c3e9fbaf7..969d6e303e8 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.c
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.c
@@ -70,7 +70,9 @@ static void exec(void *data, bNode *node, bNodeStack **UNUSED(in), bNodeStack **
stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE);
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_NODE_MASK_FEATHER) != 0);
if (node->custom1) {
PLX_antialias_buffer(res,sx,sy);
diff --git a/source/blender/python/bmesh/bmesh_py_utils.c b/source/blender/python/bmesh/bmesh_py_utils.c
index 374a01c51f8..bb4e0c61c2b 100644
--- a/source/blender/python/bmesh/bmesh_py_utils.c
+++ b/source/blender/python/bmesh/bmesh_py_utils.c
@@ -370,7 +370,7 @@ static PyObject *bpy_bm_utils_edge_rotate(PyObject *UNUSED(self), PyObject *args
PyDoc_STRVAR(bpy_bm_utils_face_split_doc,
".. method:: face_split(face, vert_a, vert_b, coords=(), use_exist=True, example=None)\n"
"\n"
-" Split an edge, return the newly created data.\n"
+" Face split with optional intermediate points.\n"
"\n"
" :arg face: The face to cut.\n"
" :type face: :class:`bmesh.types.BMFace`\n"