2.5 Transform Code - Preparing for Action Editor Support

* Fixed up most of the relevant Fixme's for Action Editor and/or some animation stuff

* Added keymap for action editor transforms to transform keymap.

* Added context pointer to TransInfo struct. This was needed to avoid passing context to everything. As such, renamed the old 'context' setting to options.
This commit is contained in:
Joshua Leung 2008-12-29 06:06:59 +00:00
parent c3ccc8a5ac
commit fc243ed361
6 changed files with 260 additions and 184 deletions

@ -488,12 +488,12 @@ void action_header_buttons(const bContext *C, ARegion *ar)
xmax= GetButStringLength("View");
uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C),
"View", xco, yco, xmax-3, 24, "");
"View", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
xmax= GetButStringLength("Select");
uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C),
"Select", xco, yco, xmax-3, 24, "");
"Select", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if ( (saction->mode == SACTCONT_DOPESHEET) ||
@ -501,31 +501,31 @@ void action_header_buttons(const bContext *C, ARegion *ar)
{
xmax= GetButStringLength("Channel");
uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C),
"Channel", xco, yco, xmax-3, 24, "");
"Channel", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
else if (saction->mode==SACTCONT_GPENCIL) {
xmax= GetButStringLength("Channel");
uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C),
"Channel", xco, yco, xmax-3, 24, "");
"Channel", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
xmax= GetButStringLength("Marker");
uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C),
"Marker", xco, yco, xmax-3, 24, "");
"Marker", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
if (saction->mode == SACTCONT_GPENCIL) {
xmax= GetButStringLength("Frame");
uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C),
"Frame", xco, yco, xmax-3, 24, "");
"Frame", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
else {
xmax= GetButStringLength("Key");
uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C),
"Key", xco, yco, xmax-3, 24, "");
"Key", xco, yco-2, xmax-3, 24, "");
xco+= xmax;
}
}

@ -467,6 +467,16 @@ static void viewRedrawForce(TransInfo *t)
// need to redraw ALL 3d view
ED_area_tag_redraw(t->sa);
}
else if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= CTX_wm_space_data(t->context);
// TRANSFORM_FIX_ME
if (saction->lock) {
// whole window...
}
else
ED_area_tag_redraw(t->sa);
}
#if 0 // TRANSFORM_FIX_ME
else if (t->spacetype==SPACE_IMAGE) {
if (G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
@ -961,14 +971,14 @@ void transformEvent(TransInfo *t, wmEvent *event)
switch(handleNDofInput(&(t->ndof), event))
{
case NDOF_CONFIRM:
if ((t->context & CTX_NDOF) == 0)
if ((t->options & CTX_NDOF) == 0)
{
/* Confirm on normal transform only */
t->state = TRANS_CONFIRM;
}
break;
case NDOF_CANCEL:
if (t->context & CTX_NDOF)
if (t->options & CTX_NDOF)
{
/* Cancel on pure NDOF transform */
t->state = TRANS_CANCEL;
@ -980,7 +990,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
}
break;
case NDOF_NOMOVE:
if (t->context & CTX_NDOF)
if (t->options & CTX_NDOF)
{
/* Confirm on pure NDOF transform */
t->state = TRANS_CONFIRM;
@ -1010,7 +1020,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
break;
case LEFTMOUSE:
case RIGHTMOUSE:
if (t->context & CTX_TWEAK)
if (t->options & CTX_TWEAK)
t->state = TRANS_CONFIRM;
break;
case LEFTSHIFTKEY:
@ -1033,7 +1043,7 @@ int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float
t->state = TRANS_RUNNING;
t->context = CTX_NONE;
t->options = CTX_NONE;
t->mode = TFM_DUMMY;
@ -1065,13 +1075,13 @@ int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float
return success;
}
void initTransform(bContext *C, TransInfo *t, int mode, int context, wmEvent *event)
void initTransform(bContext *C, TransInfo *t, int mode, int options, wmEvent *event)
{
/* added initialize, for external calls to set stuff in TransInfo, like undo string */
t->state = TRANS_RUNNING;
t->context = context;
t->options = options;
t->mode = mode;
@ -1207,7 +1217,7 @@ void transformApply(TransInfo *t)
}
/* If auto confirm is on, break after one pass */
if (t->context & CTX_AUTOCONFIRM)
if (t->options & CTX_AUTOCONFIRM)
{
t->state = TRANS_CONFIRM;
}
@ -1250,7 +1260,8 @@ int transformEnd(TransInfo *t)
#endif
return 1;
}
t->context= NULL;
t->event = NULL;
return 0;
@ -1263,7 +1274,7 @@ void initManipulator(int mode)
#if 0 // TRANSFORM_FIX_ME
Trans.state = TRANS_RUNNING;
Trans.context = CTX_NONE;
Trans.options = CTX_NONE;
Trans.mode = mode;
@ -4244,68 +4255,77 @@ int Align(TransInfo *t, short mval[2])
/* This function returns the snapping 'mode' for Animation Editors only
* We cannot use the standard snapping due to NLA-strip scaling complexities.
*/
// XXX these modifier checks should be keymappable
static short getAnimEdit_SnapMode(TransInfo *t)
{
short autosnap= SACTSNAP_OFF;
#if 0 // TRANSFORM_FIX_ME
/* currently, some of these are only for the action editor */
if (t->spacetype == SPACE_ACTION && G.saction) {
switch (G.saction->autosnap) {
case SACTSNAP_OFF:
if (G.qual == LR_CTRLKEY)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
autosnap= SACTSNAP_FRAME;
else if (G.qual == LR_ALTKEY)
autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
case SACTSNAP_STEP:
autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
break;
case SACTSNAP_FRAME:
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
case SACTSNAP_MARKER:
autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
break;
if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= CTX_wm_space_data(t->context);
if (saction) {
switch (saction->autosnap) {
case SACTSNAP_OFF:
if (t->event->ctrl)
autosnap= SACTSNAP_STEP;
else if (t->event->shift)
autosnap= SACTSNAP_FRAME;
else if (t->event->alt)
autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
case SACTSNAP_STEP:
autosnap= (t->event->ctrl)? SACTSNAP_OFF: SACTSNAP_STEP;
break;
case SACTSNAP_FRAME:
autosnap= (t->event->shift)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
case SACTSNAP_MARKER:
autosnap= (t->event->alt)? SACTSNAP_OFF: SACTSNAP_MARKER;
break;
}
}
}
else if (t->spacetype == SPACE_NLA && G.snla) {
switch (G.snla->autosnap) {
case SACTSNAP_OFF:
if (G.qual == LR_CTRLKEY)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
autosnap= SACTSNAP_FRAME;
else if (G.qual == LR_ALTKEY)
autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
case SACTSNAP_STEP:
autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
break;
case SACTSNAP_FRAME:
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
case SACTSNAP_MARKER:
autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
break;
else if (t->spacetype == SPACE_NLA) {
SpaceAction *snla= CTX_wm_space_data(t->context);
if (snla) {
switch (snla->autosnap) {
case SACTSNAP_OFF:
if (t->event->ctrl)
autosnap= SACTSNAP_STEP;
else if (t->event->shift)
autosnap= SACTSNAP_FRAME;
else if (t->event->alt)
autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
break;
case SACTSNAP_STEP:
autosnap= (t->event->ctrl)? SACTSNAP_OFF: SACTSNAP_STEP;
break;
case SACTSNAP_FRAME:
autosnap= (t->event->shift)? SACTSNAP_OFF: SACTSNAP_FRAME;
break;
case SACTSNAP_MARKER:
autosnap= (t->event->alt)? SACTSNAP_OFF: SACTSNAP_MARKER;
break;
}
}
}
else {
if (G.qual == LR_CTRLKEY)
if (t->event->ctrl)
autosnap= SACTSNAP_STEP;
else if (G.qual == LR_SHIFTKEY)
else if (t->event->shift)
autosnap= SACTSNAP_FRAME;
else if (G.qual == LR_ALTKEY)
else if (t->event->alt)
autosnap= SACTSNAP_MARKER;
else
autosnap= SACTSNAP_OFF;
}
#endif
return autosnap;
}
@ -4315,23 +4335,24 @@ static short getAnimEdit_SnapMode(TransInfo *t)
*/
static short getAnimEdit_DrawTime(TransInfo *t)
{
#if 0 // TRANSFORM_FIX_ME
short drawtime;
/* currently, some of these are only for the action editor */
if (t->spacetype == SPACE_ACTION && G.saction) {
drawtime = (G.saction->flag & SACTION_DRAWTIME)? 1 : 0;
if (t->spacetype == SPACE_ACTION) {
SpaceAction *saction= CTX_wm_space_data(t->context);
drawtime = (saction->flag & SACTION_DRAWTIME)? 1 : 0;
}
else if (t->spacetype == SPACE_NLA && G.snla) {
drawtime = (G.snla->flag & SNLA_DRAWTIME)? 1 : 0;
else if (t->spacetype == SPACE_NLA) {
SpaceAction *snla= CTX_wm_space_data(t->context);
drawtime = (snla->flag & SNLA_DRAWTIME)? 1 : 0;
}
else {
drawtime = 0;
}
return drawtime;
#endif
return 0;
}
@ -4340,11 +4361,11 @@ return 0;
*/
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short autosnap)
{
#if 0 // TRANSFORM_FIX_ME
/* snap key to nearest frame? */
if (autosnap == SACTSNAP_FRAME) {
short doTime= getAnimEdit_DrawTime(t);
double secf= FPS;
const Scene *scene= t->scene;
const short doTime= getAnimEdit_DrawTime(t);
const double secf= FPS;
double val;
/* convert frame to nla-action time (if needed) */
@ -4376,15 +4397,15 @@ static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short
val= *(td->val);
/* snap to nearest marker */
val= (float)find_nearest_marker_time(val);
// XXX missing function!
//val= (float)find_nearest_marker_time(val);
/* convert frame out of nla-action time */
if (ob)
*(td->val)= get_action_frame(ob, val);
else
*(td->val)= val;
}
#endif
}
/* ----------------- Translation ----------------------- */
@ -4413,10 +4434,10 @@ static void headerTimeTranslate(TransInfo *t, char *str)
outputNumInput(&(t->num), tvec);
}
else {
Scene *scene = t->scene;
short autosnap= getAnimEdit_SnapMode(t);
short doTime = getAnimEdit_DrawTime(t);
double secf= FPS;
const Scene *scene = t->scene;
const short autosnap= getAnimEdit_SnapMode(t);
const short doTime = getAnimEdit_DrawTime(t);
const double secf= FPS;
float val= t->fac;
/* apply snapping + frame->seconds conversions */
@ -4443,10 +4464,10 @@ static void applyTimeTranslate(TransInfo *t, float sval)
Scene *scene = t->scene;
int i;
short doTime= getAnimEdit_DrawTime(t);
double secf= FPS;
const short doTime= getAnimEdit_DrawTime(t);
const double secf= FPS;
short autosnap= getAnimEdit_SnapMode(t);
const short autosnap= getAnimEdit_SnapMode(t);
float deltax, val;

@ -177,7 +177,7 @@ typedef struct TransInfo {
int mode; /* current mode */
int flag; /* generic flags for special behaviors */
short state; /* current state (running, canceled,...)*/
int context; /* current context */
int options; /* current context/options for transform */
float val; /* init value for some transformations (and rotation angle) */
float fac; /* factor for distance based transform */
int (*transform)(struct TransInfo *, short *);
@ -224,6 +224,7 @@ typedef struct TransInfo {
/*************** NEW STUFF *********************/
float values[4];
struct bContext *context;
void *view;
struct ScrArea *sa;
struct ARegion *ar;

@ -120,8 +120,13 @@
//#include "BIF_toolbox.h"
#include "ED_types.h"
#include "ED_anim_api.h"
#include "ED_keyframing.h"
#include "ED_keyframes_edit.h"
#include "ED_view3d.h"
#include "UI_view2d.h"
//#include "BSE_drawipo.h"
//#include "BSE_edit.h"
//#include "BSE_editipo.h"
@ -2108,7 +2113,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
int propmode = t->flag & T_PROP_EDIT;
int mirror = 0;
if ((t->context & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
if ((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
{
mirror = 1;
}
@ -2680,7 +2685,6 @@ static void posttrans_gpd_clean (bGPdata *gpd)
*/
static void posttrans_ipo_clean (Ipo *ipo)
{
#if 0 // TRANSFORM_FIX_ME
IpoCurve *icu;
int i;
@ -2737,40 +2741,39 @@ static void posttrans_ipo_clean (Ipo *ipo)
/* free cache */
MEM_freeN(selcache);
}
#endif
}
/* Called by special_aftertrans_update to make sure selected keyframes replace
* any other keyframes which may reside on that frame (that is not selected).
* remake_action_ipos should have already been called
*/
static void posttrans_action_clean (bAction *act)
static void posttrans_action_clean (bAnimContext *ac, bAction *act)
{
#if 0 // TRANSFORM_FIX_ME
ListBase act_data = {NULL, NULL};
bActListElem *ale;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
/* filter data */
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
actdata_filter(&act_data, filter, act, ACTCONT_ACTION);
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
ANIM_animdata_filter(&anim_data, filter, act, ANIMCONT_ACTION);
/* loop through relevant data, removing keyframes from the ipo-blocks that were attached
* - all keyframes are converted in/out of global time
*/
for (ale= act_data.first; ale; ale= ale->next) {
if (NLA_ACTION_SCALED) {
actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
for (ale= anim_data.first; ale; ale= ale->next) {
Object *nob= ANIM_nla_mapping_get(ac, ale);
if (nob) {
ANIM_nla_mapping_apply(nob, ale->key_data, 0, 1);
posttrans_ipo_clean(ale->key_data);
actstrip_map_ipo_keys(OBACT, ale->key_data, 1, 1);
ANIM_nla_mapping_apply(nob, ale->key_data, 1, 1);
}
else
posttrans_ipo_clean(ale->key_data);
}
/* free temp data */
BLI_freelistN(&act_data);
#endif
BLI_freelistN(&anim_data);
}
/* Called by special_aftertrans_update to make sure selected keyframes replace
@ -2948,7 +2951,6 @@ static void TimeToTransData(TransData *td, float *time, Object *ob)
*/
static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side, float cfra)
{
#if 0 // TRANSFORM_FIX_ME
IpoCurve *icu;
BezTriple *bezt;
int i;
@ -2977,8 +2979,6 @@ static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side,
}
return td;
#endif
return NULL;
}
/* helper struct for gp-frame transforms (only used here) */
@ -3041,16 +3041,13 @@ static int GPLayerToTransData (TransData *td, tGPFtransdata *tfd, bGPDlayer *gpl
static void createTransActionData(bContext *C, TransInfo *t)
{
// TRANSFORM_FIX_ME
#if 0
Scene *scene= CTX_data_scene(C);
TransData *td = NULL;
tGPFtransdata *tfd = NULL;
Object *ob= NULL;
ListBase act_data = {NULL, NULL};
bActListElem *ale;
void *data;
short datatype;
bAnimContext ac;
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
int filter;
int count=0;
@ -3058,26 +3055,22 @@ static void createTransActionData(bContext *C, TransInfo *t)
char side;
/* determine what type of data we are operating on */
data = get_action_context(&datatype);
if (data == NULL) return;
if (ANIM_animdata_get_context(C, &ac) == 0)
return;
/* filter data */
if (datatype == ACTCONT_GPENCIL)
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT);
if (ac.datatype == ANIMCONT_GPENCIL)
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
else
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
actdata_filter(&act_data, filter, data, datatype);
/* is the action scaled? if so, the it should belong to the active object */
if (NLA_ACTION_SCALED)
ob= OBACT;
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
/* which side of the current frame should be allowed */
if (t->mode == TFM_TIME_EXTEND) {
/* only side on which mouse is gets transformed */
float xmouse, ymouse;
areamouseco_to_ipoco(G.v2d, t->imval, &xmouse, &ymouse);
UI_view2d_region_to_view(&ac.ar->v2d, t->imval[0], t->imval[1], &xmouse, &ymouse);
side = (xmouse > CFRA) ? 'R' : 'L';
}
else {
@ -3085,26 +3078,28 @@ static void createTransActionData(bContext *C, TransInfo *t)
side = 'B';
}
/* convert current-frame to action-time (slightly less accurate, espcially under
* higher scaling ratios, but is faster than converting all points)
*/
if (ob)
cfra = get_action_frame(ob, (float)CFRA);
else
cfra = (float)CFRA;
/* loop 1: fully select ipo-keys and count how many BezTriples are selected */
for (ale= act_data.first; ale; ale= ale->next) {
if (ale->type == ACTTYPE_GPLAYER)
count += count_gplayer_frames(ale->data, side, cfra);
for (ale= anim_data.first; ale; ale= ale->next) {
Object *nob= ANIM_nla_mapping_get(&ac, ale);
/* convert current-frame to action-time (slightly less accurate, espcially under
* higher scaling ratios, but is faster than converting all points)
*/
if (nob)
cfra = get_action_frame(nob, (float)CFRA);
else
cfra = (float)CFRA;
//if (ale->type == ANIMTYPE_GPLAYER)
// count += count_gplayer_frames(ale->data, side, cfra);
//else
count += count_ipo_keys(ale->key_data, side, cfra);
}
/* stop if trying to build list if nothing selected */
if (count == 0) {
/* cleanup temp list */
BLI_freelistN(&act_data);
BLI_freelistN(&anim_data);
return;
}
@ -3114,7 +3109,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)");
td= t->data;
if (datatype == ACTCONT_GPENCIL) {
if (ac.datatype == ANIMCONT_GPENCIL) {
if (t->mode == TFM_TIME_SLIDE) {
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
@ -3128,20 +3123,29 @@ static void createTransActionData(bContext *C, TransInfo *t)
t->customData= MEM_callocN(sizeof(float)*2, "TimeSlide Min/Max");
/* loop 2: build transdata array */
for (ale= act_data.first; ale; ale= ale->next) {
if (ale->type == ACTTYPE_GPLAYER) {
bGPDlayer *gpl= (bGPDlayer *)ale->data;
int i;
i = GPLayerToTransData(td, tfd, gpl, side, cfra);
td += i;
tfd += i;
}
else {
for (ale= anim_data.first; ale; ale= ale->next) {
//if (ale->type == ANIMTYPE_GPLAYER) {
// bGPDlayer *gpl= (bGPDlayer *)ale->data;
// int i;
//
// i = GPLayerToTransData(td, tfd, gpl, side, cfra);
// td += i;
// tfd += i;
//}
//else {
Object *nob= ANIM_nla_mapping_get(&ac, ale);
Ipo *ipo= (Ipo *)ale->key_data;
td= IpoToTransData(td, ipo, ob, side, cfra);
}
/* convert current-frame to action-time (slightly less accurate, espcially under
* higher scaling ratios, but is faster than converting all points)
*/
if (nob)
cfra = get_action_frame(nob, (float)CFRA);
else
cfra = (float)CFRA;
td= IpoToTransData(td, ipo, nob, side, cfra);
//}
}
/* check if we're supposed to be setting minx/maxx for TimeSlide */
@ -3164,8 +3168,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
}
/* cleanup temp list */
BLI_freelistN(&act_data);
#endif
BLI_freelistN(&anim_data);
}
static void createTransNlaData(bContext *C, TransInfo *t)
@ -3968,67 +3971,99 @@ void special_aftertrans_update(TransInfo *t)
}
}
}
#if 0 // TRANSFORM_FIX_ME
if (t->spacetype == SPACE_ACTION) {
void *data;
short datatype;
SpaceAction *saction= (SpaceAction *)(t->sa->spacedata.first);
Scene *scene= NULL;
bAnimContext ac;
/* determine what type of data we are operating on */
data = get_action_context(&datatype);
if (data == NULL) return;
ob = OBACT;
if (ANIM_animdata_get_context(t->context, &ac) == 0) {
printf("space action transform -> special aftertrans exit. no context \n"); // XXX
return;
}
if (datatype == ACTCONT_ACTION) {
/* get pointers to useful data */
ob = OBACT;
scene= ac.scene;
if (ac.datatype == ANIMCONT_DOPESHEET) {
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;
short filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
/* get channels to work on */
ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
/* these should all be ipo-blocks */
for (ale= anim_data.first; ale; ale= ale->next) {
Object *nob= ANIM_nla_mapping_get(&ac, ale);
Ipo *ipo= ale->key_data;
IpoCurve *icu;
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
{
if (nob) {
ANIM_nla_mapping_apply(nob, ipo, 0, 1);
posttrans_ipo_clean(ipo);
ANIM_nla_mapping_apply(nob, ipo, 1, 1);
}
else
posttrans_ipo_clean(ipo);
}
}
/* free temp memory */
BLI_freelistN(&anim_data);
}
else if (ac.datatype == ANIMCONT_ACTION) {
/* Depending on the lock status, draw necessary views */
// fixme... some of this stuff is not good
if (ob) {
ob->ctime= -1234567.0f;
if(ob->pose || ob_get_key(ob))
DAG_object_flush_update(G.scene, ob, OB_RECALC);
if (ob->pose || ob_get_key(ob))
DAG_object_flush_update(scene, ob, OB_RECALC);
else
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
DAG_object_flush_update(scene, ob, OB_RECALC_OB);
}
/* Do curve cleanups? */
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
{
posttrans_action_clean((bAction *)data);
posttrans_action_clean(&ac, (bAction *)ac.data);
}
/* Do curve updates */
remake_action_ipos((bAction *)data);
}
else if (datatype == ACTCONT_SHAPEKEY) {
else if (ac.datatype == ANIMCONT_SHAPEKEY) {
/* fix up the Ipocurves and redraw stuff */
Key *key= (Key *)data;
Key *key= (Key *)ac.data;
if (key->ipo) {
IpoCurve *icu;
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
((cancelled == 0) || (duplicate)) )
{
posttrans_ipo_clean(key->ipo);
}
for (icu = key->ipo->curve.first; icu; icu=icu->next) {
sort_time_ipocurve(icu);
testhandles_ipocurve(icu);
}
}
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
DAG_object_flush_update(scene, OBACT, OB_RECALC_DATA);
}
else if (datatype == ACTCONT_GPENCIL) {
#if 0 // XXX future of this is still not clear
else if (ac.datatype == ANIMCONT_GPENCIL) {
/* remove duplicate frames and also make sure points are in order! */
if ((cancelled == 0) || (duplicate))
{
bScreen *sc= (bScreen *)ac.data;
ScrArea *sa;
/* BAD... we need to loop over all screen areas for current screen...
* - sync this with actdata_filter_gpencil() in editaction.c
*/
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
for (sa= sc->areabase.first; sa; sa= sa->next) {
bGPdata *gpd= gpencil_data_getactive(sa);
if (gpd)
@ -4036,9 +4071,15 @@ void special_aftertrans_update(TransInfo *t)
}
}
}
#endif // XXX future of this is still not clear
G.saction->flag &= ~SACTION_MOVING;
/* make sure all IPO-curves are set correctly */
ANIM_editkeyframes_refresh(&ac);
/* clear flag that was set for time-slide drawing */
saction->flag &= ~SACTION_MOVING;
}
#if 0 // TRANSFORM_FIX_ME
else if (t->spacetype == SPACE_NLA) {
recalc_all_ipos(); // bad
synchronize_action_strips();
@ -4317,11 +4358,11 @@ void createTransData(bContext *C, TransInfo *t)
Scene *scene = CTX_data_scene(C);
Object *ob = OBACT;
if (t->context == CTX_TEXTURE) {
if (t->options == CTX_TEXTURE) {
t->flag |= T_TEXTURE;
createTransTexspace(C, t);
}
else if (t->context == CTX_EDGE) {
else if (t->options == CTX_EDGE) {
t->ext = NULL;
t->flag |= T_EDIT;
createTransEdge(C, t);
@ -4331,7 +4372,7 @@ void createTransData(bContext *C, TransInfo *t)
sort_trans_data_dist(t);
}
}
else if (t->context == CTX_BMESH) {
else if (t->options == CTX_BMESH) {
// TRANSFORM_FIX_ME
//createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td);
}

@ -444,7 +444,7 @@ void recalcData(TransInfo *t)
}
clipMirrorModifier(t, G.obedit);
}
if((t->context & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
if((t->options & CTX_NO_MIRROR) == 0 && (G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR))
editmesh_apply_to_mirror(t);
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
@ -673,7 +673,8 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
// if(G.obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
// else G.moving= G_TRANSFORM_OBJ;
t->context= C;
t->scene = sce;
t->sa = sa;
t->ar = ar;
@ -684,7 +685,7 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
t->flag = 0;
/* setting PET flag */
if ((t->context & CTX_NO_PET) == 0 && (sce->proportional)) {
if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
t->flag |= T_PROP_EDIT;
if(sce->proportional == 2)

@ -50,10 +50,10 @@ static void transformops_exit(bContext *C, wmOperator *op)
static void transformops_data(bContext *C, wmOperator *op, wmEvent *event)
{
int mode = RNA_int_get(op->ptr, "mode");
int context = RNA_int_get(op->ptr, "context");
int options = RNA_int_get(op->ptr, "options");
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
initTransform(C, t, mode, context, event);
initTransform(C, t, mode, options, event);
/* store data */
op->customdata = t;
@ -133,7 +133,7 @@ void TFM_OT_transform(struct wmOperatorType *ot)
ot->poll = ED_operator_areaactive;
RNA_def_property(ot->srna, "mode", PROP_INT, PROP_NONE);
RNA_def_property(ot->srna, "context", PROP_INT, PROP_NONE);
RNA_def_property(ot->srna, "options", PROP_INT, PROP_NONE);
prop = RNA_def_property(ot->srna, "value", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_array(prop, 4);
@ -170,6 +170,18 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
RNA_int_set(km->ptr, "mode", TFM_SHEAR);
break;
case SPACE_ACTION:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
default:
break;
}