Commit: 02acfdab9eeb01f0394f5428038d39db54096401
Author: Campbell Barton
Date:   Wed Feb 4 05:35:09 2015 +1100
Branches: master
https://developer.blender.org/rB02acfdab9eeb01f0394f5428038d39db54096401

Add inverse-square blending for PET and warp

Similar to 'Root' but without noticeable spike/pinch in the center.

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

M       source/blender/editors/transform/transform_generics.c
M       source/blender/makesdna/DNA_modifier_types.h
M       source/blender/makesdna/DNA_scene_types.h
M       source/blender/makesrna/intern/rna_modifier.c
M       source/blender/makesrna/intern/rna_scene.c
M       source/blender/modifiers/intern/MOD_warp.c

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

diff --git a/source/blender/editors/transform/transform_generics.c 
b/source/blender/editors/transform/transform_generics.c
index fcf7895..903b3f1 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1937,6 +1937,9 @@ void calculatePropRatio(TransInfo *t)
                                        case PROP_RANDOM:
                                                td->factor = BLI_frand() * dist;
                                                break;
+                                       case PROP_INVSQUARE:
+                                               td->factor = dist * (2.0f - 
dist);
+                                               break;
                                        default:
                                                td->factor = 1;
                                                break;
@@ -1965,6 +1968,9 @@ void calculatePropRatio(TransInfo *t)
                        case PROP_RANDOM:
                                strcpy(t->proptext, IFACE_("(Random)"));
                                break;
+                       case PROP_INVSQUARE:
+                               strcpy(t->proptext, IFACE_("(InvSquare)"));
+                               break;
                        default:
                                t->proptext[0] = '\0';
                                break;
diff --git a/source/blender/makesdna/DNA_modifier_types.h 
b/source/blender/makesdna/DNA_modifier_types.h
index 43d7b45..2d8c3b2 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -978,6 +978,7 @@ typedef enum {
        eWarp_Falloff_Linear = 5, /* PROP_LIN */
        eWarp_Falloff_Const  = 6, /* PROP_CONST */
        eWarp_Falloff_Sphere = 7, /* PROP_SPHERE */
+       eWarp_Falloff_InvSquare = 8, /* PROP_INVSQUARE */
        /* PROP_RANDOM not used */
 } WarpModifierFalloff;
 
diff --git a/source/blender/makesdna/DNA_scene_types.h 
b/source/blender/makesdna/DNA_scene_types.h
index fabfa76..9ac5066 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1625,7 +1625,8 @@ extern const char *RE_engine_id_CYCLES;
 #define PROP_LIN               4
 #define PROP_CONST             5
 #define PROP_RANDOM            6
-#define PROP_MODE_MAX          7
+#define PROP_INVSQUARE         7
+#define PROP_MODE_MAX          8
 
 /* toolsettings->proportional */
 #define PROP_EDIT_OFF                  0
diff --git a/source/blender/makesrna/intern/rna_modifier.c 
b/source/blender/makesrna/intern/rna_modifier.c
index a7e0ed2..12b6d74 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1117,6 +1117,7 @@ static void rna_def_modifier_warp(BlenderRNA *brna)
                {eWarp_Falloff_Smooth,  "SMOOTH", ICON_SMOOTHCURVE, "Smooth", 
""},
                {eWarp_Falloff_Sphere,  "SPHERE", ICON_SPHERECURVE, "Sphere", 
""},
                {eWarp_Falloff_Root,    "ROOT", ICON_ROOTCURVE, "Root", ""},
+               {eWarp_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, 
"Inverse Square", ""},
                {eWarp_Falloff_Sharp,   "SHARP", ICON_SHARPCURVE, "Sharp", ""},
                {eWarp_Falloff_Linear,  "LINEAR", ICON_LINCURVE, "Linear", ""},
                {eWarp_Falloff_Const,   "CONSTANT", ICON_NOCURVE, "Constant", 
""},
diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index e830e86..7ebbf0b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -112,6 +112,7 @@ EnumPropertyItem proportional_falloff_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"},
        {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
diff --git a/source/blender/modifiers/intern/MOD_warp.c 
b/source/blender/modifiers/intern/MOD_warp.c
index ed0d18f..3eb34e5 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -265,6 +265,9 @@ static void warpModifier_do(WarpModifierData *wmd, Object 
*ob,
                                case eWarp_Falloff_Sphere:
                                        fac = sqrtf(2 * fac - fac * fac);
                                        break;
+                               case eWarp_Falloff_InvSquare:
+                                       fac = fac * (2.0f - fac);
+                                       break;
                        }
 
                        fac *= weight;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to