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:
@@ -488,12 +488,12 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
|||||||
|
|
||||||
xmax= GetButStringLength("View");
|
xmax= GetButStringLength("View");
|
||||||
uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_viewmenu, CTX_wm_area(C),
|
||||||
"View", xco, yco, xmax-3, 24, "");
|
"View", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
|
|
||||||
xmax= GetButStringLength("Select");
|
xmax= GetButStringLength("Select");
|
||||||
uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_selectmenu, CTX_wm_area(C),
|
||||||
"Select", xco, yco, xmax-3, 24, "");
|
"Select", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
|
|
||||||
if ( (saction->mode == SACTCONT_DOPESHEET) ||
|
if ( (saction->mode == SACTCONT_DOPESHEET) ||
|
||||||
@@ -501,31 +501,31 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
|||||||
{
|
{
|
||||||
xmax= GetButStringLength("Channel");
|
xmax= GetButStringLength("Channel");
|
||||||
uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_channelmenu, CTX_wm_area(C),
|
||||||
"Channel", xco, yco, xmax-3, 24, "");
|
"Channel", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
}
|
}
|
||||||
else if (saction->mode==SACTCONT_GPENCIL) {
|
else if (saction->mode==SACTCONT_GPENCIL) {
|
||||||
xmax= GetButStringLength("Channel");
|
xmax= GetButStringLength("Channel");
|
||||||
uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_gplayermenu, CTX_wm_area(C),
|
||||||
"Channel", xco, yco, xmax-3, 24, "");
|
"Channel", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmax= GetButStringLength("Marker");
|
xmax= GetButStringLength("Marker");
|
||||||
uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_markermenu, CTX_wm_area(C),
|
||||||
"Marker", xco, yco, xmax-3, 24, "");
|
"Marker", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
|
|
||||||
if (saction->mode == SACTCONT_GPENCIL) {
|
if (saction->mode == SACTCONT_GPENCIL) {
|
||||||
xmax= GetButStringLength("Frame");
|
xmax= GetButStringLength("Frame");
|
||||||
uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_framemenu, CTX_wm_area(C),
|
||||||
"Frame", xco, yco, xmax-3, 24, "");
|
"Frame", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
xmax= GetButStringLength("Key");
|
xmax= GetButStringLength("Key");
|
||||||
uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C),
|
uiDefPulldownBut(block, action_keymenu, CTX_wm_area(C),
|
||||||
"Key", xco, yco, xmax-3, 24, "");
|
"Key", xco, yco-2, xmax-3, 24, "");
|
||||||
xco+= xmax;
|
xco+= xmax;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -467,6 +467,16 @@ static void viewRedrawForce(TransInfo *t)
|
|||||||
// need to redraw ALL 3d view
|
// need to redraw ALL 3d view
|
||||||
ED_area_tag_redraw(t->sa);
|
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
|
#if 0 // TRANSFORM_FIX_ME
|
||||||
else if (t->spacetype==SPACE_IMAGE) {
|
else if (t->spacetype==SPACE_IMAGE) {
|
||||||
if (G.sima->lock) force_draw_plus(SPACE_VIEW3D, 0);
|
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))
|
switch(handleNDofInput(&(t->ndof), event))
|
||||||
{
|
{
|
||||||
case NDOF_CONFIRM:
|
case NDOF_CONFIRM:
|
||||||
if ((t->context & CTX_NDOF) == 0)
|
if ((t->options & CTX_NDOF) == 0)
|
||||||
{
|
{
|
||||||
/* Confirm on normal transform only */
|
/* Confirm on normal transform only */
|
||||||
t->state = TRANS_CONFIRM;
|
t->state = TRANS_CONFIRM;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NDOF_CANCEL:
|
case NDOF_CANCEL:
|
||||||
if (t->context & CTX_NDOF)
|
if (t->options & CTX_NDOF)
|
||||||
{
|
{
|
||||||
/* Cancel on pure NDOF transform */
|
/* Cancel on pure NDOF transform */
|
||||||
t->state = TRANS_CANCEL;
|
t->state = TRANS_CANCEL;
|
||||||
@@ -980,7 +990,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NDOF_NOMOVE:
|
case NDOF_NOMOVE:
|
||||||
if (t->context & CTX_NDOF)
|
if (t->options & CTX_NDOF)
|
||||||
{
|
{
|
||||||
/* Confirm on pure NDOF transform */
|
/* Confirm on pure NDOF transform */
|
||||||
t->state = TRANS_CONFIRM;
|
t->state = TRANS_CONFIRM;
|
||||||
@@ -1010,7 +1020,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
|
|||||||
break;
|
break;
|
||||||
case LEFTMOUSE:
|
case LEFTMOUSE:
|
||||||
case RIGHTMOUSE:
|
case RIGHTMOUSE:
|
||||||
if (t->context & CTX_TWEAK)
|
if (t->options & CTX_TWEAK)
|
||||||
t->state = TRANS_CONFIRM;
|
t->state = TRANS_CONFIRM;
|
||||||
break;
|
break;
|
||||||
case LEFTSHIFTKEY:
|
case LEFTSHIFTKEY:
|
||||||
@@ -1033,7 +1043,7 @@ int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float
|
|||||||
|
|
||||||
t->state = TRANS_RUNNING;
|
t->state = TRANS_RUNNING;
|
||||||
|
|
||||||
t->context = CTX_NONE;
|
t->options = CTX_NONE;
|
||||||
|
|
||||||
t->mode = TFM_DUMMY;
|
t->mode = TFM_DUMMY;
|
||||||
|
|
||||||
@@ -1065,13 +1075,13 @@ int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float
|
|||||||
return success;
|
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 */
|
/* added initialize, for external calls to set stuff in TransInfo, like undo string */
|
||||||
|
|
||||||
t->state = TRANS_RUNNING;
|
t->state = TRANS_RUNNING;
|
||||||
|
|
||||||
t->context = context;
|
t->options = options;
|
||||||
|
|
||||||
t->mode = mode;
|
t->mode = mode;
|
||||||
|
|
||||||
@@ -1207,7 +1217,7 @@ void transformApply(TransInfo *t)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If auto confirm is on, break after one pass */
|
/* If auto confirm is on, break after one pass */
|
||||||
if (t->context & CTX_AUTOCONFIRM)
|
if (t->options & CTX_AUTOCONFIRM)
|
||||||
{
|
{
|
||||||
t->state = TRANS_CONFIRM;
|
t->state = TRANS_CONFIRM;
|
||||||
}
|
}
|
||||||
@@ -1250,7 +1260,8 @@ int transformEnd(TransInfo *t)
|
|||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
t->context= NULL;
|
||||||
t->event = NULL;
|
t->event = NULL;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1263,7 +1274,7 @@ void initManipulator(int mode)
|
|||||||
#if 0 // TRANSFORM_FIX_ME
|
#if 0 // TRANSFORM_FIX_ME
|
||||||
Trans.state = TRANS_RUNNING;
|
Trans.state = TRANS_RUNNING;
|
||||||
|
|
||||||
Trans.context = CTX_NONE;
|
Trans.options = CTX_NONE;
|
||||||
|
|
||||||
Trans.mode = mode;
|
Trans.mode = mode;
|
||||||
|
|
||||||
@@ -4244,68 +4255,77 @@ int Align(TransInfo *t, short mval[2])
|
|||||||
/* This function returns the snapping 'mode' for Animation Editors only
|
/* This function returns the snapping 'mode' for Animation Editors only
|
||||||
* We cannot use the standard snapping due to NLA-strip scaling complexities.
|
* 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)
|
static short getAnimEdit_SnapMode(TransInfo *t)
|
||||||
{
|
{
|
||||||
short autosnap= SACTSNAP_OFF;
|
short autosnap= SACTSNAP_OFF;
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
|
||||||
/* currently, some of these are only for the action editor */
|
/* currently, some of these are only for the action editor */
|
||||||
if (t->spacetype == SPACE_ACTION && G.saction) {
|
if (t->spacetype == SPACE_ACTION) {
|
||||||
switch (G.saction->autosnap) {
|
SpaceAction *saction= CTX_wm_space_data(t->context);
|
||||||
case SACTSNAP_OFF:
|
|
||||||
if (G.qual == LR_CTRLKEY)
|
if (saction) {
|
||||||
autosnap= SACTSNAP_STEP;
|
switch (saction->autosnap) {
|
||||||
else if (G.qual == LR_SHIFTKEY)
|
case SACTSNAP_OFF:
|
||||||
autosnap= SACTSNAP_FRAME;
|
if (t->event->ctrl)
|
||||||
else if (G.qual == LR_ALTKEY)
|
autosnap= SACTSNAP_STEP;
|
||||||
autosnap= SACTSNAP_MARKER;
|
else if (t->event->shift)
|
||||||
else
|
autosnap= SACTSNAP_FRAME;
|
||||||
autosnap= SACTSNAP_OFF;
|
else if (t->event->alt)
|
||||||
break;
|
autosnap= SACTSNAP_MARKER;
|
||||||
case SACTSNAP_STEP:
|
else
|
||||||
autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
|
autosnap= SACTSNAP_OFF;
|
||||||
break;
|
break;
|
||||||
case SACTSNAP_FRAME:
|
case SACTSNAP_STEP:
|
||||||
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
|
autosnap= (t->event->ctrl)? SACTSNAP_OFF: SACTSNAP_STEP;
|
||||||
break;
|
break;
|
||||||
case SACTSNAP_MARKER:
|
case SACTSNAP_FRAME:
|
||||||
autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
|
autosnap= (t->event->shift)? SACTSNAP_OFF: SACTSNAP_FRAME;
|
||||||
break;
|
break;
|
||||||
|
case SACTSNAP_MARKER:
|
||||||
|
autosnap= (t->event->alt)? SACTSNAP_OFF: SACTSNAP_MARKER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_NLA && G.snla) {
|
else if (t->spacetype == SPACE_NLA) {
|
||||||
switch (G.snla->autosnap) {
|
SpaceAction *snla= CTX_wm_space_data(t->context);
|
||||||
case SACTSNAP_OFF:
|
|
||||||
if (G.qual == LR_CTRLKEY)
|
if (snla) {
|
||||||
autosnap= SACTSNAP_STEP;
|
switch (snla->autosnap) {
|
||||||
else if (G.qual == LR_SHIFTKEY)
|
case SACTSNAP_OFF:
|
||||||
autosnap= SACTSNAP_FRAME;
|
if (t->event->ctrl)
|
||||||
else if (G.qual == LR_ALTKEY)
|
autosnap= SACTSNAP_STEP;
|
||||||
autosnap= SACTSNAP_MARKER;
|
else if (t->event->shift)
|
||||||
else
|
autosnap= SACTSNAP_FRAME;
|
||||||
autosnap= SACTSNAP_OFF;
|
else if (t->event->alt)
|
||||||
break;
|
autosnap= SACTSNAP_MARKER;
|
||||||
case SACTSNAP_STEP:
|
else
|
||||||
autosnap= (G.qual==LR_CTRLKEY)? SACTSNAP_OFF: SACTSNAP_STEP;
|
autosnap= SACTSNAP_OFF;
|
||||||
break;
|
break;
|
||||||
case SACTSNAP_FRAME:
|
case SACTSNAP_STEP:
|
||||||
autosnap= (G.qual==LR_SHIFTKEY)? SACTSNAP_OFF: SACTSNAP_FRAME;
|
autosnap= (t->event->ctrl)? SACTSNAP_OFF: SACTSNAP_STEP;
|
||||||
break;
|
break;
|
||||||
case SACTSNAP_MARKER:
|
case SACTSNAP_FRAME:
|
||||||
autosnap= (G.qual==LR_ALTKEY)? SACTSNAP_OFF: SACTSNAP_MARKER;
|
autosnap= (t->event->shift)? SACTSNAP_OFF: SACTSNAP_FRAME;
|
||||||
break;
|
break;
|
||||||
|
case SACTSNAP_MARKER:
|
||||||
|
autosnap= (t->event->alt)? SACTSNAP_OFF: SACTSNAP_MARKER;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (G.qual == LR_CTRLKEY)
|
if (t->event->ctrl)
|
||||||
autosnap= SACTSNAP_STEP;
|
autosnap= SACTSNAP_STEP;
|
||||||
else if (G.qual == LR_SHIFTKEY)
|
else if (t->event->shift)
|
||||||
autosnap= SACTSNAP_FRAME;
|
autosnap= SACTSNAP_FRAME;
|
||||||
else if (G.qual == LR_ALTKEY)
|
else if (t->event->alt)
|
||||||
autosnap= SACTSNAP_MARKER;
|
autosnap= SACTSNAP_MARKER;
|
||||||
else
|
else
|
||||||
autosnap= SACTSNAP_OFF;
|
autosnap= SACTSNAP_OFF;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return autosnap;
|
return autosnap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4315,23 +4335,24 @@ static short getAnimEdit_SnapMode(TransInfo *t)
|
|||||||
*/
|
*/
|
||||||
static short getAnimEdit_DrawTime(TransInfo *t)
|
static short getAnimEdit_DrawTime(TransInfo *t)
|
||||||
{
|
{
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
|
||||||
short drawtime;
|
short drawtime;
|
||||||
|
|
||||||
/* currently, some of these are only for the action editor */
|
/* currently, some of these are only for the action editor */
|
||||||
if (t->spacetype == SPACE_ACTION && G.saction) {
|
if (t->spacetype == SPACE_ACTION) {
|
||||||
drawtime = (G.saction->flag & SACTION_DRAWTIME)? 1 : 0;
|
SpaceAction *saction= CTX_wm_space_data(t->context);
|
||||||
|
|
||||||
|
drawtime = (saction->flag & SACTION_DRAWTIME)? 1 : 0;
|
||||||
}
|
}
|
||||||
else if (t->spacetype == SPACE_NLA && G.snla) {
|
else if (t->spacetype == SPACE_NLA) {
|
||||||
drawtime = (G.snla->flag & SNLA_DRAWTIME)? 1 : 0;
|
SpaceAction *snla= CTX_wm_space_data(t->context);
|
||||||
|
|
||||||
|
drawtime = (snla->flag & SNLA_DRAWTIME)? 1 : 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
drawtime = 0;
|
drawtime = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawtime;
|
return drawtime;
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4340,11 +4361,11 @@ return 0;
|
|||||||
*/
|
*/
|
||||||
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short autosnap)
|
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, Object *ob, short autosnap)
|
||||||
{
|
{
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
|
||||||
/* snap key to nearest frame? */
|
/* snap key to nearest frame? */
|
||||||
if (autosnap == SACTSNAP_FRAME) {
|
if (autosnap == SACTSNAP_FRAME) {
|
||||||
short doTime= getAnimEdit_DrawTime(t);
|
const Scene *scene= t->scene;
|
||||||
double secf= FPS;
|
const short doTime= getAnimEdit_DrawTime(t);
|
||||||
|
const double secf= FPS;
|
||||||
double val;
|
double val;
|
||||||
|
|
||||||
/* convert frame to nla-action time (if needed) */
|
/* 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);
|
val= *(td->val);
|
||||||
|
|
||||||
/* snap to nearest marker */
|
/* 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 */
|
/* convert frame out of nla-action time */
|
||||||
if (ob)
|
if (ob)
|
||||||
*(td->val)= get_action_frame(ob, val);
|
*(td->val)= get_action_frame(ob, val);
|
||||||
else
|
else
|
||||||
*(td->val)= val;
|
*(td->val)= val;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------- Translation ----------------------- */
|
/* ----------------- Translation ----------------------- */
|
||||||
@@ -4413,10 +4434,10 @@ static void headerTimeTranslate(TransInfo *t, char *str)
|
|||||||
outputNumInput(&(t->num), tvec);
|
outputNumInput(&(t->num), tvec);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Scene *scene = t->scene;
|
const Scene *scene = t->scene;
|
||||||
short autosnap= getAnimEdit_SnapMode(t);
|
const short autosnap= getAnimEdit_SnapMode(t);
|
||||||
short doTime = getAnimEdit_DrawTime(t);
|
const short doTime = getAnimEdit_DrawTime(t);
|
||||||
double secf= FPS;
|
const double secf= FPS;
|
||||||
float val= t->fac;
|
float val= t->fac;
|
||||||
|
|
||||||
/* apply snapping + frame->seconds conversions */
|
/* apply snapping + frame->seconds conversions */
|
||||||
@@ -4443,10 +4464,10 @@ static void applyTimeTranslate(TransInfo *t, float sval)
|
|||||||
Scene *scene = t->scene;
|
Scene *scene = t->scene;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
short doTime= getAnimEdit_DrawTime(t);
|
const short doTime= getAnimEdit_DrawTime(t);
|
||||||
double secf= FPS;
|
const double secf= FPS;
|
||||||
|
|
||||||
short autosnap= getAnimEdit_SnapMode(t);
|
const short autosnap= getAnimEdit_SnapMode(t);
|
||||||
|
|
||||||
float deltax, val;
|
float deltax, val;
|
||||||
|
|
||||||
|
@@ -177,7 +177,7 @@ typedef struct TransInfo {
|
|||||||
int mode; /* current mode */
|
int mode; /* current mode */
|
||||||
int flag; /* generic flags for special behaviors */
|
int flag; /* generic flags for special behaviors */
|
||||||
short state; /* current state (running, canceled,...)*/
|
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 val; /* init value for some transformations (and rotation angle) */
|
||||||
float fac; /* factor for distance based transform */
|
float fac; /* factor for distance based transform */
|
||||||
int (*transform)(struct TransInfo *, short *);
|
int (*transform)(struct TransInfo *, short *);
|
||||||
@@ -224,6 +224,7 @@ typedef struct TransInfo {
|
|||||||
/*************** NEW STUFF *********************/
|
/*************** NEW STUFF *********************/
|
||||||
|
|
||||||
float values[4];
|
float values[4];
|
||||||
|
struct bContext *context;
|
||||||
void *view;
|
void *view;
|
||||||
struct ScrArea *sa;
|
struct ScrArea *sa;
|
||||||
struct ARegion *ar;
|
struct ARegion *ar;
|
||||||
|
@@ -120,8 +120,13 @@
|
|||||||
//#include "BIF_toolbox.h"
|
//#include "BIF_toolbox.h"
|
||||||
|
|
||||||
#include "ED_types.h"
|
#include "ED_types.h"
|
||||||
|
#include "ED_anim_api.h"
|
||||||
|
#include "ED_keyframing.h"
|
||||||
|
#include "ED_keyframes_edit.h"
|
||||||
#include "ED_view3d.h"
|
#include "ED_view3d.h"
|
||||||
|
|
||||||
|
#include "UI_view2d.h"
|
||||||
|
|
||||||
//#include "BSE_drawipo.h"
|
//#include "BSE_drawipo.h"
|
||||||
//#include "BSE_edit.h"
|
//#include "BSE_edit.h"
|
||||||
//#include "BSE_editipo.h"
|
//#include "BSE_editipo.h"
|
||||||
@@ -2108,7 +2113,7 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
|
|||||||
int propmode = t->flag & T_PROP_EDIT;
|
int propmode = t->flag & T_PROP_EDIT;
|
||||||
int mirror = 0;
|
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;
|
mirror = 1;
|
||||||
}
|
}
|
||||||
@@ -2680,7 +2685,6 @@ static void posttrans_gpd_clean (bGPdata *gpd)
|
|||||||
*/
|
*/
|
||||||
static void posttrans_ipo_clean (Ipo *ipo)
|
static void posttrans_ipo_clean (Ipo *ipo)
|
||||||
{
|
{
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
|
||||||
IpoCurve *icu;
|
IpoCurve *icu;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -2737,40 +2741,39 @@ static void posttrans_ipo_clean (Ipo *ipo)
|
|||||||
/* free cache */
|
/* free cache */
|
||||||
MEM_freeN(selcache);
|
MEM_freeN(selcache);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by special_aftertrans_update to make sure selected keyframes replace
|
/* Called by special_aftertrans_update to make sure selected keyframes replace
|
||||||
* any other keyframes which may reside on that frame (that is not selected).
|
* any other keyframes which may reside on that frame (that is not selected).
|
||||||
* remake_action_ipos should have already been called
|
* 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 anim_data = {NULL, NULL};
|
||||||
ListBase act_data = {NULL, NULL};
|
bAnimListElem *ale;
|
||||||
bActListElem *ale;
|
|
||||||
int filter;
|
int filter;
|
||||||
|
|
||||||
/* filter data */
|
/* filter data */
|
||||||
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
|
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
|
||||||
actdata_filter(&act_data, filter, act, ACTCONT_ACTION);
|
ANIM_animdata_filter(&anim_data, filter, act, ANIMCONT_ACTION);
|
||||||
|
|
||||||
/* loop through relevant data, removing keyframes from the ipo-blocks that were attached
|
/* loop through relevant data, removing keyframes from the ipo-blocks that were attached
|
||||||
* - all keyframes are converted in/out of global time
|
* - all keyframes are converted in/out of global time
|
||||||
*/
|
*/
|
||||||
for (ale= act_data.first; ale; ale= ale->next) {
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||||
if (NLA_ACTION_SCALED) {
|
Object *nob= ANIM_nla_mapping_get(ac, ale);
|
||||||
actstrip_map_ipo_keys(OBACT, ale->key_data, 0, 1);
|
|
||||||
|
if (nob) {
|
||||||
|
ANIM_nla_mapping_apply(nob, ale->key_data, 0, 1);
|
||||||
posttrans_ipo_clean(ale->key_data);
|
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
|
else
|
||||||
posttrans_ipo_clean(ale->key_data);
|
posttrans_ipo_clean(ale->key_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free temp data */
|
/* free temp data */
|
||||||
BLI_freelistN(&act_data);
|
BLI_freelistN(&anim_data);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by special_aftertrans_update to make sure selected keyframes replace
|
/* 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)
|
static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side, float cfra)
|
||||||
{
|
{
|
||||||
#if 0 // TRANSFORM_FIX_ME
|
|
||||||
IpoCurve *icu;
|
IpoCurve *icu;
|
||||||
BezTriple *bezt;
|
BezTriple *bezt;
|
||||||
int i;
|
int i;
|
||||||
@@ -2977,8 +2979,6 @@ static TransData *IpoToTransData(TransData *td, Ipo *ipo, Object *ob, char side,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return td;
|
return td;
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* helper struct for gp-frame transforms (only used here) */
|
/* 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)
|
static void createTransActionData(bContext *C, TransInfo *t)
|
||||||
{
|
{
|
||||||
// TRANSFORM_FIX_ME
|
Scene *scene= CTX_data_scene(C);
|
||||||
#if 0
|
|
||||||
TransData *td = NULL;
|
TransData *td = NULL;
|
||||||
tGPFtransdata *tfd = NULL;
|
tGPFtransdata *tfd = NULL;
|
||||||
Object *ob= NULL;
|
|
||||||
|
|
||||||
ListBase act_data = {NULL, NULL};
|
bAnimContext ac;
|
||||||
bActListElem *ale;
|
ListBase anim_data = {NULL, NULL};
|
||||||
void *data;
|
bAnimListElem *ale;
|
||||||
short datatype;
|
|
||||||
int filter;
|
int filter;
|
||||||
|
|
||||||
int count=0;
|
int count=0;
|
||||||
@@ -3058,26 +3055,22 @@ static void createTransActionData(bContext *C, TransInfo *t)
|
|||||||
char side;
|
char side;
|
||||||
|
|
||||||
/* determine what type of data we are operating on */
|
/* determine what type of data we are operating on */
|
||||||
data = get_action_context(&datatype);
|
if (ANIM_animdata_get_context(C, &ac) == 0)
|
||||||
if (data == NULL) return;
|
return;
|
||||||
|
|
||||||
/* filter data */
|
/* filter data */
|
||||||
if (datatype == ACTCONT_GPENCIL)
|
if (ac.datatype == ANIMCONT_GPENCIL)
|
||||||
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT);
|
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT);
|
||||||
else
|
else
|
||||||
filter= (ACTFILTER_VISIBLE | ACTFILTER_FOREDIT | ACTFILTER_IPOKEYS);
|
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_IPOKEYS);
|
||||||
actdata_filter(&act_data, filter, data, datatype);
|
ANIM_animdata_filter(&anim_data, filter, ac.data, ac.datatype);
|
||||||
|
|
||||||
/* is the action scaled? if so, the it should belong to the active object */
|
|
||||||
if (NLA_ACTION_SCALED)
|
|
||||||
ob= OBACT;
|
|
||||||
|
|
||||||
/* which side of the current frame should be allowed */
|
/* which side of the current frame should be allowed */
|
||||||
if (t->mode == TFM_TIME_EXTEND) {
|
if (t->mode == TFM_TIME_EXTEND) {
|
||||||
/* only side on which mouse is gets transformed */
|
/* only side on which mouse is gets transformed */
|
||||||
float xmouse, ymouse;
|
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';
|
side = (xmouse > CFRA) ? 'R' : 'L';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -3085,26 +3078,28 @@ static void createTransActionData(bContext *C, TransInfo *t)
|
|||||||
side = 'B';
|
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 */
|
/* loop 1: fully select ipo-keys and count how many BezTriples are selected */
|
||||||
for (ale= act_data.first; ale; ale= ale->next) {
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||||
if (ale->type == ACTTYPE_GPLAYER)
|
Object *nob= ANIM_nla_mapping_get(&ac, ale);
|
||||||
count += count_gplayer_frames(ale->data, 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
|
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);
|
count += count_ipo_keys(ale->key_data, side, cfra);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* stop if trying to build list if nothing selected */
|
/* stop if trying to build list if nothing selected */
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
/* cleanup temp list */
|
/* cleanup temp list */
|
||||||
BLI_freelistN(&act_data);
|
BLI_freelistN(&anim_data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3114,7 +3109,7 @@ static void createTransActionData(bContext *C, TransInfo *t)
|
|||||||
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)");
|
t->data= MEM_callocN(t->total*sizeof(TransData), "TransData(Action Editor)");
|
||||||
td= t->data;
|
td= t->data;
|
||||||
|
|
||||||
if (datatype == ACTCONT_GPENCIL) {
|
if (ac.datatype == ANIMCONT_GPENCIL) {
|
||||||
if (t->mode == TFM_TIME_SLIDE) {
|
if (t->mode == TFM_TIME_SLIDE) {
|
||||||
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
|
t->customData= MEM_callocN((sizeof(float)*2)+(sizeof(tGPFtransdata)*count), "TimeSlide + tGPFtransdata");
|
||||||
tfd= (tGPFtransdata *)( (float *)(t->customData) + 2 );
|
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");
|
t->customData= MEM_callocN(sizeof(float)*2, "TimeSlide Min/Max");
|
||||||
|
|
||||||
/* loop 2: build transdata array */
|
/* loop 2: build transdata array */
|
||||||
for (ale= act_data.first; ale; ale= ale->next) {
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
||||||
if (ale->type == ACTTYPE_GPLAYER) {
|
//if (ale->type == ANIMTYPE_GPLAYER) {
|
||||||
bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
// bGPDlayer *gpl= (bGPDlayer *)ale->data;
|
||||||
int i;
|
// int i;
|
||||||
|
//
|
||||||
i = GPLayerToTransData(td, tfd, gpl, side, cfra);
|
// i = GPLayerToTransData(td, tfd, gpl, side, cfra);
|
||||||
td += i;
|
// td += i;
|
||||||
tfd += i;
|
// tfd += i;
|
||||||
}
|
//}
|
||||||
else {
|
//else {
|
||||||
|
Object *nob= ANIM_nla_mapping_get(&ac, ale);
|
||||||
Ipo *ipo= (Ipo *)ale->key_data;
|
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 */
|
/* 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 */
|
/* cleanup temp list */
|
||||||
BLI_freelistN(&act_data);
|
BLI_freelistN(&anim_data);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createTransNlaData(bContext *C, TransInfo *t)
|
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) {
|
if (t->spacetype == SPACE_ACTION) {
|
||||||
void *data;
|
SpaceAction *saction= (SpaceAction *)(t->sa->spacedata.first);
|
||||||
short datatype;
|
Scene *scene= NULL;
|
||||||
|
bAnimContext ac;
|
||||||
|
|
||||||
/* determine what type of data we are operating on */
|
/* determine what type of data we are operating on */
|
||||||
data = get_action_context(&datatype);
|
if (ANIM_animdata_get_context(t->context, &ac) == 0) {
|
||||||
if (data == NULL) return;
|
printf("space action transform -> special aftertrans exit. no context \n"); // XXX
|
||||||
ob = OBACT;
|
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 */
|
/* Depending on the lock status, draw necessary views */
|
||||||
|
// fixme... some of this stuff is not good
|
||||||
if (ob) {
|
if (ob) {
|
||||||
ob->ctime= -1234567.0f;
|
ob->ctime= -1234567.0f;
|
||||||
|
|
||||||
if(ob->pose || ob_get_key(ob))
|
if (ob->pose || ob_get_key(ob))
|
||||||
DAG_object_flush_update(G.scene, ob, OB_RECALC);
|
DAG_object_flush_update(scene, ob, OB_RECALC);
|
||||||
else
|
else
|
||||||
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
|
DAG_object_flush_update(scene, ob, OB_RECALC_OB);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do curve cleanups? */
|
/* Do curve cleanups? */
|
||||||
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
||||||
((cancelled == 0) || (duplicate)) )
|
((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 */
|
/* fix up the Ipocurves and redraw stuff */
|
||||||
Key *key= (Key *)data;
|
Key *key= (Key *)ac.data;
|
||||||
|
|
||||||
if (key->ipo) {
|
if (key->ipo) {
|
||||||
IpoCurve *icu;
|
IpoCurve *icu;
|
||||||
|
|
||||||
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
if ( (saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
|
||||||
((cancelled == 0) || (duplicate)) )
|
((cancelled == 0) || (duplicate)) )
|
||||||
{
|
{
|
||||||
posttrans_ipo_clean(key->ipo);
|
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! */
|
/* remove duplicate frames and also make sure points are in order! */
|
||||||
if ((cancelled == 0) || (duplicate))
|
if ((cancelled == 0) || (duplicate))
|
||||||
{
|
{
|
||||||
|
bScreen *sc= (bScreen *)ac.data;
|
||||||
ScrArea *sa;
|
ScrArea *sa;
|
||||||
|
|
||||||
/* BAD... we need to loop over all screen areas for current screen...
|
/* BAD... we need to loop over all screen areas for current screen...
|
||||||
* - sync this with actdata_filter_gpencil() in editaction.c
|
* - 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);
|
bGPdata *gpd= gpencil_data_getactive(sa);
|
||||||
|
|
||||||
if (gpd)
|
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) {
|
else if (t->spacetype == SPACE_NLA) {
|
||||||
recalc_all_ipos(); // bad
|
recalc_all_ipos(); // bad
|
||||||
synchronize_action_strips();
|
synchronize_action_strips();
|
||||||
@@ -4317,11 +4358,11 @@ void createTransData(bContext *C, TransInfo *t)
|
|||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
Object *ob = OBACT;
|
Object *ob = OBACT;
|
||||||
|
|
||||||
if (t->context == CTX_TEXTURE) {
|
if (t->options == CTX_TEXTURE) {
|
||||||
t->flag |= T_TEXTURE;
|
t->flag |= T_TEXTURE;
|
||||||
createTransTexspace(C, t);
|
createTransTexspace(C, t);
|
||||||
}
|
}
|
||||||
else if (t->context == CTX_EDGE) {
|
else if (t->options == CTX_EDGE) {
|
||||||
t->ext = NULL;
|
t->ext = NULL;
|
||||||
t->flag |= T_EDIT;
|
t->flag |= T_EDIT;
|
||||||
createTransEdge(C, t);
|
createTransEdge(C, t);
|
||||||
@@ -4331,7 +4372,7 @@ void createTransData(bContext *C, TransInfo *t)
|
|||||||
sort_trans_data_dist(t);
|
sort_trans_data_dist(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (t->context == CTX_BMESH) {
|
else if (t->options == CTX_BMESH) {
|
||||||
// TRANSFORM_FIX_ME
|
// TRANSFORM_FIX_ME
|
||||||
//createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td);
|
//createTransBMeshVerts(t, G.editBMesh->bm, G.editBMesh->td);
|
||||||
}
|
}
|
||||||
|
@@ -444,7 +444,7 @@ void recalcData(TransInfo *t)
|
|||||||
}
|
}
|
||||||
clipMirrorModifier(t, G.obedit);
|
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);
|
editmesh_apply_to_mirror(t);
|
||||||
|
|
||||||
DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */
|
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;
|
// if(G.obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
|
||||||
// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
|
// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
|
||||||
// else G.moving= G_TRANSFORM_OBJ;
|
// else G.moving= G_TRANSFORM_OBJ;
|
||||||
|
|
||||||
|
t->context= C;
|
||||||
t->scene = sce;
|
t->scene = sce;
|
||||||
t->sa = sa;
|
t->sa = sa;
|
||||||
t->ar = ar;
|
t->ar = ar;
|
||||||
@@ -684,7 +685,7 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
|
|||||||
t->flag = 0;
|
t->flag = 0;
|
||||||
|
|
||||||
/* setting PET flag */
|
/* 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;
|
t->flag |= T_PROP_EDIT;
|
||||||
|
|
||||||
if(sce->proportional == 2)
|
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)
|
static void transformops_data(bContext *C, wmOperator *op, wmEvent *event)
|
||||||
{
|
{
|
||||||
int mode = RNA_int_get(op->ptr, "mode");
|
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");
|
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
|
||||||
|
|
||||||
initTransform(C, t, mode, context, event);
|
initTransform(C, t, mode, options, event);
|
||||||
|
|
||||||
/* store data */
|
/* store data */
|
||||||
op->customdata = t;
|
op->customdata = t;
|
||||||
@@ -133,7 +133,7 @@ void TFM_OT_transform(struct wmOperatorType *ot)
|
|||||||
ot->poll = ED_operator_areaactive;
|
ot->poll = ED_operator_areaactive;
|
||||||
|
|
||||||
RNA_def_property(ot->srna, "mode", PROP_INT, PROP_NONE);
|
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);
|
prop = RNA_def_property(ot->srna, "value", PROP_FLOAT, PROP_VECTOR);
|
||||||
RNA_def_property_array(prop, 4);
|
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);
|
RNA_int_set(km->ptr, "mode", TFM_SHEAR);
|
||||||
|
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user