Stage two of the giant animation recode project; Ipo/Action/NLA cleanup
-> Note; added 2 new c files (split editipo.c). MSVC needs upgrade. Impatient people can check the goodies in CMS: http://www.blender3d.org/cms/Action_and_NLA_editor.706.0.html Most work was on trying to unwind the spaghetti for editing ipos. Too much history and bad design got added here. Most evident changes: - made generic 'context' for detecting which Ipo is being edited, or to assign ipos or to retrieve ipo curves. - made generic insertkey() for all ipo types, including actions - shuffled a lot of code around to make things more logical. Also made sure local functions are not exported It is far from ready... when action/nla was added in Blender, a lot of duplicate code was generated. That's for another time. Now the goodies; - made Actions to allow any Ipo type - made NLA to define active actions, for Action window too - corrected timing for active action, so it shows the 'real time', as defined in NLA editor. I did update python code, but that would require testing. Testing is needed for this commit in general, too many changes happened on all levels of the animation system. :) Will keep track of all reports this evening, hopefully it doesnt break the pre-release schedule!
This commit is contained in:
@@ -23,7 +23,7 @@ source_files = ['B.blend.c',
|
||||
'cmovie.tga.c',
|
||||
'cursors.c',
|
||||
'drawaction.c',
|
||||
'drawarmature.c',
|
||||
'drawarmature.c',
|
||||
'drawdeps.c',
|
||||
'drawimage.c',
|
||||
'drawimasel.c',
|
||||
@@ -50,6 +50,8 @@ source_files = ['B.blend.c',
|
||||
'editgroup.c',
|
||||
'editimasel.c',
|
||||
'editipo.c',
|
||||
'editipo_lib.c',
|
||||
'editipo_mods.c',
|
||||
'editkey.c',
|
||||
'editlattice.c',
|
||||
'editmball.c',
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "BIF_butspace.h"
|
||||
#include "BDR_editcurve.h"
|
||||
#include "BIF_editaction.h"
|
||||
#include "BIF_gl.h"
|
||||
#include "BIF_glutil.h"
|
||||
#include "BIF_graphics.h"
|
||||
@@ -74,6 +74,7 @@
|
||||
#include "BIF_toolbox.h"
|
||||
|
||||
#include "BDR_drawobject.h"
|
||||
#include "BDR_editcurve.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
#include "blendef.h"
|
||||
@@ -131,7 +132,10 @@
|
||||
#include "LBM_fluidsim.h"
|
||||
|
||||
#include "BIF_editconstraint.h"
|
||||
|
||||
#include "BSE_editipo.h"
|
||||
#include "BSE_edit.h"
|
||||
|
||||
#include "BDR_editobject.h"
|
||||
|
||||
#include "butspace.h" // own module
|
||||
@@ -162,8 +166,8 @@ static void constraint_active_func(void *ob_v, void *con_v)
|
||||
}
|
||||
|
||||
/* make sure ipowin and buttons shows it */
|
||||
if(ob->ipowin==IPO_CO) {
|
||||
allqueue(REDRAWIPO, IPO_CO);
|
||||
if(ob->ipowin==ID_CO) {
|
||||
allqueue(REDRAWIPO, ID_CO);
|
||||
allspace(REMAKEIPO, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
@@ -185,38 +189,44 @@ static void add_constraint_to_active(Object *ob, bConstraint *con)
|
||||
}
|
||||
}
|
||||
|
||||
/* returns base ID for Ipo, sets actname to channel if appropriate */
|
||||
/* should not make action... */
|
||||
static void get_constraint_ipo_context(Object *ob, char *actname)
|
||||
{
|
||||
|
||||
/* todo; check object if it has ob-level action ipo */
|
||||
|
||||
if (ob->flag & OB_POSEMODE) {
|
||||
bPoseChannel *pchan;
|
||||
|
||||
pchan = get_active_posechannel(ob);
|
||||
if (pchan) {
|
||||
BLI_strncpy(actname, pchan->name, 32);
|
||||
}
|
||||
}
|
||||
else if(ob->ipoflag & OB_ACTION_OB)
|
||||
strcpy(actname, "Object");
|
||||
}
|
||||
|
||||
/* initialize UI to show Ipo window and make sure channels etc exist */
|
||||
static void enable_constraint_ipo_func (void *ob_v, void *con_v)
|
||||
{
|
||||
Object *ob= ob_v;
|
||||
bConstraint *con = con_v;
|
||||
bConstraintChannel *chan;
|
||||
ListBase *conbase;
|
||||
|
||||
char actname[32]="";
|
||||
|
||||
/* verifies if active constraint is set and shown in UI */
|
||||
constraint_active_func(ob_v, con_v);
|
||||
|
||||
conbase = get_active_constraint_channels(ob, 1); // 1 == create
|
||||
|
||||
if (!conbase)
|
||||
return;
|
||||
|
||||
/* See if this list already has an appropriate channel */
|
||||
chan = find_constraint_channel(conbase, con->name);
|
||||
|
||||
if (!chan){
|
||||
/* Add a new constraint channel */
|
||||
chan = MEM_callocN(sizeof(bConstraintChannel), "constraintChannel");
|
||||
strcpy(chan->name, con->name);
|
||||
BLI_addtail(conbase, chan);
|
||||
}
|
||||
|
||||
/* Ensure there is an ipo to display */
|
||||
if (!chan->ipo){
|
||||
chan->ipo = add_ipo(con->name, IPO_CO);
|
||||
}
|
||||
|
||||
|
||||
/* the context */
|
||||
get_constraint_ipo_context(ob, actname);
|
||||
|
||||
/* adds ipo & channels & curve if needed */
|
||||
verify_ipo((ID *)ob, ID_CO, actname, con->name);
|
||||
|
||||
/* make sure ipowin shows it */
|
||||
ob->ipowin= IPO_CO;
|
||||
allqueue(REDRAWIPO, IPO_CO);
|
||||
ob->ipowin= ID_CO;
|
||||
allqueue(REDRAWIPO, ID_CO);
|
||||
allspace(REMAKEIPO, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
@@ -226,38 +236,23 @@ static void add_influence_key_to_constraint_func (void *ob_v, void *con_v)
|
||||
{
|
||||
Object *ob= ob_v;
|
||||
bConstraint *con = con_v;
|
||||
bConstraintChannel *chan;
|
||||
ListBase *conbase;
|
||||
IpoCurve *icu;
|
||||
char actname[32]="";
|
||||
|
||||
/* verifies if active constraint is set and shown in UI */
|
||||
constraint_active_func(ob_v, con_v);
|
||||
conbase = get_active_constraint_channels(ob, 1); // 1=make
|
||||
|
||||
if (!conbase)
|
||||
return;
|
||||
|
||||
/* See if this list already has an appropriate channel */
|
||||
chan = find_constraint_channel(conbase, con->name);
|
||||
|
||||
if (!chan){
|
||||
/* Add a new constraint channel */
|
||||
chan = MEM_callocN(sizeof(bConstraintChannel), "constraintChannel");
|
||||
strcpy(chan->name, con->name);
|
||||
BLI_addtail(conbase, chan);
|
||||
}
|
||||
|
||||
/* Ensure there is an ipo to display */
|
||||
if (!chan->ipo){
|
||||
chan->ipo = add_ipo(con->name, IPO_CO);
|
||||
}
|
||||
|
||||
/* now insert an ipo key */
|
||||
icu= get_ipocurve(NULL, IPO_CO, CO_ENFORCE, chan->ipo);
|
||||
/* the context */
|
||||
get_constraint_ipo_context(ob, actname);
|
||||
|
||||
/* adds ipo & channels & curve if needed */
|
||||
icu= verify_ipocurve((ID *)ob, ID_CO, actname, con->name, CO_ENFORCE);
|
||||
|
||||
insert_vert_ipo(icu, CFRA, con->enforce);
|
||||
|
||||
/* make sure ipowin shows it */
|
||||
ob->ipowin= IPO_CO;
|
||||
allqueue(REDRAWIPO, IPO_CO);
|
||||
ob->ipowin= ID_CO;
|
||||
allqueue(REDRAWIPO, ID_CO);
|
||||
allspace(REMAKEIPO, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
|
||||
@@ -274,7 +269,7 @@ static void del_constraint_func (void *ob_v, void *con_v)
|
||||
/* remove ipo channel */
|
||||
lb= get_active_constraint_channels(ob_v, 0);
|
||||
if(lb) {
|
||||
chan = find_constraint_channel(lb, con->name);
|
||||
chan = get_constraint_channel(lb, con->name);
|
||||
if(chan) {
|
||||
if(chan->ipo) chan->ipo->id.us--;
|
||||
BLI_freelinkN(lb, chan);
|
||||
@@ -1322,23 +1317,21 @@ void do_object_panels(unsigned short event)
|
||||
/* write config files (currently no simulation) */
|
||||
fluidsimBake(ob);
|
||||
break;
|
||||
case B_FLUIDSIM_SELDIR: {
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
ScrArea *sa = closest_bigger_area();
|
||||
strcpy(str,"//");
|
||||
ob= OBACT;
|
||||
/* chosse dir for surface files */
|
||||
areawinset(sa->win);
|
||||
activate_fileselect(FILE_SPECIAL, "Select Directory", str, fluidsimFilesel);
|
||||
// continue with redraw... so no brake here!
|
||||
}
|
||||
case B_FLUIDSIM_FORCEREDRAW: {
|
||||
// force redraw
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
countall();
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
}
|
||||
case B_FLUIDSIM_SELDIR:
|
||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||
ScrArea *sa = closest_bigger_area();
|
||||
strcpy(str,"//");
|
||||
ob= OBACT;
|
||||
/* choose dir for surface files */
|
||||
areawinset(sa->win);
|
||||
activate_fileselect(FILE_SPECIAL, "Select Directory", str, fluidsimFilesel);
|
||||
/* continue with redraw... so no brake here! */
|
||||
case B_FLUIDSIM_FORCEREDRAW:
|
||||
/* force redraw */
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
countall();
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1371,35 +1364,35 @@ static void object_panel_anim(Object *ob)
|
||||
if(uiNewPanel(curarea, block, "Anim settings", "Object", 0, 0, 318, 204)==0) return;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"TrackX", 24,190,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"Y", 85,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"Z", 104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"-X", 124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"-Y", 150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButC(block, ROW,B_TRACKBUTS,"-Z", 178,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"TrackX", 24,190,59,19, &ob->trackflag, 12.0, 0.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"Y", 85,190,19,19, &ob->trackflag, 12.0, 1.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"Z", 104,190,19,19, &ob->trackflag, 12.0, 2.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"-X", 124,190,24,19, &ob->trackflag, 12.0, 3.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"-Y", 150,190,24,19, &ob->trackflag, 12.0, 4.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiDefButS(block, ROW,B_TRACKBUTS,"-Z", 178,190,24,19, &ob->trackflag, 12.0, 5.0, 0, 0, "Specify the axis that points to another object");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButC(block, ROW,REDRAWVIEW3D,"UpX", 226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
|
||||
uiDefButC(block, ROW,REDRAWVIEW3D,"Y", 274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
|
||||
uiDefButC(block, ROW,REDRAWVIEW3D,"Z", 298,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
|
||||
uiDefButS(block, ROW,REDRAWVIEW3D,"UpX", 226,190,45,19, &ob->upflag, 13.0, 0.0, 0, 0, "Specify the axis that points up");
|
||||
uiDefButS(block, ROW,REDRAWVIEW3D,"Y", 274,190,20,19, &ob->upflag, 13.0, 1.0, 0, 0, "Specify the axis that points up");
|
||||
uiDefButS(block, ROW,REDRAWVIEW3D,"Z", 298,190,19,19, &ob->upflag, 13.0, 2.0, 0, 0, "Specify the axis that points up");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitC(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,160,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
|
||||
uiDefButBitC(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
|
||||
uiDefButBitC(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
|
||||
uiDefButBitS(block, TOG, OB_DRAWKEY, REDRAWVIEW3D, "Draw Key", 24,160,71,19, &ob->ipoflag, 0, 0, 0, 0, "Draw object as key position");
|
||||
uiDefButBitS(block, TOG, OB_DRAWKEYSEL, REDRAWVIEW3D, "Draw Key Sel", 97,160,81,19, &ob->ipoflag, 0, 0, 0, 0, "Limit the drawing of object keys");
|
||||
uiDefButBitS(block, TOG, OB_POWERTRACK, REDRAWVIEW3D, "Powertrack", 180,160,78,19, &ob->transflag, 0, 0, 0, 0, "Switch objects rotation off");
|
||||
uiDefButBitS(block, TOG, PARSLOW, 0, "SlowPar", 260,160,56,19, &ob->partype, 0, 0, 0, 0, "Create a delay in the parent relationship");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitC(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,128,89,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
|
||||
uiDefButBitC(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
|
||||
uiDefButBitC(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
|
||||
uiDefButBitC(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
|
||||
uiDefButBitS(block, TOG, OB_DUPLIFRAMES, REDRAWVIEW3D, "DupliFrames", 24,128,89,19, &ob->transflag, 0, 0, 0, 0, "Make copy of object for every frame");
|
||||
uiDefButBitS(block, TOG, OB_DUPLIVERTS, REDRAWVIEW3D, "DupliVerts", 114,128,82,19, &ob->transflag, 0, 0, 0, 0, "Duplicate child objects on all vertices");
|
||||
uiDefButBitS(block, TOG, OB_DUPLIROT, REDRAWVIEW3D, "Rot", 200,128,31,19, &ob->transflag, 0, 0, 0, 0, "Rotate dupli according to facenormal");
|
||||
uiDefButBitS(block, TOG, OB_DUPLINOSPEED, REDRAWVIEW3D, "No Speed", 234,128,82,19, &ob->transflag, 0, 0, 0, 0, "Set dupliframes to still, regardless of frame");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButS(block, NUM, REDRAWVIEW3D, "DupSta:", 24,105,141,19, &ob->dupsta, 1.0, (MAXFRAMEF - 1.0f), 0, 0, "Specify startframe for Dupliframes");
|
||||
uiDefButS(block, NUM, REDRAWVIEW3D, "DupOn:", 170,105,146,19, &ob->dupon, 1.0, 1500.0, 0, 0, "");
|
||||
uiDefButS(block, NUM, REDRAWVIEW3D, "DupEnd", 24,82,140,19, &ob->dupend, 1.0, MAXFRAMEF, 0, 0, "Specify endframe for Dupliframes");
|
||||
uiDefButS(block, NUM, REDRAWVIEW3D, "DupOff", 171,82,145,19, &ob->dupoff, 0.0, 1500.0, 0, 0, "");
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitC(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
|
||||
uiDefButBitC(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
|
||||
uiDefButBitC(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_OB, REDRAWALL, "Offs Ob", 24,51,56,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on its own objectipo");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARENT, REDRAWALL, "Offs Par", 82,51,56,20 , &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the parent");
|
||||
uiDefButBitS(block, TOG, OB_OFFS_PARTICLE, REDRAWALL, "Offs Particle", 140,51,103,20, &ob->ipoflag, 0, 0, 0, 0, "Let the timeoffset work on the particle effect");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, REDRAWALL, "TimeOffset:", 24,17,115,30, &ob->sf, -MAXFRAMEF, MAXFRAMEF, 100, 0, "Specify an offset in frames");
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
#include "BDR_editcurve.h"
|
||||
|
||||
#include "BSE_view.h"
|
||||
#include "BSE_drawnla.h"
|
||||
#include "BSE_drawipo.h"
|
||||
|
||||
/* 'old' stuff": defines and types, and own include -------------------- */
|
||||
@@ -360,41 +361,6 @@ int count_action_levels(bAction *act)
|
||||
|
||||
return y;
|
||||
}
|
||||
/** Draw a nicely beveled button (in screen space) */
|
||||
void draw_bevel_but(int x, int y, int w, int h, int sel)
|
||||
{
|
||||
int xmin= x, ymin= y;
|
||||
int xmax= x+w-1, ymax= y+h-1;
|
||||
int i;
|
||||
|
||||
glColor3ub(0,0,0);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2i(xmin, ymin);
|
||||
glVertex2i(xmax, ymin);
|
||||
glVertex2i(xmax, ymax);
|
||||
glVertex2i(xmin, ymax);
|
||||
glEnd();
|
||||
|
||||
glBegin(GL_LINE_LOOP);
|
||||
if (sel) glColor3ub(0xD0, 0x7E, 0x06);
|
||||
else glColor3ub(0x8C, 0x8C, 0x8C);
|
||||
glVertex2i(xmax-1, ymin+1);
|
||||
glVertex2i(xmax-1, ymax-1);
|
||||
if (sel) glColor3ub(0xF4, 0xEE, 0x8E);
|
||||
else glColor3ub(0xDF, 0xDF, 0xDF);
|
||||
glVertex2i(xmin+1, ymax-1);
|
||||
glVertex2i(xmin+1, ymin+1);
|
||||
glEnd();
|
||||
|
||||
if (sel) glColor3ub(0xF1, 0xCA, 0x13);
|
||||
else glColor3ub(0xAC, 0xAC, 0xAC);
|
||||
glBegin(GL_LINES);
|
||||
for (i=xmin+2; i<=xmax-2; i++) {
|
||||
glVertex2f(i, ymin+2);
|
||||
glVertex2f(i, ymax-1);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static void draw_channel_strips(SpaceAction *saction)
|
||||
{
|
||||
@@ -404,6 +370,7 @@ static void draw_channel_strips(SpaceAction *saction)
|
||||
bActionChannel *chan;
|
||||
bConstraintChannel *conchan;
|
||||
float y;
|
||||
int act_end, dummy;
|
||||
char col1[3], col2[3];
|
||||
|
||||
BIF_GetThemeColor3ubv(TH_SHADE2, col2);
|
||||
@@ -413,14 +380,21 @@ static void draw_channel_strips(SpaceAction *saction)
|
||||
if (!act)
|
||||
return;
|
||||
|
||||
scr_rct.xmin= saction->area->winrct.xmin + ACTWIDTH;
|
||||
scr_rct.xmin= saction->area->winrct.xmin + saction->v2d.mask.xmin;
|
||||
scr_rct.ymin= saction->area->winrct.ymin + saction->v2d.mask.ymin;
|
||||
scr_rct.xmax= saction->area->winrct.xmin + saction->v2d.hor.xmax;
|
||||
scr_rct.ymax= saction->area->winrct.ymin + saction->v2d.mask.ymax;
|
||||
di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
|
||||
|
||||
/* if in NLA there's a strip active, map the view */
|
||||
if (G.saction->pin==0 && OBACT)
|
||||
map_active_strip(di, OBACT, 0);
|
||||
|
||||
y= count_action_levels(act)*(CHANNELHEIGHT+CHANNELSKIP);
|
||||
|
||||
/* end of action itself */
|
||||
gla2DDrawTranslatePt(di, calc_action_end(act), 0, &act_end, &dummy);
|
||||
|
||||
for (chan=act->chanbase.first; chan; chan=chan->next){
|
||||
int frame1_x, channel_y;
|
||||
|
||||
@@ -429,11 +403,11 @@ static void draw_channel_strips(SpaceAction *saction)
|
||||
glEnable(GL_BLEND);
|
||||
if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
glRectf(0, channel_y-CHANNELHEIGHT/2, frame1_x, channel_y+CHANNELHEIGHT/2);
|
||||
glRectf(0, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2);
|
||||
|
||||
if (chan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2);
|
||||
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2, act_end, channel_y+CHANNELHEIGHT/2);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
draw_ipo_channel(di, chan->ipo, 0, y);
|
||||
@@ -445,14 +419,15 @@ static void draw_channel_strips(SpaceAction *saction)
|
||||
/* Draw constraint channels */
|
||||
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
|
||||
|
||||
glEnable(GL_BLEND);
|
||||
if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x22);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x22);
|
||||
glRectf(0, channel_y-CHANNELHEIGHT/2+4, frame1_x, channel_y+CHANNELHEIGHT/2-4);
|
||||
glRectf(0, channel_y-CHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2-4);
|
||||
|
||||
if (conchan->flag & ACHAN_SELECTED) glColor4ub(col1[0], col1[1], col1[2], 0x44);
|
||||
else glColor4ub(col2[0], col2[1], col2[2], 0x44);
|
||||
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+CHANNELHEIGHT/2-4);
|
||||
glRectf(frame1_x, channel_y-CHANNELHEIGHT/2+4, act_end, channel_y+CHANNELHEIGHT/2-4);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
draw_ipo_channel(di, conchan->ipo, 0, y);
|
||||
@@ -651,10 +626,8 @@ void drawactionspace(ScrArea *sa, void *spacedata)
|
||||
* then draw the key frames in the action window
|
||||
*/
|
||||
draw_mesh_strips(G.saction, key);
|
||||
/*meshactionbuts(G.saction, key);*/
|
||||
}
|
||||
|
||||
|
||||
/* Draw current frame */
|
||||
glViewport(ofsx+G.v2d->mask.xmin,
|
||||
ofsy+G.v2d->mask.ymin,
|
||||
@@ -674,16 +647,20 @@ void drawactionspace(ScrArea *sa, void *spacedata)
|
||||
if(G.v2d->scroll) drawscroll(0);
|
||||
}
|
||||
|
||||
/* Draw channel names */
|
||||
draw_channel_names();
|
||||
if(G.v2d->mask.xmin!=0) {
|
||||
/* Draw channel names */
|
||||
draw_channel_names();
|
||||
|
||||
if ( key ) {
|
||||
/* if there is a mesh with rvk's selected,
|
||||
* then draw the key frames in the action window
|
||||
*/
|
||||
meshactionbuts(G.saction, key);
|
||||
if(sa->winx > 50 + NAMEWIDTH + SLIDERWIDTH) {
|
||||
if ( key ) {
|
||||
/* if there is a mesh with rvk's selected,
|
||||
* then draw the key frames in the action window
|
||||
*/
|
||||
meshactionbuts(G.saction, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mywinset(curarea->win); // reset scissor too
|
||||
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
|
||||
draw_area_emboss(sa);
|
||||
@@ -695,11 +672,41 @@ void drawactionspace(ScrArea *sa, void *spacedata)
|
||||
curarea->win_swap= WIN_BACK_OK;
|
||||
}
|
||||
|
||||
/* unused and blank
|
||||
void draw_channel_name(const char* name, short type, float ypos, int selected)
|
||||
|
||||
/** Draw a nicely beveled button (in screen space) */
|
||||
static void draw_bevel_but(int x, int y, int w, int h, int sel)
|
||||
{
|
||||
int xmin= x, ymin= y;
|
||||
int xmax= x+w-1, ymax= y+h-1;
|
||||
|
||||
/* outline */
|
||||
glColor3ub(0,0,0);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
glVertex2i(xmin, ymin);
|
||||
glVertex2i(xmax, ymin);
|
||||
glVertex2i(xmax, ymax);
|
||||
glVertex2i(xmin, ymax);
|
||||
glEnd();
|
||||
|
||||
/* interior */
|
||||
if (sel) glColor3ub(0xF1, 0xCA, 0x13);
|
||||
else glColor3ub(0xAC, 0xAC, 0xAC);
|
||||
glRectf(xmin+1, ymin+1, xmax-1, ymax-1);
|
||||
|
||||
/* bevel */
|
||||
glBegin(GL_LINE_LOOP);
|
||||
|
||||
if (sel) glColor3ub(0xD0, 0x7E, 0x06);
|
||||
else glColor3ub(0x8C, 0x8C, 0x8C);
|
||||
glVertex2i(xmax-1, ymin+1);
|
||||
glVertex2i(xmax-1, ymax-1);
|
||||
|
||||
if (sel) glColor3ub(0xF4, 0xEE, 0x8E);
|
||||
else glColor3ub(0xDF, 0xDF, 0xDF);
|
||||
glVertex2i(xmin+1, ymax-1);
|
||||
glVertex2i(xmin+1, ymin+1);
|
||||
glEnd();
|
||||
}
|
||||
*/
|
||||
|
||||
static void draw_keylist(gla2DDrawInfo *di, int totvert, BezTriple **blist, float ypos)
|
||||
{
|
||||
@@ -712,7 +719,7 @@ static void draw_keylist(gla2DDrawInfo *di, int totvert, BezTriple **blist, floa
|
||||
if (v==0 || (blist[v]->vec[1][0] != blist[v-1]->vec[1][0])){
|
||||
int sc_x, sc_y;
|
||||
gla2DDrawTranslatePt(di, blist[v]->vec[1][0], ypos, &sc_x, &sc_y);
|
||||
draw_bevel_but(sc_x-2, sc_y-5, 7, 13, (blist[v]->f2 & 1));
|
||||
draw_bevel_but(sc_x-2, sc_y-7, 7, 13, (blist[v]->f2 & 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -770,6 +777,7 @@ void draw_action_channel(gla2DDrawInfo *di, bAction *act, int flags, float ypos)
|
||||
static BezTriple **ob_to_keylist(Object *ob, int flags, int *totvert)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
bConstraintChannel *conchan;
|
||||
int v, count=0;
|
||||
|
||||
BezTriple **list = NULL;
|
||||
@@ -784,6 +792,12 @@ static BezTriple **ob_to_keylist(Object *ob, int flags, int *totvert)
|
||||
}
|
||||
|
||||
/* Count Constraint Keys */
|
||||
for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
if(conchan->ipo)
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
|
||||
count+=icu->totvert;
|
||||
}
|
||||
|
||||
/* Count object data keys */
|
||||
|
||||
/* Build the list */
|
||||
@@ -792,13 +806,21 @@ static BezTriple **ob_to_keylist(Object *ob, int flags, int *totvert)
|
||||
count=0;
|
||||
|
||||
/* Add object keyframes */
|
||||
for (icu=ob->ipo->curve.first; icu; icu=icu->next){
|
||||
for (v=0; v<icu->totvert; v++){
|
||||
list[count++]=&icu->bezt[v];
|
||||
if(ob->ipo) {
|
||||
for (icu=ob->ipo->curve.first; icu; icu=icu->next){
|
||||
for (v=0; v<icu->totvert; v++){
|
||||
list[count++]=&icu->bezt[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Add constraint keyframes */
|
||||
for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
if(conchan->ipo)
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
|
||||
for (v=0; v<icu->totvert; v++)
|
||||
list[count++]=&icu->bezt[v];
|
||||
}
|
||||
|
||||
/* Add constraint keyframes */
|
||||
/* Add object data keyframes */
|
||||
|
||||
/* Sort */
|
||||
@@ -880,13 +902,13 @@ static BezTriple **action_to_keylist(bAction *act, int flags, int *totvert)
|
||||
if(achan->ipo) {
|
||||
for (icu=achan->ipo->curve.first; icu; icu=icu->next)
|
||||
count+=icu->totvert;
|
||||
|
||||
/* Count constraint keys */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next)
|
||||
}
|
||||
/* Count constraint keys */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next)
|
||||
if(conchan->ipo)
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
|
||||
count+=icu->totvert;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* Build the list */
|
||||
@@ -895,17 +917,19 @@ static BezTriple **action_to_keylist(bAction *act, int flags, int *totvert)
|
||||
count=0;
|
||||
|
||||
for (achan=act->chanbase.first; achan; achan=achan->next){
|
||||
/* Add transformation keys */
|
||||
for (icu=achan->ipo->curve.first; icu; icu=icu->next){
|
||||
for (v=0; v<icu->totvert; v++)
|
||||
list[count++]=&icu->bezt[v];
|
||||
}
|
||||
|
||||
/* Add constraint keys */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
|
||||
if(achan->ipo) {
|
||||
/* Add transformation keys */
|
||||
for (icu=achan->ipo->curve.first; icu; icu=icu->next){
|
||||
for (v=0; v<icu->totvert; v++)
|
||||
list[count++]=&icu->bezt[v];
|
||||
}
|
||||
}
|
||||
/* Add constraint keys */
|
||||
for (conchan=achan->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
if(conchan->ipo)
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
|
||||
for (v=0; v<icu->totvert; v++)
|
||||
list[count++]=&icu->bezt[v];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,14 +92,15 @@
|
||||
#define ISPOIN4(a, b, c, d, e) ( (a->b) && (a->c) && (a->d) && (a->e) )
|
||||
|
||||
#define IPOBUTX 65
|
||||
#define IPOSTEP 35 /* minimum pixels per gridstep */
|
||||
/* minimum pixels per gridstep */
|
||||
#define IPOSTEP 35
|
||||
|
||||
static float ipogrid_dx, ipogrid_dy, ipogrid_startx, ipogrid_starty;
|
||||
static int ipomachtx, ipomachty;
|
||||
|
||||
static int vertymin, vertymax, horxmin, horxmax; /* globals om LEFTMOUSE op scrollbar te testen */
|
||||
static int vertymin, vertymax, horxmin, horxmax; /* globals to test LEFTMOUSE for scrollbar */
|
||||
|
||||
extern short ACTWIDTH;
|
||||
extern short ACTWIDTH; /* this is ugly! */
|
||||
|
||||
static void scroll_prstr(float x, float y, float val, char dir, int disptype)
|
||||
{
|
||||
@@ -313,7 +314,7 @@ void draw_ipogrid(void)
|
||||
glRectf(0.0, 0.0, 100.0, 1.0);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
}
|
||||
else if(ELEM(G.sipo->blocktype, ID_CU, IPO_CO)) {
|
||||
else if(ELEM(G.sipo->blocktype, ID_CU, ID_CO)) {
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glRectf(0.0, 1.0, G.v2d->cur.xmax, 1.0);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
@@ -594,12 +595,16 @@ void calc_scrollrcts(ScrArea *sa, View2D *v2d, int winx, int winy)
|
||||
v2d->mask.ymax= winy;
|
||||
|
||||
if(sa->spacetype==SPACE_ACTION) {
|
||||
v2d->mask.xmin+= ACTWIDTH;
|
||||
v2d->hor.xmin+=ACTWIDTH;
|
||||
if(sa->winx > ACTWIDTH+50) {
|
||||
v2d->mask.xmin+= ACTWIDTH;
|
||||
v2d->hor.xmin+=ACTWIDTH;
|
||||
}
|
||||
}
|
||||
else if(sa->spacetype==SPACE_NLA){
|
||||
v2d->mask.xmin+= NLAWIDTH;
|
||||
v2d->hor.xmin+=NLAWIDTH;
|
||||
if(sa->winx > NLAWIDTH+50) {
|
||||
v2d->mask.xmin+= NLAWIDTH;
|
||||
v2d->hor.xmin+=NLAWIDTH;
|
||||
}
|
||||
}
|
||||
else if(sa->spacetype==SPACE_IPO) {
|
||||
v2d->mask.xmax-= IPOBUTX;
|
||||
@@ -1688,7 +1693,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, NULL);
|
||||
ei->icu= verify_ipocurve(G.sipo->from, G.sipo->blocktype, G.sipo->actname, G.sipo->constname, ei->adrcode);
|
||||
ei->flag |= IPO_SELECT;
|
||||
ei->icu->flag= ei->flag;
|
||||
}
|
||||
@@ -2040,6 +2045,8 @@ int view2dzoom(unsigned short event)
|
||||
areawinset(curarea->win); /* from buttons */
|
||||
curarea->head_swap= 0;
|
||||
getmouseco_areawin(mvalo);
|
||||
mval[0]= mvalo[0];
|
||||
mval[1]= mvalo[1];
|
||||
|
||||
while( (get_mbut()&(L_MOUSE|M_MOUSE)) || (event==WHEELUPMOUSE) || (event==WHEELDOWNMOUSE) ) {
|
||||
|
||||
@@ -2130,11 +2137,23 @@ int view2dzoom(unsigned short event)
|
||||
mvalo[1]= mval[1];
|
||||
}
|
||||
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
|
||||
if ELEM5(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME);
|
||||
if( ELEM(curarea->spacetype, SPACE_NLA, SPACE_ACTION) ) {
|
||||
if(mvalo[0] < G.v2d->mask.xmin) {
|
||||
G.v2d->cur.ymin+= dy;
|
||||
G.v2d->cur.ymax-= dy;
|
||||
}
|
||||
else {
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
}
|
||||
}
|
||||
else if (ELEM3(curarea->spacetype, SPACE_SEQ, SPACE_SOUND, SPACE_TIME)) {
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
}
|
||||
else {
|
||||
G.v2d->cur.xmin+= dx;
|
||||
G.v2d->cur.xmax-= dx;
|
||||
G.v2d->cur.ymin+= dy;
|
||||
G.v2d->cur.ymax-= dy;
|
||||
}
|
||||
@@ -2214,10 +2233,20 @@ int view2dmove(unsigned short event)
|
||||
|
||||
if ELEM7(curarea->spacetype, SPACE_IPO, SPACE_SEQ, SPACE_OOPS, SPACE_SOUND, SPACE_ACTION, SPACE_NLA, SPACE_TIME)
|
||||
{
|
||||
|
||||
if( BLI_in_rcti(&G.v2d->mask, (int)mvalo[0], (int)mvalo[1]) ) {
|
||||
facx= (G.v2d->cur.xmax-G.v2d->cur.xmin)/(float)(G.v2d->mask.xmax-G.v2d->mask.xmin);
|
||||
facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
|
||||
}
|
||||
/* stoopid exception to allow scroll in lefthand side */
|
||||
else if(curarea->spacetype==SPACE_ACTION && BLI_in_rcti(&G.v2d->mask, ACTWIDTH+(int)mvalo[0], (int)mvalo[1]) ) {
|
||||
facx= 0.0f;
|
||||
facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
|
||||
}
|
||||
else if(curarea->spacetype==SPACE_NLA && BLI_in_rcti(&G.v2d->mask, NLAWIDTH+(int)mvalo[0], (int)mvalo[1]) ) {
|
||||
facx= 0.0f;
|
||||
facy= (G.v2d->cur.ymax-G.v2d->cur.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
|
||||
}
|
||||
else if(IN_2D_VERT_SCROLL((int)mvalo)) {
|
||||
facy= -(G.v2d->tot.ymax-G.v2d->tot.ymin)/(float)(G.v2d->mask.ymax-G.v2d->mask.ymin);
|
||||
if(get_mbut() & mousebut) {
|
||||
|
||||
@@ -56,6 +56,8 @@
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "MEM_guardedalloc.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_global.h"
|
||||
|
||||
#include "BSE_drawnla.h"
|
||||
@@ -77,24 +79,16 @@
|
||||
#include "blendef.h"
|
||||
#include "mydevice.h"
|
||||
|
||||
/* Local function prototypes */
|
||||
static void draw_nlastrips(SpaceNla *snla);
|
||||
static void draw_nlatree(void);
|
||||
|
||||
int count_nla_levels(void);
|
||||
int nla_filter (Base* base, int flags);
|
||||
|
||||
#define TESTBASE_SAFE(base) ((base)->flag & SELECT)
|
||||
|
||||
/* Implementation */
|
||||
static void draw_nlatree(void)
|
||||
/* the left hand side with channels only */
|
||||
static void draw_nla_channels(void)
|
||||
{
|
||||
|
||||
short ofsx, ofsy = 0;
|
||||
Base *base;
|
||||
float x, y;
|
||||
bActionStrip *strip;
|
||||
bConstraintChannel *conchan;
|
||||
Base *base;
|
||||
Object *ob;
|
||||
float x, y;
|
||||
short ofsx, ofsy = 0;
|
||||
|
||||
myortho2(0, NLAWIDTH, G.v2d->cur.ymin, G.v2d->cur.ymax); // Scaling
|
||||
|
||||
@@ -111,14 +105,13 @@ static void draw_nlatree(void)
|
||||
glColor3ub(0x00, 0x00, 0x00);
|
||||
|
||||
x = 0.0;
|
||||
|
||||
y = count_nla_levels();
|
||||
|
||||
y*= (NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
if (nla_filter(base, 0)){
|
||||
if (nla_filter(base)) {
|
||||
ob= base->object;
|
||||
|
||||
BIF_ThemeColorShade(TH_HEADER, 20);
|
||||
glRectf(x, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
@@ -127,63 +120,56 @@ static void draw_nlatree(void)
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+16, y-4);
|
||||
glRasterPos2f(x+21, y-4);
|
||||
|
||||
BMF_DrawString(G.font, base->object->id.name+2);
|
||||
BMF_DrawString(G.font, ob->id.name+2);
|
||||
|
||||
/* Draw the constraint ipos */
|
||||
for (conchan = base->object->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
BIF_ThemeColorShade(TH_HEADER, -30);
|
||||
/* icon to indicate nla or action */
|
||||
if(ob->nlastrips.first && ob->action) {
|
||||
if(ob->nlaflag & OB_NLA_OVERRIDE)
|
||||
BIF_draw_icon(x+5, y-8, ICON_NLA);
|
||||
else
|
||||
BIF_draw_icon(x+5, y-8, ICON_ACTION);
|
||||
}
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
/* Draw the action timeline */
|
||||
if (ob->action){
|
||||
BIF_ThemeColorShade(TH_HEADER, -20);
|
||||
glRectf(x+16, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+32, y-4);
|
||||
BMF_DrawString(G.font, ob->action->id.name+2);
|
||||
|
||||
if (conchan->flag & CONSTRAINT_CHANNEL_SELECT)
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
}
|
||||
|
||||
/* Draw the nla strips */
|
||||
for (strip = ob->nlastrips.first; strip; strip=strip->next){
|
||||
BIF_ThemeColorShade(TH_HEADER, -40);
|
||||
glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
glRasterPos2f(x+32, y-4);
|
||||
BMF_DrawString(G.font, conchan->name);
|
||||
}
|
||||
|
||||
/* Draw the action timeline */
|
||||
if (ACTIVE_ARMATURE(base)){
|
||||
BIF_draw_icon(x, y-8, ICON_DOWNARROW_HLT);
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
if (base->object->action){
|
||||
BIF_ThemeColorShade(TH_HEADER, -30);
|
||||
glRectf(x+16, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
glRasterPos2f(x+32, y-4);
|
||||
BMF_DrawString(G.font, base->object->action->id.name+2);
|
||||
}
|
||||
}
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
/* Draw the nla strips */
|
||||
if (base->object->type==OB_ARMATURE){
|
||||
for (strip = base->object->nlastrips.first; strip; strip=strip->next){
|
||||
BIF_ThemeColorShade(TH_HEADER, -50);
|
||||
glRectf(x+32, y-NLACHANNELHEIGHT/2, (float)NLAWIDTH, y+NLACHANNELHEIGHT/2);
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
BIF_ThemeColor(TH_TEXT_HI);
|
||||
else
|
||||
BIF_ThemeColor(TH_TEXT);
|
||||
|
||||
// why this test? check freeing mem when deleting strips? (ton)
|
||||
if(strip->act) {
|
||||
glRasterPos2f(x+48, y-4);
|
||||
BMF_DrawString(G.font, strip->act->id.name+2);
|
||||
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
// why this test? check freeing mem when deleting strips? (ton)
|
||||
if(strip->act) {
|
||||
glRasterPos2f(x+48, y-4);
|
||||
BMF_DrawString(G.font, strip->act->id.name+2);
|
||||
|
||||
if(strip->flag & ACTSTRIP_ACTIVE) {
|
||||
glEnable(GL_BLEND);
|
||||
BIF_draw_icon_blended(x+16, y-8, ICON_DOT, TH_BACK, 0);
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
}
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,12 +177,29 @@ static void draw_nlatree(void)
|
||||
myortho2(0, NLAWIDTH, 0, ( ofsy+G.v2d->mask.ymax)-( ofsy+G.v2d->mask.ymin)); // Scaling
|
||||
}
|
||||
|
||||
static void draw_nlastrips(SpaceNla *snla)
|
||||
void map_active_strip(gla2DDrawInfo *di, Object *ob, int restore)
|
||||
{
|
||||
static rctf stored;
|
||||
|
||||
if(restore)
|
||||
gla2DSetMap(di, &stored);
|
||||
else {
|
||||
rctf map;
|
||||
|
||||
gla2DGetMap(di, &stored);
|
||||
map= stored;
|
||||
map.xmin= get_action_frame(ob, map.xmin);
|
||||
map.xmax= get_action_frame(ob, map.xmax);
|
||||
gla2DSetMap(di, &map);
|
||||
}
|
||||
}
|
||||
|
||||
/* the right hand side, with strips and keys */
|
||||
static void draw_nla_strips_keys(SpaceNla *snla)
|
||||
{
|
||||
Base *base;
|
||||
rcti scr_rct;
|
||||
gla2DDrawInfo *di;
|
||||
Base *base;
|
||||
bConstraintChannel *conchan;
|
||||
float y;
|
||||
char col1[3], col2[3];
|
||||
|
||||
@@ -205,7 +208,7 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
|
||||
/* Draw strips */
|
||||
|
||||
scr_rct.xmin= snla->area->winrct.xmin + NLAWIDTH;
|
||||
scr_rct.xmin= snla->area->winrct.xmin + snla->v2d.mask.xmin;
|
||||
scr_rct.ymin= snla->area->winrct.ymin + snla->v2d.mask.ymin;
|
||||
scr_rct.xmax= snla->area->winrct.xmin + snla->v2d.hor.xmax;
|
||||
scr_rct.ymax= snla->area->winrct.ymin + snla->v2d.mask.ymax;
|
||||
@@ -215,13 +218,12 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
y*= (NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
Object *ob;
|
||||
Object *ob= base->object;
|
||||
bActionStrip *strip;
|
||||
int frame1_x, channel_y;
|
||||
|
||||
ob=base->object;
|
||||
|
||||
if (nla_filter(base, 0)){
|
||||
if (nla_filter(base)) {
|
||||
|
||||
/* Draw the field */
|
||||
glEnable (GL_BLEND);
|
||||
if (TESTBASE_SAFE(base))
|
||||
@@ -241,42 +243,14 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
/* Draw the ipo */
|
||||
/* Draw the ipo keys */
|
||||
draw_object_channel(di, ob, 0, y);
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
/* Draw the constraints */
|
||||
for (conchan=ob->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
glEnable (GL_BLEND);
|
||||
if (conchan->flag & CONSTRAINT_CHANNEL_SELECT)
|
||||
glColor4ub (col1[0], col1[1], col1[2], 0x22);
|
||||
else
|
||||
glColor4ub (col2[0], col2[1], col2[2], 0x22);
|
||||
|
||||
gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
|
||||
glRectf(0, channel_y-NLACHANNELHEIGHT/2+4, frame1_x, channel_y+NLACHANNELHEIGHT/2-4);
|
||||
|
||||
|
||||
if (conchan->flag & CONSTRAINT_CHANNEL_SELECT)
|
||||
glColor4ub (col1[0], col1[1], col1[2], 0x44);
|
||||
else
|
||||
glColor4ub (col2[0], col2[1], col2[2], 0x44);
|
||||
glRectf(frame1_x, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-4);
|
||||
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
/* Draw the ipo */
|
||||
draw_ipo_channel(di, conchan->ipo, 0, y);
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
}
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Draw the action strip */
|
||||
if (ACTIVE_ARMATURE(base)){
|
||||
if (ob->action){
|
||||
|
||||
/* Draw the field */
|
||||
glEnable (GL_BLEND);
|
||||
@@ -284,10 +258,10 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
glColor4ub (col1[0], col1[1], col1[2], 0x22);
|
||||
else
|
||||
glColor4ub (col2[0], col2[1], col2[2], 0x22);
|
||||
|
||||
gla2DDrawTranslatePt(di, 1, y, &frame1_x, &channel_y);
|
||||
glRectf(0, channel_y-NLACHANNELHEIGHT/2+4, frame1_x, channel_y+NLACHANNELHEIGHT/2-4);
|
||||
|
||||
|
||||
if (TESTBASE_SAFE(base))
|
||||
glColor4ub (col1[0], col1[1], col1[2], 0x44);
|
||||
else
|
||||
@@ -296,107 +270,108 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
/* Draw the action keys */
|
||||
/* Draw the action keys, optionally corrected for active strip */
|
||||
map_active_strip(di, ob, 0);
|
||||
draw_action_channel(di, ob->action, 0, y);
|
||||
|
||||
map_active_strip(di, ob, 1);
|
||||
|
||||
y-=NLACHANNELHEIGHT+NLACHANNELSKIP;
|
||||
|
||||
}
|
||||
|
||||
/* Draw the nla strips */
|
||||
if (ob->type==OB_ARMATURE){
|
||||
for (strip=ob->nlastrips.first; strip; strip=strip->next){
|
||||
int stripstart, stripend;
|
||||
int blendstart, blendend;
|
||||
unsigned char r, g, b;
|
||||
for (strip=ob->nlastrips.first; strip; strip=strip->next){
|
||||
int stripstart, stripend;
|
||||
int blendstart, blendend;
|
||||
|
||||
/* Draw rect */
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
BIF_ThemeColor(TH_STRIP_SELECT);
|
||||
else
|
||||
BIF_ThemeColor(TH_STRIP);
|
||||
|
||||
gla2DDrawTranslatePt(di, strip->start+strip->blendin, y, &stripstart, &channel_y);
|
||||
gla2DDrawTranslatePt(di, strip->end-strip->blendout, y, &stripend, &channel_y);
|
||||
glRectf(stripstart, channel_y-NLACHANNELHEIGHT/2+3, stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
BIF_ThemeColorShade(TH_STRIP_SELECT, -60);
|
||||
else
|
||||
BIF_ThemeColorShade(TH_STRIP, -60);
|
||||
|
||||
/* Draw blendin */
|
||||
if (strip->blendin>0){
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
/* Draw rect */
|
||||
if (strip->flag & ACTSTRIP_SELECT){
|
||||
r= 0xff; g= 0xff; b= 0xaa;
|
||||
}
|
||||
else{
|
||||
r= 0xe4; g= 0x9c; b= 0xc6;
|
||||
}
|
||||
gla2DDrawTranslatePt(di, strip->start, y, &blendstart, &channel_y);
|
||||
|
||||
glColor4ub (r, g, b, 0xFF);
|
||||
|
||||
gla2DDrawTranslatePt(di, strip->start+strip->blendin, y, &stripstart, &channel_y);
|
||||
gla2DDrawTranslatePt(di, strip->end-strip->blendout, y, &stripend, &channel_y);
|
||||
glRectf(stripstart, channel_y-NLACHANNELHEIGHT/2+3, stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
|
||||
|
||||
/* Draw blendin */
|
||||
if (strip->blendin>0){
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
gla2DDrawTranslatePt(di, strip->start, y, &blendstart, &channel_y);
|
||||
|
||||
glColor4ub (r*0.75, g*0.75, b*0.75, 0xFF);
|
||||
glVertex2f(blendstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
|
||||
|
||||
glEnd();
|
||||
}
|
||||
if (strip->blendout>0){
|
||||
glBegin(GL_TRIANGLES);
|
||||
gla2DDrawTranslatePt(di, strip->end, y, &blendend, &channel_y);
|
||||
glColor4ub (r*0.75, g*0.75, b*0.75, 0xFF);
|
||||
glVertex2f(blendend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
/* Draw border */
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glColor4f(1, 1, 1, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start, y, &stripstart, &channel_y);
|
||||
gla2DDrawTranslatePt(di, strip->end, y, &stripend, &channel_y);
|
||||
|
||||
glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(blendstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glColor4f(0, 0, 0, 0.5);
|
||||
glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
|
||||
|
||||
glEnd();
|
||||
}
|
||||
if (strip->blendout>0){
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
gla2DDrawTranslatePt(di, strip->end, y, &blendend, &channel_y);
|
||||
|
||||
/* Show strip extension */
|
||||
if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
|
||||
glColor4ub (r, g, b, 0x55);
|
||||
|
||||
glRectf(stripend, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
}
|
||||
|
||||
/* Show repeat */
|
||||
if (strip->repeat > 1.0 && !(strip->flag & ACTSTRIP_USESTRIDE)){
|
||||
float rep = 1;
|
||||
glBegin(GL_LINES);
|
||||
while (rep<strip->repeat){
|
||||
/* Draw line */
|
||||
glColor4f(0, 0, 0, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
|
||||
glVertex2f(frame1_x, channel_y-NLACHANNELHEIGHT/2+4);
|
||||
glVertex2f(frame1_x, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
|
||||
glVertex2f(frame1_x+1, channel_y-NLACHANNELHEIGHT/2+4);
|
||||
glVertex2f(frame1_x+1, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
rep+=1.0;
|
||||
}
|
||||
glEnd();
|
||||
|
||||
}
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
glVertex2f(blendend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glEnd();
|
||||
}
|
||||
|
||||
/* Draw border */
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glColor4f(1, 1, 1, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start, y, &stripstart, &channel_y);
|
||||
gla2DDrawTranslatePt(di, strip->end, y, &stripend, &channel_y);
|
||||
|
||||
glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripstart, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glVertex2f(stripend, channel_y+NLACHANNELHEIGHT/2-3);
|
||||
glColor4f(0, 0, 0, 0.5);
|
||||
glVertex2f(stripend, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glVertex2f(stripstart, channel_y-NLACHANNELHEIGHT/2+3);
|
||||
glEnd();
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
|
||||
/* Show strip extension */
|
||||
if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
BIF_ThemeColorShadeAlpha(TH_STRIP_SELECT, 0, -180);
|
||||
else
|
||||
BIF_ThemeColorShadeAlpha(TH_STRIP, 0, -180);
|
||||
|
||||
glRectf(stripend, channel_y-NLACHANNELHEIGHT/2+4, G.v2d->hor.xmax, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
}
|
||||
|
||||
/* Show repeat */
|
||||
if (strip->repeat > 1.0 && !(strip->flag & ACTSTRIP_USESTRIDE)){
|
||||
float rep = 1;
|
||||
glBegin(GL_LINES);
|
||||
while (rep<strip->repeat){
|
||||
/* Draw line */
|
||||
glColor4f(0, 0, 0, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
|
||||
glVertex2f(frame1_x, channel_y-NLACHANNELHEIGHT/2+4);
|
||||
glVertex2f(frame1_x, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
|
||||
glColor4f(1.0, 1.0, 1.0, 0.5);
|
||||
gla2DDrawTranslatePt(di, strip->start+(rep*((strip->end-strip->start)/strip->repeat)), y, &frame1_x, &channel_y);
|
||||
glVertex2f(frame1_x+1, channel_y-NLACHANNELHEIGHT/2+4);
|
||||
glVertex2f(frame1_x+1, channel_y+NLACHANNELHEIGHT/2-2);
|
||||
rep+=1.0;
|
||||
}
|
||||
glEnd();
|
||||
|
||||
}
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
y-=(NLACHANNELHEIGHT+NLACHANNELSKIP);
|
||||
}
|
||||
}
|
||||
glaEnd2DDraw(di);
|
||||
@@ -407,18 +382,16 @@ static void draw_nlastrips(SpaceNla *snla)
|
||||
|
||||
#define B_NLA_PANEL 121
|
||||
|
||||
static bActionStrip *get_active_nlastrip(void)
|
||||
/* For now just returns the first selected strip */
|
||||
bActionStrip *get_active_nlastrip(void)
|
||||
{
|
||||
Base *base;
|
||||
bActionStrip *strip;
|
||||
|
||||
for (base=G.scene->base.first; base; base=base->next){
|
||||
if (nla_filter(base, 0) && base->object->type==OB_ARMATURE){
|
||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
return strip;
|
||||
}
|
||||
for (strip=base->object->nlastrips.first; strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
return strip;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,30 +451,30 @@ static void nla_panel_properties(short cntrl) // NLA_HANDLER_PROPERTIES
|
||||
strip = get_active_nlastrip();
|
||||
if (!strip) return;
|
||||
|
||||
// first labels, for simpler align code :)
|
||||
/* first labels, for simpler align code :) */
|
||||
uiDefBut(block, LABEL, 0, "Timeline Range:", 10,180,300,19, 0, 0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Action Range:", 10,140,300,19, 0, 0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Blending:", 10,100,300,19, 0, 0, 0, 0, 0, "");
|
||||
uiDefBut(block, LABEL, 0, "Options:", 10,60,300,19, 0, 0, 0, 0, 0, "");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, 1.0, MAXFRAMEF, 100, 0, "First frame in the timeline");
|
||||
uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, 1.0, MAXFRAMEF, 100, 0, "Last frame in the timeline");
|
||||
uiDefButF(block, NUM, B_REDR, "Strip Start:", 10,160,150,19, &strip->start, -1000.0, MAXFRAMEF, 100, 0, "First frame in the timeline");
|
||||
uiDefButF(block, NUM, B_REDR, "Strip End:", 160,160,150,19, &strip->end, -1000.0, MAXFRAMEF, 100, 0, "Last frame in the timeline");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, B_REDR, "Action Start:", 10,120,150,19, &strip->actstart, 1.0, MAXFRAMEF, 100, 0, "First frame of the action to map to the playrange");
|
||||
uiDefButF(block, NUM, B_REDR, "Action End:", 160,120,150,19, &strip->actend, 1.0, MAXFRAMEF, 100, 0, "Last frame of the action to map to the playrange");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-in");
|
||||
uiDefButF(block, NUM, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, MAXFRAMEF, 100, 0, "Number of frames of ease-out");
|
||||
uiDefButF(block, NUM, B_REDR, "Blendin:", 10,80,150,19, &strip->blendin, 0.0, strip->actend-strip->actstart, 100, 0, "Number of frames of ease-in");
|
||||
uiDefButF(block, NUM, B_REDR, "Blendout:", 160,80,150,19, &strip->blendout, 0.0, strip->actend-strip->actstart, 100, 0, "Number of frames of ease-out");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButF(block, NUM, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, MAXFRAMEF, 100, 0, "Number of times the action should repeat");
|
||||
uiDefButF(block, NUM, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, MAXFRAMEF, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range");
|
||||
uiDefButF(block, NUM, B_REDR, "Repeat:", 10,40,150,19, &strip->repeat, 0.0001, 1000.0f, 100, 0, "Number of times the action should repeat");
|
||||
uiDefButF(block, NUM, B_REDR, "Stride:", 160,40,150,19, &strip->stridelen, 0.0001, 1000.0, 100, 0, "Distance covered by one complete cycle of the action specified in the Action Range");
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride. Only armatures parented to a path");
|
||||
uiDefButBitS(block, TOG, ACTSTRIP_USESTRIDE, B_REDR, "Use Path", 10,0,100,19, &strip->flag, 0, 0, 0, 0, "Plays action based on path position & stride");
|
||||
uiDefButBitS(block, TOG, ACTSTRIP_HOLDLASTFRAME, B_REDR, "Hold", 110,0,100,19, &strip->flag, 0, 0, 0, 0, "Toggles whether to continue displaying the last frame past the end of the strip");
|
||||
uiDefButS(block, TOG, B_REDR, "Add", 210,0,100,19, &strip->mode, 0, 0, 0, 0, "Toggles additive blending mode");
|
||||
}
|
||||
@@ -563,8 +536,8 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
|
||||
calc_ipogrid();
|
||||
draw_ipogrid();
|
||||
|
||||
/* Draw channel strips */
|
||||
draw_nlastrips(G.snla);
|
||||
/* the right hand side, with strips and keys */
|
||||
draw_nla_strips_keys(G.snla);
|
||||
|
||||
/* Draw current frame */
|
||||
glViewport(ofsx+G.v2d->mask.xmin, ofsy+G.v2d->mask.ymin, ( ofsx+G.v2d->mask.xmax-1)-(ofsx+G.v2d->mask.xmin)+1, ( ofsy+G.v2d->mask.ymax-1)-( ofsy+G.v2d->mask.ymin)+1);
|
||||
@@ -578,10 +551,10 @@ void drawnlaspace(ScrArea *sa, void *spacedata)
|
||||
myortho2(-0.375, curarea->winx-0.375, -0.375, curarea->winy-0.375);
|
||||
if(G.v2d->scroll) drawscroll(0);
|
||||
}
|
||||
|
||||
/* Draw channel names */
|
||||
draw_nlatree();
|
||||
|
||||
if(G.v2d->mask.xmin!=0) {
|
||||
/* Draw channel names */
|
||||
draw_nla_channels();
|
||||
}
|
||||
mywinset(curarea->win); // reset scissor too
|
||||
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
|
||||
draw_area_emboss(sa);
|
||||
@@ -598,48 +571,36 @@ int count_nla_levels(void)
|
||||
Base *base;
|
||||
int y=0;
|
||||
|
||||
for (y=0, base=G.scene->base.first; base; base=base->next)
|
||||
{
|
||||
if (nla_filter(base,0 )){
|
||||
/* Ipo */
|
||||
for (y=0, base=G.scene->base.first; base; base=base->next) {
|
||||
if (nla_filter(base)) {
|
||||
/* object level */
|
||||
y++;
|
||||
/* Constraint channels */
|
||||
y+=BLI_countlist(&base->object->constraintChannels);
|
||||
|
||||
if (base->object->type==OB_ARMATURE){
|
||||
/* Action */
|
||||
if(base->object->action){
|
||||
// bActionChannel *achan;
|
||||
y++;
|
||||
|
||||
// for (achan=base->object->action->chanbase.first; achan; achan=achan->next){
|
||||
// y+=BLI_countlist(&achan->constraintChannels);
|
||||
// }
|
||||
}
|
||||
/* Nla strips */
|
||||
y+= BLI_countlist(&base->object->nlastrips);
|
||||
}
|
||||
if(base->object->action)
|
||||
y++;
|
||||
|
||||
/* Nla strips */
|
||||
y+= BLI_countlist(&base->object->nlastrips);
|
||||
}
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
int nla_filter (Base* base, int flags)
|
||||
int nla_filter (Base *base)
|
||||
{
|
||||
Object *ob = base->object;
|
||||
|
||||
if(ob->action || ob->nlastrips.first)
|
||||
return 1;
|
||||
|
||||
/* Only objects with ipos */
|
||||
/* should become option */
|
||||
if (ob->ipo)
|
||||
return 1;
|
||||
|
||||
if (ob->constraintChannels.first)
|
||||
return 1;
|
||||
|
||||
/* Only armatures */
|
||||
if (ob->type==OB_ARMATURE)
|
||||
return 1;
|
||||
|
||||
else return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -255,14 +255,15 @@ static void draw_ob_keys()
|
||||
/* go through each channel in the action */
|
||||
for (achan=act->chanbase.first; achan; achan=achan->next){
|
||||
/* convert the ipo to a list of 'current frame elements' */
|
||||
|
||||
elems.first= elems.last= NULL;
|
||||
make_cfra_list(achan->ipo, &elems);
|
||||
if(achan->ipo) {
|
||||
elems.first= elems.last= NULL;
|
||||
make_cfra_list(achan->ipo, &elems);
|
||||
|
||||
col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
|
||||
draw_key_list(elems, col);
|
||||
|
||||
BLI_freelistN(&elems);
|
||||
col[0] = 0x00; col[1] = 0x82; col[2] = 0x8B;
|
||||
draw_key_list(elems, col);
|
||||
|
||||
BLI_freelistN(&elems);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_mesh_types.h"
|
||||
#include "DNA_nla_types.h"
|
||||
#include "DNA_lattice_types.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
@@ -98,9 +99,7 @@ extern int count_action_levels (bAction *act);
|
||||
#define BEZSELECTED(bezt) (((bezt)->f1 & 1) || ((bezt)->f2 & 1) || ((bezt)->f3 & 1))
|
||||
|
||||
/* Local Function prototypes, are forward needed */
|
||||
static void insertactionkey(bAction *act, bActionChannel *achan, bPoseChannel *chan, int adrcode, short makecurve, float time);
|
||||
static void hilight_channel (bAction *act, bActionChannel *chan, short hilight);
|
||||
static void set_action_key_time (bAction *act, bPoseChannel *chan, int adrcode, short makecurve, float time);
|
||||
|
||||
static void up_sel_action(void);
|
||||
static void down_sel_action(void);
|
||||
@@ -137,6 +136,7 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
bActionChannel *achan;
|
||||
bAction *temp;
|
||||
bPoseChannel *pchan;
|
||||
ID *id;
|
||||
float actlen;
|
||||
int oldframe;
|
||||
int curframe;
|
||||
@@ -144,7 +144,7 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
|
||||
if (!act)
|
||||
return NULL;
|
||||
|
||||
|
||||
arm = get_armature(armob);
|
||||
|
||||
if (G.obedit){
|
||||
@@ -158,7 +158,8 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
}
|
||||
|
||||
/* Get a new action */
|
||||
result = add_empty_action();
|
||||
result = add_empty_action(ID_PO);
|
||||
id= (ID *)armob;
|
||||
|
||||
/* Assign the new action a unique name */
|
||||
sprintf (newname, "%s.BAKED", act->id.name+2);
|
||||
@@ -169,7 +170,7 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
oldframe = G.scene->r.cfra;
|
||||
|
||||
temp = armob->action;
|
||||
armob->action = act;
|
||||
armob->action = result;
|
||||
|
||||
for (curframe=1; curframe<ceil(actlen+1); curframe++){
|
||||
|
||||
@@ -186,16 +187,16 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
for (pchan=armob->pose->chanbase.first; pchan; pchan=pchan->next){
|
||||
|
||||
/* Apply to keys */
|
||||
set_action_key_time (result, pchan, AC_QUAT_X, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_QUAT_Y, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_QUAT_Z, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_QUAT_W, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_LOC_X, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_LOC_Y, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_LOC_Z, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_SIZE_X, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_SIZE_Y, 1, curframe);
|
||||
set_action_key_time (result, pchan, AC_SIZE_Z, 1, curframe);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_X);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_Y);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_Z);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_QUAT_X);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_QUAT_Y);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_QUAT_Z);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_QUAT_W);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_SIZE_X);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_SIZE_Y);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_SIZE_Z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,8 +204,10 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
|
||||
/* Make another pass to ensure all keyframes are set to linear interpolation mode */
|
||||
for (achan = result->chanbase.first; achan; achan=achan->next){
|
||||
IpoCurve* icu;
|
||||
for (icu = achan->ipo->curve.first; icu; icu=icu->next){
|
||||
icu->ipo= IPO_LIN;
|
||||
if(achan->ipo) {
|
||||
for (icu = achan->ipo->curve.first; icu; icu=icu->next){
|
||||
icu->ipo= IPO_LIN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +234,6 @@ void select_actionchannel_by_name (bAction *act, char *name, int select)
|
||||
|
||||
for (chan = act->chanbase.first; chan; chan=chan->next){
|
||||
if (!strcmp (chan->name, name)){
|
||||
act->achan = chan;
|
||||
if (select){
|
||||
chan->flag |= ACHAN_SELECTED;
|
||||
hilight_channel (act, chan, 1);
|
||||
@@ -322,25 +324,27 @@ void duplicate_actionchannel_keys(void)
|
||||
duplicate_ipo_keys(conchan->ipo);
|
||||
}
|
||||
|
||||
transform_actionchannel_keys ('g');
|
||||
transform_actionchannel_keys ('g', 0);
|
||||
}
|
||||
|
||||
static bActionChannel *get_nearest_actionchannel_key (float *index, short *sel, bConstraintChannel **rchan){
|
||||
static bActionChannel *get_nearest_actionchannel_key (float *index, short *sel, bConstraintChannel **rchan)
|
||||
{
|
||||
bAction *act;
|
||||
bActionChannel *chan;
|
||||
IpoCurve *icu;
|
||||
bActionChannel *firstchan=NULL;
|
||||
bConstraintChannel *conchan, *firstconchan=NULL;
|
||||
int foundsel=0;
|
||||
float firstvert=-1, foundx=-1;
|
||||
int i;
|
||||
short mval[2];
|
||||
float ymin, ymax;
|
||||
rctf rectf;
|
||||
float firstvert=-1, foundx=-1;
|
||||
float ymin, ymax, xmin, xmax;
|
||||
int i;
|
||||
int foundsel=0;
|
||||
short mval[2];
|
||||
|
||||
*index=0;
|
||||
|
||||
*rchan=NULL;
|
||||
act=G.saction->action; /* We presume that we are only called during a valid action */
|
||||
act= G.saction->action; /* We presume that we are only called during a valid action */
|
||||
|
||||
getmouseco_areawin (mval);
|
||||
|
||||
@@ -352,16 +356,26 @@ static bActionChannel *get_nearest_actionchannel_key (float *index, short *sel,
|
||||
ymax = count_action_levels(act) * (CHANNELHEIGHT + CHANNELSKIP);
|
||||
ymax += CHANNELHEIGHT/2;
|
||||
|
||||
/* if action is mapped in NLA, it returns a correction */
|
||||
if(G.saction->pin==0 && OBACT) {
|
||||
xmin= get_action_frame(OBACT, rectf.xmin);
|
||||
xmax= get_action_frame(OBACT, rectf.xmax);
|
||||
}
|
||||
else {
|
||||
xmin= rectf.xmin;
|
||||
xmax= rectf.xmax;
|
||||
}
|
||||
|
||||
*sel=0;
|
||||
|
||||
for (chan=act->chanbase.first; chan; chan=chan->next){
|
||||
|
||||
/* Check action channel */
|
||||
ymin= ymax-(CHANNELHEIGHT+CHANNELSKIP);
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax)) && chan->ipo){
|
||||
for (icu=chan->ipo->curve.first; icu; icu=icu->next){
|
||||
for (i=0; i<icu->totvert; i++){
|
||||
if (icu->bezt[i].vec[1][0] > rectf.xmin && icu->bezt[i].vec[1][0] <= rectf.xmax ){
|
||||
if (icu->bezt[i].vec[1][0] > xmin && icu->bezt[i].vec[1][0] <= xmax ){
|
||||
if (!firstchan){
|
||||
firstchan=chan;
|
||||
firstvert=icu->bezt[i].vec[1][0];
|
||||
@@ -388,10 +402,10 @@ static bActionChannel *get_nearest_actionchannel_key (float *index, short *sel,
|
||||
/* Check constraint channels */
|
||||
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
|
||||
ymin=ymax-(CHANNELHEIGHT+CHANNELSKIP);
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax))){
|
||||
if (!((ymax < rectf.ymin) || (ymin > rectf.ymax)) && conchan->ipo) {
|
||||
for (icu=conchan->ipo->curve.first; icu; icu=icu->next){
|
||||
for (i=0; i<icu->totvert; i++){
|
||||
if (icu->bezt[i].vec[1][0] > rectf.xmin && icu->bezt[i].vec[1][0] <= rectf.xmax ){
|
||||
if (icu->bezt[i].vec[1][0] > xmin && icu->bezt[i].vec[1][0] <= xmax ){
|
||||
if (!firstchan){
|
||||
firstchan=chan;
|
||||
firstconchan=conchan;
|
||||
@@ -550,13 +564,11 @@ static void mouse_action(int selectmode)
|
||||
|
||||
if (chan){
|
||||
if (selectmode == SELECT_REPLACE) {
|
||||
if (sel == 0)
|
||||
selectmode = SELECT_ADD;
|
||||
else
|
||||
selectmode = SELECT_SUBTRACT;
|
||||
selectmode = SELECT_ADD;
|
||||
|
||||
deselect_actionchannel_keys(act, 0);
|
||||
deselect_actionchannels(act, 0);
|
||||
act->achan = chan;
|
||||
|
||||
chan->flag |= ACHAN_SELECTED;
|
||||
hilight_channel (act, chan, 1);
|
||||
select_poseelement_by_name(chan->name, 1);
|
||||
@@ -567,7 +579,9 @@ static void mouse_action(int selectmode)
|
||||
else
|
||||
select_ipo_key(chan->ipo, selx, selectmode);
|
||||
|
||||
BIF_undo_push("Select Action");
|
||||
|
||||
std_rmouse_transform(transform_actionchannel_keys);
|
||||
|
||||
allqueue(REDRAWIPO, 0);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
@@ -731,16 +745,17 @@ void borderselect_mesh(Key *key)
|
||||
/* Lets loop throug the IpoCurves and do borderselect
|
||||
* on the curves with adrcodes in our selected range.
|
||||
*/
|
||||
for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
|
||||
/* lets not deal with the "speed" Ipo
|
||||
*/
|
||||
if (!icu->adrcode) continue;
|
||||
if ( (icu->adrcode >= adrcodemin) &&
|
||||
(icu->adrcode <= adrcodemax) ) {
|
||||
borderselect_icu_key(icu, xmin, xmax, select_function);
|
||||
if(key->ipo) {
|
||||
for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
|
||||
/* lets not deal with the "speed" Ipo
|
||||
*/
|
||||
if (!icu->adrcode) continue;
|
||||
if ( (icu->adrcode >= adrcodemin) &&
|
||||
(icu->adrcode <= adrcodemax) ) {
|
||||
borderselect_icu_key(icu, xmin, xmax, select_function);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* redraw stuff */
|
||||
BIF_undo_push("Border select Action Key");
|
||||
allqueue(REDRAWNLA, 0);
|
||||
@@ -749,6 +764,23 @@ void borderselect_mesh(Key *key)
|
||||
}
|
||||
}
|
||||
|
||||
/* ******************** action API ***************** */
|
||||
|
||||
/* generic get current action call, for action window context */
|
||||
bAction *ob_get_action(Object *ob)
|
||||
{
|
||||
bActionStrip *strip;
|
||||
|
||||
if(ob->action)
|
||||
return ob->action;
|
||||
|
||||
for (strip=ob->nlastrips.first; strip; strip=strip->next){
|
||||
if (strip->flag & ACTSTRIP_SELECT)
|
||||
return strip->act;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* used by ipo, outliner, buttons to find the active channel */
|
||||
bActionChannel* get_hilighted_action_channel(bAction* action)
|
||||
{
|
||||
@@ -766,41 +798,6 @@ 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;
|
||||
@@ -808,109 +805,23 @@ void set_exprap_action(int mode)
|
||||
error ("Not yet implemented!");
|
||||
}
|
||||
|
||||
void set_action_key (struct bAction *act, struct bPoseChannel *chan, int adrcode, short makecurve)
|
||||
{
|
||||
set_action_key_time (act, chan, adrcode, makecurve, frame_to_float(CFRA));
|
||||
}
|
||||
|
||||
static void set_action_key_time (bAction *act, bPoseChannel *chan, int adrcode, short makecurve, float time)
|
||||
{
|
||||
bActionChannel *achan;
|
||||
char ipstr[256];
|
||||
|
||||
if (!act)
|
||||
return;
|
||||
|
||||
if (!chan)
|
||||
return;
|
||||
|
||||
/* See if this action channel exists already */
|
||||
for (achan=act->chanbase.first; achan; achan=achan->next){
|
||||
if (!strcmp (chan->name, achan->name))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!achan){
|
||||
if (!makecurve)
|
||||
return;
|
||||
achan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
|
||||
strcpy (achan->name, chan->name);
|
||||
BLI_addtail (&act->chanbase, achan);
|
||||
}
|
||||
|
||||
/* Ensure the channel appears selected in the action window */
|
||||
/* ton: added flag hilighted, for display in ipowin. dunno what the difference is between select/hilite */
|
||||
achan->flag |= ACHAN_SELECTED|ACHAN_HILIGHTED;
|
||||
|
||||
/* Ensure this action channel has a valid Ipo */
|
||||
if (!achan->ipo){
|
||||
sprintf (ipstr, "%s.%s", act->id.name+2, chan->name);
|
||||
ipstr[23]=0;
|
||||
achan->ipo= add_ipo(ipstr, ID_AC);
|
||||
}
|
||||
|
||||
insertactionkey(act, achan, chan, adrcode, makecurve, time);
|
||||
|
||||
}
|
||||
|
||||
static void insertactionkey(bAction *act, bActionChannel *achan, bPoseChannel *chan, int adrcode, short makecurve, float cfra)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
void *poin;
|
||||
float curval;
|
||||
int type;
|
||||
ID *id;
|
||||
|
||||
if (!act){
|
||||
return;
|
||||
}
|
||||
if (act->id.lib){
|
||||
error ("Can't pose library actions");
|
||||
return;
|
||||
}
|
||||
act->achan=achan;
|
||||
act->pchan=chan;
|
||||
|
||||
id=(ID*) act;
|
||||
|
||||
/* First see if this curve exists */
|
||||
if (!makecurve){
|
||||
if (!achan->ipo)
|
||||
return;
|
||||
|
||||
for (icu = achan->ipo->curve.first; icu; icu=icu->next){
|
||||
if (icu->adrcode == adrcode)
|
||||
break;
|
||||
}
|
||||
if (!icu)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
icu = get_ipocurve (id, GS(id->name), adrcode, achan->ipo);
|
||||
|
||||
if(icu) {
|
||||
poin= get_ipo_poin(id, icu, &type);
|
||||
if(poin) {
|
||||
curval= read_ipo_poin(poin, type);
|
||||
// cfra= frame_to_float(CFRA);
|
||||
insert_vert_ipo(icu, cfra, curval);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bAction *add_empty_action(void)
|
||||
bAction *add_empty_action(int blocktype)
|
||||
{
|
||||
bAction *act;
|
||||
|
||||
act= alloc_libblock(&G.main->action, ID_AC, "Action");
|
||||
char *str= "Action";
|
||||
|
||||
if(blocktype==ID_OB)
|
||||
str= "ObAction";
|
||||
else if(blocktype==ID_KE)
|
||||
str= "ShapeAction";
|
||||
|
||||
act= alloc_libblock(&G.main->action, ID_AC, str);
|
||||
act->id.flag |= LIB_FAKEUSER;
|
||||
act->id.us++;
|
||||
return act;
|
||||
}
|
||||
|
||||
void transform_actionchannel_keys(char mode)
|
||||
void transform_actionchannel_keys(int mode, int dummy)
|
||||
{
|
||||
bAction *act;
|
||||
TransVert *tv;
|
||||
@@ -1054,9 +965,13 @@ void transform_actionchannel_keys(char mode)
|
||||
headerprint(str);
|
||||
}
|
||||
|
||||
if (G.saction->lock){
|
||||
if(ob && ob->pose) {
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
if (G.saction->lock) {
|
||||
if(ob) {
|
||||
ob->ctime= -1234567.0f;
|
||||
if(ob->pose || ob_get_key(ob))
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
else
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
|
||||
}
|
||||
force_draw_plus(SPACE_VIEW3D, 0);
|
||||
}
|
||||
@@ -1073,8 +988,13 @@ void transform_actionchannel_keys(char mode)
|
||||
/* Update the curve */
|
||||
/* Depending on the lock status, draw necessary views */
|
||||
|
||||
if(ob && ob->pose) {
|
||||
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
|
||||
if(ob) {
|
||||
ob->ctime= -1234567.0f;
|
||||
|
||||
if(ob->pose || ob_get_key(ob))
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
|
||||
else
|
||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
|
||||
}
|
||||
remake_action_ipos(act);
|
||||
|
||||
@@ -1272,7 +1192,6 @@ void transform_meshchannel_keys(char mode, Key *key)
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void deselect_actionchannel_keys (bAction *act, int test)
|
||||
{
|
||||
bActionChannel *chan;
|
||||
@@ -1535,9 +1454,7 @@ static void mouse_actionchannels(bAction *act, short *mval,
|
||||
* active channel for the action
|
||||
*/
|
||||
sel = (chan->flag & ACHAN_SELECTED);
|
||||
if ( select_channel(act, chan, selectmode) && !sel ) {
|
||||
act->achan = chan;
|
||||
}
|
||||
select_channel(act, chan, selectmode);
|
||||
}
|
||||
--clickmin;
|
||||
--clickmax;
|
||||
@@ -2175,7 +2092,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
transform_meshchannel_keys('g', key);
|
||||
}
|
||||
else if (act) {
|
||||
transform_actionchannel_keys ('g');
|
||||
transform_actionchannel_keys ('g', 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2215,7 +2132,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
transform_meshchannel_keys('s', key);
|
||||
}
|
||||
else if (act) {
|
||||
transform_actionchannel_keys ('s');
|
||||
transform_actionchannel_keys ('s', 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -2284,7 +2201,8 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
* based on user preference USER_LMOUSESELECT
|
||||
*/
|
||||
case LEFTMOUSE:
|
||||
if(view2dmove(LEFTMOUSE)); // only checks for sliders
|
||||
if(view2dmove(LEFTMOUSE)) // only checks for sliders
|
||||
break;
|
||||
else if (mval[0]>ACTWIDTH){
|
||||
do {
|
||||
getmouseco_areawin(mval);
|
||||
@@ -2301,8 +2219,9 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
|
||||
else PIL_sleep_ms(30);
|
||||
|
||||
} while(get_mbut() & mousebut);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
/* passed on as selection */
|
||||
case RIGHTMOUSE:
|
||||
/* Clicking in the channel area selects the
|
||||
* channel or constraint channel
|
||||
|
||||
@@ -2433,7 +2433,7 @@ void armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
|
||||
act = ob->action;
|
||||
if (act && !act->id.lib){
|
||||
/* Find the appropriate channel */
|
||||
chan= get_named_actionchannel(act, oldname);
|
||||
chan= get_action_channel(act, oldname);
|
||||
if(chan) BLI_strncpy(chan->name, newname, MAXBONENAME);
|
||||
}
|
||||
|
||||
|
||||
@@ -85,11 +85,11 @@ ListBase *get_active_constraint_channels (Object *ob, int forcevalid)
|
||||
if (!forcevalid)
|
||||
return NULL;
|
||||
|
||||
ob->action=add_empty_action();
|
||||
ob->action=add_empty_action(ID_PO);
|
||||
}
|
||||
|
||||
/* Make sure we have an actionchannel */
|
||||
achan = get_named_actionchannel(ob->action, pchan->name);
|
||||
achan = get_action_channel(ob->action, pchan->name);
|
||||
if (!achan){
|
||||
if (!forcevalid)
|
||||
return NULL;
|
||||
@@ -109,7 +109,17 @@ ListBase *get_active_constraint_channels (Object *ob, int forcevalid)
|
||||
else return NULL;
|
||||
}
|
||||
/* else we return object constraints */
|
||||
return &ob->constraintChannels;
|
||||
else {
|
||||
if(ob->ipoflag & OB_ACTION_OB) {
|
||||
bActionChannel *achan = get_action_channel(ob->action, "Object");
|
||||
if(achan)
|
||||
return &achan->constraintChannels;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &ob->constraintChannels;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -162,7 +172,7 @@ bConstraintChannel *get_active_constraint_channel(Object *ob)
|
||||
if(con->flag & CONSTRAINT_ACTIVE)
|
||||
break;
|
||||
if(con) {
|
||||
bActionChannel *achan = get_named_actionchannel(ob->action, pchan->name);
|
||||
bActionChannel *achan = get_action_channel(ob->action, pchan->name);
|
||||
if(achan) {
|
||||
for(chan= achan->constraintChannels.first; chan; chan= chan->next)
|
||||
if(!strcmp(chan->name, con->name))
|
||||
@@ -178,10 +188,14 @@ bConstraintChannel *get_active_constraint_channel(Object *ob)
|
||||
if(con->flag & CONSTRAINT_ACTIVE)
|
||||
break;
|
||||
if(con) {
|
||||
for(chan= ob->constraintChannels.first; chan; chan= chan->next)
|
||||
if(!strcmp(chan->name, con->name))
|
||||
break;
|
||||
return chan;
|
||||
ListBase *lb= get_active_constraint_channels(ob, 0);
|
||||
|
||||
if(lb) {
|
||||
for(chan= lb->first; chan; chan= chan->next)
|
||||
if(!strcmp(chan->name, con->name))
|
||||
break;
|
||||
return chan;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +203,6 @@ bConstraintChannel *get_active_constraint_channel(Object *ob)
|
||||
}
|
||||
|
||||
|
||||
|
||||
bConstraint *add_new_constraint(short type)
|
||||
{
|
||||
bConstraint *con;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
309
source/blender/src/editipo_lib.c
Normal file
309
source/blender/src/editipo_lib.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/**
|
||||
* $Id:
|
||||
*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Contributor(s): Blender Foundation, 2005. Full recode
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
/* ********** General calls (minimal dependencies) for editing Ipos in Blender ************* */
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_ipo.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BSE_edit.h"
|
||||
#include "BSE_editipo_types.h"
|
||||
#include "BSE_editipo.h"
|
||||
#include "BSE_drawipo.h"
|
||||
|
||||
#include "blendef.h"
|
||||
#include "mydevice.h"
|
||||
|
||||
char *ob_ic_names[OB_TOTNAM] = { "LocX", "LocY", "LocZ", "dLocX", "dLocY", "dLocZ",
|
||||
"RotX", "RotY", "RotZ", "dRotX", "dRotY", "dRotZ",
|
||||
"SizeX", "SizeY", "SizeZ", "dSizeX", "dSizeY", "dSizeZ",
|
||||
"Layer", "Time", "ColR", "ColG", "ColB", "ColA",
|
||||
"FStreng", "FFall", "RDamp", "Damping", "Perm" };
|
||||
|
||||
char *co_ic_names[CO_TOTNAM] = { "Inf" };
|
||||
char *mtex_ic_names[TEX_TOTNAM] = { "OfsX", "OfsY", "OfsZ", "SizeX", "SizeY", "SizeZ",
|
||||
"texR", "texG", "texB", "DefVar", "Col", "Nor", "Var",
|
||||
"Disp" };
|
||||
char *tex_ic_names[TE_TOTNAM] = { "NSize", "NDepth", "NType", "Turb", "Vnw1", "Vnw2",
|
||||
"Vnw3", "Vnw4", "MinkMExp", "DistM", "ColT", "iScale",
|
||||
"DistA", "MgType", "MgH", "Lacu", "Oct", "MgOff",
|
||||
"MgGain", "NBase1", "NBase2" };
|
||||
char *ma_ic_names[MA_TOTNAM] = { "R", "G", "B", "SpecR", "SpecG", "SpecB", "MirR",
|
||||
"MirG", "MirB", "Ref", "Alpha", "Emit", "Amb", "Spec",
|
||||
"Hard", "SpTra", "Ior", "Mode", "HaSize", "Translu",
|
||||
"RayMir", "FresMir", "FresMirI", "FresTra", "FresTraI",
|
||||
"TraGlow" };
|
||||
char *seq_ic_names[SEQ_TOTNAM] = { "Fac" };
|
||||
char *cu_ic_names[CU_TOTNAM] = { "Speed" };
|
||||
char *key_ic_names[KEY_TOTNAM] = { "Speed", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5",
|
||||
"Key 6", "Key 7", "Key 8", "Key 9", "Key 10",
|
||||
"Key 11", "Key 12", "Key 13", "Key 14", "Key 15",
|
||||
"Key 16", "Key 17", "Key 18", "Key 19", "Key 20",
|
||||
"Key 21", "Key 22", "Key 23", "Key 24", "Key 25",
|
||||
"Key 26", "Key 27", "Key 28", "Key 29", "Key 30",
|
||||
"Key 31", "Key 32", "Key 33", "Key 34", "Key 35",
|
||||
"Key 36", "Key 37", "Key 38", "Key 39", "Key 40",
|
||||
"Key 41", "Key 42", "Key 43", "Key 44", "Key 45",
|
||||
"Key 46", "Key 47", "Key 48", "Key 49", "Key 50",
|
||||
"Key 51", "Key 52", "Key 53", "Key 54", "Key 55",
|
||||
"Key 56", "Key 57", "Key 58", "Key 59", "Key 60",
|
||||
"Key 61", "Key 62", "Key 63"};
|
||||
char *wo_ic_names[WO_TOTNAM] = { "HorR", "HorG", "HorB", "ZenR", "ZenG", "ZenB", "Expos",
|
||||
"Misi", "MisDi", "MisSta", "MisHi", "StarR", "StarB",
|
||||
"StarG", "StarDi", "StarSi" };
|
||||
char *la_ic_names[LA_TOTNAM] = { "Energ", "R", "G", "B", "Dist", "SpoSi", "SpoBl",
|
||||
"Quad1", "Quad2", "HaInt" };
|
||||
/* yafray: two curve names added, 'Apert' for aperture, and 'FDist' for focal distance */
|
||||
char *cam_ic_names[CAM_TOTNAM] = { "Lens", "ClSta", "ClEnd", "Apert", "FDist" };
|
||||
char *snd_ic_names[SND_TOTNAM] = { "Vol", "Pitch", "Pan", "Atten" };
|
||||
char *ac_ic_names[AC_TOTNAM] = {"LocX", "LocY", "LocZ", "SizeX", "SizeY",
|
||||
"SizeZ", "QuatW", "QuatX", "QuatY", "QuatZ"};
|
||||
char *ic_name_empty[1] ={ "" };
|
||||
|
||||
char *getname_ac_ei(int nr)
|
||||
{
|
||||
switch(nr) {
|
||||
case AC_LOC_X:
|
||||
case AC_LOC_Y:
|
||||
case AC_LOC_Z:
|
||||
return ac_ic_names[nr-1];
|
||||
case AC_SIZE_X:
|
||||
case AC_SIZE_Y:
|
||||
case AC_SIZE_Z:
|
||||
return ac_ic_names[nr-10];
|
||||
case AC_QUAT_X:
|
||||
case AC_QUAT_Y:
|
||||
case AC_QUAT_Z:
|
||||
case AC_QUAT_W:
|
||||
return ac_ic_names[nr-19];
|
||||
default:
|
||||
return ic_name_empty[0]; /* empty */
|
||||
}
|
||||
}
|
||||
|
||||
char *getname_co_ei(int nr)
|
||||
{
|
||||
switch(nr){
|
||||
case CO_ENFORCE:
|
||||
return co_ic_names[nr-1];
|
||||
}
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_ob_ei(int nr, int colipo)
|
||||
{
|
||||
if(nr>=OB_LOC_X && nr <= OB_PD_PERM) return ob_ic_names[nr-1];
|
||||
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_tex_ei(int nr)
|
||||
{
|
||||
if(nr>=TE_NSIZE && nr<=TE_N_BAS2) return tex_ic_names[nr-1];
|
||||
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_mtex_ei(int nr)
|
||||
{
|
||||
if(nr>=MAP_OFS_X && nr<=MAP_DISP) return mtex_ic_names[nr-1];
|
||||
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_mat_ei(int nr)
|
||||
{
|
||||
if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
|
||||
else {
|
||||
if(nr>=MA_COL_R && nr<=MA_ADD) return ma_ic_names[nr-1];
|
||||
}
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_world_ei(int nr)
|
||||
{
|
||||
if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
|
||||
else {
|
||||
if(nr>=WO_HOR_R && nr<=WO_STARSIZE) return wo_ic_names[nr-1];
|
||||
}
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_seq_ei(int nr)
|
||||
{
|
||||
if(nr == SEQ_FAC1) return seq_ic_names[nr-1];
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_cu_ei(int nr)
|
||||
{
|
||||
if(nr==CU_SPEED) return cu_ic_names[nr-1];
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_la_ei(int nr)
|
||||
{
|
||||
if(nr>=MA_MAP1) return getname_mtex_ei((nr & (MA_MAP1-1)));
|
||||
else {
|
||||
if(nr>=LA_ENERGY && nr<=LA_HALOINT) return la_ic_names[nr-1];
|
||||
}
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_cam_ei(int nr)
|
||||
{
|
||||
/* yafray: curves extended to CAM_YF_FDIST */
|
||||
//if(nr>=CAM_LENS && nr<=CAM_END) return cam_ic_names[nr-1];
|
||||
if(nr>=CAM_LENS && nr<=CAM_YF_FDIST) return cam_ic_names[nr-1];
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
char *getname_snd_ei(int nr)
|
||||
{
|
||||
if(nr>=SND_VOLUME && nr<=SND_ATTEN) return snd_ic_names[nr-1];
|
||||
return ic_name_empty[0];
|
||||
}
|
||||
|
||||
|
||||
void boundbox_ipocurve(IpoCurve *icu)
|
||||
{
|
||||
BezTriple *bezt;
|
||||
float vec[3]={0.0,0.0,0.0};
|
||||
float min[3], max[3];
|
||||
int a;
|
||||
|
||||
if(icu->totvert) {
|
||||
INIT_MINMAX(min, max);
|
||||
|
||||
if(icu->bezt ) {
|
||||
a= icu->totvert;
|
||||
bezt= icu->bezt;
|
||||
while(a--) {
|
||||
if(icu->vartype & IPO_BITS) {
|
||||
vec[0]= bezt->vec[1][0];
|
||||
vec[1]= 0.0;
|
||||
DO_MINMAX(vec, min, max);
|
||||
|
||||
vec[1]= 16.0;
|
||||
DO_MINMAX(vec, min, max);
|
||||
}
|
||||
else {
|
||||
if(icu->ipo==IPO_BEZ && a!=icu->totvert-1) {
|
||||
DO_MINMAX(bezt->vec[0], min, max);
|
||||
}
|
||||
DO_MINMAX(bezt->vec[1], min, max);
|
||||
if(icu->ipo==IPO_BEZ && a!=0) {
|
||||
DO_MINMAX(bezt->vec[2], min, max);
|
||||
}
|
||||
}
|
||||
|
||||
bezt++;
|
||||
}
|
||||
}
|
||||
if(min[0]==max[0]) max[0]= (float)(min[0]+1.0);
|
||||
if(min[1]==max[1]) max[1]= (float)(min[1]+0.1);
|
||||
|
||||
icu->totrct.xmin= min[0];
|
||||
icu->totrct.ymin= min[1];
|
||||
icu->totrct.xmax= max[0];
|
||||
icu->totrct.ymax= max[1];
|
||||
}
|
||||
else {
|
||||
icu->totrct.xmin= icu->totrct.ymin= 0.0;
|
||||
icu->totrct.xmax= EFRA;
|
||||
icu->totrct.ymax= 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
void boundbox_ipo(Ipo *ipo, rctf *bb)
|
||||
{
|
||||
IpoCurve *icu;
|
||||
int first= 1;
|
||||
|
||||
icu= ipo->curve.first;
|
||||
while(icu) {
|
||||
|
||||
boundbox_ipocurve(icu);
|
||||
|
||||
if(first) {
|
||||
*bb= icu->totrct;
|
||||
first= 0;
|
||||
}
|
||||
else BLI_union_rctf(bb, &(icu->totrct));
|
||||
|
||||
icu= icu->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
unsigned int ipo_rainbow(int cur, int tot)
|
||||
{
|
||||
float dfac, fac, sat;
|
||||
|
||||
dfac= (float)(1.0/( (float)tot+1.0));
|
||||
|
||||
/* this calculation makes 2 or 4 different cycles of rainbow colors */
|
||||
if(cur< tot/2) fac= (float)(cur*2.0f*dfac);
|
||||
else fac= (float)((cur-tot/2)*2.0f*dfac +dfac);
|
||||
if(tot > 32) fac= fac*1.95f;
|
||||
if(fac>1.0f) fac-= 1.0f;
|
||||
|
||||
if(fac>0.5f && fac<0.8f) sat= 0.4f;
|
||||
else sat= 0.5f;
|
||||
|
||||
return hsv_to_cpack(fac, sat, 1.0f);
|
||||
}
|
||||
|
||||
/* exported to python, hrms... (ton) */
|
||||
int texchannel_to_adrcode(int channel)
|
||||
{
|
||||
switch(channel) {
|
||||
case 0: return MA_MAP1;
|
||||
case 1: return MA_MAP2;
|
||||
case 2: return MA_MAP3;
|
||||
case 3: return MA_MAP4;
|
||||
case 4: return MA_MAP5;
|
||||
case 5: return MA_MAP6;
|
||||
case 6: return MA_MAP7;
|
||||
case 7: return MA_MAP8;
|
||||
case 8: return MA_MAP9;
|
||||
case 9: return MA_MAP10;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1115
source/blender/src/editipo_mods.c
Normal file
1115
source/blender/src/editipo_mods.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -96,18 +96,20 @@ float meshslidervals[64] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
|
||||
|
||||
static IpoCurve *get_key_icu(Key *key, int keynum) {
|
||||
static IpoCurve *get_key_icu(Key *key, int keynum)
|
||||
{
|
||||
/* return the Ipocurve that has the specified
|
||||
* keynum as ardcode -- return NULL if no such
|
||||
* curve exists.
|
||||
*/
|
||||
IpoCurve *icu;
|
||||
|
||||
/* why this? (ton) */
|
||||
if (!(key->ipo)) {
|
||||
key->ipo = get_ipo((ID *)key, ID_KE, 1);
|
||||
key->ipo= add_ipo("KeyIpo", ID_KE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
for (icu = key->ipo->curve.first; icu ; icu = icu->next) {
|
||||
if (!icu->adrcode) continue;
|
||||
if (icu->adrcode == keynum) return icu;
|
||||
@@ -158,7 +160,7 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
|
||||
|
||||
cfra = frame_to_float(CFRA);
|
||||
|
||||
icu = get_key_icu(key, keynum);
|
||||
icu = verify_ipocurve(&key->id, ID_KE, NULL, NULL, keynum);
|
||||
|
||||
if (icu) {
|
||||
/* if the ipocurve exists, try to get a bezier
|
||||
@@ -166,12 +168,6 @@ static void rvk_slider_func(void *voidkey, void *voidkeynum)
|
||||
*/
|
||||
bezt = get_bezt_icu_time(icu, &cfra, &rvkval);
|
||||
}
|
||||
else {
|
||||
/* create an IpoCurve if one doesn't already
|
||||
* exist.
|
||||
*/
|
||||
icu = get_ipocurve(key->from, GS(key->from->name), keynum, key->ipo);
|
||||
}
|
||||
|
||||
/* create the bezier triple if one doesn't exist,
|
||||
* otherwise modify it's value
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -181,6 +181,7 @@ void add_object_draw(int type) /* for toolbox or menus, only non-editmode stuff
|
||||
if ELEM3(curarea->spacetype, SPACE_VIEW3D, SPACE_BUTS, SPACE_INFO) {
|
||||
if (G.obedit) exit_editmode(2); // freedata, and undo
|
||||
ob= add_object(type);
|
||||
set_active_base(BASACT);
|
||||
base_init_from_view3d(BASACT, G.vd);
|
||||
|
||||
/* only undo pushes on objects without editmode... */
|
||||
@@ -3541,8 +3542,10 @@ void std_rmouse_transform(void (*xf_func)(int, int))
|
||||
PIL_sleep_ms(10);
|
||||
timer++;
|
||||
if(timer>=10*U.tb_rightmouse) {
|
||||
toolbox_n();
|
||||
return;
|
||||
if(curarea->spacetype==SPACE_VIEW3D) {
|
||||
toolbox_n();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1041,11 +1041,13 @@ void set_active_base(Base *base)
|
||||
set_active_group();
|
||||
|
||||
/* signal to ipo */
|
||||
if (base) {
|
||||
allqueue(REDRAWIPO, base->object->ipowin);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
allqueue(REDRAWIPO, base->object->ipowin);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
|
||||
/* signal to action */
|
||||
select_actionchannel_by_name(base->object->action, "Object", 1);
|
||||
|
||||
/* disable temporal locks */
|
||||
for(tbase=FIRSTBASE; tbase; tbase= tbase->next) {
|
||||
if(base!=tbase && (tbase->object->shapeflag & OB_SHAPE_TEMPLOCK)) {
|
||||
|
||||
@@ -377,6 +377,28 @@ struct gla2DDrawInfo {
|
||||
float wo_to_sc[2];
|
||||
};
|
||||
|
||||
void gla2DGetMap(gla2DDrawInfo *di, rctf *rect)
|
||||
{
|
||||
*rect= di->world_rect;
|
||||
}
|
||||
|
||||
void gla2DSetMap(gla2DDrawInfo *di, rctf *rect)
|
||||
{
|
||||
int sc_w, sc_h;
|
||||
float wo_w, wo_h;
|
||||
|
||||
di->world_rect= *rect;
|
||||
|
||||
sc_w= (di->screen_rect.xmax-di->screen_rect.xmin);
|
||||
sc_h= (di->screen_rect.ymax-di->screen_rect.ymin);
|
||||
wo_w= (di->world_rect.xmax-di->world_rect.xmin);
|
||||
wo_h= (di->world_rect.ymax-di->world_rect.ymin);
|
||||
|
||||
di->wo_to_sc[0]= sc_w/wo_w;
|
||||
di->wo_to_sc[1]= sc_h/wo_h;
|
||||
}
|
||||
|
||||
|
||||
gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect)
|
||||
{
|
||||
gla2DDrawInfo *di= MEM_mallocN(sizeof(*di), "gla2DDrawInfo");
|
||||
|
||||
@@ -395,7 +395,7 @@ static void do_action_keymenu_transformmenu(void *arg, int event)
|
||||
transform_meshchannel_keys('g', key);
|
||||
}
|
||||
else if (act) {
|
||||
transform_actionchannel_keys ('g');
|
||||
transform_actionchannel_keys ('g', 0);
|
||||
}
|
||||
break;
|
||||
case ACTMENU_KEY_TRANSFORM_SCALE:
|
||||
@@ -403,7 +403,7 @@ static void do_action_keymenu_transformmenu(void *arg, int event)
|
||||
transform_meshchannel_keys('s', key);
|
||||
}
|
||||
else if (act) {
|
||||
transform_actionchannel_keys ('s');
|
||||
transform_actionchannel_keys ('s', 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -743,30 +743,24 @@ void action_buttons(void)
|
||||
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
// object action is allowed to be zero!
|
||||
/* (ton) commented out below line, since people can apparently link Action to any object (mesh) and
|
||||
not unlink anymore when theres a mesh key. Needs to be rethought this stuff! */
|
||||
//if (!get_action_mesh_key()) {
|
||||
/* NAME ETC */
|
||||
ob=OBACT;
|
||||
from = (ID*) ob;
|
||||
|
||||
xco= std_libbuttons(block, xco, 0, B_ACTPIN, &G.saction->pin,
|
||||
B_ACTIONBROWSE, (ID*)G.saction->action,
|
||||
from, &(G.saction->actnr), B_ACTALONE,
|
||||
B_ACTLOCAL, B_ACTIONDELETE, 0, 0);
|
||||
|
||||
/* Draw action baker */
|
||||
xco+= 8;
|
||||
|
||||
/* NAME ETC */
|
||||
ob=OBACT;
|
||||
from = (ID*) ob;
|
||||
uiDefBut(block, BUT, B_ACTBAKE,
|
||||
"Bake", xco, 0, 64, YIC, 0, 0, 0, 0, 0,
|
||||
"Create an action with the constraint effects "
|
||||
"converted into Ipo keys");
|
||||
xco+=64;
|
||||
|
||||
xco= std_libbuttons(block, xco, 0, B_ACTPIN, &G.saction->pin,
|
||||
B_ACTIONBROWSE, (ID*)G.saction->action,
|
||||
from, &(G.saction->actnr), B_ACTALONE,
|
||||
B_ACTLOCAL, B_ACTIONDELETE, 0, 0);
|
||||
|
||||
/* Draw action baker */
|
||||
xco+= 8;
|
||||
|
||||
uiDefBut(block, BUT, B_ACTBAKE,
|
||||
"Bake", xco, 0, 64, YIC, 0, 0, 0, 0, 0,
|
||||
"Create an action with the constraint effects "
|
||||
"converted into Ipo keys");
|
||||
xco+=64;
|
||||
|
||||
//}
|
||||
uiClearButLock();
|
||||
|
||||
/* draw LOCK */
|
||||
|
||||
@@ -43,34 +43,47 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_camera_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_constraint_types.h"
|
||||
#include "DNA_ID.h"
|
||||
#include "DNA_ipo_types.h"
|
||||
#include "DNA_key_types.h"
|
||||
#include "DNA_lamp_types.h"
|
||||
#include "DNA_material_types.h"
|
||||
#include "DNA_object_types.h"
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_texture_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_sequence_types.h"
|
||||
#include "DNA_sound_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_mainqueue.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_constraint.h"
|
||||
#include "BKE_global.h"
|
||||
#include "BKE_main.h"
|
||||
#include "BKE_material.h"
|
||||
#include "BKE_texture.h"
|
||||
#include "BKE_utildefines.h"
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "BSE_drawipo.h"
|
||||
#include "BSE_editipo_types.h"
|
||||
#include "BSE_edit.h"
|
||||
#include "BSE_editipo.h"
|
||||
#include "BSE_headerbuttons.h"
|
||||
|
||||
#include "BIF_editaction.h"
|
||||
#include "BIF_interface.h"
|
||||
#include "BIF_mainqueue.h"
|
||||
#include "BIF_resources.h"
|
||||
#include "BIF_screen.h"
|
||||
#include "BIF_space.h"
|
||||
|
||||
#include "nla.h"
|
||||
|
||||
#include "blendef.h"
|
||||
@@ -79,6 +92,154 @@
|
||||
static int viewmovetemp = 0;
|
||||
extern int totipo_edit, totipo_sel;
|
||||
|
||||
/* headerbutton call, assuming full context is set */
|
||||
/* it aligns with editipo.c, verify_ipo */
|
||||
void spaceipo_assign_ipo(SpaceIpo *si, Ipo *ipo)
|
||||
{
|
||||
if(si->from==NULL || si->from->lib) return;
|
||||
|
||||
if(ipo) ipo->id.us++;
|
||||
|
||||
/* first check action ipos */
|
||||
if(si->actname && si->actname[0]) {
|
||||
Object *ob= (Object *)si->from;
|
||||
bActionChannel *achan;
|
||||
|
||||
if(ob->action) {
|
||||
achan= get_action_channel(ob->action, si->actname);
|
||||
|
||||
if(achan) {
|
||||
/* constraint exception */
|
||||
if(si->blocktype==ID_CO) {
|
||||
bConstraintChannel *conchan= get_constraint_channel(&achan->constraintChannels, si->constname);
|
||||
if(conchan) {
|
||||
if(conchan->ipo)
|
||||
conchan->ipo->id.us--;
|
||||
conchan->ipo= ipo;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(achan->ipo)
|
||||
achan->ipo->id.us--;
|
||||
achan->ipo= ipo;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(GS(si->from->name)) {
|
||||
case ID_OB:
|
||||
{
|
||||
Object *ob= (Object *)si->from;
|
||||
/* constraint exception */
|
||||
if(si->blocktype==ID_CO) {
|
||||
bConstraintChannel *conchan= get_constraint_channel(&ob->constraintChannels, si->constname);
|
||||
if(conchan) {
|
||||
if(conchan->ipo)
|
||||
conchan->ipo->id.us--;
|
||||
conchan->ipo= ipo;
|
||||
}
|
||||
}
|
||||
else if(si->blocktype==ID_OB) {
|
||||
if(ob->ipo)
|
||||
ob->ipo->id.us--;
|
||||
ob->ipo= ipo;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ID_MA:
|
||||
{
|
||||
Material *ma= (Material *)si->from;
|
||||
|
||||
if(ma->ipo)
|
||||
ma->ipo->id.us--;
|
||||
ma->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_TE:
|
||||
{
|
||||
Tex *tex= (Tex *)si->from;
|
||||
|
||||
if(tex->ipo)
|
||||
tex->ipo->id.us--;
|
||||
tex->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_SEQ:
|
||||
{
|
||||
Sequence *seq= (Sequence *)si->from; /* note, sequence is mimicing Id */
|
||||
|
||||
if((seq->type & SEQ_EFFECT)||(seq->type == SEQ_SOUND)) {
|
||||
if(seq->ipo)
|
||||
seq->ipo->id.us--;
|
||||
seq->ipo= ipo;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ID_CU:
|
||||
{
|
||||
Curve *cu= (Curve *)si->from;
|
||||
|
||||
if(cu->ipo)
|
||||
cu->ipo->id.us--;
|
||||
cu->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_KE:
|
||||
{
|
||||
Key *key= (Key *)si->from;
|
||||
|
||||
if(key->ipo)
|
||||
key->ipo->id.us--;
|
||||
key->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_WO:
|
||||
{
|
||||
World *wo= (World *)si->from;
|
||||
|
||||
if(wo->ipo)
|
||||
wo->ipo->id.us--;
|
||||
wo->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_LA:
|
||||
{
|
||||
Lamp *la= (Lamp *)si->from;
|
||||
|
||||
if(la->ipo)
|
||||
la->ipo->id.us--;
|
||||
la->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_CA:
|
||||
{
|
||||
Camera *ca= (Camera *)si->from;
|
||||
|
||||
if(ca->ipo)
|
||||
ca->ipo->id.us--;
|
||||
ca->ipo= ipo;
|
||||
}
|
||||
break;
|
||||
case ID_SO:
|
||||
{
|
||||
bSound *snd= (bSound *)si->from;
|
||||
|
||||
if(snd->ipo)
|
||||
snd->ipo->id.us--;
|
||||
snd->ipo= ipo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
allqueue(REDRAWBUTSALL, 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void do_ipo_editmenu_transformmenu(void *arg, int event)
|
||||
{
|
||||
@@ -203,7 +364,7 @@ static uiBlock *ipo_editmenu_keymenu(void *arg_unused)
|
||||
block= uiNewBlock(&curarea->uiblocks, "ipo_editmenu_keymenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
|
||||
uiBlockSetButmFunc(block, do_ipo_editmenu_keymenu, NULL);
|
||||
|
||||
ei = get_editipo();
|
||||
ei = get_active_editipo();
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Linear", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Cardinal", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
|
||||
@@ -475,10 +636,10 @@ static void do_ipo_viewmenu(void *arg, int event)
|
||||
case 5:
|
||||
mainqenter(PADMINUS,1);
|
||||
break;
|
||||
case 6: /* Play Back Animation */
|
||||
case 6: /* Play Animation */
|
||||
play_anim(0);
|
||||
break;
|
||||
case 7: /* Play Back Animation in All */
|
||||
case 7: /* Play Animation in All */
|
||||
play_anim(1);
|
||||
break;
|
||||
case 8:
|
||||
@@ -493,7 +654,7 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
|
||||
EditIpo *ei;
|
||||
short yco= 0, menuwidth=120;
|
||||
|
||||
ei = get_editipo();
|
||||
ei = get_active_editipo();
|
||||
|
||||
block= uiNewBlock(&curarea->uiblocks, "ipo_viewmenu", UI_EMBOSSP, UI_HELV, curarea->headwin);
|
||||
uiBlockSetButmFunc(block, do_ipo_viewmenu, NULL);
|
||||
@@ -512,9 +673,9 @@ static uiBlock *ipo_viewmenu(void *arg_unused)
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation|Alt A", 0, yco-=20,
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Animation|Alt A", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Back Animation in 3D View|Alt Shift A", 0, yco-=20,
|
||||
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Play Animation in 3D View|Alt Shift A", 0, yco-=20,
|
||||
menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
|
||||
|
||||
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
|
||||
@@ -582,6 +743,7 @@ static uiBlock *ipo_selectmenu(void *arg_unused)
|
||||
|
||||
static char *ipo_modeselect_pup(void)
|
||||
{
|
||||
Object *ob= OBACT;
|
||||
static char string[1024];
|
||||
char tmpstr[1024];
|
||||
char formatstring[1024];
|
||||
@@ -590,12 +752,12 @@ static char *ipo_modeselect_pup(void)
|
||||
|
||||
strcpy(formatstring, "|%s %%x%d %%i%d");
|
||||
|
||||
if(OBACT) {
|
||||
if(ob) {
|
||||
sprintf(tmpstr,formatstring,"Object",ID_OB, ICON_OBJECT);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT && give_current_material(OBACT, OBACT->actcol)) { // check for material
|
||||
if(ob && give_current_material(ob, ob->actcol)) { // check for material
|
||||
sprintf(tmpstr,formatstring,"Material",ID_MA, ICON_MATERIAL);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
@@ -605,37 +767,37 @@ static char *ipo_modeselect_pup(void)
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT && OBACT->type==OB_CURVE) {
|
||||
if(ob && ob->type==OB_CURVE) {
|
||||
sprintf(tmpstr,formatstring,"Path",ID_CU, ICON_CURVE);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT && OBACT->type==OB_CAMERA) {
|
||||
if(ob && ob->type==OB_CAMERA) {
|
||||
sprintf(tmpstr,formatstring,"Camera",ID_CA, ICON_CAMERA);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT && OBACT->type==OB_LAMP) {
|
||||
if(ob && ob->type==OB_LAMP) {
|
||||
sprintf(tmpstr,formatstring,"Lamp",ID_LA, ICON_LAMP);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT && give_current_texture(OBACT, OBACT->actcol)) {
|
||||
if(ob && give_current_texture(ob, ob->actcol)) {
|
||||
sprintf(tmpstr,formatstring,"Texture",ID_TE, ICON_TEXTURE);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
|
||||
if(OBACT){
|
||||
if ELEM4(OBACT->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) {
|
||||
if(ob){
|
||||
if ELEM4(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_LATTICE) {
|
||||
sprintf(tmpstr,formatstring,"Shape",ID_KE, ICON_EDIT);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
if (OBACT->action){
|
||||
sprintf(tmpstr,formatstring,"Action",ID_AC, ICON_ACTION);
|
||||
if (ob->type==OB_ARMATURE){
|
||||
sprintf(tmpstr,formatstring,"Pose",ID_PO, ICON_POSE_HLT);
|
||||
strcat(string,tmpstr);
|
||||
}
|
||||
#ifdef __CON_IPO
|
||||
sprintf(tmpstr,formatstring,"Constraint",IPO_CO, ICON_CONSTRAINT);
|
||||
sprintf(tmpstr,formatstring,"Constraint",ID_CO, ICON_CONSTRAINT);
|
||||
strcat(string,tmpstr);
|
||||
#endif
|
||||
}
|
||||
@@ -652,6 +814,7 @@ void do_ipo_buttons(short event)
|
||||
EditIpo *ei;
|
||||
View2D *v2d;
|
||||
rcti rect;
|
||||
Object *ob= OBACT;
|
||||
float xmin, ymin, dx, dy;
|
||||
int a, val, first;
|
||||
short mval[2];
|
||||
@@ -744,10 +907,9 @@ void do_ipo_buttons(short event)
|
||||
set_exprap_ipo(IPO_CYCLX);
|
||||
break;
|
||||
case B_IPOMAIN:
|
||||
make_editipo();
|
||||
scrarea_queue_winredraw(curarea);
|
||||
scrarea_queue_headredraw(curarea);
|
||||
|
||||
if(ob) ob->ipowin= G.sipo->blocktype;
|
||||
break;
|
||||
case B_IPOSHOWKEY:
|
||||
/* reverse value because of winqread */
|
||||
@@ -762,7 +924,53 @@ void do_ipo_buttons(short event)
|
||||
view2dzoom(event);
|
||||
scrarea_queue_headredraw(curarea);
|
||||
break;
|
||||
|
||||
case B_IPO_ACTION_OB:
|
||||
if(ob && G.sipo->from && G.sipo->pin==0) {
|
||||
if(ob->ipoflag & OB_ACTION_OB) { /* check if channel exists, and flip ipo link */
|
||||
bActionChannel *achan;
|
||||
|
||||
if(ob->action==NULL)
|
||||
ob->action= add_empty_action(ID_OB);
|
||||
achan= verify_action_channel(ob->action, "Object");
|
||||
if(achan->ipo==NULL && ob->ipo) {
|
||||
achan->ipo= ob->ipo;
|
||||
ob->ipo= NULL;
|
||||
}
|
||||
|
||||
/* object constraints */
|
||||
if(ob->constraintChannels.first) {
|
||||
free_constraint_channels(&achan->constraintChannels);
|
||||
achan->constraintChannels= ob->constraintChannels;
|
||||
ob->constraintChannels.first= ob->constraintChannels.last= NULL;
|
||||
}
|
||||
}
|
||||
else if(ob->action) {
|
||||
bActionChannel *achan= get_action_channel(ob->action, "Object");
|
||||
if(achan) {
|
||||
|
||||
if(achan->ipo && ob->ipo==NULL) {
|
||||
ob->ipo= achan->ipo;
|
||||
achan->ipo= NULL;
|
||||
}
|
||||
|
||||
/* object constraints */
|
||||
if(achan->constraintChannels.first) {
|
||||
free_constraint_channels(&ob->constraintChannels);
|
||||
ob->constraintChannels= achan->constraintChannels;
|
||||
achan->constraintChannels.first= achan->constraintChannels.last= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWOOPS, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
break;
|
||||
case B_IPO_ACTION_KEY:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -770,7 +978,6 @@ void ipo_buttons(void)
|
||||
{
|
||||
Object *ob;
|
||||
EditIpo *ei;
|
||||
ID *id, *from;
|
||||
uiBlock *block;
|
||||
short xco,xmax;
|
||||
char naam[20];
|
||||
@@ -807,7 +1014,7 @@ void ipo_buttons(void)
|
||||
if((curarea->flag & HEADER_NO_PULLDOWN)==0) {
|
||||
uiBlockSetEmboss(block, UI_EMBOSSP);
|
||||
|
||||
ei = get_editipo();
|
||||
ei = get_active_editipo();
|
||||
|
||||
xmax= GetButStringLength("View");
|
||||
uiDefPulldownBut(block,ipo_viewmenu, NULL, "View", xco, -2, xmax-3, 24, "");
|
||||
@@ -836,10 +1043,45 @@ void ipo_buttons(void)
|
||||
/* end of pull down menus */
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
/* mainmenu, only when data is there and no pin */
|
||||
ob= OBACT;
|
||||
|
||||
/* action switch option, only when active object is there and no pin */
|
||||
uiSetButLock(G.sipo->pin, "Can't change because of pinned data");
|
||||
|
||||
ob= OBACT;
|
||||
/* define whether ipos are on Object or on action */
|
||||
if(ob) {
|
||||
static short fake1= 1;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
|
||||
if(G.sipo->blocktype==ID_OB) {
|
||||
uiDefIconButBitS(block, TOG, OB_ACTION_OB, B_IPO_ACTION_OB, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
|
||||
xco+= XIC;
|
||||
}
|
||||
else if(G.sipo->blocktype==ID_KE) {
|
||||
uiDefIconButBitS(block, TOG, OB_ACTION_KEY, B_IPO_ACTION_KEY, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
|
||||
xco+= XIC;
|
||||
}
|
||||
else if(G.sipo->blocktype==ID_CO) {
|
||||
|
||||
if(G.sipo->from && G.sipo->actname[0]==0)
|
||||
uiDefIconButBitS(block, TOG, OB_ACTION_OB, B_IPO_ACTION_OB, ICON_ACTION, xco,0,XIC,YIC, &(ob->ipoflag), 0, 0, 0, 0, "Sets Ipo to be included in an Action or not");
|
||||
else {
|
||||
uiSetButLock(1, "Pose Constraint Ipo cannot be switched");
|
||||
uiDefIconButS(block, TOG, 1, ICON_ACTION, xco,0,XIC,YIC, &fake1, 0, 0, 0, 0, "Ipo is connected to Pose Action");
|
||||
}
|
||||
xco+= XIC;
|
||||
}
|
||||
else if(G.sipo->blocktype==ID_PO) { /* only to indicate we have action ipos */
|
||||
uiSetButLock(1, "Pose Action Ipo cannot be switched");
|
||||
uiDefIconButS(block, TOG, 1, ICON_ACTION, xco,0,XIC,YIC, &fake1, 0, 0, 0, 0, "Ipo is connected to Pose Action");
|
||||
xco+= XIC;
|
||||
}
|
||||
uiClearButLock();
|
||||
}
|
||||
|
||||
/* mainmenu, only when data is there and no pin */
|
||||
uiSetButLock(G.sipo->pin, "Can't change because of pinned data");
|
||||
|
||||
if (G.sipo->blocktype == ID_OB)
|
||||
icon = ICON_OBJECT;
|
||||
@@ -855,9 +1097,9 @@ void ipo_buttons(void)
|
||||
icon = ICON_LAMP;
|
||||
else if (G.sipo->blocktype == ID_KE)
|
||||
icon = ICON_EDIT;
|
||||
else if (G.sipo->blocktype == ID_AC)
|
||||
icon = ICON_ACTION;
|
||||
else if (G.sipo->blocktype == IPO_CO)
|
||||
else if (G.sipo->blocktype == ID_PO)
|
||||
icon = ICON_POSE_HLT;
|
||||
else if (G.sipo->blocktype == ID_CO)
|
||||
icon = ICON_CONSTRAINT;
|
||||
else if (G.sipo->blocktype == ID_SEQ)
|
||||
icon = ICON_SEQUENCE;
|
||||
@@ -882,25 +1124,22 @@ void ipo_buttons(void)
|
||||
xco-= 4;
|
||||
}
|
||||
|
||||
uiBlockEndAlign(block);
|
||||
|
||||
uiClearButLock();
|
||||
|
||||
/* NAME ETC */
|
||||
id= (ID *)get_ipo_to_edit(&from);
|
||||
|
||||
xco= std_libbuttons(block, (short)(xco+1.5*XIC), 0, B_IPOPIN, &G.sipo->pin, B_IPOBROWSE, (ID*)G.sipo->ipo, from, &(G.sipo->menunr), B_IPOALONE, B_IPOLOCAL, B_IPODELETE, 0, B_KEEPDATA);
|
||||
|
||||
uiSetButLock(id && id->lib, "Can't edit library data");
|
||||
xco= std_libbuttons(block, (short)(xco+1.5*XIC), 0, B_IPOPIN, &G.sipo->pin, B_IPOBROWSE, (ID*)G.sipo->ipo, G.sipo->from, &(G.sipo->menunr), B_IPOALONE, B_IPOLOCAL, B_IPODELETE, 0, B_KEEPDATA);
|
||||
|
||||
/* COPY PASTE */
|
||||
xco-= XIC/2;
|
||||
if(curarea->headertype==HEADERTOP) {
|
||||
uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
|
||||
uiSetButLock(id && id->lib, "Can't edit library data");
|
||||
uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
|
||||
uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEUP, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
|
||||
}
|
||||
else {
|
||||
uiDefIconBut(block, BUT, B_IPOCOPY, ICON_COPYDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Copies the selected curves to the buffer");
|
||||
uiSetButLock(id && id->lib, "Can't edit library data");
|
||||
uiSetButLock(G.sipo->ipo && G.sipo->ipo->id.lib, "Can't edit library data");
|
||||
uiDefIconBut(block, BUT, B_IPOPASTE, ICON_PASTEDOWN, xco+=XIC,0,XIC,YIC, 0, 0, 0, 0, 0, "Pastes the curves from the buffer");
|
||||
}
|
||||
xco+=XIC/2;
|
||||
|
||||
@@ -207,11 +207,11 @@ static void do_nla_strip_transformmenu(void *arg, int event)
|
||||
{
|
||||
switch(event) {
|
||||
case 0: /* grab/move */
|
||||
transform_nlachannel_keys ('g');
|
||||
transform_nlachannel_keys ('g', 0);
|
||||
update_for_newframe_muted();
|
||||
break;
|
||||
case 1: /* scale */
|
||||
transform_nlachannel_keys ('s');
|
||||
transform_nlachannel_keys ('s', 0);
|
||||
update_for_newframe_muted();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -634,14 +634,12 @@ void do_global_buttons(unsigned short event)
|
||||
Ipo *ipo;
|
||||
Lamp *la;
|
||||
World *wrld;
|
||||
Sequence *seq;
|
||||
bAction *act;
|
||||
ID *id, *idtest, *from;
|
||||
ID *id, *idtest, *from=NULL;
|
||||
ScrArea *sa;
|
||||
int nr= 1;
|
||||
char buf[FILE_MAXDIR+FILE_MAXFILE];
|
||||
|
||||
|
||||
ob= OBACT;
|
||||
|
||||
id= NULL; /* id at null for texbrowse */
|
||||
@@ -966,7 +964,7 @@ void do_global_buttons(unsigned short event)
|
||||
if (act)
|
||||
idtest= (ID *)copy_action(act);
|
||||
else
|
||||
idtest=(ID *)add_empty_action();
|
||||
idtest=(ID *)add_empty_action(ob->type==OB_ARMATURE?ID_PO:ID_OB);
|
||||
idtest->us--;
|
||||
}
|
||||
|
||||
@@ -992,9 +990,10 @@ void do_global_buttons(unsigned short event)
|
||||
break;
|
||||
case B_IPOBROWSE:
|
||||
|
||||
ipo= get_ipo_to_edit(&from);
|
||||
ipo= G.sipo->ipo;
|
||||
from= G.sipo->from;
|
||||
id= (ID *)ipo;
|
||||
if(from==0) return;
|
||||
if(from==NULL) return;
|
||||
|
||||
if(G.sipo->menunr== -2) {
|
||||
activate_databrowse((ID *)G.sipo->ipo, ID_IP, GS(from->name), B_IPOBROWSE, &G.sipo->menunr, do_global_buttons);
|
||||
@@ -1026,13 +1025,10 @@ void do_global_buttons(unsigned short event)
|
||||
if(idtest==0) {
|
||||
if(ipo) idtest= (ID *)copy_ipo(ipo);
|
||||
else {
|
||||
nr= GS(from->name);
|
||||
if(nr==ID_OB){
|
||||
if (G.sipo->blocktype==IPO_CO)
|
||||
idtest= (ID *)add_ipo("CoIpo", IPO_CO); /* constraint channel is no ID data... */
|
||||
else
|
||||
idtest= (ID *)add_ipo("ObIpo", nr);
|
||||
}
|
||||
nr= G.sipo->blocktype;
|
||||
if(nr==ID_OB) idtest= (ID *)add_ipo("ObIpo", ID_OB);
|
||||
else if(nr==ID_CO) idtest= (ID *)add_ipo("CoIpo", ID_CO);
|
||||
else if(nr==ID_PO) idtest= (ID *)add_ipo("ActIpo", nr);
|
||||
else if(nr==ID_MA) idtest= (ID *)add_ipo("MatIpo", nr);
|
||||
else if(nr==ID_TE) idtest= (ID *)add_ipo("TexIpo", nr);
|
||||
else if(nr==ID_SEQ) idtest= (ID *)add_ipo("MatSeq", nr);
|
||||
@@ -1042,136 +1038,26 @@ void do_global_buttons(unsigned short event)
|
||||
else if(nr==ID_LA) idtest= (ID *)add_ipo("LaIpo", nr);
|
||||
else if(nr==ID_CA) idtest= (ID *)add_ipo("CaIpo", nr);
|
||||
else if(nr==ID_SO) idtest= (ID *)add_ipo("SndIpo", nr);
|
||||
else if(nr==ID_AC) idtest= (ID *)add_ipo("ActIpo", nr);
|
||||
else error("Warn bugtracker!");
|
||||
}
|
||||
idtest->us--;
|
||||
}
|
||||
if(idtest!=id && from) {
|
||||
ipo= (Ipo *)idtest;
|
||||
|
||||
if (ipo->blocktype==IPO_CO){
|
||||
bConstraintChannel *chan= get_active_constraint_channel((Object*)from);
|
||||
if(chan) {
|
||||
chan->ipo = ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
}
|
||||
else if(ipo->blocktype==ID_OB) {
|
||||
( (Object *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_AC) {
|
||||
bActionChannel *chan;
|
||||
chan = get_hilighted_action_channel ((bAction*)from);
|
||||
if (!chan){
|
||||
error ("Create an action channel first");
|
||||
return;
|
||||
}
|
||||
chan->ipo=ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_MA) {
|
||||
( (Material *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSSHADING, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_TE) {
|
||||
( (Tex *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSSHADING, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_SEQ) {
|
||||
seq= (Sequence *)from;
|
||||
if((seq->type & SEQ_EFFECT)||(seq->type == SEQ_SOUND)) {
|
||||
id_us_plus(idtest);
|
||||
seq->ipo= ipo;
|
||||
}
|
||||
}
|
||||
else if(ipo->blocktype==ID_CU) {
|
||||
( (Curve *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_KE) {
|
||||
( (Key *)from)->ipo= ipo;
|
||||
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWVIEW3D, 0);
|
||||
|
||||
}
|
||||
else if(ipo->blocktype==ID_WO) {
|
||||
( (World *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSSHADING, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_LA) {
|
||||
( (Lamp *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSSHADING, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_CA) {
|
||||
( (Camera *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
}
|
||||
else if(ipo->blocktype==ID_SO) {
|
||||
( (bSound *)from)->ipo= ipo;
|
||||
id_us_plus(idtest);
|
||||
allqueue(REDRAWBUTSEDIT, 0);
|
||||
}
|
||||
else
|
||||
printf("error in browse ipo \n");
|
||||
|
||||
if(id) id->us--;
|
||||
|
||||
spaceipo_assign_ipo(G.sipo, (Ipo *)idtest);
|
||||
|
||||
BIF_undo_push("Browse Ipo");
|
||||
scrarea_queue_winredraw(curarea);
|
||||
scrarea_queue_headredraw(curarea);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case B_IPODELETE:
|
||||
ipo= get_ipo_to_edit(&from);
|
||||
if(from==0) return;
|
||||
ipo= G.sipo->ipo;
|
||||
from= G.sipo->from;
|
||||
|
||||
ipo->id.us--;
|
||||
|
||||
if(ipo->blocktype==ID_OB) ( (Object *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_MA) ( (Material *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_TE) ( (Tex *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_SEQ) ( (Sequence *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_CU) ( (Curve *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_KE) ( (Key *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_LA) ( (Lamp *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_WO) ( (World *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_CA) ( (Camera *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_SO) ( (bSound *)from)->ipo= NULL;
|
||||
else if(ipo->blocktype==ID_AC) {
|
||||
bAction *act = (bAction*) from;
|
||||
bActionChannel *chan =
|
||||
get_hilighted_action_channel((bAction*)from);
|
||||
BLI_freelinkN (&act->chanbase, chan);
|
||||
}
|
||||
else if(ipo->blocktype==IPO_CO) {
|
||||
bConstraintChannel *chan= get_active_constraint_channel((Object*)from);
|
||||
if(chan) chan->ipo= NULL;
|
||||
}
|
||||
else error("Warn bugtracker!");
|
||||
spaceipo_assign_ipo(G.sipo, NULL);
|
||||
|
||||
editipo_changed(G.sipo, 1); /* doredraw */
|
||||
|
||||
BIF_undo_push("Unlink Ipo");
|
||||
allqueue(REDRAWIPO, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
allqueue (REDRAWACTION, 0);
|
||||
|
||||
break;
|
||||
case B_WORLDBROWSE:
|
||||
@@ -1616,6 +1502,8 @@ void do_global_buttons(unsigned short event)
|
||||
scrarea_queue_headredraw(curarea);
|
||||
allqueue(REDRAWINFO, 1);
|
||||
allqueue(REDRAWOOPS, 1);
|
||||
allqueue(REDRAWACTION, 1);
|
||||
allqueue(REDRAWNLA, 1);
|
||||
/* name scene also in set PUPmenu */
|
||||
allqueue(REDRAWBUTSALL, 0);
|
||||
allqueue(REDRAWHEADERS, 0);
|
||||
@@ -1973,9 +1861,10 @@ void do_global_buttons2(short event)
|
||||
break;
|
||||
|
||||
case B_IPOALONE:
|
||||
ipo= get_ipo_to_edit(&idfrom);
|
||||
ipo= G.sipo->ipo;
|
||||
idfrom= G.sipo->from;
|
||||
|
||||
if(idfrom && idfrom->lib==0) {
|
||||
if(idfrom && idfrom->lib==NULL) {
|
||||
if(ipo->id.us>1) {
|
||||
if(okee("Single user")) {
|
||||
if(ipo->blocktype==ID_OB) ((Object *)idfrom)->ipo= copy_ipo(ipo);
|
||||
@@ -1990,7 +1879,7 @@ void do_global_buttons2(short event)
|
||||
else if(ipo->blocktype==ID_SO) ((bSound *)idfrom)->ipo= copy_ipo(ipo);
|
||||
else if(ipo->blocktype==ID_AC)
|
||||
get_hilighted_action_channel((bAction *)idfrom)->ipo= copy_ipo(ipo);
|
||||
else if(ipo->blocktype==IPO_CO)
|
||||
else if(ipo->blocktype==ID_CO)
|
||||
get_active_constraint_channel((Object*)idfrom)->ipo= copy_ipo(ipo);
|
||||
else error("Warn bugtracker!");
|
||||
|
||||
@@ -2001,7 +1890,8 @@ void do_global_buttons2(short event)
|
||||
}
|
||||
break;
|
||||
case B_IPOLOCAL:
|
||||
ipo= get_ipo_to_edit(&idfrom);
|
||||
ipo= G.sipo->ipo;
|
||||
idfrom= G.sipo->from;
|
||||
|
||||
if(idfrom && idfrom->lib==0) {
|
||||
if(ipo->id.lib) {
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include "BDR_editobject.h"
|
||||
|
||||
#include "BSE_edit.h"
|
||||
#include "BSE_editipo.h"
|
||||
|
||||
#include "mydevice.h"
|
||||
#include "blendef.h"
|
||||
@@ -493,7 +494,6 @@ void paste_posebuf (int flip)
|
||||
Object *ob= OBACT;
|
||||
bPoseChannel *chan, *pchan;
|
||||
float eul[4];
|
||||
int newchan = 0;
|
||||
char name[32];
|
||||
|
||||
if (!ob || !ob->pose)
|
||||
@@ -533,22 +533,23 @@ void paste_posebuf (int flip)
|
||||
}
|
||||
|
||||
if (G.flags & G_RECORDKEYS){
|
||||
ID *id= &ob->id;
|
||||
/* Set keys on pose */
|
||||
if (chan->flag & POSE_ROT){
|
||||
set_action_key(ob->action, pchan, AC_QUAT_X, newchan);
|
||||
set_action_key(ob->action, pchan, AC_QUAT_Y, newchan);
|
||||
set_action_key(ob->action, pchan, AC_QUAT_Z, newchan);
|
||||
set_action_key(ob->action, pchan, AC_QUAT_W, newchan);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_QUAT_X);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_QUAT_Y);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_QUAT_Z);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_QUAT_W);
|
||||
}
|
||||
if (chan->flag & POSE_SIZE){
|
||||
set_action_key(ob->action, pchan, AC_SIZE_X, newchan);
|
||||
set_action_key(ob->action, pchan, AC_SIZE_Y, newchan);
|
||||
set_action_key(ob->action, pchan, AC_SIZE_Z, newchan);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_SIZE_X);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_SIZE_Y);
|
||||
insertkey(id, ID_AC, chan->name, NULL, AC_SIZE_Z);
|
||||
}
|
||||
if (chan->flag & POSE_LOC){
|
||||
set_action_key(ob->action, pchan, AC_LOC_X, newchan);
|
||||
set_action_key(ob->action, pchan, AC_LOC_Y, newchan);
|
||||
set_action_key(ob->action, pchan, AC_LOC_Z, newchan);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_X);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_Y);
|
||||
insertkey(id, ID_AC, pchan->name, NULL, AC_LOC_Z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -812,7 +812,11 @@ char *BIF_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
|
||||
cp= ts->bone_solid; break;
|
||||
case TH_BONE_POSE:
|
||||
cp= ts->bone_pose; break;
|
||||
|
||||
case TH_STRIP:
|
||||
cp= ts->strip; break;
|
||||
case TH_STRIP_SELECT:
|
||||
cp= ts->strip_select; break;
|
||||
|
||||
case TH_SYNTAX_B:
|
||||
cp= ts->syntaxb; break;
|
||||
case TH_SYNTAX_V:
|
||||
@@ -962,6 +966,8 @@ void BIF_InitTheme(void)
|
||||
SETCOL(btheme->tnla.shade1, 172, 172, 172, 255); // sliders
|
||||
SETCOL(btheme->tnla.shade2, 84, 44, 31, 100); // bar
|
||||
SETCOL(btheme->tnla.hilite, 17, 27, 60, 100); // bar
|
||||
SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
|
||||
SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
|
||||
|
||||
/* space seq */
|
||||
btheme->tseq= btheme->tv3d;
|
||||
@@ -1088,6 +1094,8 @@ char *BIF_ThemeColorsPup(int spacetype)
|
||||
sprintf(str, "View Sliders %%x%d|", TH_SHADE1); strcat(cp, str);
|
||||
sprintf(str, "Bars %%x%d|", TH_SHADE2); strcat(cp, str);
|
||||
sprintf(str, "Bars selected %%x%d|", TH_HILITE); strcat(cp, str);
|
||||
sprintf(str, "Strips %%x%d|", TH_STRIP); strcat(cp, str);
|
||||
sprintf(str, "Strips selected %%x%d|", TH_STRIP_SELECT); strcat(cp, str);
|
||||
}
|
||||
else if(spacetype==SPACE_ACTION) {
|
||||
//sprintf(str, "Panel %%x%d|", TH_PANEL); strcat(cp, str);
|
||||
|
||||
@@ -2521,7 +2521,7 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
uiDefButBitI(block, TOGN, USER_TRACKBALL, B_DRAWINFO, "Turntable",
|
||||
(xpos+edgsp+mpref+(2*spref)+(3*midsp)+(mpref/2)),y3,(mpref/2),buth,
|
||||
&(U.flag), 0, 0, 0, 0,
|
||||
"Allow the view to tumble freely when orbiting with the Middle Mouse Button");
|
||||
"Use fixed up axis for orbiting with Middle Mouse Button");
|
||||
uiBlockSetCol(block, TH_AUTO); /* end color */
|
||||
uiDefButBitI(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Perspective",
|
||||
(xpos+edgsp+mpref+(2*spref)+(3*midsp)),y2,(mpref/2),buth,
|
||||
@@ -4639,7 +4639,7 @@ void allqueue(unsigned short event, short val)
|
||||
scrarea_queue_headredraw(sa);
|
||||
if(val) {
|
||||
si= sa->spacedata.first;
|
||||
if (si->pin==0)
|
||||
if (si->pin==0)
|
||||
si->blocktype= val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1627,24 +1627,24 @@ void special_aftertrans_update(TransInfo *t)
|
||||
pose= ob->pose;
|
||||
|
||||
if (!act)
|
||||
act= ob->action= add_empty_action();
|
||||
act= ob->action= add_empty_action(ID_PO);
|
||||
|
||||
set_pose_keys(ob); // sets chan->flag to POSE_KEY if bone selected
|
||||
for (pchan=pose->chanbase.first; pchan; pchan=pchan->next){
|
||||
if (pchan->flag & POSE_KEY){
|
||||
|
||||
set_action_key(act, pchan, AC_QUAT_X, 1);
|
||||
set_action_key(act, pchan, AC_QUAT_Y, 1);
|
||||
set_action_key(act, pchan, AC_QUAT_Z, 1);
|
||||
set_action_key(act, pchan, AC_QUAT_W, 1);
|
||||
|
||||
set_action_key(act, pchan, AC_SIZE_X, 1);
|
||||
set_action_key(act, pchan, AC_SIZE_Y, 1);
|
||||
set_action_key(act, pchan, AC_SIZE_Z, 1);
|
||||
|
||||
set_action_key(act, pchan, AC_LOC_X, 1);
|
||||
set_action_key(act, pchan, AC_LOC_Y, 1);
|
||||
set_action_key(act, pchan, AC_LOC_Z, 1);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_SIZE_X);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_SIZE_Y);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_SIZE_Z);
|
||||
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_QUAT_W);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_QUAT_X);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_QUAT_Y);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_QUAT_Z);
|
||||
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_LOC_X);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_LOC_Y);
|
||||
insertkey(&act->id, ID_AC, pchan->name, NULL, AC_LOC_Z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1679,18 +1679,18 @@ void special_aftertrans_update(TransInfo *t)
|
||||
|
||||
/* Set autokey if necessary */
|
||||
if ((G.flags & G_RECORDKEYS) && (!cancelled) && (base->flag & SELECT)){
|
||||
/* note, here we have to do context still */
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_ROT_X);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_ROT_Y);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_ROT_Z);
|
||||
|
||||
insertkey(&base->object->id, OB_ROT_X);
|
||||
insertkey(&base->object->id, OB_ROT_Y);
|
||||
insertkey(&base->object->id, OB_ROT_Z);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_LOC_X);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_LOC_Y);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_LOC_Z);
|
||||
|
||||
insertkey(&base->object->id, OB_LOC_X);
|
||||
insertkey(&base->object->id, OB_LOC_Y);
|
||||
insertkey(&base->object->id, OB_LOC_Z);
|
||||
|
||||
insertkey(&base->object->id, OB_SIZE_X);
|
||||
insertkey(&base->object->id, OB_SIZE_Y);
|
||||
insertkey(&base->object->id, OB_SIZE_Z);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_SIZE_X);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_SIZE_Y);
|
||||
insertkey(&base->object->id, ID_OB, NULL, NULL, OB_SIZE_Z);
|
||||
|
||||
remake_object_ipos (ob);
|
||||
allqueue(REDRAWIPO, 0);
|
||||
|
||||
@@ -238,6 +238,17 @@ static void init_userdef_file(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (G.main->versionfile <= 238) {
|
||||
bTheme *btheme;
|
||||
/* bone colors */
|
||||
for(btheme= U.themes.first; btheme; btheme= btheme->next) {
|
||||
/* check for alpha==0 is safe, then color was never set */
|
||||
if(btheme->tnla.strip[3]==0) {
|
||||
SETCOL(btheme->tnla.strip_select, 0xff, 0xff, 0xaa, 255);
|
||||
SETCOL(btheme->tnla.strip, 0xe4, 0x9c, 0xc6, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (U.undosteps==0) U.undosteps=32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user