2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
2010-01-21 22:20:49 +00:00
|
|
|
* Contributor(s): Jonathan Smith
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/util/numinput.c
|
|
|
|
* \ingroup edutil
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
#include <math.h> /* fabs */
|
|
|
|
#include <stdio.h> /* for size_t */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2012-01-11 12:33:51 +00:00
|
|
|
#include "BLI_string.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
2010-02-20 20:29:09 +00:00
|
|
|
#include "ED_numinput.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
/* ************************** Functions *************************** */
|
|
|
|
|
|
|
|
/* ************************** NUMINPUT **************************** */
|
|
|
|
|
|
|
|
void initNumInput(NumInput *n)
|
|
|
|
{
|
2012-03-30 10:00:20 +00:00
|
|
|
n->flag =
|
|
|
|
n->idx =
|
|
|
|
n->idx_max =
|
2009-01-06 02:27:07 +00:00
|
|
|
n->inv[0] =
|
|
|
|
n->inv[1] =
|
|
|
|
n->inv[2] =
|
2012-03-30 10:00:20 +00:00
|
|
|
n->ctrl[0] =
|
|
|
|
n->ctrl[1] =
|
|
|
|
n->ctrl[2] = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
n->val[0] =
|
|
|
|
n->val[1] =
|
|
|
|
n->val[2] = 0.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void outputNumInput(NumInput *n, char *str)
|
|
|
|
{
|
|
|
|
char cur;
|
2009-01-06 02:27:07 +00:00
|
|
|
char inv[] = "1/";
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
short i, j;
|
2012-07-14 14:03:36 +00:00
|
|
|
const int ln = NUM_STR_REP_LEN;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
for (j = 0; j <= n->idx_max; j++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if AFFECTALL and no number typed and cursor not on number, use first number */
|
|
|
|
if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
|
|
|
|
i = 0;
|
|
|
|
else
|
|
|
|
i = j;
|
|
|
|
|
|
|
|
if (n->idx != i)
|
|
|
|
cur = ' ';
|
|
|
|
else
|
|
|
|
cur = '|';
|
|
|
|
|
2009-01-06 02:27:07 +00:00
|
|
|
if (n->inv[i])
|
|
|
|
inv[0] = '1';
|
|
|
|
else
|
|
|
|
inv[0] = 0;
|
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
if (n->val[i] > 1e10f || n->val[i] < -1e10f)
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.4e%c", inv, n->val[i], cur);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
|
|
|
switch (n->ctrl[i]) {
|
2012-03-30 10:00:20 +00:00
|
|
|
case 0:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%sNONE%c", inv, cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
case -1:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.0f%c", inv, n->val[i], cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
case -10:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.f.%c", inv, n->val[i], cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
case 100:
|
|
|
|
case -100:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.1f%c", inv, n->val[i], cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
case 1000:
|
|
|
|
case -1000:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.2f%c", inv, n->val[i], cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
case 10000:
|
|
|
|
case -10000:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.3f%c", inv, n->val[i], cur);
|
2012-03-30 10:00:20 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&str[j * ln], ln, "%s%.4e%c", inv, n->val[i], cur);
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
short hasNumInput(NumInput *n)
|
|
|
|
{
|
|
|
|
short i;
|
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
for (i = 0; i <= n->idx_max; i++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (n->ctrl[i])
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-26 03:47:20 +00:00
|
|
|
/**
|
|
|
|
* \warning \a vec must be set beforehand otherwise we risk uninitialized vars.
|
|
|
|
*/
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
void applyNumInput(NumInput *n, float *vec)
|
|
|
|
{
|
|
|
|
short i, j;
|
|
|
|
|
|
|
|
if (hasNumInput(n)) {
|
2012-03-30 10:00:20 +00:00
|
|
|
for (j = 0; j <= n->idx_max; j++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if AFFECTALL and no number typed and cursor not on number, use first number */
|
|
|
|
if (n->flag & NUM_AFFECT_ALL && n->idx != j && n->ctrl[j] == 0)
|
|
|
|
i = 0;
|
|
|
|
else
|
|
|
|
i = j;
|
|
|
|
|
|
|
|
if (n->ctrl[i] == 0 && n->flag & NUM_NULL_ONE) {
|
|
|
|
vec[j] = 1.0f;
|
|
|
|
}
|
2009-03-06 14:12:12 +00:00
|
|
|
else if (n->val[i] == 0.0f && n->flag & NUM_NO_ZERO) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec[j] = 0.0001f;
|
|
|
|
}
|
|
|
|
else {
|
2012-03-06 18:40:15 +00:00
|
|
|
if (n->inv[i]) {
|
2009-03-06 14:12:12 +00:00
|
|
|
vec[j] = 1.0f / n->val[i];
|
2009-01-06 02:27:07 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2009-03-06 14:12:12 +00:00
|
|
|
vec[j] = n->val[i];
|
2009-01-06 02:27:07 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
char handleNumInput(NumInput *n, const wmEvent *event)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
float Val = 0;
|
|
|
|
short idx = n->idx, idx_max = n->idx_max;
|
|
|
|
|
2010-01-25 17:48:02 +00:00
|
|
|
if (event->type == EVT_MODAL_MAP) {
|
|
|
|
switch (event->val) {
|
2012-03-30 10:00:20 +00:00
|
|
|
case NUM_MODAL_INCREMENT_UP:
|
|
|
|
if (!n->ctrl[idx])
|
|
|
|
n->ctrl[idx] = 1;
|
2010-01-22 02:50:40 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
n->val[idx] += n->increment;
|
|
|
|
break;
|
|
|
|
case NUM_MODAL_INCREMENT_DOWN:
|
|
|
|
if (!n->ctrl[idx])
|
|
|
|
n->ctrl[idx] = 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
n->val[idx] -= n->increment;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-01-25 17:48:02 +00:00
|
|
|
switch (event->type) {
|
2012-03-30 10:00:20 +00:00
|
|
|
case BACKSPACEKEY:
|
|
|
|
if (n->ctrl[idx] == 0) {
|
|
|
|
n->val[0] =
|
|
|
|
n->val[1] =
|
|
|
|
n->val[2] = 0.0f;
|
|
|
|
n->ctrl[0] =
|
|
|
|
n->ctrl[1] =
|
|
|
|
n->ctrl[2] = 0;
|
|
|
|
n->inv[0] =
|
|
|
|
n->inv[1] =
|
|
|
|
n->inv[2] = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
n->val[idx] = 0.0f;
|
|
|
|
n->ctrl[idx] = 0;
|
|
|
|
n->inv[idx] = 0;
|
|
|
|
}
|
2010-01-25 17:48:02 +00:00
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
case PERIODKEY: case PADPERIOD:
|
2012-03-30 10:00:20 +00:00
|
|
|
if (n->flag & NUM_NO_FRACTION)
|
|
|
|
return 0;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (n->ctrl[idx]) {
|
2012-03-30 10:00:20 +00:00
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
n->ctrl[idx] = 10;
|
|
|
|
break;
|
|
|
|
case -1:
|
|
|
|
n->ctrl[idx] = -10;
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2012-03-30 10:00:20 +00:00
|
|
|
}
|
2010-01-25 17:48:02 +00:00
|
|
|
break;
|
2012-03-30 10:00:20 +00:00
|
|
|
case PADMINUS:
|
|
|
|
if (event->alt)
|
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
2012-03-30 10:00:20 +00:00
|
|
|
case MINUSKEY:
|
|
|
|
if (n->flag & NUM_NO_NEGATIVE)
|
2012-05-10 07:10:39 +00:00
|
|
|
return 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
if (n->ctrl[idx]) {
|
|
|
|
n->ctrl[idx] *= -1;
|
|
|
|
n->val[idx] *= -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
n->ctrl[idx] = -1;
|
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
case PADSLASHKEY: case SLASHKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
if (n->flag & NUM_NO_FRACTION)
|
|
|
|
return 0;
|
2010-02-20 20:29:09 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
n->inv[idx] = !n->inv[idx];
|
|
|
|
break;
|
|
|
|
case TABKEY:
|
|
|
|
if (idx_max == 0)
|
|
|
|
return 0;
|
2010-02-20 20:29:09 +00:00
|
|
|
|
2012-03-30 10:00:20 +00:00
|
|
|
idx++;
|
|
|
|
if (idx > idx_max)
|
|
|
|
idx = 0;
|
|
|
|
n->idx = idx;
|
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
case PAD9: case NINEKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD8: case EIGHTKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD7: case SEVENKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD6: case SIXKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD5: case FIVEKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD4: case FOURKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD3: case THREEKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD2: case TWOKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD1: case ONEKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
Val += 1.0f;
|
2013-07-21 08:16:37 +00:00
|
|
|
/* fall-through */
|
|
|
|
case PAD0: case ZEROKEY:
|
2012-03-30 10:00:20 +00:00
|
|
|
if (!n->ctrl[idx])
|
|
|
|
n->ctrl[idx] = 1;
|
2010-01-25 17:48:02 +00:00
|
|
|
|
2012-10-01 15:27:50 +00:00
|
|
|
if (fabsf(n->val[idx]) > 9999999.0f) {
|
|
|
|
/* pass */
|
|
|
|
}
|
2012-03-30 10:00:20 +00:00
|
|
|
else if (n->ctrl[idx] == 1) {
|
|
|
|
n->val[idx] *= 10;
|
|
|
|
n->val[idx] += Val;
|
2010-01-25 17:48:02 +00:00
|
|
|
}
|
2012-03-30 10:00:20 +00:00
|
|
|
else if (n->ctrl[idx] == -1) {
|
|
|
|
n->val[idx] *= 10;
|
|
|
|
n->val[idx] -= Val;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* float resolution breaks when over six digits after comma */
|
|
|
|
if (ABS(n->ctrl[idx]) < 10000000) {
|
|
|
|
n->val[idx] += Val / (float)n->ctrl[idx];
|
|
|
|
n->ctrl[idx] *= 10;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-30 04:58:45 +00:00
|
|
|
// printf("%f\n", n->val[idx]);
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* REDRAW SINCE NUMBERS HAVE CHANGED */
|
|
|
|
return 1;
|
|
|
|
}
|