[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48152] trunk/blender/source/blender: falloff options for dilate/erode feather compo node.
Campbell Barton
ideasman42 at gmail.com
Thu Jun 21 09:45:57 CEST 2012
Revision: 48152
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48152
Author: campbellbarton
Date: 2012-06-21 07:45:41 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
falloff options for dilate/erode feather compo node.
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/BKE_blender.h
trunk/blender/source/blender/blenloader/intern/readfile.c
trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
trunk/blender/source/blender/editors/space_node/drawnode.c
trunk/blender/source/blender/makesdna/DNA_node_types.h
trunk/blender/source/blender/makesrna/RNA_enum_types.h
trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
trunk/blender/source/blender/nodes/composite/nodes/node_composite_dilate.c
Modified: trunk/blender/source/blender/blenkernel/BKE_blender.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_blender.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/blenkernel/BKE_blender.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -42,7 +42,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 12
+#define BLENDER_SUBVERSION 13
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c 2012-06-21 07:45:41 UTC (rev 48152)
@@ -6982,6 +6982,21 @@
}
}
+static void do_version_ntree_dilateerode_264(void *UNUSED(data), ID *UNUSED(id), bNodeTree *ntree)
+{
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_DILATEERODE) {
+ if (node->storage == NULL) {
+ NodeDilateErode *data = MEM_callocN(sizeof(NodeDilateErode), __func__);
+ data->falloff = PROP_SMOOTH;
+ node->storage = data;
+ }
+ }
+ }
+}
+
static void do_versions(FileData *fd, Library *lib, Main *main)
{
/* WATCH IT!!!: pointers from libdata have not been converted */
@@ -7789,6 +7804,13 @@
ma->strand_widthfade = 0.0f;
}
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 13)) {
+ bNodeTreeType *ntreetype = ntreeGetType(NTREE_COMPOSIT);
+
+ if (ntreetype && ntreetype->foreach_nodetree)
+ ntreetype->foreach_nodetree(main, NULL, do_version_ntree_dilateerode_264);
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
Modified: trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/nodes/COM_DilateErodeNode.cpp 2012-06-21 07:45:41 UTC (rev 48152)
@@ -117,6 +117,12 @@
#endif
operationx->setSubtract(editorNode->custom2 < 0);
operationy->setSubtract(editorNode->custom2 < 0);
+
+ if (editorNode->storage) {
+ NodeDilateErode *data = (NodeDilateErode *)editorNode->storage;
+ operationx->setFalloff(data->falloff);
+ operationy->setFalloff(data->falloff);
+ }
}
else {
if (editorNode->custom2 > 0) {
Modified: trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-21 07:45:41 UTC (rev 48152)
@@ -91,7 +91,7 @@
/* normalized distance from the current (inverted so 1.0 is close and 0.0 is far)
* 'ease' is applied after, looks nicer */
-float *BlurBaseOperation::make_dist_fac_inverse(int rad)
+float *BlurBaseOperation::make_dist_fac_inverse(int rad, int falloff)
{
float *dist_fac_invert, val;
int i, n;
@@ -103,9 +103,26 @@
for (i = -rad; i <= rad; i++) {
val = 1.0f - fabsf(((float)i / (float)rad));
- /* ease - gives less hard lines for dilate/erode feather */
- val = (3.0f * val * val - 2.0f * val * val * val);
-
+ /* keep in sync with proportional_falloff_curve_only_items */
+ switch (falloff) {
+ case PROP_SMOOTH:
+ /* ease - gives less hard lines for dilate/erode feather */
+ val = (3.0f * val * val - 2.0f * val * val * val);
+ break;
+ case PROP_SPHERE:
+ val = sqrtf(2.0f * val - val * val);
+ break;
+ case PROP_ROOT:
+ val = sqrtf(val);
+ break;
+ case PROP_SHARP:
+ val = val * val;
+ break;
+ case PROP_LIN:
+ default:
+ /* nothing */
+ break;
+ }
dist_fac_invert[i + rad] = val;
}
Modified: trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -37,7 +37,7 @@
NodeBlurData *data;
BlurBaseOperation(DataType data_type);
float *make_gausstab(int rad);
- float *make_dist_fac_inverse(int rad);
+ float *make_dist_fac_inverse(int rad, int falloff);
float size;
bool deleteData;
bool sizeavailable;
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.cpp 2012-06-21 07:45:41 UTC (rev 48152)
@@ -54,7 +54,7 @@
this->rad = rad;
this->gausstab = BlurBaseOperation::make_gausstab(rad);
- this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
}
}
@@ -77,7 +77,7 @@
rad = 1;
this->rad = rad;
- this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaXBlurOperation.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -30,6 +30,7 @@
private:
float *gausstab;
float *distbuf_inv;
+ int falloff; /* falloff for distbuf_inv */
bool do_subtract;
int rad;
void updateGauss(MemoryBuffer **memoryBuffers);
@@ -58,5 +59,6 @@
* Set subtract for Dilate/Erode functionality
*/
void setSubtract(bool subtract) { this->do_subtract = subtract; }
+ void setFalloff(int falloff) { this->falloff = falloff; }
};
#endif
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.cpp 2012-06-21 07:45:41 UTC (rev 48152)
@@ -54,7 +54,7 @@
this->rad = rad;
this->gausstab = BlurBaseOperation::make_gausstab(rad);
- this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
}
}
@@ -77,7 +77,7 @@
rad = 1;
this->rad = rad;
- this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad);
+ this->distbuf_inv = BlurBaseOperation::make_dist_fac_inverse(rad, this->falloff);
}
}
Modified: trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/compositor/operations/COM_GaussianAlphaYBlurOperation.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -31,6 +31,7 @@
float *gausstab;
float *distbuf_inv;
bool do_subtract;
+ int falloff;
int rad;
void updateGauss(MemoryBuffer **memoryBuffers);
public:
@@ -58,5 +59,6 @@
* Set subtract for Dilate/Erode functionality
*/
void setSubtract(bool subtract) { this->do_subtract = subtract; }
+ void setFalloff(int falloff) { this->falloff = falloff; }
};
#endif
Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c 2012-06-21 07:45:41 UTC (rev 48152)
@@ -1768,8 +1768,13 @@
{
uiItemR(layout, ptr, "type", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "distance", 0, NULL, ICON_NONE);
- if (RNA_enum_get(ptr, "type") == CMP_NODE_DILATEERODE_DISTANCE_THRESH) {
- uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
+ switch (RNA_enum_get(ptr, "type")) {
+ case CMP_NODE_DILATEERODE_DISTANCE_THRESH:
+ uiItemR(layout, ptr, "edge", 0, NULL, ICON_NONE);
+ break;
+ case CMP_NODE_DILATEERODE_DISTANCE_FEATHER:
+ uiItemR(layout, ptr, "falloff", 0, NULL, ICON_NONE);
+ break;
}
}
Modified: trunk/blender/source/blender/makesdna/DNA_node_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_node_types.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/makesdna/DNA_node_types.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -559,6 +559,11 @@
float uspillr, uspillg, uspillb;
} NodeColorspill;
+typedef struct NodeDilateErode {
+ char falloff;
+ char pad[7];
+} NodeDilateErode;
+
typedef struct NodeTexBase {
TexMapping tex_mapping;
ColorMapping color_mapping;
Modified: trunk/blender/source/blender/makesrna/RNA_enum_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_enum_types.h 2012-06-21 07:32:06 UTC (rev 48151)
+++ trunk/blender/source/blender/makesrna/RNA_enum_types.h 2012-06-21 07:45:41 UTC (rev 48152)
@@ -41,6 +41,7 @@
extern EnumPropertyItem metaelem_type_items[];
extern EnumPropertyItem proportional_falloff_items[];
+extern EnumPropertyItem proportional_falloff_curve_only_items[];
extern EnumPropertyItem proportional_editing_items[];
extern EnumPropertyItem snap_target_items[];
extern EnumPropertyItem snap_element_items[];
Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list