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:
authorTon Roosendaal <ton@blender.org>2007-11-20 19:58:25 +0300
committerTon Roosendaal <ton@blender.org>2007-11-20 19:58:25 +0300
commitb7e0da6c3a83bd5aa8d3ad4aa285904d5c121f91 (patch)
treea2bc329c2f9f36166e198c3efb6b5eca09ba963d
parent0ec59425210033b9158bd8d2fbc5c6de1bc62bbb (diff)
Another feature request from the animation dept:
Relative shapekeys now allow to define the Shape it is relative to! (It used to be relative with respect to the first key, which is still default). The reason for this feature is that keys don't always add together well when they're all derived from the same base shape. A clear example is hard to make... will wait for someone posting it. :)
-rw-r--r--source/blender/blenkernel/intern/key.c6
-rw-r--r--source/blender/makesdna/DNA_key_types.h4
-rw-r--r--source/blender/src/buttons_editing.c16
3 files changed, 18 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 8da3ea0b994..234a096edce 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -680,11 +680,15 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, i
/* only with value, and no difference allowed */
if(icuval!=0.0f && kb->totelem==tot) {
+ KeyBlock *refb;
float weight, *weights= kb->weights;
poin= basispoin;
- reffrom= key->refkey->data;
from= kb->data;
+ /* reference now can be any block */
+ refb= BLI_findlink(&key->block, kb->relative);
+ if(refb==NULL) continue;
+ reffrom= refb->data;
poin+= start*ofs[0];
reffrom+= key->elemsize*start; // key elemsize yes!
diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h
index 3292e07f80e..785cf515a42 100644
--- a/source/blender/makesdna/DNA_key_types.h
+++ b/source/blender/makesdna/DNA_key_types.h
@@ -44,8 +44,8 @@ typedef struct KeyBlock {
float pos;
float curval;
- short type, adrcode;
- int totelem;
+ short type, adrcode, relative, pad1; /* relative == 0 means first key is reference */
+ int totelem, pad2;
void *data;
float *weights;
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index b1d13d86f38..082353f1174 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -2217,7 +2217,7 @@ static void editing_panel_modifiers(Object *ob)
if(yco < 0) uiNewPanelHeight(block, 204-yco);
}
-static char *make_key_menu(Key *key)
+static char *make_key_menu(Key *key, int startindex)
{
KeyBlock *kb;
int index= 1;
@@ -2227,7 +2227,7 @@ static char *make_key_menu(Key *key)
str= MEM_mallocN(index*40, "key string");
str[0]= 0;
- index= 1;
+ index= startindex;
for (kb = key->block.first; kb; kb=kb->next, index++) {
sprintf (item, "|%s%%x%d", kb->name, index);
strcat(str, item);
@@ -2273,9 +2273,10 @@ static void editing_panel_shapes(Object *ob)
uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
uiSetButLock(G.obedit==ob, "Unable to perform in EditMode");
uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 35,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key");
- strp= make_key_menu(key);
- uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
+ strp= make_key_menu(key, 1);
+ uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices");
MEM_freeN(strp);
+
uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key");
uiClearButLock();
uiDefBut(block, TEX, B_NAMEKEY, "", 95, 150, 190, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name");
@@ -2289,9 +2290,14 @@ static void editing_panel_shapes(Object *ob)
uiDefButF(block, NUM, B_REDR, "Max ", 235,120, 75, 20, &kb->slidermax, -10.0, 10.0, 100, 1, "Maximum for slider");
uiBlockEndAlign(block);
}
- if(key->type && ob->shapenr!=1)
+ if(key->type && ob->shapenr!=1) {
uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", 10, 90, 150,19, &kb->vgroup, 0.0, 31.0, 0, 0, "Vertex Weight Group name, to blend with Basis Shape");
+ strp= make_key_menu(key, 0);
+ uiDefButS(block, MENU, B_MODIFIER_RECALC, strp, 160, 90, 150,19, &kb->relative, 0.0, 0.0, 0, 0, "Shape used as a relative key");
+ MEM_freeN(strp);
+ }
+
if(key->type==0)
uiDefButS(block, NUM, B_DIFF, "Slurph:", 10, 60, 150, 19, &(key->slurph), -500.0, 500.0, 0, 0, "Creates a delay in amount of frames in applying keypositions, first vertex goes first");