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
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-10-03 17:03:25 +0400
committerTon Roosendaal <ton@blender.org>2005-10-03 17:03:25 +0400
commit45edb9cecb14a12a42230b9e12acf0ec5c2d07ee (patch)
tree6d7abec5d3f03babaacb0c4d44e457b859d0e79e /source
parent1c72a19fd83d62e285f9280b7676da4a42636e3c (diff)
IpoWindow, Action curve update.
When no Ipo existed yet for an Action Channel (Bone), you could not add curves with CTRL+click or Drivers. This was due to antique action code state... it's still messy, no time for big cleanup here yet. At least this works now. :) (Also: removed test prints of previous commit)
Diffstat (limited to 'source')
-rw-r--r--source/blender/include/BIF_editaction.h2
-rw-r--r--source/blender/render/intern/source/initrender.c2
-rw-r--r--source/blender/src/buttons_editing.c2
-rw-r--r--source/blender/src/drawipo.c2
-rw-r--r--source/blender/src/editaction.c35
-rw-r--r--source/blender/src/editipo.c33
6 files changed, 60 insertions, 16 deletions
diff --git a/source/blender/include/BIF_editaction.h b/source/blender/include/BIF_editaction.h
index c2443d24ea9..495b7a620c2 100644
--- a/source/blender/include/BIF_editaction.h
+++ b/source/blender/include/BIF_editaction.h
@@ -96,6 +96,8 @@ struct bAction *add_empty_action(void);
void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
struct bAction *bake_action_with_client (struct bAction *act, struct Object *arm, float tolerance);
+void verify_active_action_channel(struct Object *ob);
+
void remake_action_ipos(struct bAction *act);
diff --git a/source/blender/render/intern/source/initrender.c b/source/blender/render/intern/source/initrender.c
index 143d4867d08..f79b86f018b 100644
--- a/source/blender/render/intern/source/initrender.c
+++ b/source/blender/render/intern/source/initrender.c
@@ -692,7 +692,6 @@ static void initparts(void)
pa->x+= 2;
pa->y+= 2;
}
- printf("part %d %d\n", pa->x, pa->y);
BLI_addtail(&R.parts, pa);
}
else MEM_freeN(pa);
@@ -720,7 +719,6 @@ static void addparttorect(Part *pa)
int y, heigth, len, copylen;
/* calc the right offset in rects, zbuffer cannot exist... */
- printf("add part %d %d\n", pa->x, pa->y);
if(pa->rect==NULL) return;
rtp= pa->rect;
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 7ae055490f2..e2eb2b7efc3 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -1375,7 +1375,7 @@ static void editing_panel_modifiers(Object *ob)
uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier");
sprintf(str, "To: %s", ob->id.name+2);
- uiDefBut(block, LABEL, 1, str, 140, 190, 140, 20, NULL, 0.0, 0.0, 0, 0, "Object whose modifier stack is being edited");
+ uiDefBut(block, LABEL, 1, str, 140, 190, 150, 20, NULL, 0.0, 0.0, 0, 0, "Object whose modifier stack is being edited");
xco = 0;
yco = 160;
diff --git a/source/blender/src/drawipo.c b/source/blender/src/drawipo.c
index 3890af122bf..83b01a08307 100644
--- a/source/blender/src/drawipo.c
+++ b/source/blender/src/drawipo.c
@@ -1685,7 +1685,7 @@ void do_ipobuts(unsigned short event)
ei= get_active_editipo();
if(ei) {
if(ei->icu==NULL) {
- ei->icu= get_ipocurve(G.sipo->from, G.sipo->blocktype, ei->adrcode, 0);
+ ei->icu= get_ipocurve(G.sipo->from, G.sipo->blocktype, ei->adrcode, NULL);
ei->flag |= IPO_SELECT;
ei->icu->flag= ei->flag;
}
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index 722e2f72cac..faead395413 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -766,6 +766,41 @@ bActionChannel* get_hilighted_action_channel(bAction* action)
}
+/* sets action->achan to active channel, also adds if needed */
+void verify_active_action_channel(Object *ob)
+{
+ if(ob) {
+ bPoseChannel *pchan;
+ bActionChannel *achan;
+
+ if(ob->action==NULL) return;
+
+ pchan= get_active_posechannel(ob);
+ if(pchan) {
+ /* See if this action channel exists already */
+ for (achan=ob->action->chanbase.first; achan; achan=achan->next){
+ if (!strcmp (pchan->name, achan->name))
+ break;
+ }
+
+ if (!achan){
+ achan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
+ strcpy (achan->name, pchan->name);
+ BLI_addtail (&ob->action->chanbase, achan);
+ }
+
+ ob->action->achan= achan;
+ ob->action->pchan= pchan;
+
+ for (achan=ob->action->chanbase.first; achan; achan=achan->next)
+ achan->flag &= ~(ACHAN_SELECTED|ACHAN_HILIGHTED);
+
+ ob->action->achan->flag |= ACHAN_SELECTED|ACHAN_HILIGHTED;
+
+ }
+ }
+}
+
void set_exprap_action(int mode)
{
if(G.saction->action && G.saction->action->id.lib) return;
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index 0025d723d77..db0bdcf6a49 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -338,10 +338,13 @@ static void set_active_editipo(EditIpo *actei)
EditIpo *get_active_editipo(void)
{
- EditIpo *ei= G.sipo->editipo;
+ EditIpo *ei;
int a;
- for(a=0; a<G.sipo->totipo; a++, ei++)
+ if(G.sipo==NULL)
+ return NULL;
+
+ for(a=0, ei=G.sipo->editipo; a<G.sipo->totipo; a++, ei++)
if(ei->flag & IPO_ACTIVE)
return ei;
@@ -635,16 +638,14 @@ Ipo *get_ipo_to_edit(ID **from)
}
else if(G.sipo->blocktype==ID_AC) {
bActionChannel *chan;
- if (ob && ob->action){
+ if (ob && ob->action) {
*from= (ID *) ob->action;
chan= get_hilighted_action_channel(ob->action);
if (chan)
return chan->ipo;
- else{
- *from = NULL;
+ else
return NULL;
- }
- }
+ }
}
else if(G.sipo->blocktype==ID_WO) {
@@ -1909,12 +1910,22 @@ Ipo *get_ipo(ID *from, short type, int make)
}
else if( type==ID_AC) {
act= (bAction *)from;
- if (!act->achan) return NULL;
if (act->id.lib) return NULL;
+
+ /* weak... the *from pointer has action, ipo doesnt give more context info yet */
+ verify_active_action_channel(OBACT);
+
+ if (act->achan==NULL)
+ return NULL;
+
ipo= act->achan->ipo;
- /* This should never happen */
- if(make && ipo==NULL) ipo= act->achan->ipo= add_ipo("AcIpo", ID_AC);
+ if(make && ipo==NULL) {
+ ipo= act->achan->ipo= add_ipo(act->achan->name, ID_AC);
+ allspace(REMAKEIPO, 0);
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWACTION, 0);
+ }
}
else if( type==ID_MA) {
ma= (Material *)from;
@@ -1998,13 +2009,11 @@ IpoCurve *get_ipocurve(ID *from, short type, int adrcode, Ipo *useipo)
/* also test if ipo and ipocurve exist */
if (useipo==NULL) {
-
if (G.sipo==NULL || G.sipo->pin==0){
ipo= get_ipo(from, type, 1); /* 1= make */
}
else
ipo = G.sipo->ipo;
-
if(G.sipo) {
if (G.sipo->pin==0) G.sipo->ipo= ipo;