[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48158] trunk/blender: option to disable feather, since its so slow - for interactively editing masks its useful to be able to disable .

Campbell Barton ideasman42 at gmail.com
Thu Jun 21 14:28:03 CEST 2012


Revision: 48158
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48158
Author:   campbellbarton
Date:     2012-06-21 12:27:57 +0000 (Thu, 21 Jun 2012)
Log Message:
-----------
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'

Modified Paths:
--------------
    trunk/blender/SConstruct
    trunk/blender/source/blender/blenkernel/BKE_mask.h
    trunk/blender/source/blender/blenkernel/intern/mask.c
    trunk/blender/source/blender/blenkernel/intern/sequencer.c
    trunk/blender/source/blender/compositor/nodes/COM_MaskNode.cpp
    trunk/blender/source/blender/compositor/operations/COM_MaskOperation.cpp
    trunk/blender/source/blender/compositor/operations/COM_MaskOperation.h
    trunk/blender/source/blender/editors/space_node/drawnode.c
    trunk/blender/source/blender/makesdna/DNA_node_types.h
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/nodes/composite/nodes/node_composite_mask.c
    trunk/blender/source/blender/python/bmesh/bmesh_py_utils.c

Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/SConstruct	2012-06-21 12:27:57 UTC (rev 48158)
@@ -240,6 +240,7 @@
 if 'blenderlite' in B.targets:
     target_env_defs = {}
     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_OPENEXR'] = False
     target_env_defs['WITH_BF_OPENMP'] = False

Modified: trunk/blender/source/blender/blenkernel/BKE_mask.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_mask.h	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/blenkernel/BKE_mask.h	2012-06-21 12:27:57 UTC (rev 48158)
@@ -170,7 +170,8 @@
 /* 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)

Modified: trunk/blender/source/blender/blenkernel/intern/mask.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/blenkernel/intern/mask.c	2012-06-21 12:27:57 UTC (rev 48158)
@@ -2090,7 +2090,8 @@
 
 /* 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 @@
 			                                                            &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) {

Modified: trunk/blender/source/blender/blenkernel/intern/sequencer.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/blenkernel/intern/sequencer.c	2012-06-21 12:27:57 UTC (rev 48158)
@@ -2082,7 +2082,9 @@
 		                   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 @@
 		                   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;

Modified: trunk/blender/source/blender/compositor/nodes/COM_MaskNode.cpp
===================================================================
--- trunk/blender/source/blender/compositor/nodes/COM_MaskNode.cpp	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/compositor/nodes/COM_MaskNode.cpp	2012-06-21 12:27:57 UTC (rev 48158)
@@ -55,7 +55,8 @@
 
 	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);
 }

Modified: trunk/blender/source/blender/compositor/operations/COM_MaskOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_MaskOperation.cpp	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/compositor/operations/COM_MaskOperation.cpp	2012-06-21 12:27:57 UTC (rev 48158)
@@ -75,8 +75,8 @@
 		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);
 		}
 

Modified: trunk/blender/source/blender/compositor/operations/COM_MaskOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_MaskOperation.h	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/compositor/operations/COM_MaskOperation.h	2012-06-21 12:27:57 UTC (rev 48158)
@@ -40,7 +40,8 @@
 	int maskWidth;
 	int maskHeight;
 	int framenumber;
-	bool smooth;
+	bool do_smooth;
+	bool do_feather;
 	float *rasterizedMask;
 
 	/**
@@ -60,7 +61,8 @@
 	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);
 };

Modified: trunk/blender/source/blender/editors/space_node/drawnode.c
===================================================================
--- trunk/blender/source/blender/editors/space_node/drawnode.c	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/editors/space_node/drawnode.c	2012-06-21 12:27:57 UTC (rev 48158)
@@ -1894,7 +1894,7 @@
 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 */
@@ -2431,7 +2431,8 @@
 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);
 
 }
 

Modified: trunk/blender/source/blender/makesdna/DNA_node_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_node_types.h	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/makesdna/DNA_node_types.h	2012-06-21 12:27:57 UTC (rev 48158)
@@ -347,21 +347,31 @@
 
 
 /* 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
-#define CMP_NODE_MASKTYPE_SUBTRACT  	1
-#define CMP_NODE_MASKTYPE_MULTIPLY  	2
-#define 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
+};
 
-#define CMP_NODE_LENSFLARE_GHOST   1
-#define CMP_NODE_LENSFLARE_GLOW    2
-#define CMP_NODE_LENSFLARE_CIRCLE  4
-#define 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
+};
 
-#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_NODEFLAG_MASK_AA      = (1 << 0),
+	CMP_NODEFLAG_MASK_FEATHER = (1 << 1)
+};
 
 typedef struct NodeFrame {
 	short flag;

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-06-21 10:52:23 UTC (rev 48157)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2012-06-21 12:27:57 UTC (rev 48158)
@@ -2466,9 +2466,9 @@
 	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 @@
 {
 	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");

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list