[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11061] trunk/blender/source/blender: == Action/IPO Editors - Code Cleanup ==
Joshua Leung
aligorith at gmail.com
Tue Jun 26 12:08:58 CEST 2007
Revision: 11061
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11061
Author: aligorith
Date: 2007-06-26 12:08:58 +0200 (Tue, 26 Jun 2007)
Log Message:
-----------
== Action/IPO Editors - Code Cleanup ==
Added two macros which are used to test if the active Action/IPO editor is displaying data from a scaled NLA-strip.
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editaction.h
trunk/blender/source/blender/src/drawaction.c
trunk/blender/source/blender/src/drawipo.c
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/editipo.c
trunk/blender/source/blender/src/editipo_mods.c
Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h 2007-06-26 08:06:32 UTC (rev 11060)
+++ trunk/blender/source/blender/include/BIF_editaction.h 2007-06-26 10:08:58 UTC (rev 11061)
@@ -64,6 +64,9 @@
#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
#define SEL_ICU(icu) (icu->flag & IPO_SELECT)
+#define NLA_ACTION_SCALED (G.saction->pin==0 && OBACT)
+#define NLA_IPO_SCALED (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname)
+
/* constants for setting ipo-interpolation type */
#define SET_IPO_POPUP 0
#define SET_IPO_CONSTANT 1
Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c 2007-06-26 08:06:32 UTC (rev 11060)
+++ trunk/blender/source/blender/src/drawaction.c 2007-06-26 10:08:58 UTC (rev 11061)
@@ -25,7 +25,7 @@
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Joshua Leung
*
* ***** END GPL/BL DUAL LICENSE BLOCK *****
* Drawing routines for the Action window type
@@ -716,7 +716,7 @@
di= glaBegin2DDraw(&scr_rct, &G.v2d->cur);
/* if in NLA there's a strip active, map the view */
- if (G.saction->pin==0 && OBACT)
+ if (NLA_ACTION_SCALED)
map_active_strip(di, OBACT, 0);
/* start and end of action itself */
@@ -724,7 +724,7 @@
gla2DDrawTranslatePt(di, sta, 0.0f, &act_start, &dummy);
gla2DDrawTranslatePt(di, end, 0.0f, &act_end, &dummy);
- if (G.saction->pin==0 && OBACT)
+ if (NLA_ACTION_SCALED)
map_active_strip(di, OBACT, 1);
/* first backdrop strips */
@@ -795,7 +795,7 @@
}
glDisable(GL_BLEND);
- if (G.saction->pin==0 && OBACT)
+ if (NLA_ACTION_SCALED)
map_active_strip(di, OBACT, 0);
/* keyframes */
Modified: trunk/blender/source/blender/src/drawipo.c
===================================================================
--- trunk/blender/source/blender/src/drawipo.c 2007-06-26 08:06:32 UTC (rev 11060)
+++ trunk/blender/source/blender/src/drawipo.c 2007-06-26 10:08:58 UTC (rev 11061)
@@ -2158,9 +2158,8 @@
}
/* map ipo-points for drawing if scaled ipo */
- if (OBACT && OBACT->action && sipo->pin==0 && sipo->actname) {
+ if (NLA_IPO_SCALED)
actstrip_map_ipo_keys(OBACT, sipo->ipo, 0, 0);
- }
/* draw deselect */
draw_ipocurves(0);
@@ -2173,9 +2172,8 @@
draw_ipovertices(1);
/* undo mapping of ipo-points for drawing if scaled ipo */
- if (OBACT && OBACT->action && sipo->pin==0 && sipo->actname) {
+ if (NLA_IPO_SCALED)
actstrip_map_ipo_keys(OBACT, sipo->ipo, 1, 0);
- }
/* Draw 'curtains' for preview */
draw_anim_preview_timespace();
Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c 2007-06-26 08:06:32 UTC (rev 11060)
+++ trunk/blender/source/blender/src/editaction.c 2007-06-26 10:08:58 UTC (rev 11061)
@@ -588,7 +588,7 @@
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
/* if action is mapped in NLA, it returns a correction */
- if (G.saction->pin==0 && OBACT && datatype==ACTCONT_ACTION) {
+ if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
xmin= get_action_frame(OBACT, rectf.xmin);
xmax= get_action_frame(OBACT, rectf.xmax);
}
@@ -773,7 +773,7 @@
getmouseco_areawin (mvals);
areamouseco_to_ipoco(G.v2d, mvals, &sval[0], &sval[1]);
- if(G.saction->pin==0 && OBACT)
+ if (NLA_ACTION_SCALED)
sval[0]= get_action_frame(OBACT, sval[0]);
/* used for drawing */
@@ -826,10 +826,10 @@
getmouseco_areawin (mvalc);
areamouseco_to_ipoco(G.v2d, mvalc, &cval[0], &cval[1]);
- if(G.saction->pin==0 && OBACT)
+ if (NLA_ACTION_SCALED)
cval[0]= get_action_frame(OBACT, cval[0]);
- if(mode=='t')
+ if (mode=='t')
G.saction->timeslide= cval[0];
if (!firsttime && lastcval[0]==cval[0] && lastcval[1]==cval[1]) {
@@ -878,7 +878,7 @@
}
break;
case 'g':
- if (G.saction->pin==0 && OBACT && context==ACTCONT_ACTION) {
+ if (NLA_ACTION_SCALED && context==ACTCONT_ACTION) {
deltax = get_action_frame_inv(OBACT, cval[0]);
deltax -= get_action_frame_inv(OBACT, sval[0]);
@@ -919,7 +919,7 @@
fac*=-1;
}
startx= (G.scene->r.cfra);
- if(G.saction->pin==0 && OBACT && context==ACTCONT_ACTION)
+ if(NLA_ACTION_SCALED && context==ACTCONT_ACTION)
startx= get_action_frame(OBACT, startx);
tv[i].loc[0]-= startx;
@@ -934,7 +934,7 @@
float snapval;
/* convert frame to nla-action time (if needed) */
- if (G.saction->pin==0 && OBACT && context==ACTCONT_ACTION)
+ if (NLA_ACTION_SCALED && context==ACTCONT_ACTION)
snapval= get_action_frame_inv(OBACT, tv[i].loc[0]);
else
snapval= tv[i].loc[0];
@@ -943,7 +943,7 @@
snapval= (float)(floor(snapval+0.5));
/* convert frame out of nla-action time */
- if (G.saction->pin==0 && OBACT && context==ACTCONT_ACTION)
+ if (NLA_ACTION_SCALED && context==ACTCONT_ACTION)
tv[i].loc[0]= get_action_frame(OBACT, snapval);
else
tv[i].loc[0]= snapval;
@@ -955,7 +955,7 @@
headerprint(str);
}
else if (mode=='g') {
- if(G.saction->pin==0 && OBACT && context==ACTCONT_ACTION) {
+ if (NLA_ACTION_SCALED && context==ACTCONT_ACTION) {
/* recalculate the delta based on 'visual' times */
fac = get_action_frame_inv(OBACT, cval[0]);
fac -= get_action_frame_inv(OBACT, sval[0]);
@@ -1133,7 +1133,7 @@
/* snap to frame */
for (ale= act_data.first; ale; ale= ale->next) {
- if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) {
+ if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
snap_ipo_keys(ale->key_data, mode);
actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
@@ -1191,7 +1191,7 @@
/* mirror */
for (ale= act_data.first; ale; ale= ale->next) {
- if (datatype==ACTCONT_ACTION && G.saction->pin==0 && OBACT) {
+ if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
mirror_ipo_keys(ale->key_data, mode);
actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
@@ -2120,7 +2120,7 @@
/* select keys in-between */
for (ale= act_data.first; ale; ale= ale->next) {
- if(G.saction->pin==0 && OBACT && datatype==ACTCONT_ACTION) {
+ if(NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
borderselect_ipo_key(ale->key_data, min, max, SELECT_ADD);
actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
@@ -2189,7 +2189,7 @@
make_marker_cfra_list(&elems, 1);
/* apply scaled action correction if needed */
- if (G.saction->pin==0 && OBACT && datatype==ACTCONT_ACTION) {
+ if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
for (ce= elems.first; ce; ce= ce->next)
ce->cfra= get_action_frame(OBACT, ce->cfra);
}
@@ -2261,7 +2261,7 @@
areamouseco_to_ipoco(G.v2d, mval, &rectf.xmax, &rectf.ymax);
/* if action is mapped in NLA, it returns a correction */
- if (G.saction->pin==0 && OBACT && datatype==ACTCONT_ACTION) {
+ if (NLA_ACTION_SCALED && datatype==ACTCONT_ACTION) {
rectf.xmin= get_action_frame(OBACT, rectf.xmin);
rectf.xmax= get_action_frame(OBACT, rectf.xmax);
}
Modified: trunk/blender/source/blender/src/editipo.c
===================================================================
--- trunk/blender/source/blender/src/editipo.c 2007-06-26 08:06:32 UTC (rev 11060)
+++ trunk/blender/source/blender/src/editipo.c 2007-06-26 10:08:58 UTC (rev 11061)
@@ -1372,7 +1372,7 @@
marker=find_nearest_marker(1);
/* map ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
}
@@ -1535,7 +1535,7 @@
}
/* undo mapping of ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
}
@@ -1990,7 +1990,7 @@
areamouseco_to_ipoco(G.v2d, mval, &x, &y);
/* convert click-time to ipo-time */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
x= get_action_frame(OBACT, x);
}
@@ -2363,7 +2363,7 @@
}
/* convert cfra to ipo-time */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
cfra= get_action_frame(OBACT, cfra);
}
@@ -3512,7 +3512,7 @@
get_status_editipo();
/* map ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
}
@@ -3585,7 +3585,7 @@
}
/* undo mapping of ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
}
@@ -3620,7 +3620,7 @@
if (!ei) return;
/* map ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 0, 0);
}
@@ -3679,7 +3679,7 @@
}
/* undo mapping of ipo-points for editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
actstrip_map_ipo_keys(OBACT, G.sipo->ipo, 1, 0);
}
@@ -4154,7 +4154,7 @@
else ik->flag= 0;
/* map ipo-keys for drawing/editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
ik->val= get_action_frame_inv(OBACT, ik->val);
}
@@ -4258,7 +4258,7 @@
ik= lb->first;
while(ik) {
/* map ipo-keys for drawing/editing if scaled ipo */
- if (OBACT && OBACT->action && G.sipo->pin==0 && G.sipo->actname) {
+ if (NLA_IPO_SCALED) {
ik->val= get_action_frame_inv(OBACT, ik->val);
}
@@ -4278,7 +4278,7 @@
ik->val= ik->data[a]->vec[1][0];
/* map ipo-keys for drawing/editing if scaled ipo */
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list