Revision: 45412
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45412
Author:   campbellbarton
Date:     2012-04-05 05:51:26 +0000 (Thu, 05 Apr 2012)
Log Message:
-----------
adding shape key blocks to absolute shape keys would not set the position 
(which is odd since its the only time they are used).

also re-sort the shape keys after adding them in for absolute keyblocks.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/key.c
    trunk/blender/source/blender/editors/object/object_shapekey.c

Modified: trunk/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/key.c        2012-04-05 
05:38:52 UTC (rev 45411)
+++ trunk/blender/source/blender/blenkernel/intern/key.c        2012-04-05 
05:51:26 UTC (rev 45412)
@@ -1136,9 +1136,11 @@
        else {
                if (key->type==KEY_RELATIVE) {
                        KeyBlock *kb;
-                       
-                       for (kb= key->block.first; kb; kb= kb->next)
+                       float f = 0.0;
+                       for (kb= key->block.first; kb; kb= kb->next, f += 0.1f) 
{
                                kb->weights= get_weights_array(ob, kb->vgroup);
+                               // kb->pos = f;
+                       }
 
                        do_rel_key(0, tot, tot, (char *)out, key, actkb, 
KEY_MODE_DUMMY);
                        
@@ -1472,18 +1474,12 @@
        kb->slidermax= 1.0f;
        
        // XXX kb->pos is the confusing old horizontal-line RVK crap in old IPO 
Editor...
-       if (key->type == KEY_RELATIVE) 
+       if (key->type == KEY_RELATIVE)  {
                kb->pos= curpos + 0.1f;
+       }
        else {
-#if 0 // XXX old animation system
-               curpos= BKE_curframe(scene);
-               if (calc_ipo_spec(key->ipo, KEY_SPEED, &curpos)==0) {
-                       curpos /= 100.0;
-               }
-               kb->pos= curpos;
-               
+               kb->pos = key->ctime / 100.0f;
                sort_keys(key);
-#endif // XXX old animation system
        }
        return kb;
 }

Modified: trunk/blender/source/blender/editors/object/object_shapekey.c
===================================================================
--- trunk/blender/source/blender/editors/object/object_shapekey.c       
2012-04-05 05:38:52 UTC (rev 45411)
+++ trunk/blender/source/blender/editors/object/object_shapekey.c       
2012-04-05 05:51:26 UTC (rev 45412)
@@ -76,9 +76,11 @@
 
 static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int 
from_mix)
 {
-       if (object_insert_shape_key(scene, ob, NULL, from_mix)) {
+       KeyBlock *kb;
+       if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) {
                Key *key= ob_get_key(ob);
-               ob->shapenr= BLI_countlist(&key->block);
+               /* for absolute shape keys, new keys may not be added last */
+               ob->shapenr = BLI_findindex(&key->block, kb) + 1;
 
                WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
        }

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

Reply via email to