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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-01-06 18:02:55 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-01-06 18:06:37 +0300
commit8e73b770d4e9da71fb727444611657732cc52047 (patch)
tree7296c302fe204cf6e238106bfcf2928a5ddf8b84 /source/blender/blenkernel/intern
parent05271830901401dd6a395f730990a6ac1ca6a6d6 (diff)
Remove slurph shape-key feature
This is an old option which wasn't working in over a year without complaint.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/displist.c2
-rw-r--r--source/blender/blenkernel/intern/key.c194
-rw-r--r--source/blender/blenkernel/intern/object.c20
3 files changed, 58 insertions, 158 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 80a8d373220..9ea5a5638b9 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -813,7 +813,7 @@ static void curve_calc_modifiers_pre(Scene *scene, Object *ob, ListBase *nurb,
required_mode |= eModifierMode_Editmode;
if (cu->editnurb == NULL) {
- keyVerts = BKE_key_evaluate_object(scene, ob, &numVerts);
+ keyVerts = BKE_key_evaluate_object(ob, &numVerts);
if (keyVerts) {
/* split coords from key data, the latter also includes
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 3ba0c6e5ffa..32e95e7ad92 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -73,10 +73,6 @@
#define IPO_BEZTRIPLE 100
#define IPO_BPOINT 101
-/* extern, not threadsafe */
-int slurph_opt = 1;
-
-
void BKE_key_free(Key *key)
{
KeyBlock *kb;
@@ -607,7 +603,7 @@ static void cp_key(const int start, int end, const int tot, char *poin, Key *key
k1 = key_block_get_data(key, actkb, kb, &freek1);
kref = key_block_get_data(key, actkb, key->refkey, &freekref);
- /* this exception is needed for slurphing */
+ /* this exception is needed curves with multiple splines */
if (start != 0) {
poin += poinsize * start;
@@ -891,7 +887,7 @@ static void do_key(const int start, int end, const int tot, char *poin, Key *key
}
}
- /* this exception needed for slurphing */
+ /* this exception is needed for curves with multiple splines */
if (start != 0) {
poin += poinsize * start;
@@ -1168,53 +1164,29 @@ void BKE_keyblock_free_per_block_weights(Key *key, float **per_keyblock_weights,
MEM_freeN(per_keyblock_weights);
}
-static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
+static void do_mesh_key(Object *ob, Key *key, char *out, const int tot)
{
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag = 0;
- if (key->slurph && key->type != KEY_RELATIVE) {
+ if (key->type == KEY_RELATIVE) {
+ WeightsArrayCache cache = {0, NULL};
+ float **per_keyblock_weights;
+ per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, &cache);
+ BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, per_keyblock_weights, KEY_MODE_DUMMY);
+ BKE_keyblock_free_per_block_weights(key, per_keyblock_weights, &cache);
+ }
+ else {
const float ctime_scaled = key->ctime / 100.0f;
- float delta = (float)key->slurph / tot;
- float cfra = BKE_scene_frame_get(scene);
- int step, a;
-
- if (tot > 100 && slurph_opt) {
- step = tot / 50;
- delta *= step;
- /* in do_key and cp_key the case a>tot is handled */
- }
- else {
- step = 1;
- }
- for (a = 0; a < tot; a += step, cfra += delta) {
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
+ flag = setkeys(ctime_scaled, &key->block, k, t, 0);
- if (flag == 0)
- do_key(a, a + step, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
- else
- cp_key(a, a + step, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
- }
- }
- else {
- if (key->type == KEY_RELATIVE) {
- WeightsArrayCache cache = {0, NULL};
- float **per_keyblock_weights;
- per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, &cache);
- BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, per_keyblock_weights, KEY_MODE_DUMMY);
- BKE_keyblock_free_per_block_weights(key, per_keyblock_weights, &cache);
+ if (flag == 0) {
+ do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
}
else {
- const float ctime_scaled = key->ctime / 100.0f;
-
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
-
- if (flag == 0)
- do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
- else
- cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
+ cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
}
}
}
@@ -1259,135 +1231,63 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
}
}
-static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
+static void do_curve_key(Object *ob, Key *key, char *out, const int tot)
{
Curve *cu = ob->data;
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag = 0;
- if (key->slurph && key->type != KEY_RELATIVE) {
+ if (key->type == KEY_RELATIVE) {
+ do_rel_cu_key(cu, cu->key, actkb, out, tot);
+ }
+ else {
const float ctime_scaled = key->ctime / 100.0f;
- float delta = (float)key->slurph / tot;
- float cfra = BKE_scene_frame_get(scene);
- Nurb *nu;
- int i = 0, remain = 0;
- int step, a;
- if (tot > 100 && slurph_opt) {
- step = tot / 50;
- delta *= step;
- /* in do_key and cp_key the case a>tot has been handled */
- }
- else {
- step = 1;
- }
+ flag = setkeys(ctime_scaled, &key->block, k, t, 0);
- for (nu = cu->nurb.first; nu; nu = nu->next) {
- int estep, mode;
-
- if (nu->bp) {
- mode = KEY_MODE_BPOINT;
- estep = nu->pntsu * nu->pntsv;
- }
- else if (nu->bezt) {
- mode = KEY_MODE_BEZTRIPLE;
- estep = 3 * nu->pntsu;
- }
- else {
- mode = 0;
- estep = 0;
- }
-
- a = 0;
- while (a < estep) {
- int count;
-
- if (remain <= 0) {
- cfra += delta;
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
-
- remain = step;
- }
-
- count = min_ii(remain, estep);
- if (mode == KEY_MODE_BEZTRIPLE) {
- count += 3 - count % 3;
- }
-
- if (flag == 0)
- do_key(i, i + count, tot, (char *)out, key, actkb, k, t, mode);
- else
- cp_key(i, i + count, tot, (char *)out, key, actkb, k[2], NULL, mode);
-
- a += count;
- i += count;
- remain -= count;
- }
- }
- }
- else {
- if (key->type == KEY_RELATIVE) {
- do_rel_cu_key(cu, cu->key, actkb, out, tot);
+ if (flag == 0) {
+ do_cu_key(cu, key, actkb, k, t, out, tot);
}
else {
- const float ctime_scaled = key->ctime / 100.0f;
-
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
-
- if (flag == 0) do_cu_key(cu, key, actkb, k, t, out, tot);
- else cp_cu_key(cu, key, actkb, k[2], 0, tot, out, tot);
+ cp_cu_key(cu, key, actkb, k[2], 0, tot, out, tot);
}
}
}
-static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
+static void do_latt_key(Object *ob, Key *key, char *out, const int tot)
{
Lattice *lt = ob->data;
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
float t[4];
int flag;
- if (key->slurph && key->type != KEY_RELATIVE) {
- const float ctime_scaled = key->ctime / 100.0f;
- float delta = (float)key->slurph / tot;
- float cfra = BKE_scene_frame_get(scene);
- int a;
-
- for (a = 0; a < tot; a++, cfra += delta) {
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
-
- if (flag == 0)
- do_key(a, a + 1, tot, out, key, actkb, k, t, KEY_MODE_DUMMY);
- else
- cp_key(a, a + 1, tot, out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
- }
+ if (key->type == KEY_RELATIVE) {
+ float **per_keyblock_weights;
+ per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, NULL);
+ BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, per_keyblock_weights, KEY_MODE_DUMMY);
+ BKE_keyblock_free_per_block_weights(key, per_keyblock_weights, NULL);
}
else {
- if (key->type == KEY_RELATIVE) {
- float **per_keyblock_weights;
- per_keyblock_weights = BKE_keyblock_get_per_block_weights(ob, key, NULL);
- BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, per_keyblock_weights, KEY_MODE_DUMMY);
- BKE_keyblock_free_per_block_weights(key, per_keyblock_weights, NULL);
+ const float ctime_scaled = key->ctime / 100.0f;
+
+ flag = setkeys(ctime_scaled, &key->block, k, t, 0);
+
+ if (flag == 0) {
+ do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
}
else {
- const float ctime_scaled = key->ctime / 100.0f;
-
- flag = setkeys(ctime_scaled, &key->block, k, t, 0);
-
- if (flag == 0)
- do_key(0, tot, tot, (char *)out, key, actkb, k, t, KEY_MODE_DUMMY);
- else
- cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
+ cp_key(0, tot, tot, (char *)out, key, actkb, k[2], NULL, KEY_MODE_DUMMY);
}
}
-
+
if (lt->flag & LT_OUTSIDE) outside_lattice(lt);
}
/* returns key coordinates (+ tilt) when key applied, NULL otherwise */
-float *BKE_key_evaluate_object_ex(Scene *scene, Object *ob, int *r_totelem,
- float *arr, size_t arr_size)
+float *BKE_key_evaluate_object_ex(
+ Object *ob, int *r_totelem,
+ float *arr, size_t arr_size)
{
Key *key = BKE_key_from_object(ob);
KeyBlock *actkb = BKE_keyblock_from_object(ob);
@@ -1469,10 +1369,10 @@ float *BKE_key_evaluate_object_ex(Scene *scene, Object *ob, int *r_totelem,
}
else {
- if (ob->type == OB_MESH) do_mesh_key(scene, ob, key, out, tot);
- else if (ob->type == OB_LATTICE) do_latt_key(scene, ob, key, out, tot);
- else if (ob->type == OB_CURVE) do_curve_key(scene, ob, key, out, tot);
- else if (ob->type == OB_SURF) do_curve_key(scene, ob, key, out, tot);
+ if (ob->type == OB_MESH) do_mesh_key(ob, key, out, tot);
+ else if (ob->type == OB_LATTICE) do_latt_key(ob, key, out, tot);
+ else if (ob->type == OB_CURVE) do_curve_key(ob, key, out, tot);
+ else if (ob->type == OB_SURF) do_curve_key(ob, key, out, tot);
}
if (r_totelem) {
@@ -1481,9 +1381,9 @@ float *BKE_key_evaluate_object_ex(Scene *scene, Object *ob, int *r_totelem,
return (float *)out;
}
-float *BKE_key_evaluate_object(Scene *scene, Object *ob, int *r_totelem)
+float *BKE_key_evaluate_object(Object *ob, int *r_totelem)
{
- return BKE_key_evaluate_object_ex(scene, ob, r_totelem, NULL, 0);
+ return BKE_key_evaluate_object_ex(ob, r_totelem, NULL, 0);
}
Key *BKE_key_from_object(Object *ob)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index f6b328eb8e8..d4a2c327572 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -3347,7 +3347,7 @@ void BKE_object_delete_ptcache(Object *ob, int index)
/* shape key utility function */
/************************* Mesh ************************/
-static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_meshkey(Object *ob, const char *name, const bool from_mix)
{
Mesh *me = ob->data;
Key *key = me->key;
@@ -3368,7 +3368,7 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, cons
else {
/* copy from current values */
int totelem;
- float *data = BKE_key_evaluate_object(scene, ob, &totelem);
+ float *data = BKE_key_evaluate_object(ob, &totelem);
/* create new block with prepared data */
kb = BKE_keyblock_add_ctime(key, name, false);
@@ -3379,7 +3379,7 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, cons
return kb;
}
/************************* Lattice ************************/
-static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_lattkey(Object *ob, const char *name, const bool from_mix)
{
Lattice *lt = ob->data;
Key *key = lt->key;
@@ -3406,7 +3406,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, cons
else {
/* copy from current values */
int totelem;
- float *data = BKE_key_evaluate_object(scene, ob, &totelem);
+ float *data = BKE_key_evaluate_object(ob, &totelem);
/* create new block with prepared data */
kb = BKE_keyblock_add_ctime(key, name, false);
@@ -3417,7 +3417,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, cons
return kb;
}
/************************* Curve ************************/
-static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, const bool from_mix)
+static KeyBlock *insert_curvekey(Object *ob, const char *name, const bool from_mix)
{
Curve *cu = ob->data;
Key *key = cu->key;
@@ -3446,7 +3446,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, con
else {
/* copy from current values */
int totelem;
- float *data = BKE_key_evaluate_object(scene, ob, &totelem);
+ float *data = BKE_key_evaluate_object(ob, &totelem);
/* create new block with prepared data */
kb = BKE_keyblock_add_ctime(key, name, false);
@@ -3457,16 +3457,16 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, con
return kb;
}
-KeyBlock *BKE_object_insert_shape_key(Scene *scene, Object *ob, const char *name, const bool from_mix)
+KeyBlock *BKE_object_insert_shape_key(Object *ob, const char *name, const bool from_mix)
{
switch (ob->type) {
case OB_MESH:
- return insert_meshkey(scene, ob, name, from_mix);
+ return insert_meshkey(ob, name, from_mix);
case OB_CURVE:
case OB_SURF:
- return insert_curvekey(scene, ob, name, from_mix);
+ return insert_curvekey(ob, name, from_mix);
case OB_LATTICE:
- return insert_lattkey(scene, ob, name, from_mix);
+ return insert_lattkey(ob, name, from_mix);
default:
return NULL;
}