forked from bartvdbraak/blender
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)
This commit is contained in:
parent
1c72a19fd8
commit
45edb9cecb
@ -96,6 +96,8 @@ struct bAction *add_empty_action(void);
|
|||||||
void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
|
||||||
struct bAction *bake_action_with_client (struct bAction *act, struct Object *arm, float tolerance);
|
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);
|
void remake_action_ipos(struct bAction *act);
|
||||||
|
|
||||||
|
|
||||||
|
@ -692,7 +692,6 @@ static void initparts(void)
|
|||||||
pa->x+= 2;
|
pa->x+= 2;
|
||||||
pa->y+= 2;
|
pa->y+= 2;
|
||||||
}
|
}
|
||||||
printf("part %d %d\n", pa->x, pa->y);
|
|
||||||
BLI_addtail(&R.parts, pa);
|
BLI_addtail(&R.parts, pa);
|
||||||
}
|
}
|
||||||
else MEM_freeN(pa);
|
else MEM_freeN(pa);
|
||||||
@ -720,7 +719,6 @@ static void addparttorect(Part *pa)
|
|||||||
int y, heigth, len, copylen;
|
int y, heigth, len, copylen;
|
||||||
|
|
||||||
/* calc the right offset in rects, zbuffer cannot exist... */
|
/* calc the right offset in rects, zbuffer cannot exist... */
|
||||||
printf("add part %d %d\n", pa->x, pa->y);
|
|
||||||
if(pa->rect==NULL) return;
|
if(pa->rect==NULL) return;
|
||||||
|
|
||||||
rtp= pa->rect;
|
rtp= pa->rect;
|
||||||
|
@ -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");
|
uiDefBlockBut(block, modifiers_add_menu, ob, "Add Modifier", 0, 190, 130, 20, "Add a new modifier");
|
||||||
|
|
||||||
sprintf(str, "To: %s", ob->id.name+2);
|
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;
|
xco = 0;
|
||||||
yco = 160;
|
yco = 160;
|
||||||
|
@ -1685,7 +1685,7 @@ void do_ipobuts(unsigned short event)
|
|||||||
ei= get_active_editipo();
|
ei= get_active_editipo();
|
||||||
if(ei) {
|
if(ei) {
|
||||||
if(ei->icu==NULL) {
|
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->flag |= IPO_SELECT;
|
||||||
ei->icu->flag= ei->flag;
|
ei->icu->flag= ei->flag;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
void set_exprap_action(int mode)
|
||||||
{
|
{
|
||||||
if(G.saction->action && G.saction->action->id.lib) return;
|
if(G.saction->action && G.saction->action->id.lib) return;
|
||||||
|
@ -338,10 +338,13 @@ static void set_active_editipo(EditIpo *actei)
|
|||||||
|
|
||||||
EditIpo *get_active_editipo(void)
|
EditIpo *get_active_editipo(void)
|
||||||
{
|
{
|
||||||
EditIpo *ei= G.sipo->editipo;
|
EditIpo *ei;
|
||||||
int a;
|
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)
|
if(ei->flag & IPO_ACTIVE)
|
||||||
return ei;
|
return ei;
|
||||||
|
|
||||||
@ -635,16 +638,14 @@ Ipo *get_ipo_to_edit(ID **from)
|
|||||||
}
|
}
|
||||||
else if(G.sipo->blocktype==ID_AC) {
|
else if(G.sipo->blocktype==ID_AC) {
|
||||||
bActionChannel *chan;
|
bActionChannel *chan;
|
||||||
if (ob && ob->action){
|
if (ob && ob->action) {
|
||||||
*from= (ID *) ob->action;
|
*from= (ID *) ob->action;
|
||||||
chan= get_hilighted_action_channel(ob->action);
|
chan= get_hilighted_action_channel(ob->action);
|
||||||
if (chan)
|
if (chan)
|
||||||
return chan->ipo;
|
return chan->ipo;
|
||||||
else{
|
else
|
||||||
*from = NULL;
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(G.sipo->blocktype==ID_WO) {
|
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) {
|
else if( type==ID_AC) {
|
||||||
act= (bAction *)from;
|
act= (bAction *)from;
|
||||||
if (!act->achan) return NULL;
|
|
||||||
if (act->id.lib) 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;
|
ipo= act->achan->ipo;
|
||||||
|
|
||||||
/* This should never happen */
|
if(make && ipo==NULL) {
|
||||||
if(make && ipo==NULL) ipo= act->achan->ipo= add_ipo("AcIpo", ID_AC);
|
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) {
|
else if( type==ID_MA) {
|
||||||
ma= (Material *)from;
|
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 */
|
/* also test if ipo and ipocurve exist */
|
||||||
|
|
||||||
if (useipo==NULL) {
|
if (useipo==NULL) {
|
||||||
|
|
||||||
if (G.sipo==NULL || G.sipo->pin==0){
|
if (G.sipo==NULL || G.sipo->pin==0){
|
||||||
ipo= get_ipo(from, type, 1); /* 1= make */
|
ipo= get_ipo(from, type, 1); /* 1= make */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ipo = G.sipo->ipo;
|
ipo = G.sipo->ipo;
|
||||||
|
|
||||||
|
|
||||||
if(G.sipo) {
|
if(G.sipo) {
|
||||||
if (G.sipo->pin==0) G.sipo->ipo= ipo;
|
if (G.sipo->pin==0) G.sipo->ipo= ipo;
|
||||||
|
Loading…
Reference in New Issue
Block a user