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:
authorThomas Dinges <blender@dingto.org>2012-03-26 02:14:21 +0400
committerThomas Dinges <blender@dingto.org>2012-03-26 02:14:21 +0400
commitaede928bdc7902bb81ebb00b286dc5064cf54dd6 (patch)
treec85380cf5bcf06bcc7c3162dc661083571d75322 /source
parentc379b78d8a00a0960346656d3e38aacd56974572 (diff)
Patch: [#30652] Influence slider for Lattice Modifier
* This patch adds a influence slider for the lattice modifier, which affects the strength of the deformation. Patch by Patrick Boelens (senshi), thanks a lot!
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/BKE_lattice.h2
-rw-r--r--source/blender/blenkernel/intern/lattice.c10
-rw-r--r--source/blender/blenloader/intern/readfile.c16
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c6
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c10
7 files changed, 38 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index eb465ea814b..ffabbcf32f0 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 262
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 3
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index 8a1529a7ad0..29c78510fd8 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -63,7 +63,7 @@ void curve_deform_vector(struct Scene *scene, struct Object *cuOb, struct Object
void lattice_deform_verts(struct Object *laOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
- int numVerts, const char *vgroup);
+ int numVerts, const char *vgroup, float influence);
void armature_deform_verts(struct Object *armOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts, int deformflag,
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index b1513954667..a02f2cc1c5d 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -153,7 +153,7 @@ void resizelattice(Lattice *lt, int uNew, int vNew, int wNew, Object *ltOb)
copy_m4_m4(mat, ltOb->obmat);
unit_m4(ltOb->obmat);
- lattice_deform_verts(ltOb, NULL, NULL, vertexCos, uNew*vNew*wNew, NULL);
+ lattice_deform_verts(ltOb, NULL, NULL, vertexCos, uNew*vNew*wNew, NULL, 1.0f);
copy_m4_m4(ltOb->obmat, mat);
lt->typeu = typeu;
@@ -785,7 +785,7 @@ void curve_deform_vector(Scene *scene, Object *cuOb, Object *target,
}
void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
- float (*vertexCos)[3], int numVerts, const char *vgroup)
+ float (*vertexCos)[3], int numVerts, const char *vgroup, float influence)
{
int a;
int use_vgroups;
@@ -824,13 +824,13 @@ void lattice_deform_verts(Object *laOb, Object *target, DerivedMesh *dm,
weight= defvert_find_weight(dvert, index);
if (weight > 0.0f)
- calc_latt_deform(laOb, vertexCos[a], weight);
+ calc_latt_deform(laOb, vertexCos[a], weight*influence);
}
}
}
else {
for (a = 0; a < numVerts; a++) {
- calc_latt_deform(laOb, vertexCos[a], 1.0f);
+ calc_latt_deform(laOb, vertexCos[a], influence);
}
}
end_latt_deform(laOb);
@@ -843,7 +843,7 @@ int object_deform_mball(Object *ob, ListBase *dispbase)
for (dl=dispbase->first; dl; dl=dl->next) {
lattice_deform_verts(ob->parent, ob, NULL,
- (float(*)[3]) dl->verts, dl->nr, NULL);
+ (float(*)[3]) dl->verts, dl->nr, NULL, 1.0f);
}
return 1;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6f4ceb78157..30ae9b6af52 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -13329,6 +13329,22 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
}
+
+ if (main->versionfile < 262 || (main->versionfile == 262 && main->subversionfile < 3))
+ {
+ Object *ob;
+ ModifierData *md;
+
+ for(ob = main->object.first; ob; ob = ob->id.next) {
+ for(md=ob->modifiers.first; md; md=md->next) {
+ if(md->type == eModifierType_Lattice) {
+ LatticeModifierData *lmd = (LatticeModifierData *)md;
+ lmd->influence = 1.0f;
+ }
+ }
+ }
+ }
+
{
/* Default for old files is to save particle rotations to pointcache */
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index f00bd338fd5..bb2d320aa04 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -135,6 +135,8 @@ typedef struct LatticeModifierData {
struct Object *object;
char name[64]; /* optional vertexgroup name, MAX_VGROUP_NAME */
+ float influence;
+ char pad[4];
} LatticeModifierData;
typedef struct CurveModifierData {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index e40ed254dba..dae9c0ca044 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -960,6 +960,12 @@ static void rna_def_modifier_lattice(BlenderRNA *brna)
"Name of Vertex Group which determines influence of modifier per point");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 2);
+ RNA_def_property_ui_text(prop, "Influence", "Strength of modifier effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_curve(BlenderRNA *brna)
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index 35503f9e462..5732fee7826 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -40,7 +40,6 @@
#include "BLI_utildefines.h"
#include "BLI_string.h"
-
#include "BKE_cdderivedmesh.h"
#include "BKE_lattice.h"
#include "BKE_modifier.h"
@@ -49,6 +48,11 @@
#include "MOD_util.h"
+static void initData(ModifierData *md)
+{
+ LatticeModifierData *lmd = (LatticeModifierData*) md;
+ lmd->influence = 1.0f;
+}
static void copyData(ModifierData *md, ModifierData *target)
{
@@ -115,7 +119,7 @@ static void deformVerts(ModifierData *md, Object *ob,
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ob, derivedData,
- vertexCos, numVerts, lmd->name);
+ vertexCos, numVerts, lmd->name, lmd->influence);
}
static void deformVertsEM(
@@ -146,7 +150,7 @@ ModifierTypeInfo modifierType_Lattice = {
/* deformMatricesEM */ NULL,
/* applyModifier */ NULL,
/* applyModifierEM */ NULL,
- /* initData */ NULL,
+ /* initData */ initData,
/* requiredDataMask */ requiredDataMask,
/* freeData */ NULL,
/* isDisabled */ isDisabled,