[Bf-blender-cvs] [c2f7cff] master: Add inverse-square falloff to bmesh, mask & compo.

Campbell Barton noreply at git.blender.org
Sun Apr 26 10:37:37 CEST 2015


Commit: c2f7cffd56afffcceda11813a3dcc0a93d84673a
Author: Campbell Barton
Date:   Sun Apr 26 18:31:54 2015 +1000
Branches: master
https://developer.blender.org/rBc2f7cffd56afffcceda11813a3dcc0a93d84673a

Add inverse-square falloff to bmesh, mask & compo.

===================================================================

M	source/blender/blenkernel/intern/mask_rasterize.c
M	source/blender/bmesh/intern/bmesh_operators.h
M	source/blender/bmesh/intern/bmesh_queries.c
M	source/blender/compositor/operations/COM_BlurBaseOperation.cpp
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
index 387d093..13ec970 100644
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1360,6 +1360,9 @@ float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
 				case PROP_SHARP:
 					value_layer = value_layer * value_layer;
 					break;
+				case PROP_INVSQUARE:
+					value_layer = value_layer * (2.0f - value_layer);
+					break;
 				case PROP_LIN:
 				default:
 					/* nothing */
diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h
index d2ce2fa..d9961e5 100644
--- a/source/blender/bmesh/intern/bmesh_operators.h
+++ b/source/blender/bmesh/intern/bmesh_operators.h
@@ -46,6 +46,7 @@ enum {
 	SUBD_FALLOFF_ROOT,
 	SUBD_FALLOFF_SHARP,
 	SUBD_FALLOFF_LIN,
+	SUBD_FALLOFF_INVSQUARE = 7,  /* matching PROP_INVSQUARE */
 };
 
 enum {
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 1e0b1f2..61328a5 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -2419,6 +2419,9 @@ float bmesh_subd_falloff_calc(const int falloff, float val)
 			break;
 		case SUBD_FALLOFF_LIN:
 			break;
+		case SUBD_FALLOFF_INVSQUARE:
+			val = val * (2.0f - val);
+			break;
 		default:
 			BLI_assert(0);
 			break;
diff --git a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
index cbf9bb2..07669b1 100644
--- a/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
+++ b/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
@@ -133,6 +133,8 @@ float *BlurBaseOperation::make_dist_fac_inverse(float rad, int size, int falloff
 			case PROP_SHARP:
 				val = val * val;
 				break;
+			case PROP_INVSQUARE:
+				val = val * (2.0f - val);
 			case PROP_LIN:
 				/* fall-through */
 #ifndef NDEBUG
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f67af39..f671a4b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -134,6 +134,7 @@ EnumPropertyItem proportional_falloff_curve_only_items[] = {
 	{PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
 	{PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
 	{PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
+	{PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
 	{PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
 	{PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
 	{0, NULL, 0, NULL, NULL}




More information about the Bf-blender-cvs mailing list