Commit: 4f338dfdeaf15bb4a675bbc4070587f0976190ca
Author: Lukas Tönne
Date:   Wed Jan 7 14:52:08 2015 +0100
Branches: gooseberry
https://developer.blender.org/rB4f338dfdeaf15bb4a675bbc4070587f0976190ca

Merge branch 'master' into gooseberry

Conflicts:
        source/blender/blenkernel/BKE_key.h
        source/blender/blenkernel/intern/key.c

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



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

diff --cc source/blender/blenkernel/BKE_key.h
index 0a92bb9,9535b92..afa9a41
--- a/source/blender/blenkernel/BKE_key.h
+++ b/source/blender/blenkernel/BKE_key.h
@@@ -65,12 -60,11 +65,16 @@@ void key_curve_position_weights(float t
  void key_curve_tangent_weights(float t, float data[4], int type);
  void key_curve_normal_weights(float t, float data[4], int type);
  
- float *BKE_key_evaluate_object_ex(struct Scene *scene, struct Object *ob, int 
*r_totelem,
-                                   float *arr, size_t arr_size);
- float *BKE_key_evaluate_object(struct Scene *scene, struct Object *ob, int 
*r_totelem);
- float *BKE_key_evaluate_particles_ex(struct Object *ob, struct ParticleSystem 
*psys, int *r_totelem,
-                                      float *arr, size_t arr_size);
- float *BKE_key_evaluate_particles(struct Object *ob, struct ParticleSystem 
*psys, int *r_totelem);
+ float *BKE_key_evaluate_object_ex(
+         struct Object *ob, int *r_totelem,
+         float *arr, size_t arr_size);
+ float *BKE_key_evaluate_object(
+         struct Object *ob, int *r_totelem);
++float *BKE_key_evaluate_particles_ex(
++        struct Object *ob, struct ParticleSystem *psys, int *r_totelem,
++        float *arr, size_t arr_size);
++float *BKE_key_evaluate_particles(
++        struct Object *ob, struct ParticleSystem *psys, int *r_totelem);
  
  struct Key      *BKE_key_from_object(struct Object *ob);
  struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
diff --cc source/blender/blenkernel/intern/key.c
index 5b1aa63,32e95e7..f7dfa2d
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@@ -1253,47 -1170,23 +1249,23 @@@ static void do_mesh_key(Object *ob, Ke
        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);
++              per_keyblock_weights = 
BKE_keyblock_get_per_block_object_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_object_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);
                }
        }
  }
@@@ -1427,72 -1262,32 +1341,58 @@@ static void do_latt_key(Object *ob, Ke
        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);
++              per_keyblock_weights = 
BKE_keyblock_get_per_block_object_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_object_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);
  }
  
 +static void do_psys_key(ParticleSystem *psys, Key *key, char *out, const int 
tot)
 +{
 +      KeyBlock *k[4], *actkb = BKE_keyblock_from_particles(psys);
 +      float t[4];
 +      int flag = 0;
 +      
 +      if (key->type == KEY_RELATIVE) {
 +              WeightsArrayCache cache = {0, NULL};
 +              float **per_keyblock_weights;
 +              
 +              per_keyblock_weights = 
BKE_keyblock_get_per_block_particle_weights(psys, 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;
 +              
 +              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);
 +      }
 +}
 +
  /* 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);
@@@ -1586,83 -1381,11 +1486,83 @@@
        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);
  }
  
 +/* returns key coordinates when key applied, NULL otherwise */
 +float *BKE_key_evaluate_particles_ex(Object *ob, ParticleSystem *psys, int 
*r_totelem,
 +                                     float *arr, size_t arr_size)
 +{
 +      Key *key = psys->key;
 +      KeyBlock *actkb = BKE_keyblock_from_particles(psys);
 +      char *out;
 +      int tot = 0, size = 0;
 +      int i;
 +      
 +      if (key == NULL || BLI_listbase_is_empty(&key->block))
 +              return NULL;
 +      
 +      /* compute size of output array */
 +      tot = 0;
 +      for (i = 0; i < psys->totpart; ++i)
 +              tot += psys->particles[i].totkey;
 +      size = tot * 3 * sizeof(float);
 +      
 +      /* if nothing to interpolate, cancel */
 +      if (tot == 0 || size == 0)
 +              return NULL;
 +      
 +      /* allocate array */
 +      if (arr == NULL) {
 +              out = MEM_callocN(size, "BKE_key_evaluate_object out");
 +      }
 +      else {
 +              if (arr_size != size) {
 +                      return NULL;
 +              }
 +              
 +              out = (char *)arr;
 +      }
 +      
 +      /* prevent python from screwing this up? anyhoo, the from pointer could 
be dropped */
 +      BKE_key_set_from_particles(key, ob, psys);
 +      
 +      if (ob->shapeflag & OB_SHAPE_LOCK) {
 +              /* shape locked, copy the locked shape instead of blending */
 +              KeyBlock *kb = BLI_findlink(&key->block, psys->shapenr - 1);
 +              float *weights;
 +              
 +              if (kb && (kb->flag & KEYBLOCK_MUTE))
 +                      kb = key->refkey;
 +              
 +              if (kb == NULL) {
 +                      kb = key->block.first;
 +                      psys->shapenr = 1;
 +              }
 +              
 +              weights = get_particle_weights_array(psys, kb->vgroup, NULL);
 +              
 +              cp_key(0, tot, tot, out, key, actkb, kb, weights, 0);
 +              
 +              if (weights) MEM_freeN(weights);
 +      }
 +      else {
 +              do_psys_key(psys, key, out, tot);
 +      }
 +      
 +      if (r_totelem) {
 +              *r_totelem = tot;
 +      }
 +      return (float *)out;
 +}
 +
 +float *BKE_key_evaluate_particles(Object *ob, ParticleSystem *psys, int 
*r_totelem)
 +{
 +      return BKE_key_evaluate_particles_ex(ob, psys, r_totelem, NULL, 0);
 +}
 +
  Key *BKE_key_from_object(Object *ob)
  {
        if (ob == NULL) return NULL;
diff --cc source/blender/makesdna/DNA_key_types.h
index 90cc1ef,60ab01c..4cd2a41
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@@ -102,12 -90,11 +102,12 @@@ typedef struct Key 
        struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated 
for 2.5 */
  
        ID *from;
 +      KeyFrom from_extra;     /* supplementary info about the 'from' 
datablock */
  
-       short type;    /* absolute or relative shape key */
-       short totkey;  /* (totkey == BLI_listbase_count(&key->block)) */
-       short slurph;  /* quaint feature to delay moving points based on their 
order (Key->type == KEY_NORMAL) only */
+       int totkey;  /*

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to