Transform fun

extracting params in split transform operators.

work in progress still, but lots of fun with operator replay (F6)
This commit is contained in:
2009-03-06 15:50:15 +00:00
parent aeef01559e
commit c07acfb4fd
10 changed files with 570 additions and 110 deletions

View File

@@ -287,6 +287,8 @@ Scene *add_scene(char *name)
sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH; sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE; sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
sce->toolsettings->proportional_size = 1.0f;
pset= &sce->toolsettings->particle; pset= &sce->toolsettings->particle;
pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER; pset->flag= PE_KEEP_LENGTHS|PE_LOCK_FIRST|PE_DEFLECT_EMITTER;
pset->emitterdist= 0.25f; pset->emitterdist= 0.25f;

View File

@@ -56,7 +56,6 @@ enum {
TFM_WARP, TFM_WARP,
TFM_SHRINKFATTEN, TFM_SHRINKFATTEN,
TFM_TILT, TFM_TILT,
TFM_LAMP_ENERGY,
TFM_TRACKBALL, TFM_TRACKBALL,
TFM_PUSHPULL, TFM_PUSHPULL,
TFM_CREASE, TFM_CREASE,

View File

@@ -772,7 +772,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
break; break;
case PADPLUSKEY: case PADPLUSKEY:
if(event->keymodifier & KM_ALT && t->flag & T_PROP_EDIT) { if(event->keymodifier & KM_ALT && t->flag & T_PROP_EDIT) {
t->propsize*= 1.1f; t->prop_size*= 1.1f;
calculatePropRatio(t); calculatePropRatio(t);
} }
t->redraw= 1; t->redraw= 1;
@@ -783,7 +783,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
transform_autoik_update(t, 1); transform_autoik_update(t, 1);
} }
else if(t->flag & T_PROP_EDIT) { else if(t->flag & T_PROP_EDIT) {
t->propsize*= 1.1f; t->prop_size*= 1.1f;
calculatePropRatio(t); calculatePropRatio(t);
} }
else view_editmove(event->type); else view_editmove(event->type);
@@ -791,7 +791,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
break; break;
case PADMINUS: case PADMINUS:
if(event->keymodifier & KM_ALT && t->flag & T_PROP_EDIT) { if(event->keymodifier & KM_ALT && t->flag & T_PROP_EDIT) {
t->propsize*= 0.90909090f; t->prop_size*= 0.90909090f;
calculatePropRatio(t); calculatePropRatio(t);
} }
t->redraw= 1; t->redraw= 1;
@@ -802,7 +802,7 @@ void transformEvent(TransInfo *t, wmEvent *event)
transform_autoik_update(t, -1); transform_autoik_update(t, -1);
} }
else if (t->flag & T_PROP_EDIT) { else if (t->flag & T_PROP_EDIT) {
t->propsize*= 0.90909090f; t->prop_size*= 0.90909090f;
calculatePropRatio(t); calculatePropRatio(t);
} }
else view_editmove(event->type); else view_editmove(event->type);
@@ -903,7 +903,7 @@ int calculateTransformCenter(bContext *C, wmEvent *event, int centerMode, float
t->mode = TFM_DUMMY; t->mode = TFM_DUMMY;
initTransInfo(C, t, event); // internal data, mouse, vectors initTransInfo(C, t, NULL, event); // internal data, mouse, vectors
createTransData(C, t); // make TransData structs from selection createTransData(C, t); // make TransData structs from selection
@@ -942,21 +942,85 @@ void drawTransform(const struct bContext *C, struct ARegion *ar, void *arg)
void saveTransform(bContext *C, TransInfo *t, wmOperator *op) void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
{ {
short twmode= (t->spacetype==SPACE_VIEW3D)? ((View3D*)t->view)->twmode: V3D_MANIP_GLOBAL; Scene *sce = CTX_data_scene(C);
int constraint_axis[3] = {0, 0, 0};
int proportional = 0;
RNA_int_set(op->ptr, "mode", t->mode); RNA_int_set(op->ptr, "mode", t->mode);
RNA_int_set(op->ptr, "options", t->options); RNA_int_set(op->ptr, "options", t->options);
RNA_float_set_array(op->ptr, "values", t->values);
if (t->flag & T_AUTOVALUES)
{
RNA_float_set_array(op->ptr, "value", t->auto_values);
}
else
{
RNA_float_set_array(op->ptr, "value", t->values);
}
RNA_int_set(op->ptr, "constraint_mode", t->con.mode); /* XXX convert stupid flag to enum */
RNA_int_set(op->ptr, "constraint_orientation", twmode); switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
RNA_float_set_array(op->ptr, "constraint_matrix", (float*)t->con.mtx); {
case (T_PROP_EDIT|T_PROP_CONNECTED):
proportional = 2;
break;
case T_PROP_EDIT:
proportional = 1;
break;
default:
proportional = 0;
}
if (RNA_struct_find_property(op->ptr, "proportional"))
{
RNA_enum_set(op->ptr, "proportional", proportional);
RNA_enum_set(op->ptr, "proportional_mode", t->prop_mode);
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
}
if (RNA_struct_find_property(op->ptr, "mirror"))
{
RNA_boolean_set(op->ptr, "mirror", t->flag & T_MIRROR);
}
if (RNA_struct_find_property(op->ptr, "constraint_mode"))
{
RNA_int_set(op->ptr, "constraint_mode", t->con.mode);
RNA_int_set(op->ptr, "constraint_orientation", t->current_orientation);
if (t->con.mode & CON_APPLY)
{
if (t->con.mode & CON_AXIS0) {
constraint_axis[0] = 1;
}
if (t->con.mode & CON_AXIS1) {
constraint_axis[1] = 1;
}
if (t->con.mode & CON_AXIS2) {
constraint_axis[2] = 1;
}
}
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
}
// XXX If modal, save settings back in scene
if (t->flag & T_MODAL)
{
sce->prop_mode = t->prop_mode;
sce->proportional = proportional;
if(t->spacetype == SPACE_VIEW3D)
{
View3D *v3d = t->view;
v3d->twmode = t->current_orientation;
}
}
} }
void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int mode)
{ {
int mode = RNA_int_get(op->ptr, "mode");
int options = RNA_int_get(op->ptr, "options"); int options = RNA_int_get(op->ptr, "options");
/* 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 */
@@ -967,7 +1031,7 @@ void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
t->mode = mode; t->mode = mode;
initTransInfo(C, t, event); // internal data, mouse, vectors initTransInfo(C, t, op, event); // internal data, mouse, vectors
initTransformOrientation(C, t); initTransformOrientation(C, t);
@@ -1096,24 +1160,38 @@ void initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
} }
/* overwrite initial values if operator supplied a non-null vector */ /* overwrite initial values if operator supplied a non-null vector */
if (RNA_property_is_set(op->ptr, "values")) if (RNA_property_is_set(op->ptr, "value"))
{ {
float values[4]; float values[4];
RNA_float_get_array(op->ptr, "values", values); RNA_float_get_array(op->ptr, "value", values);
QUATCOPY(t->values, values); QUATCOPY(t->values, values);
QUATCOPY(t->auto_values, values);
t->flag |= T_AUTOVALUES;
} }
/* Constraint init from operator */ /* Constraint init from operator */
if (RNA_property_is_set(op->ptr, "constraint_axis"))
{ {
t->con.mode = RNA_int_get(op->ptr, "constraint_mode"); int constraint_axis[3];
if (t->con.mode & CON_APPLY) RNA_boolean_get_array(op->ptr, "constraint_axis", constraint_axis);
if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2])
{ {
RNA_float_get_array(op->ptr, "constraint_matrix", (float*)t->spacemtx); t->con.mode |= CON_APPLY;
if (constraint_axis[0]) {
t->con.mode |= CON_AXIS0;
}
if (constraint_axis[1]) {
t->con.mode |= CON_AXIS1;
}
if (constraint_axis[2]) {
t->con.mode |= CON_AXIS2;
}
setUserConstraint(t, t->con.mode, "%s"); setUserConstraint(t, t->con.mode, "%s");
} }
} }
} }
@@ -2227,6 +2305,13 @@ int Resize(TransInfo *t, short mval[2])
applySnapping(t, size); applySnapping(t, size);
if (t->flag & T_AUTOVALUES)
{
VECCOPY(size, t->auto_values);
}
VECCOPY(t->values, size);
SizeToMat3(size, mat); SizeToMat3(size, mat);
if (t->con.applySize) { if (t->con.applySize) {

View File

@@ -214,7 +214,7 @@ typedef struct TransInfo {
NDofInput ndof; /* ndof input */ NDofInput ndof; /* ndof input */
MouseInput mouse; /* mouse input */ MouseInput mouse; /* mouse input */
char redraw; /* redraw flag */ char redraw; /* redraw flag */
float propsize; /* proportional circle radius */ float prop_size; /* proportional circle radius */
char proptext[20]; /* proportional falloff text */ char proptext[20]; /* proportional falloff text */
float center[3]; /* center of transformation */ float center[3]; /* center of transformation */
int center2d[2]; /* center in screen coordinates */ int center2d[2]; /* center in screen coordinates */
@@ -245,7 +245,12 @@ typedef struct TransInfo {
/*************** NEW STUFF *********************/ /*************** NEW STUFF *********************/
short current_orientation;
short prop_mode;
float values[4]; float values[4];
float auto_values[4];
void *view; void *view;
struct ScrArea *sa; struct ScrArea *sa;
struct ARegion *ar; struct ARegion *ar;
@@ -303,6 +308,13 @@ typedef struct TransInfo {
/* auto-ik is on */ /* auto-ik is on */
#define T_AUTOIK (1 << 18) #define T_AUTOIK (1 << 18)
#define T_MIRROR (1 << 19)
#define T_AUTOVALUES (1 << 20)
/* to specificy if we save back settings at the end */
#define T_MODAL (1 << 21)
/* TransInfo->modifiers */ /* TransInfo->modifiers */
#define MOD_CONSTRAINT_SELECT 0x01 #define MOD_CONSTRAINT_SELECT 0x01
#define MOD_PRECISION 0x02 #define MOD_PRECISION 0x02
@@ -354,7 +366,7 @@ typedef struct TransInfo {
void TFM_OT_transform(struct wmOperatorType *ot); void TFM_OT_transform(struct wmOperatorType *ot);
void initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event); void initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, struct wmEvent *event, int mode);
void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op);
void transformEvent(TransInfo *t, struct wmEvent *event); void transformEvent(TransInfo *t, struct wmEvent *event);
void transformApply(struct bContext *C, TransInfo *t); void transformApply(struct bContext *C, TransInfo *t);
@@ -539,7 +551,7 @@ void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, short mval[2],
/*********************** Generics ********************************/ /*********************** Generics ********************************/
void initTransInfo(struct bContext *C, TransInfo *t, struct wmEvent *event); void initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, struct wmEvent *event);
void postTrans (TransInfo *t); void postTrans (TransInfo *t);
void resetTransRestrictions(TransInfo *t); void resetTransRestrictions(TransInfo *t);

View File

@@ -90,6 +90,28 @@
static void drawObjectConstraint(TransInfo *t); static void drawObjectConstraint(TransInfo *t);
/* ************************** CONSTRAINTS ************************* */ /* ************************** CONSTRAINTS ************************* */
void constraintAutoValues(TransInfo *t, float vec[3])
{
int mode = t->con.mode;
if (mode & CON_APPLY)
{
float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f;
if ((mode & CON_AXIS0) == 0)
{
vec[0] = nval;
}
if ((mode & CON_AXIS1) == 0)
{
vec[1] = nval;
}
if ((mode & CON_AXIS2) == 0)
{
vec[2] = nval;
}
}
}
void constraintNumInput(TransInfo *t, float vec[3]) void constraintNumInput(TransInfo *t, float vec[3])
{ {
int mode = t->con.mode; int mode = t->con.mode;
@@ -99,6 +121,8 @@ void constraintNumInput(TransInfo *t, float vec[3])
if (getConstraintSpaceDimension(t) == 2) { if (getConstraintSpaceDimension(t) == 2) {
int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2); int axis = mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
if (axis == (CON_AXIS0|CON_AXIS1)) { if (axis == (CON_AXIS0|CON_AXIS1)) {
vec[0] = vec[0];
vec[1] = vec[1];
vec[2] = nval; vec[2] = nval;
} }
else if (axis == (CON_AXIS1|CON_AXIS2)) { else if (axis == (CON_AXIS1|CON_AXIS2)) {
@@ -107,12 +131,14 @@ void constraintNumInput(TransInfo *t, float vec[3])
vec[0] = nval; vec[0] = nval;
} }
else if (axis == (CON_AXIS0|CON_AXIS2)) { else if (axis == (CON_AXIS0|CON_AXIS2)) {
vec[0] = vec[0];
vec[2] = vec[1]; vec[2] = vec[1];
vec[1] = nval; vec[1] = nval;
} }
} }
else if (getConstraintSpaceDimension(t) == 1) { else if (getConstraintSpaceDimension(t) == 1) {
if (mode & CON_AXIS0) { if (mode & CON_AXIS0) {
vec[0] = vec[0];
vec[1] = nval; vec[1] = nval;
vec[2] = nval; vec[2] = nval;
} }
@@ -153,6 +179,12 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) {
constraintNumInput(t, vec); constraintNumInput(t, vec);
} }
if (t->flag & T_AUTOVALUES)
{
VECCOPY(vec, t->auto_values);
constraintAutoValues(t, vec);
}
if (t->con.mode & CON_AXIS0) { if (t->con.mode & CON_AXIS0) {
pvec[i++] = vec[0]; pvec[i++] = vec[0];
} }
@@ -522,9 +554,9 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
*/ */
void setUserConstraint(TransInfo *t, int mode, const char ftext[]) { void setUserConstraint(TransInfo *t, int mode, const char ftext[]) {
char text[40]; char text[40];
short twmode= (t->spacetype==SPACE_VIEW3D)? ((View3D*)t->view)->twmode: V3D_MANIP_GLOBAL; //short twmode= (t->spacetype==SPACE_VIEW3D)? ((View3D*)t->view)->twmode: V3D_MANIP_GLOBAL;
switch(twmode) { switch(t->current_orientation) {
case V3D_MANIP_GLOBAL: case V3D_MANIP_GLOBAL:
{ {
float mtx[3][3]; float mtx[3][3];
@@ -772,7 +804,7 @@ void drawPropCircle(TransInfo *t)
} }
set_inverted_drawing(1); set_inverted_drawing(1);
drawcircball(GL_LINE_LOOP, t->center, t->propsize, imat); drawcircball(GL_LINE_LOOP, t->center, t->prop_size, imat);
set_inverted_drawing(0); set_inverted_drawing(0);
glPopMatrix(); glPopMatrix();

View File

@@ -2111,7 +2111,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->options & CTX_NO_MIRROR) == 0 && (scene->toolsettings->editbutflag & B_MESH_X_MIRROR)) if (t->flag & T_MIRROR)
{ {
mirror = 1; mirror = 1;
} }

View File

@@ -52,6 +52,9 @@
#include "DNA_scene_types.h" #include "DNA_scene_types.h"
#include "DNA_userdef_types.h" #include "DNA_userdef_types.h"
#include "DNA_view3d_types.h" #include "DNA_view3d_types.h"
#include "DNA_windowmanager_types.h"
#include "RNA_access.h"
//#include "BIF_screen.h" //#include "BIF_screen.h"
//#include "BIF_mywindow.h" //#include "BIF_mywindow.h"
@@ -468,7 +471,7 @@ void recalcData(TransInfo *t)
// } // }
clipMirrorModifier(t, t->obedit); clipMirrorModifier(t, t->obedit);
} }
if((t->options & CTX_NO_MIRROR) == 0 && (scene->toolsettings->editbutflag & B_MESH_X_MIRROR)) if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
editmesh_apply_to_mirror(t); editmesh_apply_to_mirror(t);
DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */ DAG_object_flush_update(scene, t->obedit, OB_RECALC_DATA); /* sets recalc flags */
@@ -660,7 +663,7 @@ void resetTransRestrictions(TransInfo *t)
t->flag &= ~T_ALL_RESTRICTIONS; t->flag &= ~T_ALL_RESTRICTIONS;
} }
void initTransInfo (bContext *C, TransInfo *t, wmEvent *event) void initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
{ {
Scene *sce = CTX_data_scene(C); Scene *sce = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C); ARegion *ar = CTX_wm_region(C);
@@ -685,16 +688,6 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
t->redraw = 1; /* redraw first time */ t->redraw = 1; /* redraw first time */
t->propsize = 1.0f; /* TRANSFORM_FIX_ME this needs to be saved in scene or something */
/* setting PET flag */
if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
t->flag |= T_PROP_EDIT;
if(sce->proportional == 2)
t->flag |= T_PROP_CONNECTED; // yes i know, has to become define
}
if (event) if (event)
{ {
t->imval[0] = event->x - t->ar->winrct.xmin; t->imval[0] = event->x - t->ar->winrct.xmin;
@@ -741,6 +734,20 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN; if(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
t->around = v3d->around; t->around = v3d->around;
if (op && RNA_property_is_set(op->ptr, "constraint_orientation"))
{
t->current_orientation = RNA_int_get(op->ptr, "constraint_orientation");
if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C) - 1)
{
t->current_orientation = V3D_MANIP_GLOBAL;
}
}
else
{
t->current_orientation = v3d->twmode;
}
} }
else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE) else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
{ {
@@ -756,6 +763,68 @@ void initTransInfo (bContext *C, TransInfo *t, wmEvent *event)
t->around = V3D_CENTER; t->around = V3D_CENTER;
} }
if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_property_is_set(op->ptr, "mirror"))
{
if (RNA_boolean_get(op->ptr, "mirror"))
{
t->flag |= T_MIRROR;
}
}
// Need stuff to take it from edit mesh or whatnot here
else
{
if (t->obedit && t->obedit->type == OB_MESH && sce->toolsettings->editbutflag & B_MESH_X_MIRROR)
{
t->flag |= T_MIRROR;
}
}
/* setting PET flag */
if (op && RNA_struct_find_property(op->ptr, "proportional") && RNA_property_is_set(op->ptr, "proportional"))
{
switch(RNA_enum_get(op->ptr, "proportional"))
{
case 2: /* XXX connected constant */
t->flag |= T_PROP_CONNECTED;
case 1: /* XXX prop on constant */
t->flag |= T_PROP_EDIT;
break;
}
}
else
{
if ((t->options & CTX_NO_PET) == 0 && (sce->proportional)) {
t->flag |= T_PROP_EDIT;
if(sce->proportional == 2)
t->flag |= T_PROP_CONNECTED; // yes i know, has to become define
}
}
if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_property_is_set(op->ptr, "proportional_size"))
{
t->prop_size = RNA_float_get(op->ptr, "proportional_size");
}
else
{
t->prop_size = sce->toolsettings->proportional_size;
}
if (op && RNA_struct_find_property(op->ptr, "proportional_falloff") && RNA_property_is_set(op->ptr, "proportional_falloff"))
{
t->prop_mode = RNA_enum_get(op->ptr, "proportional_falloff");
}
else
{
t->prop_mode = sce->prop_mode;
}
/* TRANSFORM_FIX_ME rna restrictions */
if (t->prop_size <= 0)
{
t->prop_size = 1.0f;
}
setTransformViewMatrices(t); setTransformViewMatrices(t);
initNumInput(&t->num); initNumInput(&t->num);
initNDofInput(&t->ndof); initNDofInput(&t->ndof);
@@ -1113,10 +1182,10 @@ void calculatePropRatio(TransInfo *t)
td->factor = 1.0f; td->factor = 1.0f;
} }
else if ((connected && else if ((connected &&
(td->flag & TD_NOTCONNECTED || td->dist > t->propsize)) (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
|| ||
(connected == 0 && (connected == 0 &&
td->rdist > t->propsize)) { td->rdist > t->prop_size)) {
/* /*
The elements are sorted according to their dist member in the array, The elements are sorted according to their dist member in the array,
that means we can stop when it finds one element outside of the propsize. that means we can stop when it finds one element outside of the propsize.
@@ -1128,7 +1197,7 @@ void calculatePropRatio(TransInfo *t)
else { else {
/* Use rdist for falloff calculations, it is the real distance */ /* Use rdist for falloff calculations, it is the real distance */
td->flag &= ~TD_NOACTION; td->flag &= ~TD_NOACTION;
dist= (t->propsize-td->rdist)/t->propsize; dist= (t->prop_size-td->rdist)/t->prop_size;
/* /*
* Clamp to positive numbers. * Clamp to positive numbers.
@@ -1138,7 +1207,7 @@ void calculatePropRatio(TransInfo *t)
if (dist < 0.0f) if (dist < 0.0f)
dist = 0.0f; dist = 0.0f;
switch(t->scene->prop_mode) { switch(t->prop_mode) {
case PROP_SHARP: case PROP_SHARP:
td->factor= dist*dist; td->factor= dist*dist;
break; break;
@@ -1166,7 +1235,7 @@ void calculatePropRatio(TransInfo *t)
} }
} }
} }
switch(t->scene->prop_mode) { switch(t->prop_mode) {
case PROP_SHARP: case PROP_SHARP:
strcpy(t->proptext, "(Sharp)"); strcpy(t->proptext, "(Sharp)");
break; break;

View File

@@ -24,6 +24,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h" #include "DNA_space_types.h"
#include "DNA_windowmanager_types.h" #include "DNA_windowmanager_types.h"
@@ -44,6 +45,56 @@
#include "transform.h" #include "transform.h"
typedef struct TransformModeItem
{
char *idname;
int mode;
} TransformModeItem;
static float VecOne[3] = {1, 1, 1};
/* need constants for this */
EnumPropertyItem proportional_mode_types[] = {
{0, "OFF", "Off", ""},
{1, "ON", "On", ""},
{2, "CONNECTED", "Connected", ""},
{0, NULL, NULL, NULL}
};
EnumPropertyItem proportional_falloff_types[] = {
{PROP_SMOOTH, "SMOOTH", "Smooth", ""},
{PROP_SPHERE, "SPHERE", "Sphere", ""},
{PROP_ROOT, "ROOT", "Root", ""},
{PROP_SHARP, "SHARP", "Sharp", ""},
{PROP_LIN, "LINEAR", "Linear", ""},
{PROP_CONST, "CONSTANT", "Constant", ""},
{PROP_RANDOM, "RANDOM", "Random", ""},
{0, NULL, NULL, NULL}
};
char OP_TRANSLATION[] = "TFM_OT_translation";
char OP_ROTATION[] = "TFM_OT_rotation";
char OP_TOSPHERE[] = "TFM_OT_tosphere";
char OP_RESIZE[] = "TFM_OT_resize";
char OP_SHEAR[] = "TFM_OT_shear";
char OP_WARP[] = "TFM_OT_warp";
char OP_SHRINK_FATTEN[] = "TFM_OT_shrink_fatten";
char OP_TILT[] = "TFM_OT_tilt";
TransformModeItem transform_modes[] =
{
{OP_TRANSLATION, TFM_TRANSLATION},
{OP_ROTATION, TFM_ROTATION},
{OP_TOSPHERE, TFM_TOSPHERE},
{OP_RESIZE, TFM_RESIZE},
{OP_SHEAR, TFM_SHEAR},
{OP_WARP, TFM_WARP},
{OP_SHRINK_FATTEN, TFM_SHRINKFATTEN},
{OP_TILT, TFM_TILT},
{NULL, 0}
};
static int select_orientation_exec(bContext *C, wmOperator *op) static int select_orientation_exec(bContext *C, wmOperator *op)
{ {
int orientation = RNA_enum_get(op->ptr, "orientation"); int orientation = RNA_enum_get(op->ptr, "orientation");
@@ -103,8 +154,23 @@ static void transformops_data(bContext *C, wmOperator *op, wmEvent *event)
if (op->customdata == NULL) if (op->customdata == NULL)
{ {
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data"); TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
TransformModeItem *tmode;
int mode = -1;
initTransform(C, t, op, event); for (tmode = transform_modes; tmode->idname; tmode++)
{
if (op->type->idname == tmode->idname)
{
mode = tmode->mode;
}
}
if (mode == -1)
{
mode = RNA_int_get(op->ptr, "mode");
}
initTransform(C, t, op, event, mode);
/* store data */ /* store data */
op->customdata = t; op->customdata = t;
@@ -166,20 +232,221 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
transformops_data(C, op, event); transformops_data(C, op, event);
if(RNA_property_is_set(op->ptr, "values")) { if(RNA_property_is_set(op->ptr, "value")) {
return transform_exec(C, op); return transform_exec(C, op);
} }
else { else {
TransInfo *t = op->customdata;
/* add temp handler */ /* add temp handler */
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op); WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
t->flag |= T_MODAL; // XXX meh maybe somewhere else
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
} }
void Properties_Proportional(struct wmOperatorType *ot)
{
RNA_def_enum(ot->srna, "proportional", proportional_mode_types, 0, "Proportional Edition", "");
RNA_def_enum(ot->srna, "proportional_falloff", proportional_falloff_types, 0, "Proportional Falloff", "");
RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100);
}
void Properties_Constraints(struct wmOperatorType *ot)
{
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
}
void TFM_OT_translation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Translation";
ot->idname = OP_TRANSLATION;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
Properties_Constraints(ot);
}
void TFM_OT_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Resize";
ot->idname = OP_RESIZE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
Properties_Constraints(ot);
}
void TFM_OT_rotation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Rotation";
ot->idname = OP_ROTATION;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_vector(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
Properties_Constraints(ot);
}
void TFM_OT_tilt(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Tilt";
ot->idname = OP_TILT;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_editcurve;
RNA_def_float_vector(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
Properties_Constraints(ot);
}
void TFM_OT_warp(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Warp";
ot->idname = OP_WARP;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_vector(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", 0, 1);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
// XXX Shear axis?
// Properties_Constraints(ot);
}
void TFM_OT_shear(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shear";
ot->idname = OP_SHEAR;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_vector(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
// XXX Shear axis?
// Properties_Constraints(ot);
}
void TFM_OT_shrink_fatten(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shrink/Fatten";
ot->idname = OP_SHRINK_FATTEN;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;
RNA_def_float_vector(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
}
void TFM_OT_tosphere(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "To Sphere";
ot->idname = OP_TOSPHERE;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
//RNA_def_float_percentage(ot->srna, "value", 0, 0, 1, "Percentage", "", 0, 1);
// Switch to the previous line when get set to array works correctly
RNA_def_float_vector(ot->srna, "value", 1, NULL, 0, 1, "Percentage", "", 0, 1);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
}
void TFM_OT_transform(struct wmOperatorType *ot) void TFM_OT_transform(struct wmOperatorType *ot)
{ {
static const float mtx[3][3] = {{1, 0, 0},{0, 1, 0},{0, 0, 1}};
static EnumPropertyItem transform_mode_types[] = { static EnumPropertyItem transform_mode_types[] = {
{TFM_INIT, "INIT", "Init", ""}, {TFM_INIT, "INIT", "Init", ""},
{TFM_DUMMY, "DUMMY", "Dummy", ""}, {TFM_DUMMY, "DUMMY", "Dummy", ""},
@@ -191,7 +458,6 @@ void TFM_OT_transform(struct wmOperatorType *ot)
{TFM_WARP, "WARP", "Warp", ""}, {TFM_WARP, "WARP", "Warp", ""},
{TFM_SHRINKFATTEN, "SHRINKFATTEN", "Shrinkfatten", ""}, {TFM_SHRINKFATTEN, "SHRINKFATTEN", "Shrinkfatten", ""},
{TFM_TILT, "TILT", "Tilt", ""}, {TFM_TILT, "TILT", "Tilt", ""},
{TFM_LAMP_ENERGY, "LAMP_ENERGY", "Lamp_Energy", ""},
{TFM_TRACKBALL, "TRACKBALL", "Trackball", ""}, {TFM_TRACKBALL, "TRACKBALL", "Trackball", ""},
{TFM_PUSHPULL, "PUSHPULL", "Pushpull", ""}, {TFM_PUSHPULL, "PUSHPULL", "Pushpull", ""},
{TFM_CREASE, "CREASE", "Crease", ""}, {TFM_CREASE, "CREASE", "Crease", ""},
@@ -224,19 +490,29 @@ void TFM_OT_transform(struct wmOperatorType *ot)
ot->poll = ED_operator_areaactive; ot->poll = ED_operator_areaactive;
RNA_def_enum(ot->srna, "mode", transform_mode_types, 0, "Mode", ""); RNA_def_enum(ot->srna, "mode", transform_mode_types, 0, "Mode", "");
RNA_def_int(ot->srna, "options", 0, INT_MIN, INT_MAX, "Options", "", INT_MIN, INT_MAX);
RNA_def_float_vector(ot->srna, "values", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
RNA_def_int(ot->srna, "constraint_orientation", 0, INT_MIN, INT_MAX, "Constraint Orientation", "", INT_MIN, INT_MAX); RNA_def_enum(ot->srna, "proportional", proportional_mode_types, 0, "Proportional Edition", "");
RNA_def_int(ot->srna, "constraint_mode", 0, INT_MIN, INT_MAX, "Constraint Mode", "", INT_MIN, INT_MAX); RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", "");
RNA_def_float_matrix(ot->srna, "constraint_matrix", 9, mtx[0], -FLT_MAX, FLT_MAX, "Constraint Matrix", "", -FLT_MAX, FLT_MAX); RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
} }
void transform_operatortypes(void) void transform_operatortypes(void)
{ {
WM_operatortype_append(TFM_OT_transform); WM_operatortype_append(TFM_OT_transform);
WM_operatortype_append(TFM_OT_translation);
WM_operatortype_append(TFM_OT_rotation);
WM_operatortype_append(TFM_OT_tosphere);
WM_operatortype_append(TFM_OT_resize);
WM_operatortype_append(TFM_OT_shear);
WM_operatortype_append(TFM_OT_warp);
WM_operatortype_append(TFM_OT_shrink_fatten);
WM_operatortype_append(TFM_OT_tilt);
WM_operatortype_append(TFM_OT_select_orientation); WM_operatortype_append(TFM_OT_select_orientation);
} }
@@ -246,26 +522,23 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
switch(spaceid) switch(spaceid)
{ {
case SPACE_VIEW3D: case SPACE_VIEW3D:
km = WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_RESIZE);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", WKEY, KM_PRESS, KM_SHIFT, 0); km = WM_keymap_add_item(keymap, "TFM_OT_warp", WKEY, KM_PRESS, KM_SHIFT, 0);
RNA_int_set(km->ptr, "mode", TFM_WARP);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0); km = WM_keymap_add_item(keymap, "TFM_OT_tosphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
RNA_int_set(km->ptr, "mode", TFM_TOSPHERE);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0); km = WM_keymap_add_item(keymap, "TFM_OT_shear", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
RNA_int_set(km->ptr, "mode", TFM_SHEAR);
km = WM_keymap_add_item(keymap, "TFM_OT_shrink_fatten", SKEY, KM_PRESS, KM_ALT, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_tilt", TKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0); km = WM_keymap_add_item(keymap, "TFM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0);
@@ -287,59 +560,44 @@ void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *key
RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE); RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
break; break;
case SPACE_IPO: case SPACE_IPO:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
// XXX the 'mode' identifier here is not quite right // XXX the 'mode' identifier here is not quite right
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND); RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_RESIZE);
break; break;
case SPACE_NODE: case SPACE_NODE:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_A, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_A, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_RESIZE);
break; break;
case SPACE_SEQ: case SPACE_SEQ:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND); RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
break; break;
case SPACE_IMAGE: case SPACE_IMAGE:
km = WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0); km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", RKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_ROTATION);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_RESIZE);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", MKEY, KM_PRESS, 0, 0); km = WM_keymap_add_item(keymap, "TFM_OT_transform", MKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_MIRROR); RNA_int_set(km->ptr, "mode", TFM_MIRROR);

View File

@@ -454,9 +454,9 @@ void initTransformOrientation(bContext *C, TransInfo *t)
float normal[3]={0.0, 0.0, 0.0}; float normal[3]={0.0, 0.0, 0.0};
float plane[3]={0.0, 0.0, 0.0}; float plane[3]={0.0, 0.0, 0.0};
if(v3d==NULL) return; if(t->spacetype != SPACE_VIEW3D) return;
switch(v3d->twmode) { switch(t->current_orientation) {
case V3D_MANIP_GLOBAL: case V3D_MANIP_GLOBAL:
strcpy(t->spacename, "global"); strcpy(t->spacename, "global");
break; break;

View File

@@ -469,6 +469,9 @@ typedef struct ToolSettings {
/* Particle Editing */ /* Particle Editing */
struct ParticleEditSettings particle; struct ParticleEditSettings particle;
/* Transform Proportional Area of Effect */
float proportional_size;
/* Select Group Threshold */ /* Select Group Threshold */
float select_thresh; float select_thresh;
@@ -502,7 +505,7 @@ typedef struct ToolSettings {
char skgen_multi_level; char skgen_multi_level;
char skgen_optimisation_method; char skgen_optimisation_method;
char tpad[6]; char tpad[2];
/* Alt+RMB option */ /* Alt+RMB option */
char edge_mode; char edge_mode;