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>2005-10-28 12:11:15 +0400
committerTon Roosendaal <ton@blender.org>2005-10-28 12:11:15 +0400
commit595447a85ea2e388fa17b4a44dacf256ac97f343 (patch)
tree3461e1157f41cbe304f8e346cd2ac5c8333c395d /source/blender/src/editipo.c
parent0dde486eeae6c563059bfab408f1ed5bd239ad85 (diff)
Here's another milestone: Shape Keys now can be inserted in Actions and NLA
It works like for moving Object Ipos to the Action, press the Action icon in the header of the IpoWindow, to the left of the mode selection menu. It then creates an Action (if not existed) and moves the Shape Ipo to the Action, using custom channel "Shape". Main code change was that evaluating Ipo Curves for Relative Shapes had to be recoded, but that's pretty minor and even much cleaner. (added "curval" in the KeyBlock struct). That this feature can work is thanks to the full modifier/derivedmesh recode Daniel did, can't give him enough credits! :) Also; small fixes in Outliner, for clicking on the Ipo icon (sets the Ipo window to show that Ipo).
Diffstat (limited to 'source/blender/src/editipo.c')
-rw-r--r--source/blender/src/editipo.c86
1 files changed, 50 insertions, 36 deletions
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 853b069f484..3aa9bb83639 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -196,20 +196,23 @@ EditIpo *get_active_editipo(void)
static void set_active_key(int index)
{
if(G.sipo->blocktype==ID_KE && G.sipo->from) {
- Key *key= (Key *)G.sipo->from;
- KeyBlock *curkb;
- Object *ob= OBACT;
+ Object *ob= (Object *)G.sipo->from;
+ Key *key= ob_get_key(ob);
- curkb= BLI_findlink(&key->block, index-1);
- if(curkb) {
- ob->shapenr= index;
- ob->shapeflag |= OB_SHAPE_TEMPLOCK;
+ if(key) {
+ KeyBlock *curkb;
- /* calc keypos */
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
- allqueue(REDRAWVIEW3D, 0);
- allqueue(REDRAWBUTSEDIT, 0);
- }
+ curkb= BLI_findlink(&key->block, index-1);
+ if(curkb) {
+ ob->shapenr= index;
+ ob->shapeflag |= OB_SHAPE_TEMPLOCK;
+
+ /* calc keypos */
+ DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+ allqueue(REDRAWVIEW3D, 0);
+ allqueue(REDRAWBUTSEDIT, 0);
+ }
+ }
}
}
@@ -251,7 +254,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
/* keylines? */
if(si->blocktype==ID_KE) {
- key= (Key *)si->from;
+ key= ob_get_key((Object *)G.sipo->from);
if(key && key->block.first) {
kb= key->block.first;
if(kb->pos < v2d->tot.ymin) v2d->tot.ymin= kb->pos;
@@ -484,7 +487,7 @@ static void make_key_editipo(SpaceIpo *si)
EditIpo *ei;
int a;
- key= (Key *)G.sipo->from;
+ key= ob_get_key((Object *)G.sipo->from);
if(key==NULL) return;
si->totipo= BLI_countlist(&key->block);
@@ -998,8 +1001,19 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
else if(blocktype==ID_KE) {
if(ob) {
Key *key= ob_get_key(ob);
- *from= (ID *)key;
- if(key) *ipo= key->ipo;
+
+ if(ob->ipoflag & OB_ACTION_KEY) {
+ if (ob->action) {
+ bActionChannel *achan= get_action_channel(ob->action, "Shape");
+ if(achan) {
+ *ipo= achan->ipo;
+ BLI_strncpy(actname, achan->name, 32);
+ }
+ }
+ }
+ else if(key) *ipo= key->ipo;
+
+ *from= (ID *)ob;
}
}
else if(blocktype==ID_CU) {
@@ -1034,9 +1048,9 @@ static void get_ipo_context(short blocktype, ID **from, Ipo **ipo, char *actname
}
/* called on each redraw, check if editipo data has to be remade */
-void test_editipo(void)
+/* if doit already set, it always makes (in case no ipo exists, we need to see the channels */
+void test_editipo(int doit)
{
- int doit= 0;
if(G.sipo->pin==0) {
Ipo *ipo;
@@ -1292,8 +1306,7 @@ static short findnearest_ipovert(IpoCurve **icu, BezTriple **bezt)
void mouse_select_ipo(void)
{
Object *ob;
- Key *key;
- KeyBlock *kb, *actkb=NULL, *curkb;
+ KeyBlock *actkb=NULL;
EditIpo *ei, *actei= 0;
IpoCurve *icu;
IpoKey *ik, *actik;
@@ -1377,10 +1390,12 @@ void mouse_select_ipo(void)
/* vertex keys ? */
if(G.sipo->blocktype==ID_KE && G.sipo->from) {
+ Key *key;
+ KeyBlock *kb, *curkb;
int i, index= 1;
- key= (Key *)G.sipo->from;
- ob= OBACT;
+ ob= (Object *)G.sipo->from;
+ key= ob_get_key(ob);
curkb= BLI_findlink(&key->block, ob->shapenr-1);
ei= G.sipo->editipo;
@@ -1634,6 +1649,17 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname)
}
return ob->ipo;
}
+ else if(blocktype==ID_KE) {
+ Key *key= ob_get_key((Object *)G.sipo->from);
+
+ if(key) {
+ if(key->ipo==NULL) {
+ key->ipo= add_ipo("KeyIpo", ID_KE);
+ }
+ return key->ipo;
+ }
+ return NULL;
+ }
}
break;
case ID_MA:
@@ -1678,16 +1704,6 @@ Ipo *verify_ipo(ID *from, short blocktype, char *actname, char *constname)
return cu->ipo;
}
break;
- case ID_KE:
- {
- Key *key= (Key *)from;
-
- if(key->ipo==NULL) {
- key->ipo= add_ipo("KeyIpo", ID_KE);
- }
- return key->ipo;
- }
- break;
case ID_WO:
{
World *wo= (World *)from;
@@ -1853,10 +1869,11 @@ void add_vert_ipo(void)
if(mval[0]>G.v2d->mask.xmax) return;
ei= get_active_editipo();
- if(ei==0) {
+ if(ei==NULL) {
error("No active Ipo curve");
return;
}
+ ei->flag |= IPO_VISIBLE; /* can happen it is active but not visible */
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
@@ -4084,9 +4101,6 @@ void ipo_record(void)
if(anim < 1) return;
if(anim!=2) anim= 0;
-// ipo= verify_ipo(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname);
-// test_editipo();
-
ob= OBACT;
/* find the curves... */