* 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.
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) ||
{
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;
}
}
// 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);
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;
}
break;
case NDOF_NOMOVE:
- if (t->context & CTX_NDOF)
+ if (t->options & CTX_NDOF)
{
/* Confirm on pure NDOF transform */
t->state = TRANS_CONFIRM;
break;
case LEFTMOUSE:
case RIGHTMOUSE:
- if (t->context & CTX_TWEAK)
+ if (t->options & CTX_TWEAK)
t->state = TRANS_CONFIRM;
break;
case LEFTSHIFTKEY:
t->state = TRANS_RUNNING;
- t->context = CTX_NONE;
+ t->options = CTX_NONE;
t->mode = TFM_DUMMY;
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;
}
/* If auto confirm is on, break after one pass */
- if (t->context & CTX_AUTOCONFIRM)
+ if (t->options & CTX_AUTOCONFIRM)
{
t->state = TRANS_CONFIRM;
}
#endif
return 1;
}
-
+
+ t->context= NULL;
t->event = NULL;
return 0;
#if 0 // TRANSFORM_FIX_ME
Trans.state = TRANS_RUNNING;
- Trans.context = CTX_NONE;
+ Trans.options = CTX_NONE;
Trans.mode = mode;
/* 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;
}
*/
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;
}
*/
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) */
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 ----------------------- */
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 */
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;
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 *);
/*************** NEW STUFF *********************/
float values[4];
+ struct bContext *context;
void *view;
struct ScrArea *sa;
struct ARegion *ar;
//#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"
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;
}
*/
static void posttrans_ipo_clean (Ipo *ipo)
{
-#if 0 // TRANSFORM_FIX_ME
IpoCurve *icu;
int i;
/* 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
*/
static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side, float cfra)
{
-#if 0 // TRANSFORM_FIX_ME
IpoCurve *icu;
BezTriple *bezt;
int i;
}
return td;
-#endif
-return NULL;
}
/* helper struct for gp-frame transforms (only used here) */
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;
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 {
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;
}
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 );
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 */
}
/* cleanup temp list */
- BLI_freelistN(&act_data);
-#endif
+ BLI_freelistN(&anim_data);
}
static void createTransNlaData(bContext *C, 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;
+ if (ANIM_animdata_get_context(t->context, &ac) == 0) {
+ printf("space action transform -> special aftertrans exit. no context \n"); // XXX
+ return;
+ }
+
+ /* get pointers to useful data */
ob = OBACT;
+ scene= ac.scene;
- if (datatype == ACTCONT_ACTION) {
+ 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)
}
}
}
+#endif // XXX future of this is still not clear
+
+ /* make sure all IPO-curves are set correctly */
+ ANIM_editkeyframes_refresh(&ac);
- G.saction->flag &= ~SACTION_MOVING;
+ /* 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();
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);
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);
}
}
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 */
// 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;
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)
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;
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);
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;
}