New transform:
- added texture space grab/scale (TKEY objectmode) - made new transform work with menus (meaning, dropping dreaded while-hold) To Martin & other while-hold lovers: this needs to be carefully thought over and designed. I prefer to look on this within context of making transform fully tablet/pen friendly, as option. Aim now for me is still: get transform back to work! :)
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
#ifndef BIF_TRANSFORM_H
|
#ifndef BIF_TRANSFORM_H
|
||||||
#define BIF_TRANSFORM_H
|
#define BIF_TRANSFORM_H
|
||||||
|
|
||||||
#define NEWTRANSFORM 1
|
// #define NEWTRANSFORM 1
|
||||||
|
|
||||||
/* ******************** Macros & Prototypes *********************** */
|
/* ******************** Macros & Prototypes *********************** */
|
||||||
|
|
||||||
@@ -46,6 +46,13 @@
|
|||||||
#define TFM_SHEAR 5
|
#define TFM_SHEAR 5
|
||||||
#define TFM_LAMP_ENERGY 6
|
#define TFM_LAMP_ENERGY 6
|
||||||
|
|
||||||
|
// not sure if adding modes is the right way... context detecting could be done different (ton)
|
||||||
|
#define TFM_TEX 32
|
||||||
|
#define TFM_TEX_TRANSLATION 33
|
||||||
|
#define TFM_TEX_ROTATION 34
|
||||||
|
#define TFM_TEX_RESIZE 35
|
||||||
|
|
||||||
|
|
||||||
#define PROP_SHARP 0
|
#define PROP_SHARP 0
|
||||||
#define PROP_SMOOTH 1
|
#define PROP_SMOOTH 1
|
||||||
#define PROP_ROOT 2
|
#define PROP_ROOT 2
|
||||||
|
|||||||
@@ -7941,13 +7941,13 @@ void texspace_edit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
transmode= TRANS_TEX;
|
//transmode= TRANS_TEX;
|
||||||
|
|
||||||
if(nr==1) transform('g');
|
if(nr==1) Transform(TFM_TEX_TRANSLATION);
|
||||||
else if(nr==2) transform('s');
|
else if(nr==2) Transform(TFM_TEX_RESIZE);
|
||||||
else if(nr==3) transform('r');
|
else if(nr==3) Transform(TFM_TEX_ROTATION);
|
||||||
|
|
||||||
transmode= 0;
|
//transmode= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void first_base(void)
|
void first_base(void)
|
||||||
|
|||||||
@@ -75,12 +75,7 @@
|
|||||||
#include "BKE_global.h"
|
#include "BKE_global.h"
|
||||||
#include "BKE_main.h"
|
#include "BKE_main.h"
|
||||||
|
|
||||||
#include "BIF_gl.h"
|
#include "BIF_editnla.h"
|
||||||
#include "BIF_graphics.h"
|
|
||||||
#include "BIF_mainqueue.h"
|
|
||||||
#include "BIF_interface.h"
|
|
||||||
#include "BIF_toolbox.h"
|
|
||||||
#include "BIF_mywindow.h"
|
|
||||||
#include "BIF_editarmature.h"
|
#include "BIF_editarmature.h"
|
||||||
#include "BIF_editdeform.h"
|
#include "BIF_editdeform.h"
|
||||||
#include "BIF_editfont.h"
|
#include "BIF_editfont.h"
|
||||||
@@ -89,11 +84,17 @@
|
|||||||
#include "BIF_editlattice.h"
|
#include "BIF_editlattice.h"
|
||||||
#include "BIF_editsima.h"
|
#include "BIF_editsima.h"
|
||||||
#include "BIF_editoops.h"
|
#include "BIF_editoops.h"
|
||||||
|
#include "BIF_gl.h"
|
||||||
|
#include "BIF_graphics.h"
|
||||||
#include "BIF_imasel.h"
|
#include "BIF_imasel.h"
|
||||||
|
#include "BIF_mainqueue.h"
|
||||||
|
#include "BIF_interface.h"
|
||||||
|
#include "BIF_toolbox.h"
|
||||||
|
#include "BIF_mywindow.h"
|
||||||
#include "BIF_screen.h"
|
#include "BIF_screen.h"
|
||||||
#include "BIF_space.h"
|
#include "BIF_space.h"
|
||||||
#include "BIF_tbcallback.h"
|
#include "BIF_tbcallback.h"
|
||||||
#include "BIF_editnla.h"
|
#include "BIF_transform.h"
|
||||||
|
|
||||||
#include "BDR_editobject.h"
|
#include "BDR_editobject.h"
|
||||||
#include "BDR_editcurve.h"
|
#include "BDR_editcurve.h"
|
||||||
@@ -1987,13 +1988,13 @@ static void tb_do_transform(void *arg, int event)
|
|||||||
switch(event)
|
switch(event)
|
||||||
{
|
{
|
||||||
case 0: /* Grab/move */
|
case 0: /* Grab/move */
|
||||||
transform('g');
|
Transform(TFM_TRANSLATION);
|
||||||
break;
|
break;
|
||||||
case 1: /* Rotate */
|
case 1: /* Rotate */
|
||||||
transform('r');
|
Transform(TFM_ROTATION);
|
||||||
break;
|
break;
|
||||||
case 2: /* Scale */
|
case 2: /* Scale */
|
||||||
transform('s');
|
Transform(TFM_RESIZE);
|
||||||
break;
|
break;
|
||||||
case 3: /* transform properties */
|
case 3: /* transform properties */
|
||||||
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
|
add_blockhandler(curarea, VIEW3D_HANDLER_OBJECT, UI_PNL_UNSTOW);
|
||||||
@@ -2005,7 +2006,7 @@ static void tb_do_transform(void *arg, int event)
|
|||||||
transform('N');
|
transform('N');
|
||||||
break;
|
break;
|
||||||
case 6: /* Shear */
|
case 6: /* Shear */
|
||||||
transform('S');
|
Transform(TFM_SHEAR);
|
||||||
break;
|
break;
|
||||||
case 7: /* Warp */
|
case 7: /* Warp */
|
||||||
transform('w');
|
transform('w');
|
||||||
|
|||||||
@@ -149,6 +149,55 @@ static int allocTransData(void)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void createTransTexspace(void)
|
||||||
|
{
|
||||||
|
TransData *td;
|
||||||
|
Object *ob;
|
||||||
|
ID *id;
|
||||||
|
|
||||||
|
|
||||||
|
ob= OBACT;
|
||||||
|
Trans.total = 1;
|
||||||
|
td= Trans.data= MEM_callocN(sizeof(TransData), "TransTexspace");
|
||||||
|
td->ext= MEM_callocN(sizeof(TransDataExtension), "TransTexspace");
|
||||||
|
|
||||||
|
td->flag= TD_SELECTED;
|
||||||
|
VECCOPY(td->center, ob->obmat[3]);
|
||||||
|
td->ob = ob;
|
||||||
|
|
||||||
|
Mat3CpyMat4(td->mtx, ob->obmat);
|
||||||
|
Mat3Inv(td->smtx, td->mtx);
|
||||||
|
|
||||||
|
id= ob->data;
|
||||||
|
if(id==0);
|
||||||
|
else if( GS(id->name)==ID_ME) {
|
||||||
|
Mesh *me= ob->data;
|
||||||
|
me->texflag &= ~AUTOSPACE;
|
||||||
|
td->loc= me->loc;
|
||||||
|
td->ext->rot= me->rot;
|
||||||
|
td->ext->size= me->size;
|
||||||
|
}
|
||||||
|
else if( GS(id->name)==ID_CU) {
|
||||||
|
Curve *cu= ob->data;
|
||||||
|
cu->texflag &= ~CU_AUTOSPACE;
|
||||||
|
td->loc= cu->loc;
|
||||||
|
td->ext->rot= cu->rot;
|
||||||
|
td->ext->size= cu->size;
|
||||||
|
}
|
||||||
|
else if( GS(id->name)==ID_MB) {
|
||||||
|
MetaBall *mb= ob->data;
|
||||||
|
mb->texflag &= ~MB_AUTOSPACE;
|
||||||
|
td->loc= mb->loc;
|
||||||
|
td->ext->rot= mb->rot;
|
||||||
|
td->ext->size= mb->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
VECCOPY(td->iloc, td->loc);
|
||||||
|
VECCOPY(td->ext->irot, td->ext->rot);
|
||||||
|
VECCOPY(td->ext->isize, td->ext->size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ********************* pose mode ************* */
|
/* ********************* pose mode ************* */
|
||||||
|
|
||||||
/* callback, make sure it's identical structured as next one */
|
/* callback, make sure it's identical structured as next one */
|
||||||
@@ -1078,9 +1127,13 @@ static void createTransObject(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createTransData(void)
|
static void createTransData(TransInfo *t)
|
||||||
{
|
{
|
||||||
if (G.obpose) {
|
if( t->mode & TFM_TEX) {
|
||||||
|
createTransTexspace();
|
||||||
|
t->mode &= ~TFM_TEX; // now becoming normal grab/rot/scale
|
||||||
|
}
|
||||||
|
else if (G.obpose) {
|
||||||
createTransPose();
|
createTransPose();
|
||||||
}
|
}
|
||||||
else if (G.obedit) {
|
else if (G.obedit) {
|
||||||
@@ -1142,14 +1195,15 @@ void Transform(int mode)
|
|||||||
|
|
||||||
initTransModeFlags(&Trans, mode); // modal settings in struct Trans
|
initTransModeFlags(&Trans, mode); // modal settings in struct Trans
|
||||||
|
|
||||||
initTrans(&Trans); // data, mouse, vectors
|
initTrans(&Trans); // internal data, mouse, vectors
|
||||||
|
|
||||||
createTransData(); // make TransData structs from selection
|
createTransData(&Trans); // make TransData structs from selection
|
||||||
|
|
||||||
if (Trans.total == 0)
|
if (Trans.total == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
|
/* EVIL! posemode code can switch translation to rotate when 1 bone is selected. will be removed (ton) */
|
||||||
|
/* EVIL2: we gave as argument also texture space context bit... was cleared */
|
||||||
mode= Trans.mode;
|
mode= Trans.mode;
|
||||||
|
|
||||||
calculatePropRatio(&Trans);
|
calculatePropRatio(&Trans);
|
||||||
@@ -1281,13 +1335,15 @@ void Transform(int mode)
|
|||||||
break;
|
break;
|
||||||
case LEFTMOUSE:
|
case LEFTMOUSE:
|
||||||
case RIGHTMOUSE:
|
case RIGHTMOUSE:
|
||||||
ret_val = TRANS_CONFIRM;
|
/* commented out, doesn't work for actions started with menu */
|
||||||
|
// ret_val = TRANS_CONFIRM;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(ret_val == TRANS_CANCEL) {
|
if(ret_val == TRANS_CANCEL) {
|
||||||
restoreTransObjects(&Trans);
|
restoreTransObjects(&Trans);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user