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
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/transform/transform.c
|
|
|
|
* \ingroup edtransform
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
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 <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
#ifndef WIN32
|
|
|
|
#include <unistd.h>
|
|
|
|
#else
|
|
|
|
#include <io.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "DNA_anim_types.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 "DNA_armature_types.h"
|
|
|
|
#include "DNA_constraint_types.h"
|
2012-02-19 22:17:30 +00:00
|
|
|
#include "DNA_mesh_types.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 "DNA_meshdata_types.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "DNA_movieclip_types.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 "DNA_scene_types.h" /* PET modes */
|
2009-01-03 22:15:59 +00:00
|
|
|
|
|
|
|
#include "RNA_access.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 "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "BKE_nla.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 "BKE_bmesh.h"
|
2008-12-31 17:11:42 +00:00
|
|
|
#include "BKE_context.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 "BKE_constraint.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_particle.h"
|
|
|
|
#include "BKE_pointcache.h"
|
2009-08-12 17:02:03 +00:00
|
|
|
#include "BKE_unit.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
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_image.h"
|
2009-08-01 06:03:08 +00:00
|
|
|
#include "ED_keyframing.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 "ED_screen.h"
|
2009-01-10 18:33:16 +00:00
|
|
|
#include "ED_space_api.h"
|
2009-05-09 02:37:12 +00:00
|
|
|
#include "ED_markers.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_view3d.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "ED_mesh.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "ED_clip.h"
|
2009-01-10 18:33:16 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
#include "UI_view2d.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"
|
2009-01-07 16:52:18 +00:00
|
|
|
#include "WM_api.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
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.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 "BLI_blenlib.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "BLI_ghash.h"
|
|
|
|
#include "BLI_linklist.h"
|
2010-12-23 02:14:03 +00:00
|
|
|
#include "BLI_smallhash.h"
|
2011-04-13 21:48:16 +00:00
|
|
|
#include "BLI_array.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
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
#include "UI_resources.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 "blendef.h"
|
|
|
|
//
|
|
|
|
//#include "mydevice.h"
|
|
|
|
|
|
|
|
#include "transform.h"
|
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2011-11-15 16:38:48 +00:00
|
|
|
static void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg);
|
|
|
|
static int doEdgeSlide(TransInfo *t, float perc);
|
2010-02-03 21:01:41 +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
|
|
|
/* ************************** SPACE DEPENDANT CODE **************************** */
|
|
|
|
|
|
|
|
void setTransformViewMatrices(TransInfo *t)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
RegionView3D *rv3d = t->ar->regiondata;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(t->viewmat, rv3d->viewmat);
|
|
|
|
copy_m4_m4(t->viewinv, rv3d->viewinv);
|
|
|
|
copy_m4_m4(t->persmat, rv3d->persmat);
|
|
|
|
copy_m4_m4(t->persinv, rv3d->persinv);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
t->persp = rv3d->persp;
|
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 {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(t->viewmat);
|
|
|
|
unit_m4(t->viewinv);
|
|
|
|
unit_m4(t->persmat);
|
|
|
|
unit_m4(t->persinv);
|
2009-10-27 02:54:25 +00:00
|
|
|
t->persp = RV3D_ORTHO;
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
calculateCenter2D(t);
|
|
|
|
}
|
|
|
|
|
2012-02-28 14:05:00 +00:00
|
|
|
static void convertViewVec2D(View2D *v2d, float vec[3], int dx, int dy)
|
2011-11-02 00:17:37 +00:00
|
|
|
{
|
|
|
|
float divx, divy;
|
|
|
|
|
|
|
|
divx= v2d->mask.xmax - v2d->mask.xmin;
|
|
|
|
divy= v2d->mask.ymax - v2d->mask.ymin;
|
|
|
|
|
|
|
|
vec[0]= (v2d->cur.xmax - v2d->cur.xmin) * dx / divx;
|
|
|
|
vec[1]= (v2d->cur.ymax - v2d->cur.ymin) * dy / divy;
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
|
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-08 01:22:49 +00:00
|
|
|
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->regiontype == RGN_TYPE_WINDOW)) {
|
|
|
|
float mval_f[2];
|
|
|
|
mval_f[0] = dx;
|
|
|
|
mval_f[1] = dy;
|
2012-03-12 06:53:47 +00:00
|
|
|
ED_view3d_win_to_delta(t->ar, mval_f, r_vec);
|
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 if (t->spacetype==SPACE_IMAGE) {
|
2011-11-02 00:17:37 +00:00
|
|
|
float aspx, aspy;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
convertViewVec2D(t->view, r_vec, dx, dy);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-11-02 00:17:37 +00:00
|
|
|
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
2012-03-12 06:53:47 +00:00
|
|
|
r_vec[0] *= aspx;
|
|
|
|
r_vec[1] *= aspy;
|
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 if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
|
2012-03-12 06:53:47 +00:00
|
|
|
convertViewVec2D(t->view, r_vec, dx, dy);
|
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 if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
|
2012-03-12 06:53:47 +00:00
|
|
|
convertViewVec2D(&t->ar->v2d, r_vec, dx, dy);
|
2009-01-04 01:08:01 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype==SPACE_CLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
View2D *v2d = t->view;
|
|
|
|
float divx, divy;
|
|
|
|
|
2012-03-25 23:19:21 +00:00
|
|
|
divx = v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
divy = v2d->mask.ymax-v2d->mask.ymin;
|
2011-11-07 12:55:18 +00:00
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
|
|
|
|
r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
|
|
|
|
r_vec[2] = 0.0f;
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2012-03-08 01:22:49 +00:00
|
|
|
else {
|
|
|
|
printf("%s: called in an invalid context\n", __func__);
|
2012-03-12 06:53:47 +00:00
|
|
|
zero_v3(r_vec);
|
2012-03-08 01:22:49 +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
|
|
|
}
|
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
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 (t->spacetype==SPACE_VIEW3D) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->ar->regiontype == RGN_TYPE_WINDOW)
|
2009-04-15 17:53:12 +00:00
|
|
|
project_int_noclip(t->ar, vec, adr);
|
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 if (t->spacetype==SPACE_IMAGE) {
|
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 aspx, aspy, v[2];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
|
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
|
|
|
v[0]= vec[0]/aspx;
|
|
|
|
v[1]= vec[1]/aspy;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+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-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2009-01-15 04:13:38 +00:00
|
|
|
int out[2] = {0, 0};
|
2011-05-01 10:14:09 +00:00
|
|
|
#if 0
|
|
|
|
SpaceAction *sact = t->sa->spacedata.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
if (sact->flag & SACTION_DRAWTIME) {
|
|
|
|
//vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base));
|
2011-05-01 10:14:09 +00:00
|
|
|
/* same as below */
|
2010-05-06 19:54:43 +00:00
|
|
|
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
|
2010-05-07 10:59:48 +00:00
|
|
|
}
|
2011-05-01 10:14:09 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2010-05-06 19:54:43 +00:00
|
|
|
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
|
|
|
|
}
|
|
|
|
|
|
|
|
adr[0]= out[0];
|
|
|
|
adr[1]= out[1];
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA)) {
|
2009-01-15 04:13:38 +00:00
|
|
|
int out[2] = {0, 0};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+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
|
|
|
adr[0]= out[0];
|
|
|
|
adr[1]= out[1];
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
|
2009-01-23 23:14:02 +00:00
|
|
|
int out[2] = {0, 0};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
UI_view2d_to_region_no_clip((View2D *)t->view, vec[0], vec[1], out, out+1);
|
2009-01-23 23:14:02 +00:00
|
|
|
adr[0]= out[0];
|
|
|
|
adr[1]= out[1];
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype==SPACE_CLIP) {
|
2012-04-29 12:32:26 +00:00
|
|
|
float v[2];
|
|
|
|
|
|
|
|
copy_v2_v2(v, vec);
|
|
|
|
|
|
|
|
UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
|
2011-11-07 12:55:18 +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
|
|
|
}
|
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
|
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-12 06:53:47 +00:00
|
|
|
switch (t->spacetype) {
|
|
|
|
case SPACE_VIEW3D:
|
|
|
|
{
|
|
|
|
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
project_float_noclip(t->ar, vec, adr);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SPACE_IMAGE:
|
|
|
|
case SPACE_CLIP:
|
|
|
|
case SPACE_IPO:
|
|
|
|
case SPACE_NLA:
|
|
|
|
{
|
|
|
|
int a[2];
|
|
|
|
projectIntView(t, vec, a);
|
|
|
|
adr[0] = a[0];
|
|
|
|
adr[1] = a[1];
|
|
|
|
return;
|
|
|
|
}
|
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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-12 06:53:47 +00:00
|
|
|
zero_v2(adr);
|
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-05-12 22:13:38 +00:00
|
|
|
void applyAspectRatio(TransInfo *t, float vec[2])
|
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
|
|
|
{
|
2008-12-29 04:23:41 +00:00
|
|
|
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
|
2010-05-15 02:40:44 +00:00
|
|
|
SpaceImage *sima= t->sa->spacedata.first;
|
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 aspx, aspy;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((sima->flag & SI_COORDFLOATS)==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
|
|
|
int width, height;
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_size(sima, &width, &height);
|
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
|
|
|
|
2009-01-20 20:44:36 +00:00
|
|
|
vec[0] *= width;
|
|
|
|
vec[1] *= height;
|
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
|
|
|
}
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(sima, &aspx, &aspy);
|
2009-01-20 20:44:36 +00:00
|
|
|
vec[0] /= aspx;
|
|
|
|
vec[1] /= aspy;
|
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-04-29 12:32:26 +00:00
|
|
|
else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
|
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
|
|
|
SpaceClip *sc = t->sa->spacedata.first;
|
|
|
|
float aspx, aspy;
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
ED_space_clip_size(sc, &width, &height);
|
|
|
|
ED_space_clip_aspect(sc, &aspx, &aspy);
|
|
|
|
|
|
|
|
vec[0] *= width / aspx;
|
|
|
|
vec[1] *= height / aspy;
|
|
|
|
}
|
|
|
|
}
|
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-05-12 22:13:38 +00:00
|
|
|
void removeAspectRatio(TransInfo *t, float vec[2])
|
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
|
|
|
{
|
2008-12-29 04:23:41 +00:00
|
|
|
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
|
2010-05-15 02:40:44 +00:00
|
|
|
SpaceImage *sima= t->sa->spacedata.first;
|
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 aspx, aspy;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((sima->flag & SI_COORDFLOATS)==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
|
|
|
int width, height;
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_size(sima, &width, &height);
|
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[0] /= width;
|
|
|
|
vec[1] /= height;
|
|
|
|
}
|
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
ED_space_image_uv_aspect(sima, &aspx, &aspy);
|
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[0] *= aspx;
|
|
|
|
vec[1] *= aspy;
|
|
|
|
}
|
2012-04-29 12:32:26 +00:00
|
|
|
else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
|
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
|
|
|
SpaceClip *sc = t->sa->spacedata.first;
|
|
|
|
float aspx, aspy;
|
|
|
|
int width, height;
|
|
|
|
|
|
|
|
ED_space_clip_size(sc, &width, &height);
|
|
|
|
ED_space_clip_aspect(sc, &aspx, &aspy);
|
|
|
|
|
|
|
|
vec[0] *= aspx / width;
|
|
|
|
vec[1] *= aspy / height;
|
|
|
|
}
|
|
|
|
}
|
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-02-03 21:01:41 +00:00
|
|
|
static void viewRedrawForce(const bContext *C, TransInfo *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
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Do we need more refined tags? */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_POSE)
|
2010-09-22 14:34:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_POSE, NULL);
|
|
|
|
else
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
2009-08-01 06:03:08 +00:00
|
|
|
|
|
|
|
/* for realtime animation record - send notifiers recognised by animation editors */
|
2010-02-21 11:42:32 +00:00
|
|
|
// XXX: is this notifier a lame duck?
|
2009-08-01 06:03:08 +00:00
|
|
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL);
|
2010-02-21 11:42:32 +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
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2009-07-10 10:48:25 +00:00
|
|
|
//SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2010-06-18 04:39:32 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
|
2008-12-29 06:06:59 +00:00
|
|
|
}
|
2009-01-27 11:09:30 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
2009-07-10 10:48:25 +00:00
|
|
|
//SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
2010-06-18 04:39:32 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2010-06-18 04:39:32 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA|NA_EDITED, NULL);
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2009-01-07 16:52:18 +00:00
|
|
|
//ED_area_tag_redraw(t->sa);
|
2009-11-01 00:06:53 +00:00
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
|
2009-01-02 23:58:03 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_SEQ) {
|
2009-01-21 07:01:20 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_SEQUENCER, NULL);
|
|
|
|
}
|
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 if (t->spacetype==SPACE_IMAGE) {
|
2009-02-07 01:27:46 +00:00
|
|
|
// XXX how to deal with lock?
|
2009-01-28 21:43:43 +00:00
|
|
|
SpaceImage *sima= (SpaceImage*)t->sa->spacedata.first;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
|
2009-11-04 09:22:16 +00:00
|
|
|
else ED_area_tag_redraw(t->sa);
|
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-11-07 12:55:18 +00:00
|
|
|
else if (t->spacetype==SPACE_CLIP) {
|
2012-03-25 23:19:21 +00:00
|
|
|
SpaceClip *sc = (SpaceClip*)t->sa->spacedata.first;
|
|
|
|
MovieClip *clip = ED_space_clip(sc);
|
2011-11-07 12:55:18 +00:00
|
|
|
|
|
|
|
/* objects could be parented to tracking data, so send this for viewport refresh */
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
|
|
|
|
|
|
|
|
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
|
|
|
|
}
|
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-02-07 16:41:57 +00:00
|
|
|
static void viewRedrawPost(bContext *C, TransInfo *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
|
|
|
{
|
|
|
|
ED_area_headerprint(t->sa, NULL);
|
2010-02-21 11:42:32 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2010-02-21 11:42:32 +00:00
|
|
|
/* if autokeying is enabled, send notifiers that keyframes were added */
|
|
|
|
if (IS_AUTOKEY_ON(t->scene))
|
2010-06-18 04:39:32 +00:00
|
|
|
WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
|
2011-02-07 16:41:57 +00:00
|
|
|
|
|
|
|
/* XXX temp, first hack to get auto-render in compositor work (ton) */
|
|
|
|
WM_event_add_notifier(C, NC_SCENE|ND_TRANSFORM_DONE, CTX_data_scene(C));
|
|
|
|
|
2010-02-21 11:42:32 +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
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype==SPACE_VIEW3D) {
|
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
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype==SPACE_IMAGE) {
|
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
|
|
|
allqueue(REDRAWIMAGE, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
|
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
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
allqueue(REDRAWIPO, 0);
|
|
|
|
allqueue(REDRAWTIME, 0);
|
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
scrarea_queue_headredraw(curarea);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TRANSFORMATIONS **************************** */
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
void BIF_selectOrientation(void)
|
|
|
|
{
|
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 0 // TRANSFORM_FIX_ME
|
|
|
|
short val;
|
|
|
|
char *str_menu = BIF_menustringTransformOrientation("Orientation");
|
|
|
|
val= pupmenu(str_menu);
|
|
|
|
MEM_freeN(str_menu);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (val >= 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
|
|
|
G.vd->twmode = val;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void view_editmove(unsigned short UNUSED(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
|
|
|
{
|
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
|
|
|
int refresh = 0;
|
|
|
|
/* Regular: Zoom in */
|
|
|
|
/* Shift: Scroll up */
|
|
|
|
/* Ctrl: Scroll right */
|
|
|
|
/* Alt-Shift: Rotate up */
|
|
|
|
/* Alt-Ctrl: Rotate right */
|
2009-07-12 02:01:13 +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
|
|
|
/* only work in 3D window for now
|
|
|
|
* In the end, will have to send to event to a 2D window handler instead
|
|
|
|
*/
|
|
|
|
if (Trans.flag & T_2D_EDIT)
|
|
|
|
return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (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
|
|
|
case WHEELUPMOUSE:
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( G.qual & LR_SHIFTKEY ) {
|
|
|
|
if ( G.qual & LR_ALTKEY ) {
|
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
|
|
|
G.qual &= ~LR_SHIFTKEY;
|
|
|
|
persptoetsen(PAD2);
|
|
|
|
G.qual |= LR_SHIFTKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
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
|
|
|
persptoetsen(PAD2);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if ( G.qual & LR_CTRLKEY ) {
|
|
|
|
if ( G.qual & LR_ALTKEY ) {
|
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
|
|
|
G.qual &= ~LR_CTRLKEY;
|
|
|
|
persptoetsen(PAD4);
|
|
|
|
G.qual |= LR_CTRLKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
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
|
|
|
persptoetsen(PAD4);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (U.uiflag & USER_WHEELZOOMDIR)
|
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
|
|
|
persptoetsen(PADMINUS);
|
|
|
|
else
|
|
|
|
persptoetsen(PADPLUSKEY);
|
2009-07-12 02:01:13 +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
|
|
|
refresh = 1;
|
|
|
|
break;
|
|
|
|
case WHEELDOWNMOUSE:
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( G.qual & LR_SHIFTKEY ) {
|
|
|
|
if ( G.qual & LR_ALTKEY ) {
|
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
|
|
|
G.qual &= ~LR_SHIFTKEY;
|
|
|
|
persptoetsen(PAD8);
|
|
|
|
G.qual |= LR_SHIFTKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
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
|
|
|
persptoetsen(PAD8);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if ( G.qual & LR_CTRLKEY ) {
|
|
|
|
if ( G.qual & LR_ALTKEY ) {
|
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
|
|
|
G.qual &= ~LR_CTRLKEY;
|
|
|
|
persptoetsen(PAD6);
|
|
|
|
G.qual |= LR_CTRLKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
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
|
|
|
persptoetsen(PAD6);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (U.uiflag & USER_WHEELZOOMDIR)
|
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
|
|
|
persptoetsen(PADPLUSKEY);
|
|
|
|
else
|
|
|
|
persptoetsen(PADMINUS);
|
2009-07-12 02:01:13 +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
|
|
|
refresh = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (refresh)
|
|
|
|
setTransformViewMatrices(&Trans);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************* */
|
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
|
2009-11-30 20:20:00 +00:00
|
|
|
#define TFM_MODAL_CANCEL 1
|
|
|
|
#define TFM_MODAL_CONFIRM 2
|
|
|
|
#define TFM_MODAL_TRANSLATE 3
|
|
|
|
#define TFM_MODAL_ROTATE 4
|
|
|
|
#define TFM_MODAL_RESIZE 5
|
2009-12-03 19:18:00 +00:00
|
|
|
#define TFM_MODAL_SNAP_INV_ON 6
|
|
|
|
#define TFM_MODAL_SNAP_INV_OFF 7
|
2009-11-26 19:47:55 +00:00
|
|
|
#define TFM_MODAL_SNAP_TOGGLE 8
|
2009-11-30 20:20:00 +00:00
|
|
|
#define TFM_MODAL_AXIS_X 9
|
|
|
|
#define TFM_MODAL_AXIS_Y 10
|
|
|
|
#define TFM_MODAL_AXIS_Z 11
|
|
|
|
#define TFM_MODAL_PLANE_X 12
|
|
|
|
#define TFM_MODAL_PLANE_Y 13
|
|
|
|
#define TFM_MODAL_PLANE_Z 14
|
|
|
|
#define TFM_MODAL_CONS_OFF 15
|
2009-12-01 18:26:18 +00:00
|
|
|
#define TFM_MODAL_ADD_SNAP 16
|
|
|
|
#define TFM_MODAL_REMOVE_SNAP 17
|
2010-01-25 17:48:02 +00:00
|
|
|
/* 18 and 19 used by numinput, defined in transform.h
|
|
|
|
* */
|
2010-06-27 23:57:58 +00:00
|
|
|
#define TFM_MODAL_PROPSIZE_UP 20
|
|
|
|
#define TFM_MODAL_PROPSIZE_DOWN 21
|
2010-10-17 11:20:12 +00:00
|
|
|
#define TFM_MODAL_AUTOIK_LEN_INC 22
|
|
|
|
#define TFM_MODAL_AUTOIK_LEN_DEC 23
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
|
|
|
/* called in transform_ops.c, on each regeneration of keymaps */
|
2009-12-21 17:23:44 +00:00
|
|
|
wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
{
|
|
|
|
static EnumPropertyItem modal_items[] = {
|
|
|
|
{TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
|
|
|
|
{TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
|
|
|
|
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
|
|
|
|
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
|
|
|
|
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
|
2009-12-03 19:18:00 +00:00
|
|
|
{TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Invert Snap On", ""},
|
|
|
|
{TFM_MODAL_SNAP_INV_OFF, "SNAP_INV_OFF", 0, "Invert Snap Off", ""},
|
2009-11-26 19:47:55 +00:00
|
|
|
{TFM_MODAL_SNAP_TOGGLE, "SNAP_TOGGLE", 0, "Snap Toggle", ""},
|
2009-11-30 20:20:00 +00:00
|
|
|
{TFM_MODAL_AXIS_X, "AXIS_X", 0, "Orientation X axis", ""},
|
|
|
|
{TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Orientation Y axis", ""},
|
|
|
|
{TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Orientation Z axis", ""},
|
|
|
|
{TFM_MODAL_PLANE_X, "PLANE_X", 0, "Orientation X plane", ""},
|
|
|
|
{TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Orientation Y plane", ""},
|
|
|
|
{TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Orientation Z plane", ""},
|
|
|
|
{TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Remove Constraints", ""},
|
2009-12-01 18:26:18 +00:00
|
|
|
{TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""},
|
|
|
|
{TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""},
|
2010-02-20 20:29:09 +00:00
|
|
|
{NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""},
|
|
|
|
{NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
|
2010-06-27 23:57:58 +00:00
|
|
|
{TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
|
2011-11-08 11:02:57 +00:00
|
|
|
{TFM_MODAL_PROPSIZE_DOWN, "PROPORTIONAL_SIZE_DOWN", 0, "Decrease Proportional Influence", ""},
|
2010-10-17 11:20:12 +00:00
|
|
|
{TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""},
|
|
|
|
{TFM_MODAL_AUTOIK_LEN_DEC, "AUTOIK_CHAIN_LEN_DOWN", 0, "Decrease Max AutoIK Chain Length", ""},
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
{0, NULL, 0, NULL, NULL}};
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
|
|
|
/* this function is called for each spacetype, only needs to add map once */
|
2012-04-17 15:40:04 +00:00
|
|
|
if (keymap && keymap->modal_items) return NULL;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
|
|
|
/* items for modal map */
|
|
|
|
WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);
|
2009-11-12 19:49:26 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
|
|
|
|
WM_modalkeymap_add_item(keymap, PADENTER, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
|
|
|
|
|
|
|
|
WM_modalkeymap_add_item(keymap, GKEY, KM_PRESS, 0, 0, TFM_MODAL_TRANSLATE);
|
|
|
|
WM_modalkeymap_add_item(keymap, RKEY, KM_PRESS, 0, 0, TFM_MODAL_ROTATE);
|
|
|
|
WM_modalkeymap_add_item(keymap, SKEY, KM_PRESS, 0, 0, TFM_MODAL_RESIZE);
|
|
|
|
|
2009-12-03 19:18:00 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, TABKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_SNAP_TOGGLE);
|
|
|
|
|
|
|
|
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON);
|
|
|
|
WM_modalkeymap_add_item(keymap, LEFTCTRLKEY, KM_RELEASE, KM_ANY, 0, TFM_MODAL_SNAP_INV_OFF);
|
2010-11-02 09:04:57 +00:00
|
|
|
|
|
|
|
WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_SNAP_INV_ON);
|
|
|
|
WM_modalkeymap_add_item(keymap, RIGHTCTRLKEY, KM_RELEASE, KM_ANY, 0, TFM_MODAL_SNAP_INV_OFF);
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
2009-12-01 18:26:18 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, 0, 0, TFM_MODAL_ADD_SNAP);
|
|
|
|
WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, KM_ALT, 0, TFM_MODAL_REMOVE_SNAP);
|
|
|
|
|
2010-06-27 23:57:58 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
|
|
|
|
WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
|
|
|
|
WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_UP);
|
|
|
|
WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, 0, 0, TFM_MODAL_PROPSIZE_DOWN);
|
2010-10-17 11:20:12 +00:00
|
|
|
|
|
|
|
WM_modalkeymap_add_item(keymap, PAGEUPKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
|
|
|
|
WM_modalkeymap_add_item(keymap, PAGEDOWNKEY, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
|
|
|
|
WM_modalkeymap_add_item(keymap, WHEELDOWNMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_INC);
|
|
|
|
WM_modalkeymap_add_item(keymap, WHEELUPMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOIK_LEN_DEC);
|
|
|
|
|
2009-12-21 17:23:44 +00:00
|
|
|
return keymap;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-29 16:49:26 +00:00
|
|
|
int transformEvent(TransInfo *t, 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
|
|
|
{
|
2010-11-28 06:03:30 +00:00
|
|
|
float mati[3][3]= MAT3_UNITY;
|
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
|
|
|
char cmode = constraintModeToChar(t);
|
2009-11-29 16:49:26 +00:00
|
|
|
int handled = 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->redraw |= handleMouseInput(t, &t->mouse, event);
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == MOUSEMOVE) {
|
2009-12-29 21:20:46 +00:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_SELECT)
|
|
|
|
t->con.mode |= CON_SELECT;
|
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v2_v2_int(t->mval, event->mval);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-21 18:31:00 +00:00
|
|
|
// t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
if (t->state == TRANS_STARTING) {
|
2010-03-22 09:30:00 +00:00
|
|
|
t->state = TRANS_RUNNING;
|
2009-11-12 19:49:26 +00:00
|
|
|
}
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
2011-12-26 20:23:07 +00:00
|
|
|
|
|
|
|
// Snapping mouse move events
|
|
|
|
t->redraw |= handleSnapping(t, 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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
/* handle modal keymap first */
|
|
|
|
if (event->type == EVT_MODAL_MAP) {
|
|
|
|
switch (event->val) {
|
|
|
|
case TFM_MODAL_CANCEL:
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_CONFIRM:
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_TRANSLATE:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
resetTransRestrictions(t);
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initTranslation(t);
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->mode == TFM_TRANSLATION) {
|
2012-05-01 20:08:23 +00:00
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
restoreTransObjects(t);
|
|
|
|
|
2012-04-29 12:32:26 +00:00
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
2011-11-07 12:55:18 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
}
|
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
|
|
|
case TFM_MODAL_ROTATE:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
|
|
|
|
if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
|
2011-01-06 14:19:46 +00:00
|
|
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
|
|
|
if (t->mode == TFM_ROTATION) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initTrackball(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initRotation(t);
|
|
|
|
}
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_RESIZE:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
resetTransRestrictions(t);
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initResize(t);
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2009-12-03 19:18:00 +00:00
|
|
|
case TFM_MODAL_SNAP_INV_ON:
|
|
|
|
t->modifiers |= MOD_SNAP_INVERT;
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
2009-12-03 19:18:00 +00:00
|
|
|
case TFM_MODAL_SNAP_INV_OFF:
|
|
|
|
t->modifiers &= ~MOD_SNAP_INVERT;
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
2009-11-26 19:47:55 +00:00
|
|
|
case TFM_MODAL_SNAP_TOGGLE:
|
|
|
|
t->modifiers ^= MOD_SNAP;
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
2009-11-30 20:20:00 +00:00
|
|
|
case TFM_MODAL_AXIS_X:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
|
|
|
if (cmode == 'X') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (t->flag & T_2D_EDIT) {
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS0), "along %s X");
|
|
|
|
}
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AXIS_Y:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
|
|
|
if (cmode == 'Y') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (t->flag & T_2D_EDIT) {
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS1), "along %s Y");
|
|
|
|
}
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AXIS_Z:
|
2009-12-17 17:34:56 +00:00
|
|
|
if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) {
|
2009-11-30 20:20:00 +00:00
|
|
|
if (cmode == 'Z') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS2), "along %s Z");
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_X:
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) {
|
|
|
|
if (cmode == 'X') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS1|CON_AXIS2), "locking %s X");
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_Y:
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) {
|
|
|
|
if (cmode == 'Y') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y");
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_Z:
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))== 0) {
|
|
|
|
if (cmode == 'Z') {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, t->current_orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z");
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_CONS_OFF:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
|
|
|
stopConstraint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-30 20:20:00 +00:00
|
|
|
}
|
|
|
|
break;
|
2009-12-01 18:26:18 +00:00
|
|
|
case TFM_MODAL_ADD_SNAP:
|
|
|
|
addSnapPoint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
break;
|
2009-12-01 18:26:18 +00:00
|
|
|
case TFM_MODAL_REMOVE_SNAP:
|
|
|
|
removeSnapPoint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-11-12 19:49:26 +00:00
|
|
|
break;
|
2010-06-27 23:57:58 +00:00
|
|
|
case TFM_MODAL_PROPSIZE_UP:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2010-06-27 23:57:58 +00:00
|
|
|
t->prop_size*= 1.1f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
|
2011-01-08 16:54:38 +00:00
|
|
|
t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
|
2010-06-27 23:57:58 +00:00
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PROPSIZE_DOWN:
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
|
|
|
t->prop_size*= 0.90909090f;
|
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
break;
|
2010-10-17 11:20:12 +00:00
|
|
|
case TFM_MODAL_AUTOIK_LEN_INC:
|
|
|
|
if (t->flag & T_AUTOIK)
|
|
|
|
transform_autoik_update(t, 1);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AUTOIK_LEN_DEC:
|
|
|
|
if (t->flag & T_AUTOIK)
|
|
|
|
transform_autoik_update(t, -1);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
break;
|
2009-11-29 16:49:26 +00:00
|
|
|
default:
|
|
|
|
handled = 0;
|
|
|
|
break;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
2010-01-25 17:48:02 +00:00
|
|
|
|
|
|
|
// Modal numinput events
|
2010-02-22 23:25:34 +00:00
|
|
|
t->redraw |= handleNumInput(&(t->num), event);
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
|
|
|
/* else do non-mapped events */
|
2012-04-28 06:31:57 +00:00
|
|
|
else if (event->val == KM_PRESS) {
|
2012-02-23 02:23:42 +00:00
|
|
|
switch (event->type) {
|
2009-07-18 15:02:12 +00:00
|
|
|
case RIGHTMOUSE:
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
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
|
|
|
/* enforce redraw of transform when modifiers are used */
|
2009-01-03 22:15:59 +00:00
|
|
|
case LEFTSHIFTKEY:
|
|
|
|
case RIGHTSHIFTKEY:
|
|
|
|
t->modifiers |= MOD_CONSTRAINT_PLANE;
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-01-03 22:15:59 +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
|
|
|
case SPACEKEY:
|
|
|
|
if ((t->spacetype==SPACE_VIEW3D) && event->alt) {
|
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
2011-05-12 16:47:36 +00:00
|
|
|
int mval[2];
|
2009-07-12 02:01:13 +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
|
|
|
getmouseco_sc(mval);
|
|
|
|
BIF_selectOrientation();
|
|
|
|
calc_manipulator_stats(curarea);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(t->spacemtx, G.vd->twmat);
|
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
|
|
|
warp_pointer(mval[0], mval[1]);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
break;
|
2009-07-12 02:01:13 +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
|
|
|
case MIDDLEMOUSE:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
|
|
|
/* exception for switching to dolly, or trackball, in camera view */
|
|
|
|
if (t->flag & T_CAMERA) {
|
|
|
|
if (t->mode==TFM_TRANSLATION)
|
|
|
|
setLocalConstraint(t, (CON_AXIS2), "along local Z");
|
|
|
|
else if (t->mode==TFM_ROTATION) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initTrackball(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-01-03 22:15:59 +00:00
|
|
|
t->modifiers |= MOD_CONSTRAINT_SELECT;
|
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 (t->con.mode & CON_APPLY) {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (event->shift) {
|
|
|
|
initSelectConstraint(t, t->spacemtx);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* bit hackish... but it prevents mmb select to print the orientation from menu */
|
|
|
|
strcpy(t->spacename, "global");
|
|
|
|
initSelectConstraint(t, mati);
|
|
|
|
}
|
|
|
|
postSelectConstraint(t);
|
|
|
|
}
|
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ESCKEY:
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
break;
|
|
|
|
case PADENTER:
|
|
|
|
case RETKEY:
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
break;
|
|
|
|
case GKEY:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
resetTransRestrictions(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
|
|
|
restoreTransObjects(t);
|
|
|
|
initTranslation(t);
|
2009-05-14 19:08:15 +00:00
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SKEY:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
resetTransRestrictions(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
|
|
|
restoreTransObjects(t);
|
|
|
|
initResize(t);
|
2009-05-14 19:08:15 +00:00
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case RKEY:
|
|
|
|
/* only switch when... */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
|
|
|
|
if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-01-08 18:46:21 +00:00
|
|
|
resetTransRestrictions(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-01-08 18:46:21 +00:00
|
|
|
if (t->mode == TFM_ROTATION) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initTrackball(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initRotation(t);
|
|
|
|
}
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case CKEY:
|
|
|
|
if (event->alt) {
|
|
|
|
t->flag ^= T_PROP_CONNECTED;
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw= 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
stopConstraint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case XKEY:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
2009-12-17 17:34:56 +00:00
|
|
|
if (t->flag & T_2D_EDIT) {
|
|
|
|
if (cmode == 'X') {
|
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
|
|
|
stopConstraint(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along X");
|
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 {
|
2009-12-17 17:34:56 +00:00
|
|
|
if (cmode == 'X') {
|
|
|
|
if (t->con.orientation != V3D_MANIP_GLOBAL) {
|
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
|
|
|
stopConstraint(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-22 23:22:05 +00:00
|
|
|
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS0), "along %s X");
|
2009-01-10 19:45:48 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS1|CON_AXIS2), "locking %s X");
|
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 {
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0), "along %s X");
|
2009-01-10 19:45:48 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1|CON_AXIS2), "locking %s X");
|
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-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case YKEY:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
2009-12-17 17:34:56 +00:00
|
|
|
if (t->flag & T_2D_EDIT) {
|
|
|
|
if (cmode == 'Y') {
|
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
|
|
|
stopConstraint(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along Y");
|
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 {
|
2009-12-17 17:34:56 +00:00
|
|
|
if (cmode == 'Y') {
|
|
|
|
if (t->con.orientation != V3D_MANIP_GLOBAL) {
|
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
|
|
|
stopConstraint(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-22 23:22:05 +00:00
|
|
|
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS1), "along %s Y");
|
2009-01-10 19:45:48 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS2), "locking %s Y");
|
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 {
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS1), "along %s Y");
|
2009-01-10 19:45:48 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0|CON_AXIS2), "locking %s Y");
|
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-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ZKEY:
|
2009-12-17 17:34:56 +00:00
|
|
|
if ((t->flag & (T_NO_CONSTRAINT|T_2D_EDIT))==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
|
|
|
if (cmode == 'Z') {
|
2009-12-17 17:34:56 +00:00
|
|
|
if (t->con.orientation != V3D_MANIP_GLOBAL) {
|
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
|
|
|
stopConstraint(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-10-22 23:22:05 +00:00
|
|
|
short orientation = t->current_orientation != V3D_MANIP_GLOBAL ? t->current_orientation : V3D_MANIP_LOCAL;
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS2), "along %s Z");
|
2009-12-17 17:34:56 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, orientation, (CON_AXIS0|CON_AXIS1), "locking %s Z");
|
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 {
|
2009-01-10 19:45:48 +00:00
|
|
|
if ((t->modifiers & MOD_CONSTRAINT_PLANE) == 0)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS2), "along %s Z");
|
2009-01-10 19:45:48 +00:00
|
|
|
else if (t->modifiers & MOD_CONSTRAINT_PLANE)
|
2009-12-17 17:34:56 +00:00
|
|
|
setUserConstraint(t, V3D_MANIP_GLOBAL, (CON_AXIS0|CON_AXIS1), "locking %s Z");
|
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-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OKEY:
|
2009-03-07 10:28:08 +00:00
|
|
|
if (t->flag & T_PROP_EDIT && event->shift) {
|
2011-07-21 23:36:17 +00:00
|
|
|
t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX;
|
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
|
|
|
calculatePropRatio(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PADPLUSKEY:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (event->alt && t->flag & T_PROP_EDIT) {
|
2009-03-07 10:28:08 +00:00
|
|
|
t->prop_size *= 1.1f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype==SPACE_VIEW3D && t->persp != RV3D_ORTHO)
|
2011-01-08 16:54:38 +00:00
|
|
|
t->prop_size= MIN2(t->prop_size, ((View3D *)t->view)->far);
|
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
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
case PAGEUPKEY:
|
|
|
|
case WHEELDOWNMOUSE:
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
transform_autoik_update(t, 1);
|
|
|
|
}
|
|
|
|
else view_editmove(event->type);
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
case PADMINUS:
|
2012-03-24 06:38:07 +00:00
|
|
|
if (event->alt && t->flag & T_PROP_EDIT) {
|
2009-03-06 15:50:15 +00:00
|
|
|
t->prop_size*= 0.90909090f;
|
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
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
case PAGEDOWNKEY:
|
|
|
|
case WHEELUPMOUSE:
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
transform_autoik_update(t, -1);
|
|
|
|
}
|
|
|
|
else view_editmove(event->type);
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
2009-11-29 16:49:26 +00:00
|
|
|
default:
|
|
|
|
handled = 0;
|
|
|
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
// Numerical input events
|
|
|
|
t->redraw |= handleNumInput(&(t->num), event);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-12-26 20:23:07 +00:00
|
|
|
// Snapping key events
|
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
|
|
|
t->redraw |= handleSnapping(t, event);
|
2009-07-12 02:01:13 +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
|
|
|
}
|
2009-11-12 19:49:26 +00:00
|
|
|
else if (event->val==KM_RELEASE) {
|
2012-02-23 02:23:42 +00:00
|
|
|
switch (event->type) {
|
2009-01-03 22:15:59 +00:00
|
|
|
case LEFTSHIFTKEY:
|
|
|
|
case RIGHTSHIFTKEY:
|
|
|
|
t->modifiers &= ~MOD_CONSTRAINT_PLANE;
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-01-03 22:15:59 +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
|
|
|
case MIDDLEMOUSE:
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT)==0) {
|
2009-01-03 22:15:59 +00:00
|
|
|
t->modifiers &= ~MOD_CONSTRAINT_SELECT;
|
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
|
|
|
postSelectConstraint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
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
|
|
|
}
|
|
|
|
break;
|
2009-07-12 02:01:13 +00:00
|
|
|
// case LEFTMOUSE:
|
|
|
|
// case RIGHTMOUSE:
|
2012-03-24 06:38:07 +00:00
|
|
|
// if (WM_modal_tweak_exit(event, t->event_type))
|
2009-07-12 02:01:13 +00:00
|
|
|
//// if (t->options & CTX_TWEAK)
|
|
|
|
// t->state = TRANS_CONFIRM;
|
|
|
|
// break;
|
2009-11-29 16:49:26 +00:00
|
|
|
default:
|
|
|
|
handled = 0;
|
|
|
|
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
|
|
|
}
|
2009-11-12 19:49:26 +00:00
|
|
|
|
|
|
|
/* confirm transform if launch key is released after mouse move */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->flag & T_RELEASE_CONFIRM) {
|
2010-04-02 19:40:51 +00:00
|
|
|
/* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE)) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
2009-11-12 19:49:26 +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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
// Per transform event, if present
|
|
|
|
if (t->handleEvent)
|
|
|
|
t->redraw |= t->handleEvent(t, event);
|
2009-11-29 16:49:26 +00:00
|
|
|
|
|
|
|
if (handled || t->redraw)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
return OPERATOR_PASS_THROUGH;
|
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
|
|
|
}
|
|
|
|
|
2009-12-21 15:37:19 +00:00
|
|
|
int calculateTransformCenter(bContext *C, int centerMode, float *vec)
|
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
|
|
|
{
|
|
|
|
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
|
|
|
|
int success = 1;
|
|
|
|
|
|
|
|
t->state = TRANS_RUNNING;
|
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
t->options = CTX_NONE;
|
2009-07-12 02:01:13 +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
|
|
|
t->mode = TFM_DUMMY;
|
|
|
|
|
2009-12-21 15:37:19 +00:00
|
|
|
initTransInfo(C, t, NULL, NULL); // internal data, mouse, vectors
|
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
|
|
|
|
2009-12-21 15:37:19 +00:00
|
|
|
createTransData(C, t); // make TransData structs from selection
|
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
|
|
|
|
|
|
|
t->around = centerMode; // override userdefined mode
|
|
|
|
|
|
|
|
if (t->total == 0) {
|
|
|
|
success = 0;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
success = 1;
|
2009-07-12 02:01:13 +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
|
|
|
calculateCenter(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
// Copy center from constraint center. Transform center can be local
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, t->con.center);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* aftertrans does insert ipos and action channels, and clears base flags, doesnt read transdata */
|
2009-12-14 03:20:17 +00:00
|
|
|
special_aftertrans_update(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
postTrans(C, t);
|
2009-11-01 02:52:38 +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
|
|
|
MEM_freeN(t);
|
2009-07-12 02:01:13 +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
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
typedef enum {
|
|
|
|
UP,
|
|
|
|
DOWN,
|
|
|
|
LEFT,
|
|
|
|
RIGHT
|
|
|
|
} ArrowDirection;
|
|
|
|
static void drawArrow(ArrowDirection d, short offset, short length, short size)
|
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (d) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case LEFT:
|
|
|
|
offset = -offset;
|
|
|
|
length = -length;
|
|
|
|
size = -size;
|
|
|
|
case RIGHT:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(offset, 0);
|
|
|
|
glVertex2s(offset + length, 0);
|
|
|
|
glVertex2s(offset + length, 0);
|
|
|
|
glVertex2s(offset + length - size, -size);
|
|
|
|
glVertex2s(offset + length, 0);
|
|
|
|
glVertex2s(offset + length - size, size);
|
2009-07-12 02:01:13 +00:00
|
|
|
glEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
case DOWN:
|
|
|
|
offset = -offset;
|
|
|
|
length = -length;
|
|
|
|
size = -size;
|
|
|
|
case UP:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(0, offset);
|
|
|
|
glVertex2s(0, offset + length);
|
|
|
|
glVertex2s(0, offset + length);
|
2009-07-12 02:01:13 +00:00
|
|
|
glVertex2s(-size, offset + length - size);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(0, offset + length);
|
|
|
|
glVertex2s(size, offset + length - size);
|
2009-07-12 02:01:13 +00:00
|
|
|
glEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drawArrowHead(ArrowDirection d, short size)
|
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (d) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case LEFT:
|
|
|
|
size = -size;
|
|
|
|
case RIGHT:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(0, 0);
|
|
|
|
glVertex2s(-size, -size);
|
|
|
|
glVertex2s(0, 0);
|
|
|
|
glVertex2s(-size, size);
|
2009-07-12 02:01:13 +00:00
|
|
|
glEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
case DOWN:
|
|
|
|
size = -size;
|
|
|
|
case UP:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(0, 0);
|
2009-07-12 02:01:13 +00:00
|
|
|
glVertex2s(-size, -size);
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2s(0, 0);
|
|
|
|
glVertex2s(size, -size);
|
2009-07-12 02:01:13 +00:00
|
|
|
glEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void drawArc(float size, float angle_start, float angle_end, int segments)
|
|
|
|
{
|
|
|
|
float delta = (angle_end - angle_start) / segments;
|
|
|
|
float angle;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
for ( angle = angle_start; angle < angle_end; angle += delta) {
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2f(cosf(angle) * size, sinf(angle) * size);
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
2012-04-29 15:47:02 +00:00
|
|
|
glVertex2f(cosf(angle_end) * size, sinf(angle_end) * size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glEnd();
|
|
|
|
}
|
|
|
|
|
2011-03-04 18:39:58 +00:00
|
|
|
static int helpline_poll(bContext *C)
|
|
|
|
{
|
|
|
|
ARegion *ar= CTX_wm_region(C);
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar && ar->regiontype==RGN_TYPE_WINDOW)
|
2011-03-04 18:39:58 +00:00
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
|
2009-04-30 11:47:35 +00:00
|
|
|
{
|
2009-12-07 18:10:11 +00:00
|
|
|
TransInfo *t = (TransInfo*)customdata;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR)) {
|
2009-04-30 11:47:35 +00:00
|
|
|
float vecrot[3], cent[2];
|
2010-11-02 13:12:30 +00:00
|
|
|
int mval[2];
|
|
|
|
|
|
|
|
mval[0]= x;
|
|
|
|
mval[1]= y;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vecrot, t->center);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_EDIT) {
|
2009-04-30 11:47:35 +00:00
|
|
|
Object *ob= t->obedit;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ob) mul_m4_v3(ob->obmat, vecrot);
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->flag & T_POSE) {
|
2009-04-30 11:47:35 +00:00
|
|
|
Object *ob=t->poseobj;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ob) mul_m4_v3(ob->obmat, vecrot);
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
projectFloatView(t, vecrot, cent); // no overflow in extreme cases
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glPushMatrix();
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->helpline) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case HLP_SPRING:
|
|
|
|
UI_ThemeColor(TH_WIRE);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
setlinestyle(3);
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2011-05-12 16:47:36 +00:00
|
|
|
glVertex2iv(t->mval);
|
2009-07-12 02:01:13 +00:00
|
|
|
glVertex2fv(cent);
|
2009-04-30 11:47:35 +00:00
|
|
|
glEnd();
|
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
glTranslatef(mval[0], mval[1], 0);
|
2011-03-28 17:06:15 +00:00
|
|
|
glRotatef(-RAD2DEGF(atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1])), 0, 0, 1);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
|
|
|
setlinestyle(0);
|
|
|
|
glLineWidth(3.0);
|
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
case HLP_HARROW:
|
|
|
|
UI_ThemeColor(TH_WIRE);
|
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
glTranslatef(mval[0], mval[1], 0);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
|
|
|
glLineWidth(3.0);
|
|
|
|
drawArrow(RIGHT, 5, 10, 5);
|
|
|
|
drawArrow(LEFT, 5, 10, 5);
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
case HLP_VARROW:
|
|
|
|
UI_ThemeColor(TH_WIRE);
|
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
glTranslatef(mval[0], mval[1], 0);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
|
|
|
glLineWidth(3.0);
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
case HLP_ANGLE:
|
|
|
|
{
|
|
|
|
float dx = t->mval[0] - cent[0], dy = t->mval[1] - cent[1];
|
|
|
|
float angle = atan2f(dy, dx);
|
|
|
|
float dist = sqrtf(dx*dx + dy*dy);
|
2011-03-28 17:06:15 +00:00
|
|
|
float delta_angle = MIN2(15.0f / dist, (float)M_PI/4.0f);
|
|
|
|
float spacing_angle = MIN2(5.0f / dist, (float)M_PI/12.0f);
|
2009-04-30 11:47:35 +00:00
|
|
|
UI_ThemeColor(TH_WIRE);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
setlinestyle(3);
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
2011-05-12 16:47:36 +00:00
|
|
|
glVertex2iv(t->mval);
|
2009-07-12 02:01:13 +00:00
|
|
|
glVertex2fv(cent);
|
2009-04-30 11:47:35 +00:00
|
|
|
glEnd();
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
glTranslatef(cent[0] - t->mval[0] + mval[0], cent[1] - t->mval[1] + mval[1], 0);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
setlinestyle(0);
|
|
|
|
glLineWidth(3.0);
|
|
|
|
drawArc(dist, angle - delta_angle, angle - spacing_angle, 10);
|
|
|
|
drawArc(dist, angle + spacing_angle, angle + delta_angle, 10);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glPushMatrix();
|
|
|
|
|
|
|
|
glTranslatef(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0);
|
2011-03-28 17:06:15 +00:00
|
|
|
glRotatef(RAD2DEGF(angle - delta_angle), 0, 0, 1);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrowHead(DOWN, 5);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glPopMatrix();
|
|
|
|
|
|
|
|
glTranslatef(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0);
|
2011-03-28 17:06:15 +00:00
|
|
|
glRotatef(RAD2DEGF(angle + delta_angle), 0, 0, 1);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
|
|
|
drawArrowHead(UP, 5);
|
|
|
|
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case HLP_TRACKBALL:
|
|
|
|
{
|
2010-12-20 03:59:22 +00:00
|
|
|
unsigned char col[3], col2[3];
|
2009-04-30 11:47:35 +00:00
|
|
|
UI_GetThemeColor3ubv(TH_GRID, col);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
glTranslatef(mval[0], mval[1], 0);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glLineWidth(3.0);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-12-20 03:59:22 +00:00
|
|
|
UI_make_axis_color(col, col2, 'X');
|
2009-04-30 11:47:35 +00:00
|
|
|
glColor3ubv((GLubyte *)col2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(RIGHT, 5, 10, 5);
|
|
|
|
drawArrow(LEFT, 5, 10, 5);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-12-20 03:59:22 +00:00
|
|
|
UI_make_axis_color(col, col2, 'Y');
|
2009-04-30 11:47:35 +00:00
|
|
|
glColor3ubv((GLubyte *)col2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
glPopMatrix();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
static void drawTransformView(const struct bContext *C, struct ARegion *UNUSED(ar), void *arg)
|
2009-01-10 18:33:16 +00:00
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
drawConstraint(t);
|
2009-03-28 20:46:38 +00:00
|
|
|
drawPropCircle(C, t);
|
|
|
|
drawSnapping(C, t);
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
|
|
|
|
2011-02-17 12:05:09 +00:00
|
|
|
#if 0
|
2011-02-13 10:52:18 +00:00
|
|
|
static void drawTransformPixel(const struct bContext *UNUSED(C), struct ARegion *UNUSED(ar), void *UNUSED(arg))
|
2009-11-01 00:06:53 +00:00
|
|
|
{
|
2009-12-07 18:10:11 +00:00
|
|
|
// TransInfo *t = arg;
|
|
|
|
//
|
|
|
|
// drawHelpline(C, t->mval[0], t->mval[1], t);
|
2009-01-10 18:33:16 +00:00
|
|
|
}
|
2011-02-17 12:05:09 +00:00
|
|
|
#endif
|
2009-01-10 18:33:16 +00:00
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
|
|
|
|
{
|
2009-06-23 00:41:55 +00:00
|
|
|
ToolSettings *ts = CTX_data_tool_settings(C);
|
2009-03-06 15:50:15 +00:00
|
|
|
int constraint_axis[3] = {0, 0, 0};
|
|
|
|
int proportional = 0;
|
2011-08-18 12:09:53 +00:00
|
|
|
PropertyRNA *prop;
|
2009-01-10 19:45:48 +00:00
|
|
|
|
2011-09-27 01:28:15 +00:00
|
|
|
// Save back mode in case we're in the generic operator
|
|
|
|
if ((prop= RNA_struct_find_property(op->ptr, "mode"))) {
|
|
|
|
RNA_property_enum_set(op->ptr, prop, t->mode);
|
|
|
|
}
|
|
|
|
|
2011-08-18 12:09:53 +00:00
|
|
|
if ((prop= RNA_struct_find_property(op->ptr, "value"))) {
|
|
|
|
float *values= (t->flag & T_AUTOVALUES) ? t->auto_values : t->values;
|
|
|
|
if (RNA_property_array_check(prop)) {
|
|
|
|
RNA_property_float_set_array(op->ptr, prop, values);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2011-08-18 12:09:53 +00:00
|
|
|
else {
|
|
|
|
RNA_property_float_set(op->ptr, prop, values[0]);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
2010-07-31 19:26:21 +00:00
|
|
|
/* convert flag to enum */
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
|
|
|
case (T_PROP_EDIT|T_PROP_CONNECTED):
|
|
|
|
proportional = PROP_EDIT_CONNECTED;
|
|
|
|
break;
|
|
|
|
case T_PROP_EDIT:
|
|
|
|
proportional = PROP_EDIT_ON;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
proportional = PROP_EDIT_OFF;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
// If modal, save settings back in scene if not set as operator argument
|
2009-11-26 19:47:55 +00:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* save settings if not set in operator */
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
|
|
|
|
!RNA_property_is_set(op->ptr, prop))
|
2012-01-14 04:42:41 +00:00
|
|
|
{
|
2010-07-31 19:26:21 +00:00
|
|
|
if (t->obedit)
|
|
|
|
ts->proportional = proportional;
|
|
|
|
else
|
|
|
|
ts->proportional_objects = (proportional != PROP_EDIT_OFF);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
|
|
|
|
!RNA_property_is_set(op->ptr, prop))
|
2012-01-14 04:42:41 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
ts->proportional_size = t->prop_size;
|
|
|
|
}
|
2012-01-14 04:42:41 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
|
|
|
|
!RNA_property_is_set(op->ptr, prop))
|
2012-01-14 04:42:41 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
ts->prop_mode = t->prop_mode;
|
|
|
|
}
|
|
|
|
|
2009-11-26 19:47:55 +00:00
|
|
|
/* do we check for parameter? */
|
|
|
|
if (t->modifiers & MOD_SNAP) {
|
|
|
|
ts->snap_flag |= SCE_SNAP;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-11-26 19:47:55 +00:00
|
|
|
ts->snap_flag &= ~SCE_SNAP;
|
|
|
|
}
|
|
|
|
|
2012-01-14 04:42:41 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
|
|
|
|
!RNA_property_is_set(op->ptr, prop))
|
2012-01-14 04:42:41 +00:00
|
|
|
{
|
2009-10-22 23:22:05 +00:00
|
|
|
View3D *v3d = t->view;
|
2012-04-28 06:31:57 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
v3d->twmode = t->current_orientation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "proportional")) {
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_enum_set(op->ptr, "proportional", proportional);
|
2010-08-18 03:24:52 +00:00
|
|
|
RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode);
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
|
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "axis"))) {
|
2012-01-14 04:42:41 +00:00
|
|
|
RNA_property_float_set_array(op->ptr, prop, t->axis);
|
2010-01-04 20:49:42 +00:00
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
|
2012-01-14 04:42:41 +00:00
|
|
|
RNA_property_boolean_set(op->ptr, prop, t->flag & T_MIRROR);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
|
2009-12-17 17:34:56 +00:00
|
|
|
/* constraint orientation can be global, event if user selects something else
|
|
|
|
* so use the orientation in the constraint if set
|
|
|
|
* */
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
RNA_enum_set(op->ptr, "constraint_orientation", t->con.orientation);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-12-17 17:34:56 +00:00
|
|
|
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2009-03-06 15:50:15 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-14 04:42:41 +00:00
|
|
|
RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
2010-08-03 22:36:59 +00:00
|
|
|
/* note: caller needs to free 't' on a 0 return */
|
2009-03-28 20:46:38 +00:00
|
|
|
int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int mode)
|
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
|
|
|
{
|
2009-03-10 18:10:24 +00:00
|
|
|
int options = 0;
|
2012-01-14 04:42:41 +00:00
|
|
|
PropertyRNA *prop;
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
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
|
|
|
/* added initialize, for external calls to set stuff in TransInfo, like undo string */
|
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
t->state = TRANS_STARTING;
|
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-04-28 06:31:57 +00:00
|
|
|
if ( (prop = RNA_struct_find_property(op->ptr, "texture_space")) && RNA_property_is_set(op->ptr, prop)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
2011-01-06 11:16:35 +00:00
|
|
|
options |= CTX_TEXTURE;
|
2012-01-14 04:42:41 +00:00
|
|
|
}
|
|
|
|
}
|
2011-01-05 17:27:26 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
t->options = options;
|
2009-07-12 02:01:13 +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
|
|
|
t->mode = mode;
|
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
t->launch_event = event ? event->type : -1;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->launch_event == EVT_TWEAK_R) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->launch_event = RIGHTMOUSE;
|
|
|
|
}
|
2012-03-07 04:53:43 +00:00
|
|
|
else if (t->launch_event == EVT_TWEAK_L) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->launch_event = LEFTMOUSE;
|
2010-03-14 18:58:14 +00:00
|
|
|
}
|
2010-03-19 03:26:31 +00:00
|
|
|
|
2010-03-14 18:58:14 +00:00
|
|
|
// XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0)
|
|
|
|
// For manipulator only, so assume LEFTMOUSE
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->launch_event == 0) {
|
2010-03-14 18:58:14 +00:00
|
|
|
t->launch_event = LEFTMOUSE;
|
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (!initTransInfo(C, t, op, event)) { /* internal data, mouse, vectors */
|
2009-03-28 20:46:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
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
|
|
|
//calc_manipulator_stats(curarea);
|
2009-04-27 15:43:35 +00:00
|
|
|
initTransformOrientation(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-03 21:01:41 +00:00
|
|
|
t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2009-12-07 18:10:11 +00:00
|
|
|
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2011-03-04 18:39:58 +00:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, 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
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->spacemtx);
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2009-12-07 18:10:11 +00:00
|
|
|
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2012-03-19 17:21:46 +00:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
|
2009-02-09 20:58:31 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
unit_m3(t->spacemtx);
|
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
|
|
|
t->options |= CTX_MOVIECLIP;
|
|
|
|
}
|
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
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->spacemtx);
|
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
|
|
|
|
|
|
|
createTransData(C, t); // make TransData structs from selection
|
|
|
|
|
|
|
|
if (t->total == 0) {
|
2009-12-07 18:10:11 +00:00
|
|
|
postTrans(C, t);
|
2009-03-28 20:46:38 +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
|
|
|
}
|
|
|
|
|
2010-03-14 19:38:36 +00:00
|
|
|
/* Stupid code to have Ctrl-Click on manipulator work ok */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event) {
|
2010-03-14 19:38:36 +00:00
|
|
|
wmKeyMap *keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
|
|
|
|
wmKeyMapItem *kmi;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
for (kmi = keymap->items.first; kmi; kmi = kmi->next) {
|
|
|
|
if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
|
2011-10-22 11:34:01 +00:00
|
|
|
if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
|
|
|
|
(ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
|
|
|
|
(ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
|
|
|
|
((kmi->type == OSKEY) && event->oskey) )
|
|
|
|
{
|
2011-05-11 09:28:00 +00:00
|
|
|
t->modifiers |= MOD_SNAP_INVERT;
|
2010-03-14 19:38:36 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
break;
|
2010-03-14 19:38:36 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2010-03-14 19:38:36 +00:00
|
|
|
}
|
|
|
|
|
2009-03-29 19:52:53 +00:00
|
|
|
initSnapping(t, op); // Initialize snapping data AFTER mode flags
|
2009-03-28 20:46:38 +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
|
|
|
/* 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 */
|
|
|
|
/* EVIL3: extend mode for animation editors also switches modes... but is best way to avoid duplicate code */
|
|
|
|
mode = t->mode;
|
2009-07-12 02:01:13 +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
|
|
|
calculatePropRatio(t);
|
|
|
|
calculateCenter(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInput(t, &t->mouse, t->center2d, t->imval);
|
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
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case TFM_TRANSLATION:
|
|
|
|
initTranslation(t);
|
|
|
|
break;
|
|
|
|
case TFM_ROTATION:
|
|
|
|
initRotation(t);
|
|
|
|
break;
|
|
|
|
case TFM_RESIZE:
|
|
|
|
initResize(t);
|
|
|
|
break;
|
|
|
|
case TFM_TOSPHERE:
|
|
|
|
initToSphere(t);
|
|
|
|
break;
|
|
|
|
case TFM_SHEAR:
|
|
|
|
initShear(t);
|
|
|
|
break;
|
|
|
|
case TFM_WARP:
|
|
|
|
initWarp(t);
|
|
|
|
break;
|
|
|
|
case TFM_SHRINKFATTEN:
|
|
|
|
initShrinkFatten(t);
|
|
|
|
break;
|
|
|
|
case TFM_TILT:
|
|
|
|
initTilt(t);
|
|
|
|
break;
|
|
|
|
case TFM_CURVE_SHRINKFATTEN:
|
|
|
|
initCurveShrinkFatten(t);
|
|
|
|
break;
|
|
|
|
case TFM_TRACKBALL:
|
|
|
|
initTrackball(t);
|
|
|
|
break;
|
|
|
|
case TFM_PUSHPULL:
|
|
|
|
initPushPull(t);
|
|
|
|
break;
|
|
|
|
case TFM_CREASE:
|
|
|
|
initCrease(t);
|
|
|
|
break;
|
|
|
|
case TFM_BONESIZE:
|
|
|
|
{ /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */
|
|
|
|
bArmature *arm= t->poseobj->data;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (arm->drawtype==ARM_ENVELOPE)
|
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
|
|
|
initBoneEnvelope(t);
|
|
|
|
else
|
|
|
|
initBoneSize(t);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_BONE_ENVELOPE:
|
|
|
|
initBoneEnvelope(t);
|
|
|
|
break;
|
2009-10-22 23:22:05 +00:00
|
|
|
case TFM_EDGE_SLIDE:
|
|
|
|
initEdgeSlide(t);
|
|
|
|
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
|
|
|
case TFM_BONE_ROLL:
|
|
|
|
initBoneRoll(t);
|
|
|
|
break;
|
|
|
|
case TFM_TIME_TRANSLATE:
|
|
|
|
initTimeTranslate(t);
|
|
|
|
break;
|
|
|
|
case TFM_TIME_SLIDE:
|
|
|
|
initTimeSlide(t);
|
|
|
|
break;
|
|
|
|
case TFM_TIME_SCALE:
|
|
|
|
initTimeScale(t);
|
|
|
|
break;
|
2011-03-02 23:39:08 +00:00
|
|
|
case TFM_TIME_DUPLICATE:
|
|
|
|
/* same as TFM_TIME_EXTEND, but we need the mode info for later
|
|
|
|
* so that duplicate-culling will work properly
|
|
|
|
*/
|
2012-03-25 22:35:18 +00:00
|
|
|
if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
|
2011-03-02 23:39:08 +00:00
|
|
|
initTranslation(t);
|
|
|
|
else
|
|
|
|
initTimeTranslate(t);
|
|
|
|
t->mode = mode;
|
|
|
|
break;
|
2009-07-12 02:01:13 +00:00
|
|
|
case TFM_TIME_EXTEND:
|
2009-01-28 02:56:58 +00:00
|
|
|
/* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation
|
|
|
|
* Editors because they have only 1D transforms for time values) or TFM_TRANSLATION
|
2009-07-07 05:41:59 +00:00
|
|
|
* (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement)
|
2009-07-12 02:01:13 +00:00
|
|
|
* depending on which editor this was called from
|
2009-01-28 02:56:58 +00:00
|
|
|
*/
|
2012-03-25 22:35:18 +00:00
|
|
|
if (ELEM(t->spacetype, SPACE_IPO, SPACE_NLA))
|
2009-01-28 02:56:58 +00:00
|
|
|
initTranslation(t);
|
|
|
|
else
|
|
|
|
initTimeTranslate(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
|
|
|
break;
|
|
|
|
case TFM_BAKE_TIME:
|
|
|
|
initBakeTime(t);
|
|
|
|
break;
|
|
|
|
case TFM_MIRROR:
|
|
|
|
initMirror(t);
|
|
|
|
break;
|
|
|
|
case TFM_BEVEL:
|
|
|
|
initBevel(t);
|
|
|
|
break;
|
|
|
|
case TFM_BWEIGHT:
|
|
|
|
initBevelWeight(t);
|
|
|
|
break;
|
|
|
|
case TFM_ALIGN:
|
|
|
|
initAlign(t);
|
|
|
|
break;
|
2009-12-21 17:23:44 +00:00
|
|
|
case TFM_SEQ_SLIDE:
|
|
|
|
initSeqSlide(t);
|
|
|
|
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
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2011-03-27 22:15:37 +00:00
|
|
|
postTrans(C, t);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
/* overwrite initial values if operator supplied a non-null vector */
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
|
2012-03-09 00:41:09 +00:00
|
|
|
float values[4]= {0}; /* in case value isn't length 4, avoid uninitialized memory */
|
2011-09-06 14:59:55 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_property_array_check(prop)) {
|
2011-09-06 14:59:55 +00:00
|
|
|
RNA_float_get_array(op->ptr, "value", values);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-09-06 14:59:55 +00:00
|
|
|
values[0]= RNA_float_get(op->ptr, "value");
|
|
|
|
}
|
|
|
|
|
2011-10-28 12:40:15 +00:00
|
|
|
copy_v4_v4(t->values, values);
|
|
|
|
copy_v4_v4(t->auto_values, values);
|
2009-03-06 15:50:15 +00:00
|
|
|
t->flag |= T_AUTOVALUES;
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
/* Transformation axis from operator */
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "axis")) && RNA_property_is_set(op->ptr, prop)) {
|
2012-01-14 04:42:41 +00:00
|
|
|
RNA_property_float_get_array(op->ptr, prop, t->axis);
|
2010-01-04 20:49:42 +00:00
|
|
|
normalize_v3(t->axis);
|
2010-11-03 04:38:07 +00:00
|
|
|
copy_v3_v3(t->axis_orig, t->axis);
|
2010-01-04 20:49:42 +00:00
|
|
|
}
|
|
|
|
|
2009-01-10 19:45:48 +00:00
|
|
|
/* Constraint init from operator */
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) {
|
2009-03-06 15:50:15 +00:00
|
|
|
int constraint_axis[3];
|
|
|
|
|
2012-01-14 04:42:41 +00:00
|
|
|
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
|
2009-03-06 15:50:15 +00:00
|
|
|
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;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
setUserConstraint(t, t->current_orientation, t->con.mode, "%s");
|
2009-01-10 19:45:48 +00:00
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
return 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
|
|
|
}
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
void transformApply(bContext *C, TransInfo *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
|
|
|
{
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
|
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
|
|
|
selectConstraint(t);
|
|
|
|
if (t->transform) {
|
|
|
|
t->transform(t, t->mval); // calls recalcData()
|
2009-01-07 16:52:18 +00:00
|
|
|
viewRedrawForce(C, 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
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw = TREDRAW_NOTHING;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (t->redraw & TREDRAW_SOFT) {
|
2010-02-03 21:01:41 +00:00
|
|
|
viewRedrawForce(C, 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
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* If auto confirm is on, break after one pass */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->options & CTX_AUTOCONFIRM) {
|
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
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (BKE_ptcache_get_continue_physics()) {
|
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
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
//do_screenhandlers(G.curscreen);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
}
|
2010-11-20 21:43:16 +00:00
|
|
|
|
|
|
|
t->context = NULL;
|
2010-02-03 21:01:41 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 16:38:48 +00:00
|
|
|
static void drawTransformApply(const bContext *C, struct ARegion *UNUSED(ar), void *arg)
|
2010-02-03 21:01:41 +00:00
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
|
|
|
|
|
|
|
if (t->redraw & TREDRAW_SOFT) {
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
2010-11-20 21:43:16 +00:00
|
|
|
transformApply((bContext *)C, 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
int transformEnd(bContext *C, TransInfo *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
|
|
|
{
|
2009-01-03 22:15:59 +00:00
|
|
|
int exit_code = OPERATOR_RUNNING_MODAL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) {
|
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
|
|
|
/* handle restoring objects */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2010-12-22 19:12:00 +00:00
|
|
|
/* exception, edge slide transformed UVs too */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->mode==TFM_EDGE_SLIDE)
|
2010-12-22 19:12:00 +00:00
|
|
|
doEdgeSlide(t, 0.0f);
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
exit_code = OPERATOR_CANCELLED;
|
2009-01-04 01:08:01 +00:00
|
|
|
restoreTransObjects(t); // calls recalcData()
|
2009-01-03 10:03:26 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2009-01-03 22:15:59 +00:00
|
|
|
exit_code = OPERATOR_FINISHED;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-02-09 01:27:44 +00:00
|
|
|
/* aftertrans does insert keyframes, and clears base flags, doesnt read transdata */
|
2009-12-14 03:20:17 +00:00
|
|
|
special_aftertrans_update(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* free data */
|
2009-12-07 18:10:11 +00:00
|
|
|
postTrans(C, t);
|
2009-11-01 02:52:38 +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
|
|
|
/* send events out for redraws */
|
2011-02-07 16:41:57 +00:00
|
|
|
viewRedrawPost(C, t);
|
2009-07-12 02:01:13 +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
|
|
|
/* Undo as last, certainly after special_trans_update! */
|
2008-12-31 17:11:42 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
// if (t->undostr) ED_undo_push(C, t->undostr);
|
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 {
|
2012-03-24 06:38:07 +00:00
|
|
|
// if (t->undostr) ED_undo_push(C, t->undostr);
|
2009-02-17 15:53:52 +00:00
|
|
|
// else ED_undo_push(C, transform_to_undostr(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
|
|
|
}
|
|
|
|
t->undostr= NULL;
|
2009-01-20 19:18:22 +00:00
|
|
|
|
|
|
|
viewRedrawForce(C, 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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
return exit_code;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TRANSFORM LOCKS **************************** */
|
|
|
|
|
|
|
|
static void protectedTransBits(short protectflag, float *vec)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCX)
|
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[0]= 0.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCY)
|
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[1]= 0.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCZ)
|
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[2]= 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void protectedSizeBits(short protectflag, float *size)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEX)
|
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
|
|
|
size[0]= 1.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEY)
|
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
|
|
|
size[1]= 1.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEZ)
|
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
|
|
|
size[2]= 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void protectedRotateBits(short protectflag, float *eul, float *oldeul)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
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
|
|
|
eul[0]= oldeul[0];
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
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
|
|
|
eul[1]= oldeul[1];
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
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
|
|
|
eul[2]= oldeul[2];
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* this function only does the delta rotation */
|
|
|
|
/* axis-angle is usually internally stored as quats... */
|
2009-11-01 00:06:53 +00:00
|
|
|
static void protectedAxisAngleBits(short protectflag, float axis[3], float *angle, float oldAxis[3], float oldAngle)
|
2009-09-16 17:43:09 +00:00
|
|
|
{
|
|
|
|
/* check that protection flags are set */
|
|
|
|
if ((protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (protectflag & OB_LOCK_ROT4D) {
|
|
|
|
/* axis-angle getting limited as 4D entities that they are... */
|
|
|
|
if (protectflag & OB_LOCK_ROTW)
|
2009-11-01 00:06:53 +00:00
|
|
|
*angle= oldAngle;
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2009-11-01 00:06:53 +00:00
|
|
|
axis[0]= oldAxis[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2009-11-01 00:06:53 +00:00
|
|
|
axis[1]= oldAxis[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2009-11-01 00:06:53 +00:00
|
|
|
axis[2]= oldAxis[2];
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* axis-angle get limited with euler... */
|
2009-11-01 00:06:53 +00:00
|
|
|
float eul[3], oldeul[3];
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle);
|
|
|
|
axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
|
|
|
eul[0]= oldeul[0];
|
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
|
|
|
eul[1]= oldeul[1];
|
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
|
|
|
eul[2]= oldeul[2];
|
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
|
|
|
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
|
2011-03-28 17:06:15 +00:00
|
|
|
if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
|
2009-09-16 17:43:09 +00:00
|
|
|
/* for now, rotate around y-axis then (so that it simply becomes the roll) */
|
2009-11-01 00:06:53 +00:00
|
|
|
axis[1]= 1.0f;
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* this function only does the delta rotation */
|
|
|
|
static void protectedQuaternionBits(short protectflag, float *quat, float *oldquat)
|
|
|
|
{
|
|
|
|
/* check that protection flags are set */
|
|
|
|
if ((protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (protectflag & OB_LOCK_ROT4D) {
|
|
|
|
/* quaternions getting limited as 4D entities that they are... */
|
|
|
|
if (protectflag & OB_LOCK_ROTW)
|
|
|
|
quat[0]= oldquat[0];
|
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
|
|
|
quat[1]= oldquat[1];
|
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
|
|
|
quat[2]= oldquat[2];
|
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
|
|
|
quat[3]= oldquat[3];
|
|
|
|
}
|
|
|
|
else {
|
2011-10-15 14:14:22 +00:00
|
|
|
/* quaternions get limited with euler... (compatibility mode) */
|
2010-12-07 01:56:32 +00:00
|
|
|
float eul[3], oldeul[3], nquat[4], noldquat[4];
|
|
|
|
float qlen;
|
|
|
|
|
|
|
|
qlen= normalize_qt_qt(nquat, quat);
|
|
|
|
normalize_qt_qt(noldquat, oldquat);
|
|
|
|
|
|
|
|
quat_to_eul(eul, nquat);
|
|
|
|
quat_to_eul(oldeul, noldquat);
|
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
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
|
|
|
eul[0]= oldeul[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
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
|
|
|
eul[1]= oldeul[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
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
|
|
|
eul[2]= oldeul[2];
|
2010-12-07 01:56:32 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
eul_to_quat(quat, eul);
|
2010-12-07 01:56:32 +00:00
|
|
|
|
|
|
|
/* restore original quat size */
|
|
|
|
mul_qt_fl(quat, qlen);
|
2009-09-16 17:43:09 +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
|
|
|
/* quaternions flip w sign to accumulate rotations correctly */
|
2010-12-07 01:56:32 +00:00
|
|
|
if ( (nquat[0]<0.0f && quat[0]>0.0f) || (nquat[0]>0.0f && quat[0]<0.0f) ) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_fl(quat, -1.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************* TRANSFORM LIMITS ********************** */
|
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
static void constraintTransLim(TransInfo *t, TransData *td)
|
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 (td->con) {
|
2011-05-24 12:12:12 +00:00
|
|
|
bConstraintTypeInfo *ctiLoc= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
|
|
|
|
bConstraintTypeInfo *ctiDist= get_constraint_typeinfo(CONSTRAINT_TYPE_DISTLIMIT);
|
|
|
|
|
2011-03-03 17:59:04 +00:00
|
|
|
bConstraintOb cob= {NULL};
|
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
|
|
|
bConstraint *con;
|
2011-05-24 12:12:12 +00:00
|
|
|
float ctime = (float)(t->scene->r.cfra);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Make a temporary bConstraintOb for using these limit constraints
|
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
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
* - current space should be local
|
|
|
|
*/
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(cob.matrix);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(cob.matrix[3], td->loc);
|
2009-10-22 23:22:05 +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
|
|
|
/* Evaluate valid constraints */
|
|
|
|
for (con= td->con; con; con= con->next) {
|
2011-05-24 12:12:12 +00:00
|
|
|
bConstraintTypeInfo *cti = NULL;
|
|
|
|
ListBase targets = {NULL, NULL};
|
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 tmat[4][4];
|
2009-10-22 23:22:05 +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
|
|
|
/* only consider constraint if enabled */
|
|
|
|
if (con->flag & CONSTRAINT_DISABLE) continue;
|
|
|
|
if (con->enforce == 0.0f) continue;
|
2009-10-22 23:22:05 +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
|
|
|
/* only use it if it's tagged for this purpose (and the right type) */
|
|
|
|
if (con->type == CONSTRAINT_TYPE_LOCLIMIT) {
|
|
|
|
bLocLimitConstraint *data= con->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM)==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
|
|
|
continue;
|
2011-05-24 12:12:12 +00:00
|
|
|
cti = ctiLoc;
|
|
|
|
}
|
|
|
|
else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) {
|
|
|
|
bDistLimitConstraint *data= con->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
if ((data->flag & LIMITDIST_TRANSFORM)==0)
|
|
|
|
continue;
|
|
|
|
cti = ctiDist;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cti) {
|
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
|
|
|
/* do space conversions */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, tmat);
|
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 if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
|
|
|
|
/* skip... incompatable spacetype */
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
/* get constraint targets if needed */
|
|
|
|
get_constraint_targets_for_solving(con, &cob, &targets, ctime);
|
|
|
|
|
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
|
|
|
/* do constraint */
|
2011-05-24 12:12:12 +00:00
|
|
|
cti->evaluate_constraint(con, &cob, &targets);
|
2009-10-22 23:22:05 +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
|
|
|
/* convert spaces again */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, tmat);
|
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-05-24 12:12:12 +00:00
|
|
|
|
|
|
|
/* free targets list */
|
|
|
|
BLI_freelistN(&targets);
|
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
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* copy results from cob->matrix */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->loc, cob.matrix[3]);
|
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-04-19 09:38:36 +00:00
|
|
|
static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
|
|
|
|
{
|
|
|
|
/* Make a temporary bConstraintOb for use by limit constraints
|
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
* - current space should be local
|
|
|
|
*/
|
|
|
|
memset(cob, 0, sizeof(bConstraintOb));
|
2012-04-28 06:31:57 +00:00
|
|
|
if (td->ext) {
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
|
|
|
/* quats */
|
2010-04-19 09:38:36 +00:00
|
|
|
/* objects and bones do normalization first too, otherwise
|
2012-03-03 16:31:46 +00:00
|
|
|
* we don't necessarily end up with a rotation matrix, and
|
|
|
|
* then conversion back to quat gives a different result */
|
2010-04-19 09:38:36 +00:00
|
|
|
float quat[4];
|
2010-12-07 01:56:32 +00:00
|
|
|
normalize_qt_qt(quat, td->ext->quat);
|
2010-04-19 09:38:36 +00:00
|
|
|
quat_to_mat4(cob->matrix, quat);
|
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
|
|
|
/* axis angle */
|
2010-04-19 09:38:36 +00:00
|
|
|
axis_angle_to_mat4(cob->matrix, &td->ext->quat[1], td->ext->quat[0]);
|
2010-11-14 19:19:58 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* eulers */
|
|
|
|
eulO_to_mat4(cob->matrix, td->ext->rot, td->ext->rotOrder);
|
|
|
|
}
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
|
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 (td->con) {
|
|
|
|
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT);
|
|
|
|
bConstraintOb cob;
|
|
|
|
bConstraint *con;
|
2010-04-19 09:38:36 +00:00
|
|
|
int dolimit = 0;
|
2009-09-16 17:43:09 +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
|
|
|
/* Evaluate valid constraints */
|
|
|
|
for (con= td->con; con; con= con->next) {
|
|
|
|
/* only consider constraint if enabled */
|
|
|
|
if (con->flag & CONSTRAINT_DISABLE) continue;
|
|
|
|
if (con->enforce == 0.0f) continue;
|
2009-09-16 17:43:09 +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
|
|
|
/* we're only interested in Limit-Rotation constraints */
|
|
|
|
if (con->type == CONSTRAINT_TYPE_ROTLIMIT) {
|
|
|
|
bRotLimitConstraint *data= con->data;
|
|
|
|
float tmat[4][4];
|
2009-09-16 17:43:09 +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
|
|
|
/* only use it if it's tagged for this purpose */
|
2009-07-12 02:01:13 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM)==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
|
|
|
continue;
|
2010-04-19 09:38:36 +00:00
|
|
|
|
|
|
|
/* skip incompatable spacetypes */
|
|
|
|
if (!ELEM(con->ownspace, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* only do conversion if necessary, to preserve quats and eulers */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!dolimit) {
|
2010-04-19 09:38:36 +00:00
|
|
|
constraintob_from_transdata(&cob, td);
|
|
|
|
dolimit= 1;
|
|
|
|
}
|
2009-09-16 17:43:09 +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
|
|
|
/* do space conversions */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, tmat);
|
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
|
|
|
}
|
2009-09-16 17:43:09 +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
|
|
|
/* do constraint */
|
|
|
|
cti->evaluate_constraint(con, &cob, NULL);
|
2009-09-16 17:43:09 +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
|
|
|
/* convert spaces again */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, tmat);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (dolimit) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* copy results from cob->matrix */
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* quats */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_quat(td->ext->quat, cob.matrix);
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* axis angle */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_axis_angle(&td->ext->quat[1], &td->ext->quat[0], cob.matrix);
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* eulers */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_eulO(td->ext->rot, td->ext->rotOrder, cob.matrix);
|
2010-04-19 09:38:36 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void constraintSizeLim(TransInfo *t, TransData *td)
|
|
|
|
{
|
|
|
|
if (td->con && td->ext) {
|
|
|
|
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT);
|
2011-03-03 17:59:04 +00:00
|
|
|
bConstraintOb cob= {NULL};
|
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
|
|
|
bConstraint *con;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Make a temporary bConstraintOb for using these limit constraints
|
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
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
* - current space should be local
|
|
|
|
*/
|
2009-10-22 23:22:05 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
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
|
|
|
/* scale val and reset size */
|
|
|
|
return; // TODO: fix this case
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
|
|
|
return;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat4(cob.matrix, td->ext->size);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* Evaluate valid constraints */
|
|
|
|
for (con= td->con; con; con= con->next) {
|
|
|
|
/* only consider constraint if enabled */
|
|
|
|
if (con->flag & CONSTRAINT_DISABLE) continue;
|
|
|
|
if (con->enforce == 0.0f) continue;
|
2009-10-22 23:22:05 +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
|
|
|
/* we're only interested in Limit-Scale constraints */
|
|
|
|
if (con->type == CONSTRAINT_TYPE_SIZELIMIT) {
|
|
|
|
bSizeLimitConstraint *data= con->data;
|
|
|
|
float tmat[4][4];
|
2009-10-22 23:22:05 +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
|
|
|
/* only use it if it's tagged for this purpose */
|
2009-07-12 02:01:13 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM)==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
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
/* do space conversions */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, tmat);
|
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 if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
|
|
|
|
/* skip... incompatable spacetype */
|
|
|
|
continue;
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* do constraint */
|
|
|
|
cti->evaluate_constraint(con, &cob, NULL);
|
2009-10-22 23:22:05 +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
|
|
|
/* convert spaces again */
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, cob.matrix);
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, tmat);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* copy results from cob->matrix */
|
2009-10-22 23:22:05 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
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
|
|
|
/* scale val and reset size */
|
|
|
|
return; // TODO: fix this case
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
|
|
|
return;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_size(td->ext->size, cob.matrix);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** WARP *************************** */
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void postInputWarp(TransInfo *t, float values[3])
|
2010-03-09 01:19:32 +00:00
|
|
|
{
|
|
|
|
mul_v3_fl(values, (float)(M_PI * 2));
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->customData) { /* non-null value indicates reversed input */
|
2010-03-09 01:19:32 +00:00
|
|
|
negate_v3(values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initWarp(TransInfo *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
|
|
|
{
|
|
|
|
float max[3], min[3];
|
|
|
|
int i;
|
2009-10-22 23:22:05 +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
|
|
|
t->mode = TFM_WARP;
|
|
|
|
t->transform = Warp;
|
|
|
|
t->handleEvent = handleEventWarp;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
setInputPostFct(&t->mouse, postInputWarp);
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO);
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
2011-03-28 17:06:15 +00:00
|
|
|
t->snap[1] = 5.0f / 180.0f * (float)M_PI;
|
|
|
|
t->snap[2] = 1.0f / 180.0f * (float)M_PI;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = 1.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
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2009-10-22 23:22:05 +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
|
|
|
/* we need min/max in view space */
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0; i < t->total; 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
|
|
|
float center[3];
|
2010-07-31 10:58:10 +00:00
|
|
|
copy_v3_v3(center, t->data[i].center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(t->data[i].mtx, center);
|
|
|
|
mul_m4_v3(t->viewmat, center);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(center, t->viewmat[3]);
|
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 (i)
|
2010-09-28 11:48:13 +00:00
|
|
|
minmax_v3v3_v3(min, max, center);
|
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 {
|
2010-07-31 10:58:10 +00:00
|
|
|
copy_v3_v3(max, center);
|
|
|
|
copy_v3_v3(min, center);
|
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-07-31 10:58:10 +00:00
|
|
|
|
|
|
|
mid_v3_v3v3(t->center, min, max);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
if (max[0] == min[0]) max[0] += 0.1f; /* not optimal, but flipping is better than invalid garbage (i.e. division by 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
|
|
|
t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */
|
|
|
|
}
|
|
|
|
|
|
|
|
int handleEventWarp(TransInfo *t, wmEvent *event)
|
|
|
|
{
|
|
|
|
int status = 0;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
|
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
|
|
|
// Use customData pointer to signal warp direction
|
2011-03-03 17:59:04 +00:00
|
|
|
if (t->customData == NULL)
|
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
|
|
|
t->customData = (void*)1;
|
|
|
|
else
|
2011-03-03 17:59:04 +00:00
|
|
|
t->customData = NULL;
|
2009-10-22 23:22:05 +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
|
|
|
status = 1;
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Warp(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3];
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-10-22 23:22:05 +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
|
|
|
curs= give_cursor(t->scene, t->view);
|
|
|
|
/*
|
|
|
|
* gcursor is the one used for helpline.
|
|
|
|
* It has to be in the same space as the drawing loop
|
|
|
|
* (that means it needs to be in the object's space when in edit mode and
|
|
|
|
* in global space in object mode)
|
|
|
|
*
|
|
|
|
* cursor is used for calculations.
|
|
|
|
* It needs to be in view space, but we need to take object's offset
|
|
|
|
* into account if in Edit mode.
|
|
|
|
*/
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(cursor, curs);
|
|
|
|
copy_v3_v3(gcursor, cursor);
|
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 (t->flag & T_EDIT) {
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(cursor, t->obedit->obmat[3]);
|
|
|
|
sub_v3_v3(gcursor, t->obedit->obmat[3]);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(t->data->smtx, gcursor);
|
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
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(t->viewmat, cursor);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(cursor, t->viewmat[3]);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
/* amount of radians for warp */
|
|
|
|
circumfac = t->values[0];
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, &circumfac);
|
|
|
|
applyNumInput(&t->num, &circumfac);
|
2009-10-22 23:22:05 +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
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-10-22 23:22:05 +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
|
|
|
outputNumInput(&(t->num), c);
|
2009-10-22 23:22:05 +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
|
|
|
sprintf(str, "Warp: %s", c);
|
2010-03-09 01:19:32 +00:00
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
circumfac = DEG2RADF(circumfac);
|
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 {
|
|
|
|
/* default header print */
|
2011-03-28 17:06:15 +00:00
|
|
|
sprintf(str, "Warp: %.3f", RAD2DEGF(circumfac));
|
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
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
t->values[0] = circumfac;
|
|
|
|
|
|
|
|
circumfac /= 2; /* only need 180 on each side to make 360 */
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
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 loc[3];
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
/* translate point to center, rotate in such a way that outline==distance */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, td->iloc);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->mtx, vec);
|
|
|
|
mul_m4_v3(t->viewmat, vec);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, t->viewmat[3]);
|
2009-10-22 23:22:05 +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
|
|
|
dist= vec[0]-cursor[0];
|
2009-10-22 23:22:05 +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
|
|
|
/* t->val is X dimension projected boundbox */
|
2009-07-12 02:01:13 +00:00
|
|
|
phi0= (circumfac*dist/t->val);
|
2009-10-22 23:22:05 +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
|
|
|
vec[1]= (vec[1]-cursor[1]);
|
2009-10-22 23:22:05 +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
|
|
|
co= (float)cos(phi0);
|
|
|
|
si= (float)sin(phi0);
|
|
|
|
loc[0]= -si*vec[1]+cursor[0];
|
|
|
|
loc[1]= co*vec[1]+cursor[1];
|
|
|
|
loc[2]= vec[2];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(t->viewinv, loc);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(loc, t->viewinv[3]);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, loc);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(loc, td->iloc);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(loc, td->factor);
|
|
|
|
add_v3_v3v3(td->loc, td->iloc, loc);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-10-22 23:22:05 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** SHEAR *************************** */
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void postInputShear(TransInfo *UNUSED(t), float values[3])
|
2010-03-09 01:19:32 +00:00
|
|
|
{
|
|
|
|
mul_v3_fl(values, 0.05f);
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initShear(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_SHEAR;
|
|
|
|
t->transform = Shear;
|
|
|
|
t->handleEvent = handleEventShear;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
setInputPostFct(&t->mouse, postInputShear);
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = 0.1f;
|
|
|
|
|
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
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
int handleEventShear(TransInfo *t, wmEvent *event)
|
|
|
|
{
|
|
|
|
int status = 0;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
|
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
|
|
|
// Use customData pointer to signal Shear direction
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->customData == NULL) {
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
|
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
|
|
|
t->customData = (void*)1;
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
|
2011-03-03 17:59:04 +00:00
|
|
|
t->customData = NULL;
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2012-03-15 00:57:14 +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
|
|
|
status = 1;
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Shear(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float vec[3];
|
|
|
|
float smat[3][3], tmat[3][3], totmat[3][3], persmat[3][3], persinv[3][3];
|
|
|
|
float value;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(persmat, t->viewmat);
|
|
|
|
invert_m3_m3(persinv, persmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
value = t->values[0];
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, &value);
|
2009-10-22 23:22:05 +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
|
|
|
applyNumInput(&t->num, &value);
|
2009-10-22 23:22:05 +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
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-10-22 23:22:05 +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
|
|
|
outputNumInput(&(t->num), c);
|
2009-10-22 23:22:05 +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
|
|
|
sprintf(str, "Shear: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
sprintf(str, "Shear: %.3f %s", value, t->proptext);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-18 08:26:58 +00:00
|
|
|
t->values[0] = value;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(smat);
|
2009-10-22 23:22:05 +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
|
|
|
// Custom data signals shear direction
|
2011-03-03 17:59:04 +00:00
|
|
|
if (t->customData == NULL)
|
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
|
|
|
smat[1][0] = value;
|
|
|
|
else
|
|
|
|
smat[0][1] = value;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(tmat, smat, persmat);
|
|
|
|
mul_m3_m3m3(totmat, persinv, tmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-01-02 19:10:35 +00:00
|
|
|
if (t->obedit) {
|
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 mat3[3][3];
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat3, totmat, td->mtx);
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, mat3);
|
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 {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(tmat, totmat);
|
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
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, t->center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(tmat, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, t->center);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, td->factor);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** RESIZE *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initResize(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_RESIZE;
|
|
|
|
t->transform = Resize;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2009-10-22 23:22:05 +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
|
|
|
t->flag |= T_NULL_ONE;
|
|
|
|
t->num.flag |= NUM_NULL_ONE;
|
|
|
|
t->num.flag |= NUM_AFFECT_ALL;
|
2009-01-02 19:10:35 +00:00
|
|
|
if (!t->obedit) {
|
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
|
|
|
t->flag |= T_NO_ZERO;
|
|
|
|
t->num.flag |= NUM_NO_ZERO;
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 2;
|
|
|
|
t->num.idx_max = 2;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void headerResize(TransInfo *t, float vec[3], char *str)
|
|
|
|
{
|
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
|
|
|
char tvec[60];
|
2011-02-12 14:25:54 +00:00
|
|
|
char *spos= str;
|
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 (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
}
|
|
|
|
else {
|
2012-01-11 12:56:31 +00:00
|
|
|
BLI_snprintf(&tvec[0], 20, "%.4f", vec[0]);
|
|
|
|
BLI_snprintf(&tvec[20], 20, "%.4f", vec[1]);
|
|
|
|
BLI_snprintf(&tvec[40], 20, "%.4f", vec[2]);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.mode & CON_APPLY) {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->num.idx_max) {
|
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
|
|
|
case 0:
|
2011-02-12 14:25:54 +00:00
|
|
|
spos += sprintf(spos, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
|
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
|
|
|
break;
|
|
|
|
case 1:
|
2011-02-12 14:25:54 +00:00
|
|
|
spos += sprintf(spos, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
|
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
|
|
|
break;
|
|
|
|
case 2:
|
2011-02-12 14:25:54 +00:00
|
|
|
spos += sprintf(spos, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
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 {
|
|
|
|
if (t->flag & T_2D_EDIT)
|
2011-02-12 14:25:54 +00:00
|
|
|
spos += sprintf(spos, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
|
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
|
2011-02-12 14:25:54 +00:00
|
|
|
spos += sprintf(spos, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
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-08 16:54:38 +00:00
|
|
|
|
2011-02-12 14:25:54 +00:00
|
|
|
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
|
|
|
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
(void)spos;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
#define SIGN(a) (a<-FLT_EPSILON?1:a>FLT_EPSILON?2:3)
|
|
|
|
#define VECSIGNFLIP(a, b) ((SIGN(a[0]) & SIGN(b[0]))==0 || (SIGN(a[1]) & SIGN(b[1]))==0 || (SIGN(a[2]) & SIGN(b[2]))==0)
|
|
|
|
|
|
|
|
/* smat is reference matrix, only scaled */
|
2012-04-29 15:47:02 +00:00
|
|
|
static void TransMat3ToSize(float mat[][3], float smat[][3], float *size)
|
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 vec[3];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(vec, mat[0]);
|
|
|
|
size[0]= normalize_v3(vec);
|
|
|
|
copy_v3_v3(vec, mat[1]);
|
|
|
|
size[1]= normalize_v3(vec);
|
|
|
|
copy_v3_v3(vec, mat[2]);
|
|
|
|
size[2]= normalize_v3(vec);
|
2009-10-22 23:22:05 +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
|
|
|
/* first tried with dotproduct... but the sign flip is crucial */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ( VECSIGNFLIP(mat[0], smat[0]) ) size[0]= -size[0];
|
|
|
|
if ( VECSIGNFLIP(mat[1], smat[1]) ) size[1]= -size[1];
|
|
|
|
if ( VECSIGNFLIP(mat[2], smat[2]) ) size[2]= -size[2];
|
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-12-17 00:52:36 +00:00
|
|
|
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3])
|
|
|
|
{
|
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 tmat[3][3], smat[3][3], center[3];
|
|
|
|
float vec[3];
|
2009-10-22 23:22:05 +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
|
|
|
if (t->flag & T_EDIT) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(smat, mat, td->mtx);
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, smat);
|
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 {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(tmat, mat);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applySize) {
|
|
|
|
t->con.applySize(t, td, tmat);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* local constraint shouldn't alter center */
|
2011-10-03 16:20:05 +00:00
|
|
|
if ((t->around == V3D_LOCAL) &&
|
|
|
|
( (t->flag & (T_OBJECT|T_POSE)) ||
|
2012-01-13 14:56:41 +00:00
|
|
|
((t->flag & T_EDIT) && (t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE))) ||
|
2011-10-03 16:20:05 +00:00
|
|
|
(t->obedit && t->obedit->type == OB_ARMATURE))
|
|
|
|
)
|
|
|
|
{
|
|
|
|
copy_v3_v3(center, td->center);
|
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 {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(center, t->center);
|
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-10-03 16:20:05 +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
|
|
|
if (td->ext) {
|
|
|
|
float fsize[3];
|
2009-10-22 23:22:05 +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
|
|
|
if (t->flag & (T_OBJECT|T_TEXTURE|T_POSE)) {
|
|
|
|
float obsizemat[3][3];
|
|
|
|
// Reorient the size mat to fit the oriented object.
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(obsizemat, tmat, td->axismtx);
|
|
|
|
//print_m3("obsizemat", obsizemat);
|
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
|
|
|
TransMat3ToSize(obsizemat, td->axismtx, fsize);
|
2009-11-10 20:43:45 +00:00
|
|
|
//print_v3("fsize", fsize);
|
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 {
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_size(fsize, tmat);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
protectedSizeBits(td->protectflag, fsize);
|
2009-10-22 23:22:05 +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
|
|
|
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't resize objects itself
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
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
|
|
|
/* scale val and reset size */
|
2010-03-22 09:30:00 +00:00
|
|
|
*td->val = td->ival * (1 + (fsize[0] - 1) * td->factor);
|
2009-10-22 23:22:05 +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
|
|
|
td->ext->size[0] = td->ext->isize[0];
|
|
|
|
td->ext->size[1] = td->ext->isize[1];
|
|
|
|
td->ext->size[2] = td->ext->isize[2];
|
2010-03-22 09:30:00 +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
|
|
|
else {
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
2010-03-22 09:30:00 +00:00
|
|
|
*td->val = td->ival;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-10-31 02:54:27 +00:00
|
|
|
td->ext->size[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor);
|
|
|
|
td->ext->size[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor);
|
|
|
|
td->ext->size[2] = td->ext->isize[2] * (1 + (fsize[2] - 1) * td->factor);
|
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
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
constraintSizeLim(t, td);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* For individual element center, Editmode need to use iloc */
|
|
|
|
if (t->flag & T_POINTS)
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, center);
|
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
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(tmat, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
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 (t->flag & T_POINTS)
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->iloc);
|
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
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, td->factor);
|
2009-10-22 23:22:05 +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
|
|
|
if (t->flag & (T_OBJECT|T_POSE)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, vec);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2009-10-22 23:22:05 +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
|
|
|
constraintTransLim(t, td);
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Resize(TransInfo *t, const int mval[2])
|
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
|
|
|
{
|
|
|
|
TransData *td;
|
|
|
|
float size[3], mat[3][3];
|
|
|
|
float ratio;
|
|
|
|
int i;
|
|
|
|
char str[200];
|
2009-10-22 23:22:05 +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
|
|
|
/* for manipulator, center handle, the scaling can't be done relative to center */
|
2012-04-28 06:31:57 +00:00
|
|
|
if ( (t->flag & T_USES_MANIPULATOR) && t->con.mode==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
|
|
|
ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
size[0] = size[1] = size[2] = ratio;
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, size);
|
2009-10-22 23:22:05 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
applyNumInput(&t->num, size);
|
|
|
|
constraintNumInput(t, size);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
applySnapping(t, size);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->flag & T_AUTOVALUES) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(size, t->auto_values);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->values, size);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applySize) {
|
|
|
|
t->con.applySize(t, NULL, mat);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(t->mat, mat); // used in manipulator
|
2009-10-22 23:22:05 +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
|
|
|
headerResize(t, size, str);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0, td=t->data; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
ElementResize(t, td, mat);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* evil hack - redo resize if cliping needed */
|
|
|
|
if (t->flag & T_CLIP_UV && clipUVTransform(t, size, 1)) {
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applySize)
|
|
|
|
t->con.applySize(t, NULL, mat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0, td=t->data; i < t->total; i++, td++)
|
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
|
|
|
ElementResize(t, td, mat);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-10-22 23:22:05 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TOSPHERE *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initToSphere(TransInfo *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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
2009-10-22 23:22:05 +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
|
|
|
t->mode = TFM_TOSPHERE;
|
|
|
|
t->transform = ToSphere;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO);
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[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
|
|
|
t->num.flag |= NUM_NULL_ONE | NUM_NO_NEGATIVE;
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2009-10-22 23:22:05 +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
|
|
|
// Calculate average radius
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
2009-11-10 20:43:45 +00:00
|
|
|
t->val += len_v3v3(t->center, td->iloc);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
t->val /= (float)t->total;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int ToSphere(TransInfo *t, const int UNUSED(mval[2]))
|
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 vec[3];
|
|
|
|
float ratio, radius;
|
|
|
|
int i;
|
|
|
|
char str[64];
|
|
|
|
TransData *td = t->data;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, &ratio);
|
2009-10-22 23:22:05 +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
|
|
|
applyNumInput(&t->num, &ratio);
|
2009-10-22 23:22:05 +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
|
|
|
if (ratio < 0)
|
|
|
|
ratio = 0.0f;
|
|
|
|
else if (ratio > 1)
|
|
|
|
ratio = 1.0f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
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
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-10-22 23:22:05 +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
|
|
|
outputNumInput(&(t->num), c);
|
2009-10-22 23:22:05 +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
|
|
|
sprintf(str, "To Sphere: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
sprintf(str, "To Sphere: %.4f %s", ratio, t->proptext);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 tratio;
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, t->center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
radius = normalize_v3(vec);
|
2009-10-22 23:22:05 +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
|
|
|
tratio = ratio * td->factor;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, radius * (1.0f - tratio) + t->val * tratio);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, t->center, vec);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-10-22 23:22:05 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** ROTATION *************************** */
|
|
|
|
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void postInputRotation(TransInfo *t, float values[3])
|
2010-03-09 01:19:32 +00:00
|
|
|
{
|
|
|
|
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
|
|
|
t->con.applyRot(t, NULL, t->axis, values);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initRotation(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_ROTATION;
|
|
|
|
t->transform = Rotation;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
setInputPostFct(&t->mouse, postInputRotation);
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = (float)((5.0/180)*M_PI);
|
|
|
|
t->snap[2] = t->snap[1] * 0.2f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = 1.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
|
|
|
if (t->flag & T_2D_EDIT)
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2010-01-04 20:49:42 +00:00
|
|
|
|
2010-02-26 09:02:52 +00:00
|
|
|
negate_v3_v3(t->axis, t->viewinv[2]);
|
2010-01-04 20:49:42 +00:00
|
|
|
normalize_v3(t->axis);
|
2010-11-03 04:38:07 +00:00
|
|
|
|
|
|
|
copy_v3_v3(t->axis_orig, t->axis);
|
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-12-17 00:52:36 +00:00
|
|
|
static void ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around)
|
|
|
|
{
|
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 vec[3], totmat[3][3], smat[3][3];
|
|
|
|
float eul[3], fmat[3][3], quat[4];
|
|
|
|
float *center = t->center;
|
2011-10-02 12:21:24 +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
|
|
|
/* local constraint shouldn't alter center */
|
|
|
|
if (around == V3D_LOCAL) {
|
2011-10-02 19:57:34 +00:00
|
|
|
if ( (t->flag & (T_OBJECT|T_POSE)) ||
|
2012-01-13 14:56:41 +00:00
|
|
|
(t->settings->selectmode & (SCE_SELECT_EDGE|SCE_SELECT_FACE)) ||
|
2011-10-02 19:57:34 +00:00
|
|
|
(t->obedit && t->obedit->type == OB_ARMATURE))
|
|
|
|
{
|
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
|
|
|
center = td->center;
|
|
|
|
}
|
|
|
|
}
|
2011-10-02 12:21:24 +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
|
|
|
if (t->flag & T_POINTS) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->mtx);
|
|
|
|
mul_m3_m3m3(smat, td->smtx, totmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, center);
|
|
|
|
mul_m3_v3(smat, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, vec, center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
sub_v3_v3v3(vec, td->loc, td->iloc);
|
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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->flag & TD_USEQUAT) {
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->ext->quat) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
2009-10-22 23:22:05 +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
|
|
|
/* is there a reason not to have this here? -jahka */
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* HACK WARNING
|
2009-07-12 02:01:13 +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
|
|
|
* This is some VERY ugly special case to deal with pose mode.
|
2009-07-12 02:01:13 +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
|
|
|
* The problem is that mtx and smtx include each bone orientation.
|
2009-07-12 02:01:13 +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
|
|
|
* That is needed to rotate each bone properly, HOWEVER, to calculate
|
|
|
|
* the translation component, we only need the actual armature object's
|
|
|
|
* matrix (and inverse). That is not all though. Once the proper translation
|
|
|
|
* has been computed, it has to be converted back into the bone's space.
|
|
|
|
*/
|
|
|
|
else if (t->flag & T_POSE) {
|
|
|
|
float pmtx[3][3], imtx[3][3];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
// Extract and invert armature object matrix
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(pmtx, t->poseobj->obmat);
|
|
|
|
invert_m3_m3(imtx, pmtx);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((td->flag & TD_NO_LOC) == 0) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(pmtx, vec); // To Global space
|
|
|
|
mul_m3_v3(mat, vec); // Applying rotation
|
|
|
|
mul_m3_v3(imtx, vec); // To Local space
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
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 now is the location where the object has to be */
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-10-24 06:16:44 +00:00
|
|
|
/* special exception, see TD_PBONE_LOCAL_MTX definition comments */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->flag & TD_PBONE_LOCAL_MTX_P) {
|
2010-10-24 06:16:44 +00:00
|
|
|
/* do nothing */
|
|
|
|
}
|
|
|
|
else if (td->flag & TD_PBONE_LOCAL_MTX_C) {
|
|
|
|
mul_m3_v3(pmtx, vec); // To Global space
|
|
|
|
mul_m3_v3(td->ext->l_smtx, vec);// To Pose space (Local Location)
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
mul_m3_v3(pmtx, vec); // To Global space
|
|
|
|
mul_m3_v3(td->smtx, vec);// To Pose space
|
|
|
|
}
|
|
|
|
|
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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2009-10-22 23:22:05 +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
|
|
|
constraintTransLim(t, td);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
/* rotation */
|
2012-05-13 16:01:59 +00:00
|
|
|
/* MORE HACK: as in some cases the matrix to apply location and rot/scale is not the same,
|
|
|
|
* and ElementRotation() might be called in Translation context (with align snapping),
|
|
|
|
* we need to be sure to actually use the *rotation* matrix here...
|
|
|
|
* So no other way than storing it in some dedicated members of td->ext! */
|
|
|
|
if ((t->flag & T_V3D_ALIGN)==0) { /* align mode doesn't rotate objects itself */
|
2009-09-16 17:43:09 +00:00
|
|
|
/* euler or quaternion/axis-angle? */
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
2012-05-13 16:01:59 +00:00
|
|
|
mul_serie_m3(fmat, td->ext->r_mtx, mat, td->ext->r_smtx, NULL, NULL, NULL, NULL, NULL);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
mat3_to_quat(quat, fmat); /* Actual transform */
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
2009-03-02 01:22:02 +00:00
|
|
|
/* this function works on end result */
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-09-16 17:43:09 +00:00
|
|
|
/* calculate effect based on quats */
|
2009-11-01 00:06:53 +00:00
|
|
|
float iquat[4], tquat[4];
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
mul_serie_m3(fmat, td->ext->r_mtx, mat, td->ext->r_smtx, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
mat3_to_quat(quat, fmat); /* Actual transform */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
|
|
|
/* this function works on end result */
|
2009-11-01 00:06:53 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-03-02 01:22:02 +00:00
|
|
|
float eulmat[3][3];
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->ext->r_mtx);
|
|
|
|
mul_m3_m3m3(smat, td->ext->r_smtx, totmat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* calculate the total rotatation in eulers */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(eul, td->ext->irot);
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_mat3(eulmat, eul, td->ext->rotOrder);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* mat = transform, obmat = bone rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(fmat, smat, eulmat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
|
2009-09-16 17:43:09 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* and apply (to end result only) */
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rot, eul);
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2009-09-16 17:43:09 +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
|
|
|
constraintRotLim(t, td);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((td->flag & TD_NO_LOC) == 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
|
|
|
/* translation */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
|
|
|
mul_m3_v3(mat, vec);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
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 now is the location where the object has to be */
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, vec);
|
2009-10-22 23:22:05 +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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
constraintTransLim(t, td);
|
2009-10-22 23:22:05 +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
|
|
|
/* rotation */
|
|
|
|
if ((t->flag & T_V3D_ALIGN)==0) { // align mode doesn't rotate objects itself
|
2009-03-02 01:22:02 +00:00
|
|
|
/* euler or quaternion? */
|
2010-11-14 19:19:58 +00:00
|
|
|
if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
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
|
|
|
/* this function works on end result */
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-10-22 23:22:05 +00:00
|
|
|
/* calculate effect based on quats */
|
2009-11-01 00:06:53 +00:00
|
|
|
float iquat[4], tquat[4];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-02-13 10:52:18 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, NULL, NULL, NULL, NULL, NULL);
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* this function works on end result */
|
2009-11-01 00:06:53 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
|
2009-10-22 23:22:05 +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
|
|
|
else {
|
|
|
|
float obmat[3][3];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->mtx);
|
|
|
|
mul_m3_m3m3(smat, td->smtx, totmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* calculate the total rotatation in eulers */
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* we have to correct for delta rot */
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_mat3(obmat, eul, td->ext->rotOrder);
|
2009-10-22 23:22:05 +00:00
|
|
|
/* mat = transform, obmat = object rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* correct back for delta rot */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(eul, eul, td->ext->drot);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
/* and apply */
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rot, eul);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
constraintRotLim(t, td);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void applyRotation(TransInfo *t, float angle, float axis[3])
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float mat[3][3];
|
|
|
|
int i;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(mat, axis, angle);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applyRot) {
|
|
|
|
t->con.applyRot(t, td, axis, NULL);
|
2012-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(mat, axis, angle * td->factor);
|
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 if (t->flag & T_PROP_EDIT) {
|
2012-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(mat, axis, angle * td->factor);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
ElementRotation(t, td, mat, t->around);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Rotation(TransInfo *t, const int UNUSED(mval[2]))
|
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-04-29 06:59:18 +00:00
|
|
|
char str[128], *spos= str;
|
2009-10-22 23:22:05 +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
|
|
|
float final;
|
2010-11-30 05:15:58 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, &final);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-21 14:13:20 +00:00
|
|
|
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
2010-03-09 01:19:32 +00:00
|
|
|
t->con.applyRot(t, NULL, t->axis, NULL);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2010-02-21 14:13:20 +00:00
|
|
|
/* reset axis if constraint is not set */
|
2010-11-03 04:38:07 +00:00
|
|
|
copy_v3_v3(t->axis, t->axis_orig);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
applySnapping(t, &final);
|
2009-10-22 23:22:05 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-10-22 23:22:05 +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
|
|
|
applyNumInput(&t->num, &final);
|
2009-10-22 23:22:05 +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
|
|
|
outputNumInput(&(t->num), c);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-29 06:59:18 +00:00
|
|
|
spos+= sprintf(spos, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
|
2011-03-28 17:06:15 +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
|
|
|
/* Clamp between -180 and 180 */
|
2011-04-03 05:29:58 +00:00
|
|
|
final= angle_wrap_rad(DEG2RADF(final));
|
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 {
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "Rot: %.2f%s %s", RAD2DEGF(final), t->con.text, t->proptext);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-29 06:59:18 +00:00
|
|
|
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
|
|
|
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
|
|
|
}
|
|
|
|
(void)spos;
|
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
t->values[0] = final;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
applyRotation(t, final, t->axis);
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-10-22 23:22:05 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************** TRACKBALL *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initTrackball(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_TRACKBALL;
|
|
|
|
t->transform = Trackball;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 1;
|
|
|
|
t->num.idx_max = 1;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = (float)((5.0/180)*M_PI);
|
|
|
|
t->snap[2] = t->snap[1] * 0.2f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = 1.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
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void applyTrackball(TransInfo *t, float axis1[3], float axis2[3], float angles[2])
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float mat[3][3], smat[3][3], totmat[3][3];
|
|
|
|
int i;
|
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(smat, axis1, angles[0]);
|
|
|
|
vec_rot_to_mat3(totmat, axis2, angles[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, smat, totmat);
|
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
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +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
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2012-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(smat, axis1, td->factor * angles[0]);
|
|
|
|
vec_rot_to_mat3(totmat, axis2, td->factor * angles[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, smat, totmat);
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
ElementRotation(t, td, mat, t->around);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Trackball(TransInfo *t, const int UNUSED(mval[2]))
|
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-04-29 06:59:18 +00:00
|
|
|
char str[128], *spos= str;
|
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 axis1[3], axis2[3];
|
|
|
|
float mat[3][3], totmat[3][3], smat[3][3];
|
|
|
|
float phi[2];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(axis1, t->persinv[0]);
|
|
|
|
copy_v3_v3(axis2, t->persinv[1]);
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(axis1);
|
|
|
|
normalize_v3(axis2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
phi[0] = t->values[0];
|
|
|
|
phi[1] = t->values[1];
|
2009-07-12 02:01:13 +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
|
|
|
snapGrid(t, phi);
|
2009-07-12 02:01:13 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[40];
|
2009-07-12 02:01:13 +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
|
|
|
applyNumInput(&t->num, phi);
|
2009-07-12 02:01:13 +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
|
|
|
outputNumInput(&(t->num), c);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
phi[0] = DEG2RADF(phi[0]);
|
|
|
|
phi[1] = DEG2RADF(phi[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
|
|
|
}
|
|
|
|
else {
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "Trackball: %.2f %.2f %s", RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
|
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-04-29 06:59:18 +00:00
|
|
|
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
|
|
|
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
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-04-29 06:59:18 +00:00
|
|
|
(void)spos;
|
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-04-29 15:47:02 +00:00
|
|
|
vec_rot_to_mat3(smat, axis1, phi[0]);
|
|
|
|
vec_rot_to_mat3(totmat, axis2, phi[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, smat, totmat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
// TRANSFORM_FIX_ME
|
2009-11-10 20:43:45 +00:00
|
|
|
//copy_m3_m3(t->mat, mat); // used in manipulator
|
2009-07-12 02:01:13 +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
|
|
|
applyTrackball(t, axis1, axis2, phi);
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-07-12 02:01:13 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TRANSLATION *************************** */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
void initTranslation(TransInfo *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-09-22 14:29:15 +00:00
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
|
|
|
/* this space uses time translate */
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
t->mode = TFM_TRANSLATION;
|
|
|
|
t->transform = Translation;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
|
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
|
|
|
|
|
|
|
t->idx_max = (t->flag & T_2D_EDIT)? 1: 2;
|
|
|
|
t->num.flag = 0;
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2009-12-27 18:09:17 +00:00
|
|
|
RegionView3D *rv3d = t->ar->regiondata;
|
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-04 20:49:42 +00:00
|
|
|
if (rv3d) {
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = rv3d->gridview * 1.0f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
}
|
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 if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) {
|
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
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.125f;
|
|
|
|
t->snap[2] = 0.0625f;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
|
|
|
}
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void headerTranslation(TransInfo *t, float vec[3], char *str)
|
|
|
|
{
|
2011-04-29 06:59:18 +00:00
|
|
|
char *spos= str;
|
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
|
|
|
char tvec[60];
|
|
|
|
char distvec[20];
|
|
|
|
char autoik[20];
|
|
|
|
float dist;
|
2009-07-12 02:01:13 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3(t->num.val);
|
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 {
|
2009-01-20 20:44:36 +00:00
|
|
|
float dvec[3];
|
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(dvec, vec);
|
2009-01-20 20:44:36 +00:00
|
|
|
applyAspectRatio(t, dvec);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3(vec);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
|
2009-08-13 07:37:41 +00:00
|
|
|
int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
|
2009-08-12 17:02:03 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i=0; i<3; i++)
|
2009-08-13 17:05:27 +00:00
|
|
|
bUnit_AsString(&tvec[i*20], 20, dvec[i]*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, do_split, 1);
|
2009-08-12 17:02:03 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(&tvec[0], "%.4f", dvec[0]);
|
|
|
|
sprintf(&tvec[20], "%.4f", dvec[1]);
|
|
|
|
sprintf(&tvec[40], "%.4f", dvec[2]);
|
|
|
|
}
|
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
|
|
|
if (!(t->flag & T_2D_EDIT) && t->scene->unit.system)
|
2009-08-13 17:05:27 +00:00
|
|
|
bUnit_AsString(distvec, sizeof(distvec), dist*t->scene->unit.scale_length, 4, t->scene->unit.system, B_UNIT_LENGTH, t->scene->unit.flag & USER_UNIT_OPT_SPLIT, 0);
|
2012-03-24 06:38:07 +00:00
|
|
|
else if ( dist > 1e10f || dist < -1e10f ) /* prevent string buffer overflow */
|
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
|
|
|
sprintf(distvec, "%.4e", dist);
|
|
|
|
else
|
|
|
|
sprintf(distvec, "%.4f", dist);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_AUTOIK) {
|
2009-06-23 00:41:55 +00:00
|
|
|
short chainlen= t->settings->autoik_chainlen;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (chainlen)
|
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
|
|
|
sprintf(autoik, "AutoIK-Len: %d", chainlen);
|
|
|
|
else
|
2011-09-15 12:26:48 +00:00
|
|
|
autoik[0]= '\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
|
|
|
}
|
|
|
|
else
|
2011-09-15 12:26:48 +00:00
|
|
|
autoik[0]= '\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
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->num.idx_max) {
|
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
|
|
|
case 0:
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[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
|
|
|
break;
|
|
|
|
case 1:
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[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
|
|
|
break;
|
|
|
|
case 2:
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[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
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_2D_EDIT)
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
|
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
|
2011-04-29 06:59:18 +00:00
|
|
|
spos += sprintf(spos, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[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-01-08 16:54:38 +00:00
|
|
|
|
2011-04-29 06:59:18 +00:00
|
|
|
if (t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) {
|
|
|
|
spos += sprintf(spos, " Proportional size: %.2f", t->prop_size);
|
|
|
|
}
|
|
|
|
(void)spos;
|
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-12-17 00:52:36 +00:00
|
|
|
static void applyTranslation(TransInfo *t, float vec[3])
|
|
|
|
{
|
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
|
|
|
TransData *td = t->data;
|
|
|
|
float tvec[3];
|
|
|
|
int i;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
/* handle snapping rotation before doing the translation */
|
2012-03-06 18:40:15 +00:00
|
|
|
if (usingSnappingNormal(t)) {
|
|
|
|
if (validSnappingNormal(t)) {
|
2012-05-13 16:01:59 +00:00
|
|
|
float *original_normal;
|
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 axis[3];
|
|
|
|
float quat[4];
|
|
|
|
float mat[3][3];
|
|
|
|
float angle;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
/* In pose mode, we want to align normals with Y axis of bones... */
|
|
|
|
if (t->flag & T_POSE)
|
|
|
|
original_normal = td->axismtx[1];
|
|
|
|
else
|
|
|
|
original_normal = td->axismtx[2];
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
cross_v3_v3v3(axis, original_normal, t->tsnap.snapNormal);
|
|
|
|
angle = saacos(dot_v3v3(original_normal, t->tsnap.snapNormal));
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(quat, axis, angle);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
quat_to_mat3(mat, quat);
|
2009-10-22 23:22:05 +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
|
|
|
ElementRotation(t, td, mat, V3D_LOCAL);
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
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 mat[3][3];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(mat);
|
2009-10-22 23:22:05 +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
|
|
|
ElementRotation(t, td, mat, V3D_LOCAL);
|
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applyVec) {
|
|
|
|
float pvec[3];
|
|
|
|
t->con.applyVec(t, td, vec, tvec, pvec);
|
|
|
|
}
|
|
|
|
else {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(tvec, vec);
|
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
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, tvec);
|
|
|
|
mul_v3_fl(tvec, td->factor);
|
2009-10-22 23:22:05 +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
|
|
|
protectedTransBits(td->protectflag, tvec);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-02-25 23:31:31 +00:00
|
|
|
if (td->loc)
|
|
|
|
add_v3_v3v3(td->loc, td->iloc, tvec);
|
2009-10-22 23:22:05 +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
|
|
|
constraintTransLim(t, td);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* uses t->vec to store actual translation in */
|
2011-05-12 16:47:36 +00:00
|
|
|
int Translation(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
char str[250];
|
2009-07-12 02:01:13 +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
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
float pvec[3] = {0.0f, 0.0f, 0.0f};
|
2009-12-21 17:23:44 +00:00
|
|
|
float tvec[3];
|
2010-11-16 17:37:26 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
removeAspectRatio(t, t->values);
|
|
|
|
}
|
2008-12-29 20:37:54 +00:00
|
|
|
applySnapping(t, t->values);
|
|
|
|
t->con.applyVec(t, NULL, t->values, tvec, pvec);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->values, tvec);
|
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
|
|
|
headerTranslation(t, pvec, str);
|
|
|
|
}
|
|
|
|
else {
|
2008-12-29 20:37:54 +00:00
|
|
|
snapGrid(t, t->values);
|
|
|
|
applyNumInput(&t->num, t->values);
|
2010-11-16 17:37:26 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2009-01-20 20:44:36 +00:00
|
|
|
removeAspectRatio(t, t->values);
|
|
|
|
}
|
2008-12-29 20:37:54 +00:00
|
|
|
applySnapping(t, t->values);
|
|
|
|
headerTranslation(t, t->values, str);
|
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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applyTranslation(t, t->values);
|
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
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
/* evil hack - redo translation if clipping needed */
|
2008-12-29 20:37:54 +00:00
|
|
|
if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 0))
|
|
|
|
applyTranslation(t, t->values);
|
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
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** SHRINK/FATTEN *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initShrinkFatten(TransInfo *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
|
|
|
{
|
|
|
|
// If not in mesh edit mode, fallback to Resize
|
2009-01-02 19:10:35 +00:00
|
|
|
if (t->obedit==NULL || t->obedit->type != OB_MESH) {
|
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
|
|
|
initResize(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->mode = TFM_SHRINKFATTEN;
|
|
|
|
t->transform = ShrinkFatten;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[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
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int ShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
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 vec[3];
|
|
|
|
float distance;
|
|
|
|
int i;
|
|
|
|
char str[64];
|
|
|
|
TransData *td = t->data;
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
distance = -t->values[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
|
|
|
|
|
|
|
snapGrid(t, &distance);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &distance);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Shrink/Fatten: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
sprintf(str, "Shrink/Fatten: %.4f %s", distance, t->proptext);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-18 08:26:58 +00:00
|
|
|
t->values[0] = distance;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, td->axismtx[2]);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, distance);
|
|
|
|
mul_v3_fl(vec, td->factor);
|
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
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TILT *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initTilt(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_TILT;
|
|
|
|
t->transform = Tilt;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
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
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = (float)((5.0/180)*M_PI);
|
|
|
|
t->snap[2] = t->snap[1] * 0.2f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
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-05-12 16:47:36 +00:00
|
|
|
int Tilt(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
|
|
|
|
|
|
|
float final;
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
snapGrid(t, &final);
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Tilt: %s %s", &c[0], t->proptext);
|
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
final = DEG2RADF(final);
|
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 {
|
2011-03-28 17:06:15 +00:00
|
|
|
sprintf(str, "Tilt: %.2f %s", RAD2DEGF(final), t->proptext);
|
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
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival + final * td->factor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************** Curve Shrink/Fatten *************** */
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
void initCurveShrinkFatten(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->mode = TFM_CURVE_SHRINKFATTEN;
|
|
|
|
t->transform = CurveShrinkFatten;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-02-16 01:42:34 +00:00
|
|
|
t->flag |= T_NO_ZERO;
|
|
|
|
t->num.flag |= NUM_NO_ZERO;
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int CurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float ratio;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
snapGrid(t, &ratio);
|
2009-07-12 02:01:13 +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
|
|
|
applyNumInput(&t->num, &ratio);
|
2009-07-12 02:01:13 +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
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-07-12 02:01:13 +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
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
sprintf(str, "Shrink/Fatten: %s", c);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Shrink/Fatten: %3f", ratio);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->val) {
|
2012-03-03 16:31:46 +00:00
|
|
|
// *td->val= ratio;
|
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
|
|
|
*td->val= td->ival*ratio;
|
2010-02-16 01:42:34 +00:00
|
|
|
if (*td->val <= 0.0f) *td->val = 0.001f;
|
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
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-07-12 02:01:13 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** PUSH/PULL *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initPushPull(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_PUSHPULL;
|
|
|
|
t->transform = PushPull;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int PushPull(TransInfo *t, const int UNUSED(mval[2]))
|
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 vec[3], axis[3];
|
|
|
|
float distance;
|
|
|
|
int i;
|
|
|
|
char str[128];
|
|
|
|
TransData *td = t->data;
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
distance = t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
snapGrid(t, &distance);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &distance);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Push/Pull: %s%s %s", c, t->con.text, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
sprintf(str, "Push/Pull: %.4f%s %s", distance, t->con.text, t->proptext);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-18 08:26:58 +00:00
|
|
|
t->values[0] = distance;
|
|
|
|
|
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 (t->con.applyRot && t->con.mode & CON_APPLY) {
|
|
|
|
t->con.applyRot(t, NULL, axis, NULL);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, t->center, td->center);
|
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 (t->con.applyRot && t->con.mode & CON_APPLY) {
|
|
|
|
t->con.applyRot(t, td, axis, NULL);
|
|
|
|
if (isLockConstraint(t)) {
|
|
|
|
float dvec[3];
|
2009-11-10 20:43:45 +00:00
|
|
|
project_v3_v3v3(dvec, vec, axis);
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, dvec);
|
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 {
|
2009-11-10 20:43:45 +00:00
|
|
|
project_v3_v3v3(vec, vec, axis);
|
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
|
|
|
}
|
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(vec);
|
|
|
|
mul_v3_fl(vec, distance);
|
|
|
|
mul_v3_fl(vec, td->factor);
|
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
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** BEVEL **************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initBevel(TransInfo *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
|
|
|
{
|
2008-12-29 20:37:54 +00:00
|
|
|
t->transform = Bevel;
|
|
|
|
t->handleEvent = handleEventBevel;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_ABSOLUTE);
|
|
|
|
|
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
|
|
|
t->mode = TFM_BEVEL;
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
t->num.flag |= NUM_NO_NEGATIVE;
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[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
|
|
|
/* DON'T KNOW WHY THIS IS NEEDED */
|
|
|
|
if (G.editBMesh->imval[0] == 0 && G.editBMesh->imval[1] == 0) {
|
|
|
|
/* save the initial mouse co */
|
|
|
|
G.editBMesh->imval[0] = t->imval[0];
|
|
|
|
G.editBMesh->imval[1] = t->imval[1];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* restore the mouse co from a previous call to initTransform() */
|
|
|
|
t->imval[0] = G.editBMesh->imval[0];
|
|
|
|
t->imval[1] = G.editBMesh->imval[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int handleEventBevel(TransInfo *t, wmEvent *event)
|
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->val == KM_PRESS) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!G.editBMesh) 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
|
|
|
|
|
|
|
switch (event->type) {
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
G.editBMesh->options ^= BME_BEVEL_VERT;
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
return 1;
|
|
|
|
//case PADPLUSKEY:
|
|
|
|
// G.editBMesh->options ^= BME_BEVEL_RES;
|
|
|
|
// G.editBMesh->res += 1;
|
|
|
|
// if (G.editBMesh->res > 4) {
|
|
|
|
// G.editBMesh->res = 4;
|
|
|
|
// }
|
|
|
|
// t->state = TRANS_CANCEL;
|
|
|
|
// return 1;
|
|
|
|
//case PADMINUS:
|
|
|
|
// G.editBMesh->options ^= BME_BEVEL_RES;
|
|
|
|
// G.editBMesh->res -= 1;
|
|
|
|
// if (G.editBMesh->res < 0) {
|
|
|
|
// G.editBMesh->res = 0;
|
|
|
|
// }
|
|
|
|
// t->state = TRANS_CANCEL;
|
|
|
|
// return 1;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Bevel(TransInfo *t, const int UNUSED(mval[2]))
|
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-04-29 15:47:02 +00:00
|
|
|
float distance, d;
|
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
|
|
|
int i;
|
|
|
|
char str[128];
|
2010-12-03 17:05:21 +00:00
|
|
|
const char *mode;
|
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
|
|
|
TransData *td = t->data;
|
|
|
|
|
|
|
|
mode = (G.editBMesh->options & BME_BEVEL_VERT) ? "verts only" : "normal";
|
2008-12-29 20:37:54 +00:00
|
|
|
distance = t->values[0] / 4; /* 4 just seemed a nice value to me, nothing special */
|
2009-07-12 02:01:13 +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
|
|
|
distance = fabs(distance);
|
|
|
|
|
|
|
|
snapGrid(t, &distance);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &distance);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Bevel - Dist: %s, Mode: %s (MMB to toggle))", c, mode);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
sprintf(str, "Bevel - Dist: %.4f, Mode: %s (MMB to toggle))", distance, mode);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
if (distance < 0) distance = -distance;
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) {
|
|
|
|
d = td->axismtx[1][0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
d = distance;
|
|
|
|
}
|
2011-11-06 15:17:43 +00:00
|
|
|
madd_v3_v3v3fl(td->loc, td->center, td->axismtx[0], (*td->val) * d);
|
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
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** BEVEL WEIGHT *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initBevelWeight(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_BWEIGHT;
|
|
|
|
t->transform = BevelWeight;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-03-28 13:59:33 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
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-05-12 16:47:36 +00:00
|
|
|
int BevelWeight(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float weight;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
weight = t->values[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
|
|
|
|
|
|
|
weight -= 1.0f;
|
|
|
|
if (weight > 1.0f) weight = 1.0f;
|
|
|
|
|
|
|
|
snapGrid(t, &weight);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &weight);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
if (weight >= 0.0f)
|
|
|
|
sprintf(str, "Bevel Weight: +%s %s", c, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Bevel Weight: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
if (weight >= 0.0f)
|
|
|
|
sprintf(str, "Bevel Weight: +%.3f %s", weight, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Bevel Weight: %.3f %s", weight, t->proptext);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival + weight * td->factor;
|
|
|
|
if (*td->val < 0.0f) *td->val = 0.0f;
|
|
|
|
if (*td->val > 1.0f) *td->val = 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** CREASE *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initCrease(TransInfo *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
|
|
|
{
|
|
|
|
t->mode = TFM_CREASE;
|
|
|
|
t->transform = Crease;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-03-28 13:59:33 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
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-05-12 16:47:36 +00:00
|
|
|
int Crease(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float crease;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
crease = t->values[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
|
|
|
|
|
|
|
crease -= 1.0f;
|
|
|
|
if (crease > 1.0f) crease = 1.0f;
|
|
|
|
|
|
|
|
snapGrid(t, &crease);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &crease);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
if (crease >= 0.0f)
|
|
|
|
sprintf(str, "Crease: +%s %s", c, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Crease: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
if (crease >= 0.0f)
|
|
|
|
sprintf(str, "Crease: +%.3f %s", crease, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Crease: %.3f %s", crease, t->proptext);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival + crease * td->factor;
|
|
|
|
if (*td->val < 0.0f) *td->val = 0.0f;
|
|
|
|
if (*td->val > 1.0f) *td->val = 1.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************** EditBone (B-bone) width scaling *************** */
|
|
|
|
|
|
|
|
void initBoneSize(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->mode = TFM_BONESIZE;
|
|
|
|
t->transform = BoneSize;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 2;
|
|
|
|
t->num.idx_max = 2;
|
|
|
|
t->num.flag |= NUM_NULL_ONE;
|
2011-04-21 12:48:07 +00:00
|
|
|
t->num.flag |= NUM_AFFECT_ALL;
|
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
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void headerBoneSize(TransInfo *t, float vec[3], char *str)
|
|
|
|
{
|
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
|
|
|
char tvec[60];
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(&tvec[0], "%.4f", vec[0]);
|
|
|
|
sprintf(&tvec[20], "%.4f", vec[1]);
|
|
|
|
sprintf(&tvec[40], "%.4f", vec[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* hmm... perhaps the y-axis values don't need to be shown? */
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
if (t->num.idx_max == 0)
|
|
|
|
sprintf(str, "ScaleB: %s%s %s", &tvec[0], t->con.text, t->proptext);
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
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
|
|
|
sprintf(str, "ScaleB: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "ScaleB X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void ElementBoneSize(TransInfo *t, TransData *td, float mat[3][3])
|
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 tmat[3][3], smat[3][3], oldy;
|
|
|
|
float sizemat[3][3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(smat, mat, td->mtx);
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, smat);
|
2009-07-12 02:01:13 +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
|
|
|
if (t->con.applySize) {
|
|
|
|
t->con.applySize(t, td, tmat);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
/* we've tucked the scale in loc */
|
|
|
|
oldy= td->iloc[1];
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(sizemat, td->iloc);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(tmat, tmat, sizemat);
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_size(td->loc, tmat);
|
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
|
|
|
td->loc[1]= oldy;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int BoneSize(TransInfo *t, const int mval[2])
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float size[3], mat[3][3];
|
|
|
|
float ratio;
|
|
|
|
int i;
|
|
|
|
char str[60];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
// TRANSFORM_FIX_ME MOVE TO MOUSE INPUT
|
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
|
|
|
/* for manipulator, center handle, the scaling can't be done relative to center */
|
2012-03-06 18:40:15 +00:00
|
|
|
if ((t->flag & T_USES_MANIPULATOR) && t->con.mode==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
|
|
|
ratio = 1.0f - ((t->imval[0] - mval[0]) + (t->imval[1] - mval[1]))/100.0f;
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[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
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
size[0] = size[1] = size[2] = ratio;
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, size);
|
2009-10-22 23:22:05 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
applyNumInput(&t->num, size);
|
|
|
|
constraintNumInput(t, size);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-10-22 23:22:05 +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
|
|
|
if (t->con.applySize) {
|
|
|
|
t->con.applySize(t, NULL, mat);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(t->mat, mat); // used in manipulator
|
2009-10-22 23:22:05 +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
|
|
|
headerBoneSize(t, size, str);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
ElementBoneSize(t, td, mat);
|
|
|
|
}
|
2009-10-22 23:22:05 +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
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-10-22 23:22:05 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* ******************** EditBone envelope *************** */
|
|
|
|
|
|
|
|
void initBoneEnvelope(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->mode = TFM_BONE_ENVELOPE;
|
|
|
|
t->transform = BoneEnvelope;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-10-22 23:22:05 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
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-05-12 16:47:36 +00:00
|
|
|
int BoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float ratio;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-10-22 23:22:05 +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
|
|
|
snapGrid(t, &ratio);
|
2009-10-22 23:22:05 +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
|
|
|
applyNumInput(&t->num, &ratio);
|
2009-10-22 23:22:05 +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
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
2009-10-22 23:22:05 +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
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
sprintf(str, "Envelope: %s", c);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Envelope: %3f", ratio);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +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
|
|
|
if (td->val) {
|
|
|
|
/* if the old/original value was 0.0f, then just use ratio */
|
|
|
|
if (td->ival)
|
|
|
|
*td->val= td->ival*ratio;
|
|
|
|
else
|
|
|
|
*td->val= ratio;
|
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************** Edge Slide *************** */
|
2012-04-19 14:38:09 +00:00
|
|
|
static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
|
2009-11-29 00:53:23 +00:00
|
|
|
{
|
|
|
|
BMIter iter;
|
|
|
|
BMEdge *e2;
|
|
|
|
|
2012-04-19 13:47:58 +00:00
|
|
|
BM_ITER_ELEM (e2, &iter, v, BM_EDGES_OF_VERT) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e2, BM_ELEM_SELECT) && e2 != e)
|
2009-12-26 08:47:38 +00:00
|
|
|
return e2;
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
|
2009-12-26 08:47:38 +00:00
|
|
|
BMEdge *olde, BMEdge *nexte, float vec[3])
|
2009-11-29 00:53:23 +00:00
|
|
|
{
|
2009-12-26 08:47:38 +00:00
|
|
|
BMLoop *firstl;
|
|
|
|
float a[3] = {0.0f, 0.0f, 0.0f}, n[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
int i=0;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
firstl = l;
|
|
|
|
do {
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l->f, l->e, v);
|
2010-07-14 22:06:10 +00:00
|
|
|
if (l->radial_next == l)
|
2009-11-29 00:53:23 +00:00
|
|
|
return NULL;
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
if (l->e == nexte) {
|
|
|
|
if (i) {
|
|
|
|
mul_v3_fl(a, 1.0f / (float)i);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-02-27 06:19:40 +00:00
|
|
|
float f1[3], f2[3], f3[3];
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
sub_v3_v3v3(f1, BM_edge_other_vert(olde, v)->co, v->co);
|
|
|
|
sub_v3_v3v3(f2, BM_edge_other_vert(nexte, v)->co, v->co);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
cross_v3_v3v3(f3, f1, l->f->no);
|
|
|
|
cross_v3_v3v3(a, f2, l->f->no);
|
|
|
|
mul_v3_fl(a, -1.0f);
|
|
|
|
|
|
|
|
add_v3_v3(a, f3);
|
|
|
|
mul_v3_fl(a, 0.5f);
|
|
|
|
}
|
|
|
|
|
2011-09-12 04:57:20 +00:00
|
|
|
copy_v3_v3(vec, a);
|
2009-11-29 00:53:23 +00:00
|
|
|
return l;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-02-12 10:51:45 +00:00
|
|
|
sub_v3_v3v3(n, BM_edge_other_vert(l->e, v)->co, v->co);
|
2009-12-26 08:47:38 +00:00
|
|
|
add_v3_v3v3(a, a, n);
|
|
|
|
i += 1;
|
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2012-03-04 16:36:31 +00:00
|
|
|
if (BM_face_other_edge_loop(l->f, l->e, v)->e == nexte) {
|
2009-12-26 08:47:38 +00:00
|
|
|
if (i)
|
|
|
|
mul_v3_fl(a, 1.0f / (float)i);
|
|
|
|
|
2011-09-12 04:57:20 +00:00
|
|
|
copy_v3_v3(vec, a);
|
2012-03-04 16:36:31 +00:00
|
|
|
return BM_face_other_edge_loop(l->f, l->e, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
l = l->radial_next;
|
2009-11-29 00:53:23 +00:00
|
|
|
} while (l != firstl);
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
if (i)
|
|
|
|
mul_v3_fl(a, 1.0f / (float)i);
|
|
|
|
|
2011-09-12 04:57:20 +00:00
|
|
|
copy_v3_v3(vec, a);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
static int createSlideVerts(TransInfo *t)
|
|
|
|
{
|
2009-09-22 08:41:03 +00:00
|
|
|
Mesh *me = t->obedit->data;
|
2009-11-29 00:53:23 +00:00
|
|
|
BMEditMesh *em = me->edit_btmesh;
|
2009-12-26 08:47:38 +00:00
|
|
|
BMesh *bm = em->bm;
|
2009-11-29 00:53:23 +00:00
|
|
|
BMIter iter, iter2;
|
2012-03-19 22:21:40 +00:00
|
|
|
BMEdge *e, *e1 /*, *ee, *le */ /* UNUSED */;
|
2009-12-26 08:47:38 +00:00
|
|
|
BMVert *v, *v2, *first;
|
2009-11-29 00:53:23 +00:00
|
|
|
BMLoop *l, *l1, *l2;
|
2012-04-25 01:24:55 +00:00
|
|
|
TransDataSlideVert *sv_array;
|
2012-05-04 17:02:02 +00:00
|
|
|
BMBVHTree *btree = BMBVH_NewBVH(em, BMBVH_RESPECT_HIDDEN, NULL, NULL);
|
2010-12-23 02:14:03 +00:00
|
|
|
SmallHash table;
|
2009-11-29 00:53:23 +00:00
|
|
|
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
2011-04-24 07:45:24 +00:00
|
|
|
View3D *v3d = t->sa ? t->sa->spacedata.first : NULL;
|
|
|
|
RegionView3D *rv3d = t->ar ? t->ar->regiondata : NULL; /* background mode support */
|
2010-07-22 22:17:20 +00:00
|
|
|
ARegion *ar = t->ar;
|
2009-11-29 00:53:23 +00:00
|
|
|
float projectMat[4][4];
|
2010-12-23 02:14:03 +00:00
|
|
|
float start[3] = {0.0f, 0.0f, 0.0f}, dir[3], end[3] = {0.0f, 0.0f, 0.0f};
|
2012-03-19 22:21:40 +00:00
|
|
|
float vec[3], vec2[3], lastvec[3] /*, size, dis=0.0, z */ /* UNUSED */;
|
2011-02-27 06:19:40 +00:00
|
|
|
int numsel, i, j;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
if (!v3d) {
|
2012-04-03 02:52:34 +00:00
|
|
|
/* ok, let's try to survive this */
|
2009-11-29 00:53:23 +00:00
|
|
|
unit_m4(projectMat);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-05-24 04:35:21 +00:00
|
|
|
ED_view3d_ob_project_mat_get(rv3d, t->obedit, projectMat);
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
BLI_smallhash_init(&sld->vhash);
|
|
|
|
BLI_smallhash_init(&sld->origfaces);
|
2010-12-23 02:14:03 +00:00
|
|
|
BLI_smallhash_init(&table);
|
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
/*ensure valid selection*/
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
2009-11-29 00:53:23 +00:00
|
|
|
numsel = 0;
|
2012-04-19 13:47:58 +00:00
|
|
|
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
2012-03-03 16:31:46 +00:00
|
|
|
/* BMESH_TODO: this is probably very evil,
|
|
|
|
* set v->e to a selected edge*/
|
2010-07-14 22:06:10 +00:00
|
|
|
v->e = e;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
numsel++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-20 01:47:08 +00:00
|
|
|
if (numsel == 0 || numsel > 2) {
|
2012-04-03 02:52:34 +00:00
|
|
|
MEM_freeN(sld);
|
|
|
|
BMBVH_FreeBVH(btree);
|
|
|
|
return 0; /* invalid edge selection */
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
2012-04-18 06:57:28 +00:00
|
|
|
if (!BM_edge_is_manifold(e)) {
|
2012-04-03 02:52:34 +00:00
|
|
|
MEM_freeN(sld);
|
|
|
|
BMBVH_FreeBVH(btree);
|
|
|
|
return 0; /* can only handle exactly 2 faces around each edge */
|
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
j = 0;
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
2011-04-13 21:48:16 +00:00
|
|
|
BLI_smallhash_insert(&table, (uintptr_t)v, SET_INT_IN_POINTER(j));
|
2009-11-29 00:53:23 +00:00
|
|
|
j += 1;
|
2011-11-01 12:51:38 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
2011-11-01 12:51:38 +00:00
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
2012-04-03 02:52:34 +00:00
|
|
|
if (!j) {
|
|
|
|
MEM_freeN(sld);
|
|
|
|
BMBVH_FreeBVH(btree);
|
2009-11-29 00:53:23 +00:00
|
|
|
return 0;
|
2012-04-03 02:52:34 +00:00
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
sv_array = MEM_callocN(sizeof(TransDataSlideVert) * j, "sv_array");
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
j = 0;
|
|
|
|
while (1) {
|
|
|
|
v = NULL;
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_TAG))
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
break;
|
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
if (!v->e)
|
2009-12-26 08:47:38 +00:00
|
|
|
continue;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
first = v;
|
|
|
|
|
|
|
|
/*walk along the edge loop*/
|
2010-07-14 22:06:10 +00:00
|
|
|
e = v->e;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
/*first, rewind*/
|
|
|
|
numsel = 0;
|
|
|
|
do {
|
2012-04-19 14:38:09 +00:00
|
|
|
e = get_other_edge(v, e);
|
2009-11-29 00:53:23 +00:00
|
|
|
if (!e) {
|
2010-07-14 22:06:10 +00:00
|
|
|
e = v->e;
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
numsel += 1;
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
if (!BM_elem_flag_test(BM_edge_other_vert(e, v), BM_ELEM_TAG))
|
2009-12-26 08:47:38 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
v = BM_edge_other_vert(e, v);
|
2010-07-14 22:06:10 +00:00
|
|
|
} while (e != first->e);
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
2010-03-10 11:16:26 +00:00
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
l1 = l2 = l = NULL;
|
2010-07-14 22:06:10 +00:00
|
|
|
l1 = e->l;
|
|
|
|
l2 = e->l->radial_next;
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l1->f, l1->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sub_v3_v3v3(vec, BM_edge_other_vert(l->e, v)->co, v->co);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
if (l2 != l1) {
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l2->f, l2->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sub_v3_v3v3(vec2, BM_edge_other_vert(l->e, v)->co, v->co);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-12-26 08:47:38 +00:00
|
|
|
l2 = NULL;
|
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
/*iterate over the loop*/
|
|
|
|
first = v;
|
|
|
|
do {
|
2012-04-25 01:24:55 +00:00
|
|
|
TransDataSlideVert *sv = sv_array + j;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
sv->v = v;
|
|
|
|
sv->origvert = *v;
|
2011-11-07 07:01:24 +00:00
|
|
|
copy_v3_v3(sv->upvec, vec);
|
2009-12-26 08:47:38 +00:00
|
|
|
if (l2)
|
2011-11-07 07:01:24 +00:00
|
|
|
copy_v3_v3(sv->downvec, vec2);
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l1->f, l1->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sv->up = BM_edge_other_vert(l->e, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
if (l2) {
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l2->f, l2->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sv->down = BM_edge_other_vert(l->e, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
v2=v, v = BM_edge_other_vert(e, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
e1 = e;
|
2012-04-19 14:38:09 +00:00
|
|
|
e = get_other_edge(v, e);
|
2009-11-29 00:53:23 +00:00
|
|
|
if (!e) {
|
2012-02-12 10:51:45 +00:00
|
|
|
//v2=v, v = BM_edge_other_vert(l1->e, v);
|
2010-03-10 11:16:26 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
sv = sv_array + j + 1;
|
2009-12-26 08:47:38 +00:00
|
|
|
sv->v = v;
|
|
|
|
sv->origvert = *v;
|
|
|
|
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l1->f, l1->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sv->up = BM_edge_other_vert(l->e, v);
|
|
|
|
sub_v3_v3v3(sv->upvec, BM_edge_other_vert(l->e, v)->co, v->co);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
if (l2) {
|
2012-03-04 16:36:31 +00:00
|
|
|
l = BM_face_other_edge_loop(l2->f, l2->e, v);
|
2012-02-12 10:51:45 +00:00
|
|
|
sv->down = BM_edge_other_vert(l->e, v);
|
|
|
|
sub_v3_v3v3(sv->downvec, BM_edge_other_vert(l->e, v)->co, v->co);
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
|
|
|
BM_elem_flag_disable(v2, BM_ELEM_TAG);
|
2010-03-10 11:16:26 +00:00
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
j += 2;
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
l1 = get_next_loop(v, l1, e1, e, vec);
|
|
|
|
l2 = l2 ? get_next_loop(v, l2, e1, e, vec2) : NULL;
|
2009-12-26 08:47:38 +00:00
|
|
|
|
|
|
|
j += 1;
|
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
|
|
|
BM_elem_flag_disable(v2, BM_ELEM_TAG);
|
2010-07-14 22:06:10 +00:00
|
|
|
} while (e != first->e && l1);
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
//EDBM_flag_disable_all(em, BM_ELEM_SELECT);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
sld->sv = sv_array;
|
2009-12-26 08:47:38 +00:00
|
|
|
sld->totsv = j;
|
|
|
|
|
2010-07-22 22:17:20 +00:00
|
|
|
/*find mouse vector*/
|
2012-03-19 22:21:40 +00:00
|
|
|
/* dis = z = -1.0f; */ /* UNUSED */
|
|
|
|
/* size = 50.0; */ /* UNUSED */
|
2010-12-23 02:14:03 +00:00
|
|
|
zero_v3(lastvec); zero_v3(dir);
|
2012-03-19 22:21:40 +00:00
|
|
|
/* ee = le = NULL; */ /* UNUSED */
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
2010-07-22 22:17:20 +00:00
|
|
|
BMIter iter2;
|
|
|
|
BMEdge *e2;
|
2011-02-27 06:19:40 +00:00
|
|
|
float vec1[3], dis2, mval[2] = {t->mval[0], t->mval[1]}, d;
|
2010-12-23 02:14:03 +00:00
|
|
|
|
2012-03-03 16:31:46 +00:00
|
|
|
/* search cross edges for visible edge to the mouse cursor,
|
2012-03-11 19:58:56 +00:00
|
|
|
* then use the shared vertex to calculate screen vector*/
|
2010-12-23 02:14:03 +00:00
|
|
|
dis2 = -1.0f;
|
2010-07-22 22:17:20 +00:00
|
|
|
for (i=0; i<2; i++) {
|
2011-02-23 00:01:50 +00:00
|
|
|
v = i?e->v1:e->v2;
|
2012-04-19 13:47:58 +00:00
|
|
|
BM_ITER_ELEM (e2, &iter2, v, BM_EDGES_OF_VERT) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e2, BM_ELEM_SELECT))
|
2010-07-22 22:17:20 +00:00
|
|
|
continue;
|
2010-12-23 02:14:03 +00:00
|
|
|
|
2011-04-24 07:45:24 +00:00
|
|
|
if (!BMBVH_EdgeVisible(btree, e2, ar, v3d, t->obedit))
|
2010-12-23 02:14:03 +00:00
|
|
|
continue;
|
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
j = GET_INT_FROM_POINTER(BLI_smallhash_lookup(&table, (uintptr_t)v));
|
2011-02-23 00:01:50 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
if (sv_array[j].down) {
|
|
|
|
ED_view3d_project_float_v3(ar, sv_array[j].down->co, vec1, projectMat);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-04-25 01:24:55 +00:00
|
|
|
add_v3_v3v3(vec1, v->co, sv_array[j].downvec);
|
2011-05-24 04:35:21 +00:00
|
|
|
ED_view3d_project_float_v3(ar, vec1, vec1, projectMat);
|
2011-02-23 00:01:50 +00:00
|
|
|
}
|
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
if (sv_array[j].up) {
|
|
|
|
ED_view3d_project_float_v3(ar, sv_array[j].up->co, vec2, projectMat);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-04-25 01:24:55 +00:00
|
|
|
add_v3_v3v3(vec1, v->co, sv_array[j].upvec);
|
2011-05-24 04:35:21 +00:00
|
|
|
ED_view3d_project_float_v3(ar, vec2, vec2, projectMat);
|
2011-02-23 00:01:50 +00:00
|
|
|
}
|
|
|
|
|
2010-07-22 22:17:20 +00:00
|
|
|
d = dist_to_line_segment_v2(mval, vec1, vec2);
|
2010-12-23 02:14:03 +00:00
|
|
|
if (dis2 == -1.0f || d < dis2) {
|
|
|
|
dis2 = d;
|
2012-03-19 22:21:40 +00:00
|
|
|
/* ee = e2; */ /* UNUSED */
|
|
|
|
/* size = len_v3v3(vec1, vec2); */ /* UNUSED */
|
2011-02-23 00:01:50 +00:00
|
|
|
sub_v3_v3v3(dir, vec1, vec2);
|
2010-07-22 22:17:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-11 19:58:56 +00:00
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
bmesh_edit_begin(bm, BMO_OP_FLAG_UNTAN_MULTIRES);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
|
|
|
/*create copies of faces for customdata projection*/
|
2012-04-25 01:24:55 +00:00
|
|
|
sv_array = sld->sv;
|
|
|
|
for (i=0; i<sld->totsv; i++, sv_array++) {
|
2011-04-13 21:48:16 +00:00
|
|
|
BMIter fiter, liter;
|
|
|
|
BMFace *f;
|
|
|
|
BMLoop *l;
|
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_ITER_ELEM (f, &fiter, sv_array->v, BM_FACES_OF_VERT) {
|
2011-04-13 21:48:16 +00:00
|
|
|
|
|
|
|
if (!BLI_smallhash_haskey(&sld->origfaces, (uintptr_t)f)) {
|
2012-04-19 14:38:09 +00:00
|
|
|
BMFace *copyf = BM_face_copy(bm, f, TRUE, TRUE);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-20 16:55:47 +00:00
|
|
|
BM_face_select_set(bm, copyf, FALSE);
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_enable(copyf, BM_ELEM_HIDDEN);
|
2012-04-19 13:47:58 +00:00
|
|
|
BM_ITER_ELEM (l, &liter, copyf, BM_LOOPS_OF_FACE) {
|
2012-04-20 16:55:47 +00:00
|
|
|
BM_vert_select_set(bm, l->v, FALSE);
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_enable(l->v, BM_ELEM_HIDDEN);
|
2012-04-20 16:55:47 +00:00
|
|
|
BM_edge_select_set(bm, l->e, FALSE);
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_enable(l->e, BM_ELEM_HIDDEN);
|
2011-04-13 21:48:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BLI_smallhash_insert(&sld->origfaces, (uintptr_t)f, copyf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
BLI_smallhash_insert(&sld->vhash, (uintptr_t)sv_array->v, sv_array);
|
2011-04-13 21:48:16 +00:00
|
|
|
}
|
|
|
|
|
2012-02-27 16:45:48 +00:00
|
|
|
sld->origfaces_init = TRUE;
|
2011-04-13 21:48:16 +00:00
|
|
|
sld->em = em;
|
|
|
|
|
2010-12-23 02:14:03 +00:00
|
|
|
/*zero out start*/
|
|
|
|
zero_v3(start);
|
|
|
|
|
|
|
|
/*dir holds a vector along edge loop*/
|
|
|
|
copy_v3_v3(end, dir);
|
2011-02-23 00:01:50 +00:00
|
|
|
mul_v3_fl(end, 0.5);
|
2010-12-23 02:14:03 +00:00
|
|
|
|
2010-07-22 22:17:20 +00:00
|
|
|
sld->start[0] = t->mval[0] + start[0];
|
|
|
|
sld->start[1] = t->mval[1] + start[1];
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2010-07-22 22:17:20 +00:00
|
|
|
sld->end[0] = t->mval[0] + end[0];
|
|
|
|
sld->end[1] = t->mval[1] + end[1];
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
sld->perc = 0.0f;
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
t->customData = sld;
|
2010-12-23 02:14:03 +00:00
|
|
|
|
|
|
|
BLI_smallhash_release(&table);
|
|
|
|
BMBVH_FreeBVH(btree);
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
return 1;
|
2011-04-13 21:48:16 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
void projectSVData(TransInfo *t, int final)
|
|
|
|
{
|
|
|
|
SlideData *sld = t->customData;
|
2012-04-25 01:24:55 +00:00
|
|
|
TransDataSlideVert *sv;
|
2011-04-13 21:48:16 +00:00
|
|
|
BMEditMesh *em = sld->em;
|
|
|
|
SmallHash visit;
|
|
|
|
int i;
|
2012-04-17 14:24:04 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
if (!em)
|
|
|
|
return;
|
|
|
|
|
2012-04-21 12:51:47 +00:00
|
|
|
if (!(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
|
2012-04-17 14:24:04 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* don't do this at all for non-basis shape keys, too easy to
|
2012-04-22 11:54:53 +00:00
|
|
|
* accidentally break uv maps or vertex colors then */
|
2012-04-21 12:51:47 +00:00
|
|
|
if (em->bm->shapenr > 1)
|
2012-04-17 14:24:04 +00:00
|
|
|
return;
|
2009-09-22 08:41:03 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
BLI_smallhash_init(&visit);
|
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
for (i=0, sv = sld->sv; i < sld->totsv; sv++, i++) {
|
2011-04-13 21:48:16 +00:00
|
|
|
BMIter fiter;
|
|
|
|
BMFace *f;
|
|
|
|
|
2012-04-25 02:46:32 +00:00
|
|
|
|
|
|
|
/* BMESH_TODO, this interpolates between vertex/loops which are not moved
|
|
|
|
* (are only apart of a face attached to a slide vert), couldn't we iterate BM_LOOPS_OF_VERT
|
|
|
|
* here and only iterpolate those? */
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_ITER_ELEM (f, &fiter, sv->v, BM_FACES_OF_VERT) {
|
|
|
|
BMIter liter;
|
|
|
|
BMLoop *l;
|
|
|
|
|
|
|
|
BMFace *f_copy; /* the copy of 'f' */
|
|
|
|
BMFace *f_copy_flip; /* the copy of 'f' or detect if we need to flip to the shorter side. */
|
|
|
|
|
|
|
|
char is_sel, is_hide;
|
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
|
|
|
|
if (BLI_smallhash_haskey(&visit, (uintptr_t)f))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
BLI_smallhash_insert(&visit, (uintptr_t)f, NULL);
|
|
|
|
|
2012-04-17 14:24:04 +00:00
|
|
|
/* the face attributes of the copied face will get
|
2012-03-03 16:31:46 +00:00
|
|
|
* copied over, so its necessary to save the selection
|
|
|
|
* and hidden state*/
|
2012-04-25 01:24:55 +00:00
|
|
|
is_sel = BM_elem_flag_test(f, BM_ELEM_SELECT);
|
|
|
|
is_hide = BM_elem_flag_test(f, BM_ELEM_HIDDEN);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
f_copy = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)f);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-17 14:24:04 +00:00
|
|
|
/* project onto copied projection face */
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
|
|
|
f_copy_flip = f_copy;
|
2012-04-25 02:46:32 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
if (BM_elem_flag_test(l->e, BM_ELEM_SELECT) || BM_elem_flag_test(l->prev->e, BM_ELEM_SELECT)) {
|
2012-04-25 02:46:32 +00:00
|
|
|
/* the loop is attached of the selected edges that are sliding */
|
2012-04-25 01:24:55 +00:00
|
|
|
BMLoop *l_ed_sel = l;
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
if (!BM_elem_flag_test(l->e, BM_ELEM_SELECT))
|
|
|
|
l_ed_sel = l_ed_sel->prev;
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-25 02:46:32 +00:00
|
|
|
if (sld->perc < 0.0f) {
|
|
|
|
if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->down)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
2012-04-25 02:46:32 +00:00
|
|
|
else if (sld->perc > 0.0f) {
|
|
|
|
if (BM_vert_in_face(l_ed_sel->radial_next->f, sv->up)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)l_ed_sel->radial_next->f);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2012-04-25 01:24:55 +00:00
|
|
|
|
|
|
|
BLI_assert(f_copy_flip != NULL);
|
|
|
|
if (!f_copy_flip) {
|
2011-08-20 01:47:08 +00:00
|
|
|
continue; /* shouldn't happen, but protection */
|
2012-04-25 01:24:55 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2012-04-25 02:46:32 +00:00
|
|
|
else {
|
|
|
|
/* the loop is attached to only one vertex and not a selected edge,
|
|
|
|
* this means we have to find a selected edges face going in the right direction
|
|
|
|
* to copy from else we get bad distortion see: [#31080] */
|
|
|
|
BMIter eiter;
|
|
|
|
BMEdge *e_sel;
|
|
|
|
|
|
|
|
BM_ITER_ELEM (e_sel, &eiter, l->v, BM_EDGES_OF_VERT) {
|
|
|
|
if (BM_elem_flag_test(e_sel, BM_ELEM_SELECT)) {;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e_sel) {
|
2012-04-25 06:06:40 +00:00
|
|
|
/* warning if the UV's are not contiguous, this will copy from the _wrong_ UVs
|
2012-04-25 02:46:32 +00:00
|
|
|
* in fact whenever the face being copied is not 'f_copy' this can happen,
|
|
|
|
* we could be a lot smarter about this but would need to deal with every UV channel or
|
|
|
|
* add a way to mask out lauers when calling #BM_loop_interp_from_face() */
|
|
|
|
if (sld->perc < 0.0f) {
|
|
|
|
if (BM_vert_in_face(e_sel->l->f, sv->down)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
|
|
|
|
}
|
|
|
|
else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->down)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (sld->perc > 0.0f) {
|
|
|
|
if (BM_vert_in_face(e_sel->l->f, sv->up)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->f);
|
|
|
|
}
|
|
|
|
else if (BM_vert_in_face(e_sel->l->radial_next->f, sv->up)) {
|
|
|
|
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-17 14:24:04 +00:00
|
|
|
/* only loop data, no vertex data since that contains shape keys,
|
|
|
|
* and we do not want to mess up other shape keys */
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_loop_interp_from_face(em->bm, l, f_copy_flip, FALSE, FALSE);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
if (final) {
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_loop_interp_multires(em->bm, l, f_copy_flip);
|
|
|
|
if (f_copy != f_copy_flip) {
|
|
|
|
BM_loop_interp_multires(em->bm, l, f_copy);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-04-03 07:31:11 +00:00
|
|
|
/* make sure face-attributes are correct (e.g. MTexPoly) */
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_elem_attrs_copy(em->bm, em->bm, f_copy, f);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-03 07:31:11 +00:00
|
|
|
/* restore selection and hidden flags */
|
2012-04-25 01:24:55 +00:00
|
|
|
BM_face_select_set(em->bm, f, is_sel);
|
|
|
|
if (!is_hide) {
|
|
|
|
/* this check is a workaround for bug, see note - [#30735],
|
|
|
|
* without this edge can be hidden and selected */
|
|
|
|
BM_elem_hide_set(em->bm, f, is_hide);
|
2012-04-03 07:31:11 +00:00
|
|
|
}
|
2010-10-21 13:33:51 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
BLI_smallhash_release(&visit);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2012-04-24 22:50:49 +00:00
|
|
|
void freeSlideTempFaces(SlideData *sld)
|
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sld->origfaces_init) {
|
2012-02-27 16:45:48 +00:00
|
|
|
SmallHashIter hiter;
|
|
|
|
BMFace *copyf;
|
|
|
|
|
|
|
|
copyf = BLI_smallhash_iternew(&sld->origfaces, &hiter, NULL);
|
|
|
|
for (; copyf; copyf=BLI_smallhash_iternext(&hiter, NULL)) {
|
|
|
|
BM_face_verts_kill(sld->em->bm, copyf);
|
|
|
|
}
|
|
|
|
|
|
|
|
BLI_smallhash_release(&sld->origfaces);
|
|
|
|
|
|
|
|
sld->origfaces_init = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
void freeSlideVerts(TransInfo *t)
|
|
|
|
{
|
|
|
|
SlideData *sld = t->customData;
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2011-05-11 09:28:00 +00:00
|
|
|
#if 0 /*BMESH_TODO*/
|
2012-03-24 06:38:07 +00:00
|
|
|
if (me->drawflag & ME_DRAWEXTRA_EDGELEN) {
|
2012-04-25 01:24:55 +00:00
|
|
|
TransDataSlideVert *sv;
|
2010-09-21 15:16:58 +00:00
|
|
|
LinkNode *look = sld->vertlist;
|
|
|
|
GHash *vertgh = sld->vhash;
|
2012-03-24 06:38:07 +00:00
|
|
|
while (look) {
|
2012-04-29 15:47:02 +00:00
|
|
|
sv = BLI_ghash_lookup(vertgh, (EditVert*)look->link);
|
2012-04-25 01:24:55 +00:00
|
|
|
if (sv != NULL) {
|
|
|
|
sv->up->f &= !SELECT;
|
|
|
|
sv->down->f &= !SELECT;
|
2010-09-21 15:16:58 +00:00
|
|
|
}
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
}
|
2011-04-13 21:48:16 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!sld)
|
|
|
|
return;
|
|
|
|
|
2012-02-27 16:45:48 +00:00
|
|
|
freeSlideTempFaces(sld);
|
|
|
|
|
2012-02-27 14:07:19 +00:00
|
|
|
bmesh_edit_end(sld->em->bm, BMO_OP_FLAG_UNTAN_MULTIRES);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
BLI_smallhash_release(&sld->vhash);
|
|
|
|
|
|
|
|
MEM_freeN(sld->sv);
|
2009-10-22 23:22:05 +00:00
|
|
|
MEM_freeN(sld);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
t->customData = NULL;
|
2011-04-17 04:12:53 +00:00
|
|
|
|
|
|
|
recalcData(t);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void initEdgeSlide(TransInfo *t)
|
|
|
|
{
|
|
|
|
SlideData *sld;
|
|
|
|
|
|
|
|
t->mode = TFM_EDGE_SLIDE;
|
|
|
|
t->transform = EdgeSlide;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!createSlideVerts(t)) {
|
2010-11-20 18:46:36 +00:00
|
|
|
t->state= TRANS_CANCEL;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
sld = t->customData;
|
|
|
|
|
|
|
|
if (!sld)
|
|
|
|
return;
|
|
|
|
|
|
|
|
t->customFree = freeSlideVerts;
|
|
|
|
|
2009-11-18 17:14:56 +00:00
|
|
|
/* set custom point first if you want value to be initialized by init */
|
2009-10-22 23:22:05 +00:00
|
|
|
setCustomPoints(t, &t->mouse, sld->end, sld->start);
|
2009-11-18 17:14:56 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
2011-06-07 09:35:20 +00:00
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2010-04-12 22:42:09 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2011-11-15 16:38:48 +00:00
|
|
|
static int doEdgeSlide(TransInfo *t, float perc)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2009-12-26 08:47:38 +00:00
|
|
|
SlideData *sld = t->customData;
|
|
|
|
TransDataSlideVert *svlist = sld->sv, *sv;
|
|
|
|
float vec[3];
|
|
|
|
int i;
|
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
sld->perc = perc;
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
sv = svlist;
|
|
|
|
for (i=0; i<sld->totsv; i++, sv++) {
|
|
|
|
if (perc > 0.0f) {
|
2011-09-12 04:57:20 +00:00
|
|
|
copy_v3_v3(vec, sv->upvec);
|
2009-12-26 08:47:38 +00:00
|
|
|
mul_v3_fl(vec, perc);
|
|
|
|
add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
|
2009-09-22 08:41:03 +00:00
|
|
|
}
|
2012-02-19 17:59:30 +00:00
|
|
|
else {
|
2011-09-12 04:57:20 +00:00
|
|
|
copy_v3_v3(vec, sv->downvec);
|
2010-03-10 11:16:26 +00:00
|
|
|
mul_v3_fl(vec, -perc);
|
2009-12-26 08:47:38 +00:00
|
|
|
add_v3_v3v3(sv->v->co, sv->origvert.co, vec);
|
|
|
|
}
|
|
|
|
}
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2012-04-17 14:24:04 +00:00
|
|
|
projectSVData(t, 0);
|
2011-04-13 21:48:16 +00:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
|
|
|
char str[50];
|
|
|
|
float final;
|
|
|
|
|
|
|
|
final = t->values[0];
|
|
|
|
|
|
|
|
snapGrid(t, &final);
|
|
|
|
|
2011-06-07 09:35:20 +00:00
|
|
|
/* only do this so out of range values are not displayed */
|
|
|
|
CLAMP(final, -1.0f, 1.0f);
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
2011-06-07 09:35:20 +00:00
|
|
|
sprintf(str, "Edge Slide: %s", &c[0]);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-06-07 09:35:20 +00:00
|
|
|
sprintf(str, "Edge Slide: %.2f", final);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CLAMP(final, -1.0f, 1.0f);
|
|
|
|
|
2012-04-18 08:26:58 +00:00
|
|
|
t->values[0] = final;
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/*do stuff here*/
|
|
|
|
if (t->customData)
|
|
|
|
doEdgeSlide(t, final);
|
|
|
|
else {
|
|
|
|
strcpy(str, "Invalid Edge Selection");
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
2009-07-12 02:01:13 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ******************** EditBone roll *************** */
|
|
|
|
|
|
|
|
void initBoneRoll(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->mode = TFM_BONE_ROLL;
|
|
|
|
t->transform = BoneRoll;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
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
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = (float)((5.0/180)*M_PI);
|
|
|
|
t->snap[2] = t->snap[1] * 0.2f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = 1.0f;
|
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
|
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-05-12 16:47:36 +00:00
|
|
|
int BoneRoll(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
|
|
|
|
|
|
|
float final;
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[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
|
|
|
|
|
|
|
snapGrid(t, &final);
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Roll: %s", &c[0]);
|
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
final = DEG2RADF(final);
|
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 {
|
2011-03-28 17:06:15 +00:00
|
|
|
sprintf(str, "Roll: %.2f", RAD2DEGF(final));
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
/* set roll values */
|
2009-07-12 02:01:13 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +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
|
|
|
*(td->val) = td->ival - final;
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** BAKE TIME ******************* */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initBakeTime(TransInfo *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
|
|
|
{
|
2008-12-29 20:37:54 +00:00
|
|
|
t->transform = BakeTime;
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
2009-07-12 02:01:13 +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
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int BakeTime(TransInfo *t, const int mval[2])
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float time;
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
float fac = 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->mouse.precision) {
|
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
|
|
|
/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
|
2008-12-29 20:37:54 +00:00
|
|
|
time= (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac;
|
|
|
|
time+= 0.1f*((float)(t->center2d[0]*fac - mval[0]) -time);
|
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 {
|
2008-12-29 20:37:54 +00:00
|
|
|
time = (float)(t->center2d[0] - mval[0])*fac;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
snapGrid(t, &time);
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &time);
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
if (time >= 0.0f)
|
|
|
|
sprintf(str, "Time: +%s %s", c, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Time: %s %s", c, t->proptext);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* default header print */
|
|
|
|
if (time >= 0.0f)
|
|
|
|
sprintf(str, "Time: +%.3f %s", time, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Time: %.3f %s", time, t->proptext);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival + time * td->factor;
|
|
|
|
if (td->ext->size && *td->val < *td->ext->size) *td->val = *td->ext->size;
|
|
|
|
if (td->ext->quat && *td->val > *td->ext->quat) *td->val = *td->ext->quat;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** MIRROR *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initMirror(TransInfo *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
|
|
|
{
|
2008-12-29 20:37:54 +00:00
|
|
|
t->transform = Mirror;
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
|
|
|
|
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
|
|
|
t->flag |= T_NULL_ONE;
|
2009-01-02 19:10:35 +00:00
|
|
|
if (!t->obedit) {
|
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
|
|
|
t->flag |= T_NO_ZERO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int Mirror(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td;
|
|
|
|
float size[3], mat[3][3];
|
|
|
|
int i;
|
|
|
|
char str[200];
|
|
|
|
|
|
|
|
/*
|
2012-03-04 04:35:12 +00:00
|
|
|
* OPTIMIZATION:
|
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
|
|
|
* This still recalcs transformation on mouse move
|
|
|
|
* while it should only recalc on constraint change
|
|
|
|
* */
|
|
|
|
|
|
|
|
/* if an axis has been selected */
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
size[0] = size[1] = size[2] = -1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-07-12 02:01:13 +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
|
|
|
if (t->con.applySize) {
|
|
|
|
t->con.applySize(t, NULL, mat);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
sprintf(str, "Mirror%s", t->con.text);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0, td=t->data; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-07-12 02:01:13 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +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
|
|
|
ElementResize(t, td, mat);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +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
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
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
|
|
|
size[0] = size[1] = size[2] = 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0, td=t->data; i < t->total; i++, td++) {
|
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 (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-07-12 02:01:13 +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
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +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
|
|
|
ElementResize(t, td, mat);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_2D_EDIT)
|
2009-09-16 17:43:09 +00:00
|
|
|
ED_area_headerprint(t->sa, "Select a mirror axis (X, Y)");
|
|
|
|
else
|
|
|
|
ED_area_headerprint(t->sa, "Select a mirror axis (X, Y, Z)");
|
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
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** ALIGN *************************** */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initAlign(TransInfo *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
|
|
|
{
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2009-07-12 02:01:13 +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
|
|
|
t->transform = Align;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
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-05-12 16:47:36 +00:00
|
|
|
int Align(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float center[3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* saving original center */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(center, t->center);
|
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-04-28 06:31:57 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
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 mat[3][3], invmat[3][3];
|
2009-07-12 02:01:13 +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
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-07-12 02:01:13 +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
|
|
|
/* around local centers */
|
|
|
|
if (t->flag & (T_OBJECT|T_POSE)) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->center, td->center);
|
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 {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->settings->selectmode & SCE_SELECT_FACE) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->center, td->center);
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m3_m3(invmat, td->axismtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, t->spacemtx, invmat);
|
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
|
|
|
|
|
|
|
ElementRotation(t, td, mat, t->around);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* restoring original center */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->center, center);
|
2009-07-12 02:01:13 +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
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, "Align");
|
2009-07-12 02:01:13 +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
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-12-21 17:23:44 +00:00
|
|
|
/* ************************** SEQ SLIDE *************************** */
|
|
|
|
|
|
|
|
void initSeqSlide(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->transform = SeqSlide;
|
|
|
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
|
|
|
|
|
|
|
|
t->idx_max = 1;
|
|
|
|
t->num.flag = 0;
|
|
|
|
t->num.idx_max = t->idx_max;
|
|
|
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
t->snap[1] = floor(t->scene->r.frs_sec / t->scene->r.frs_sec_base);
|
|
|
|
t->snap[2] = 10.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[1];
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void headerSeqSlide(TransInfo *t, float val[2], char *str)
|
|
|
|
{
|
|
|
|
char tvec[60];
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(&tvec[0], "%.0f, %.0f", val[0], val[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
|
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void applySeqSlide(TransInfo *t, float val[2])
|
|
|
|
{
|
2009-12-21 17:23:44 +00:00
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
2009-12-21 17:23:44 +00:00
|
|
|
float tvec[2];
|
|
|
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
copy_v2_v2(tvec, val);
|
|
|
|
|
|
|
|
mul_v2_fl(tvec, td->factor);
|
|
|
|
|
|
|
|
td->loc[0] = td->iloc[0] + tvec[0];
|
|
|
|
td->loc[1] = td->iloc[1] + tvec[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int SeqSlide(TransInfo *t, const int UNUSED(mval[2]))
|
2009-12-21 17:23:44 +00:00
|
|
|
{
|
|
|
|
char str[200];
|
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
float pvec[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
float tvec[3];
|
|
|
|
t->con.applyVec(t, NULL, t->values, tvec, pvec);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->values, tvec);
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
snapGrid(t, t->values);
|
|
|
|
applyNumInput(&t->num, t->values);
|
|
|
|
}
|
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
t->values[0] = floor(t->values[0] + 0.5f);
|
|
|
|
t->values[1] = floor(t->values[1] + 0.5f);
|
2009-12-21 17:23:44 +00:00
|
|
|
|
|
|
|
headerSeqSlide(t, t->values, str);
|
|
|
|
applySeqSlide(t, t->values);
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 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
|
|
|
/* ************************** ANIM EDITORS - TRANSFORM TOOLS *************************** */
|
|
|
|
|
|
|
|
/* ---------------- Special Helpers for Various Settings ------------- */
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* This function returns the snapping 'mode' for Animation Editors only
|
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
|
|
|
* We cannot use the standard snapping due to NLA-strip scaling complexities.
|
|
|
|
*/
|
2008-12-29 06:06:59 +00:00
|
|
|
// XXX these modifier checks should be keymappable
|
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
|
|
|
static short getAnimEdit_SnapMode(TransInfo *t)
|
|
|
|
{
|
|
|
|
short autosnap= SACTSNAP_OFF;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (saction)
|
|
|
|
autosnap= saction->autosnap;
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (sipo)
|
|
|
|
autosnap= sipo->autosnap;
|
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
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (snla)
|
|
|
|
autosnap= snla->autosnap;
|
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 {
|
2010-01-27 09:42:17 +00:00
|
|
|
autosnap= SACTSNAP_OFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* toggle autosnap on/off
|
|
|
|
* - when toggling on, prefer nearest frame over 1.0 frame increments
|
|
|
|
*/
|
|
|
|
if (t->modifiers & MOD_SNAP_INVERT) {
|
|
|
|
if (autosnap)
|
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
|
|
|
autosnap= SACTSNAP_OFF;
|
2010-01-27 09:42:17 +00:00
|
|
|
else
|
|
|
|
autosnap= SACTSNAP_FRAME;
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
return autosnap;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This function is used for testing if an Animation Editor is displaying
|
|
|
|
* its data in frames or seconds (and the data needing to be edited as such).
|
2009-07-12 02:01:13 +00:00
|
|
|
* Returns 1 if in seconds, 0 if in frames
|
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
|
|
|
*/
|
|
|
|
static short getAnimEdit_DrawTime(TransInfo *t)
|
|
|
|
{
|
|
|
|
short drawtime;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
drawtime = (saction->flag & SACTION_DRAWTIME)? 1 : 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
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
|
2010-01-27 09:42:17 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
drawtime = (snla->flag & SNLA_DRAWTIME)? 1 : 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
|
|
|
}
|
2010-01-27 09:42:17 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
|
|
|
|
|
|
|
drawtime = (sipo->flag & SIPO_DRAWTIME)? 1 : 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
|
|
|
else {
|
|
|
|
drawtime = 0;
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
return drawtime;
|
2009-07-12 02:01:13 +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
|
|
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* This function is used by Animation Editor specific transform functions to do
|
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
|
|
|
* the Snap Keyframe to Nearest Frame/Marker
|
|
|
|
*/
|
2010-05-06 19:54:43 +00:00
|
|
|
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, AnimData *adt, short autosnap)
|
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
|
|
|
{
|
|
|
|
/* snap key to nearest frame? */
|
|
|
|
if (autosnap == SACTSNAP_FRAME) {
|
2011-09-12 00:00:21 +00:00
|
|
|
|
|
|
|
#if 0 /* 'doTime' disabled for now */
|
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
const Scene *scene= t->scene;
|
2012-03-01 12:20:18 +00:00
|
|
|
const short doTime= 0; //getAnimEdit_DrawTime(t); // NOTE: this works, but may be confusing behavior given the option's label, hence disabled
|
2008-12-29 06:06:59 +00:00
|
|
|
const double secf= FPS;
|
2011-09-12 00:00:21 +00:00
|
|
|
#endif
|
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
|
|
|
double val;
|
2010-05-07 10:59:48 +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
|
|
|
/* convert frame to nla-action time (if needed) */
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
|
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
|
|
|
|
val= *(td->val);
|
2010-05-07 10:59:48 +00:00
|
|
|
|
2011-09-12 00:00:21 +00:00
|
|
|
#if 0 /* 'doTime' disabled for now */
|
|
|
|
|
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
|
|
|
/* do the snapping to nearest frame/second */
|
2011-09-12 00:00:21 +00:00
|
|
|
if (doTime) {
|
2012-04-29 15:47:02 +00:00
|
|
|
val= (float)(floor((val/secf) + 0.5f) * secf);
|
2011-09-12 00:00:21 +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
|
|
|
else
|
2011-09-12 00:00:21 +00:00
|
|
|
#endif
|
|
|
|
{
|
2011-11-11 12:00:08 +00:00
|
|
|
val= floorf(val+0.5f);
|
2011-09-12 00:00:21 +00:00
|
|
|
}
|
2010-05-07 10:59:48 +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
|
|
|
/* convert frame out of nla-action time */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
*(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
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
|
|
|
|
*(td->val)= val;
|
|
|
|
}
|
|
|
|
/* snap key to nearest marker? */
|
|
|
|
else if (autosnap == SACTSNAP_MARKER) {
|
|
|
|
float val;
|
2010-05-07 10:59:48 +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
|
|
|
/* convert frame to nla-action time (if needed) */
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
val= BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
|
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
|
|
|
|
val= *(td->val);
|
2010-05-07 10:59:48 +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
|
|
|
/* snap to nearest marker */
|
2009-05-09 02:37:12 +00:00
|
|
|
// TODO: need some more careful checks for where data comes from
|
|
|
|
val= (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val);
|
2010-05-07 10:59:48 +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
|
|
|
/* convert frame out of nla-action time */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
*(td->val)= BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
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
|
|
|
|
*(td->val)= val;
|
|
|
|
}
|
2010-05-07 10:59:48 +00:00
|
|
|
|
|
|
|
/* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect)
|
|
|
|
* offset them by the same amount so that the general angles are maintained (i.e. won't change while
|
|
|
|
* handles are free-to-roam and keyframes are snap-locked)
|
|
|
|
*/
|
2010-05-06 19:54:43 +00:00
|
|
|
if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
|
|
|
|
td2d->h1[0] = td2d->ih1[0] + *td->val - td->ival;
|
|
|
|
}
|
|
|
|
if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
|
|
|
|
td2d->h2[0] = td2d->ih2[0] + *td->val - td->ival;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------- Translation ----------------------- */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initTimeTranslate(TransInfo *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-03-27 22:15:37 +00:00
|
|
|
/* this tool is only really available in the Action Editor... */
|
2011-07-05 09:47:09 +00:00
|
|
|
if (!ELEM(t->spacetype, SPACE_ACTION, SPACE_SEQ)) {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
t->mode = TFM_TIME_TRANSLATE;
|
|
|
|
t->transform = TimeTranslate;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
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
|
|
|
|
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.flag = 0;
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 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
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void headerTimeTranslate(TransInfo *t, char *str)
|
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
|
|
|
{
|
|
|
|
char tvec[60];
|
2009-07-12 02:01:13 +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
|
|
|
/* if numeric input is active, use results from that, otherwise apply snapping to result */
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
}
|
|
|
|
else {
|
2008-12-29 06:06:59 +00:00
|
|
|
const Scene *scene = t->scene;
|
|
|
|
const short autosnap= getAnimEdit_SnapMode(t);
|
|
|
|
const short doTime = getAnimEdit_DrawTime(t);
|
|
|
|
const double secf= FPS;
|
2008-12-29 20:37:54 +00:00
|
|
|
float val = t->values[0];
|
2010-01-27 09:42:17 +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
|
|
|
/* apply snapping + frame->seconds conversions */
|
|
|
|
if (autosnap == SACTSNAP_STEP) {
|
|
|
|
if (doTime)
|
2012-02-04 06:55:29 +00:00
|
|
|
val= floorf((double)val/secf + 0.5f);
|
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
|
2012-02-04 06:55:29 +00:00
|
|
|
val= floorf(val + 0.5f);
|
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 {
|
|
|
|
if (doTime)
|
2011-11-11 12:00:08 +00:00
|
|
|
val= (float)((double)val / secf);
|
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-27 09:42:17 +00:00
|
|
|
|
|
|
|
if (autosnap == SACTSNAP_FRAME)
|
|
|
|
sprintf(&tvec[0], "%d.00 (%.4f)", (int)val, val);
|
|
|
|
else
|
|
|
|
sprintf(&tvec[0], "%.4f", val);
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
sprintf(str, "DeltaX: %s", &tvec[0]);
|
|
|
|
}
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void applyTimeTranslate(TransInfo *t, float UNUSED(sval))
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d = t->data2d;
|
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
|
|
|
Scene *scene = t->scene;
|
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
const short doTime= getAnimEdit_DrawTime(t);
|
|
|
|
const double secf= FPS;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
const short autosnap= getAnimEdit_SnapMode(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-20 08:48:48 +00:00
|
|
|
float deltax, val /* , valprev */;
|
2009-07-12 02:01:13 +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
|
|
|
/* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
|
2010-05-06 19:54:43 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++, td2d++) {
|
2009-06-24 01:41:12 +00:00
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
2009-07-12 02:01:13 +00:00
|
|
|
* whose active action is where this keyframe comes from
|
2009-06-24 01:41:12 +00:00
|
|
|
* (this is only valid when not in NLA)
|
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
|
|
|
*/
|
2009-06-24 01:41:12 +00:00
|
|
|
AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-20 08:48:48 +00:00
|
|
|
/* valprev = *td->val; */ /* UNUSED */
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* check if any need to apply nla-mapping */
|
2009-11-26 17:17:13 +00:00
|
|
|
if (adt && t->spacetype != SPACE_SEQ) {
|
2008-12-29 20:37:54 +00:00
|
|
|
deltax = t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
if (autosnap == SACTSNAP_STEP) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if (doTime)
|
2012-04-29 15:47:02 +00:00
|
|
|
deltax= (float)(floor((deltax/secf) + 0.5f) * secf);
|
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
|
2012-04-29 15:47:02 +00:00
|
|
|
deltax= (float)(floor(deltax + 0.5f));
|
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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-06-28 07:32:00 +00:00
|
|
|
val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP);
|
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
|
|
|
val += deltax;
|
2009-06-28 07:32:00 +00:00
|
|
|
*(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
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 {
|
2008-12-29 20:37:54 +00:00
|
|
|
deltax = val = t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
if (autosnap == SACTSNAP_STEP) {
|
|
|
|
if (doTime)
|
2012-04-29 15:47:02 +00:00
|
|
|
val= (float)(floor((deltax/secf) + 0.5f) * secf);
|
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
|
2012-04-29 15:47:02 +00:00
|
|
|
val= (float)(floor(val + 0.5f));
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
*(td->val) = td->ival + val;
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
/* apply nearest snapping */
|
2010-05-06 19:54:43 +00:00
|
|
|
doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap);
|
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-05-12 16:47:36 +00:00
|
|
|
int TimeTranslate(TransInfo *t, const int mval[2])
|
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
|
|
|
{
|
2008-12-29 06:22:45 +00:00
|
|
|
View2D *v2d = (View2D *)t->view;
|
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 cval[2], sval[2];
|
|
|
|
char str[200];
|
2009-07-12 02:01:13 +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
|
|
|
/* calculate translation amount from mouse movement - in 'time-grid space' */
|
2008-12-29 06:22:45 +00:00
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[0], &cval[0], &cval[1]);
|
|
|
|
UI_view2d_region_to_view(v2d, t->imval[0], t->imval[0], &sval[0], &sval[1]);
|
2009-07-12 02:01:13 +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
|
|
|
/* we only need to calculate effect for time (applyTimeTranslate only needs that) */
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = cval[0] - sval[0];
|
2009-07-12 02:01:13 +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
|
|
|
/* handle numeric-input stuff */
|
2008-12-29 20:37:54 +00:00
|
|
|
t->vec[0] = t->values[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
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = t->vec[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
|
|
|
headerTimeTranslate(t, str);
|
2009-07-12 02:01:13 +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
|
|
|
applyTimeTranslate(t, sval[0]);
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------- Time Slide ----------------------- */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initTimeSlide(TransInfo *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
|
|
|
{
|
|
|
|
/* this tool is only really available in the Action Editor... */
|
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
/* set flag for drawing stuff */
|
|
|
|
saction->flag |= SACTION_MOVING;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-03-27 22:15:37 +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
|
|
|
t->mode = TFM_TIME_SLIDE;
|
|
|
|
t->transform = TimeSlide;
|
|
|
|
t->flag |= T_FREE_CUSTOMDATA;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
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
|
|
|
|
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.flag = 0;
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 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
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void headerTimeSlide(TransInfo *t, float sval, char *str)
|
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
|
|
|
{
|
|
|
|
char tvec[60];
|
2009-07-12 02:01:13 +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
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
}
|
|
|
|
else {
|
2008-12-29 07:19:16 +00:00
|
|
|
float minx= *((float *)(t->customData));
|
|
|
|
float maxx= *((float *)(t->customData) + 1);
|
2008-12-29 20:37:54 +00:00
|
|
|
float cval= t->values[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
|
|
|
float val;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
val= 2.0f*(cval-sval) / (maxx-minx);
|
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
|
|
|
CLAMP(val, -1.0f, 1.0f);
|
2009-07-12 02:01:13 +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
|
|
|
sprintf(&tvec[0], "%.4f", val);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
sprintf(str, "TimeSlide: %s", &tvec[0]);
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void applyTimeSlide(TransInfo *t, float sval)
|
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
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
2009-07-12 02:01:13 +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
|
|
|
float minx= *((float *)(t->customData));
|
|
|
|
float maxx= *((float *)(t->customData) + 1);
|
2009-07-12 02:01:13 +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
|
|
|
/* set value for drawing black line */
|
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2008-12-29 07:19:16 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2008-12-29 20:37:54 +00:00
|
|
|
float cvalf = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
saction->timeslide= cvalf;
|
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
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
/* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
|
|
|
|
for (i = 0 ; i < t->total; i++, td++) {
|
2009-06-23 13:25:31 +00:00
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
2009-07-12 02:01:13 +00:00
|
|
|
* whose active action is where this keyframe comes from
|
2009-06-24 01:41:12 +00:00
|
|
|
* (this is only valid when not in NLA)
|
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
|
|
|
*/
|
2009-06-24 01:41:12 +00:00
|
|
|
AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
2008-12-29 20:37:54 +00:00
|
|
|
float cval = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* apply NLA-mapping to necessary values */
|
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
cval= BKE_nla_tweakedit_remap(adt, cval, NLATIME_CONVERT_UNMAP);
|
2009-07-12 02:01:13 +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
|
|
|
/* only apply to data if in range */
|
|
|
|
if ((sval > minx) && (sval < maxx)) {
|
|
|
|
float cvalc= CLAMPIS(cval, minx, maxx);
|
|
|
|
float timefac;
|
2009-07-12 02:01:13 +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
|
|
|
/* left half? */
|
|
|
|
if (td->ival < sval) {
|
|
|
|
timefac= (sval - td->ival) / (sval - minx);
|
|
|
|
*(td->val)= cvalc - timefac * (cvalc - minx);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
timefac= (td->ival - sval) / (maxx - sval);
|
|
|
|
*(td->val)= cvalc + timefac * (maxx - cvalc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
int TimeSlide(TransInfo *t, const int mval[2])
|
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
|
|
|
{
|
2008-12-29 06:22:45 +00:00
|
|
|
View2D *v2d = (View2D *)t->view;
|
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 cval[2], sval[2];
|
|
|
|
float minx= *((float *)(t->customData));
|
|
|
|
float maxx= *((float *)(t->customData) + 1);
|
|
|
|
char str[200];
|
2009-07-12 02:01:13 +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
|
|
|
/* calculate mouse co-ordinates */
|
2011-06-02 11:51:38 +00:00
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
|
|
|
|
UI_view2d_region_to_view(v2d, t->imval[0], t->imval[1], &sval[0], &sval[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
/* t->values[0] stores cval[0], which is the current mouse-pointer location (in frames) */
|
2010-03-09 01:19:32 +00:00
|
|
|
// XXX Need to be able to repeat this
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = cval[0];
|
2009-07-12 02:01:13 +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
|
|
|
/* handle numeric-input stuff */
|
2008-12-29 07:19:16 +00:00
|
|
|
t->vec[0] = 2.0f*(cval[0]-sval[0]) / (maxx-minx);
|
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
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2011-03-28 17:06:15 +00:00
|
|
|
t->values[0] = (maxx-minx) * t->vec[0] / 2.0f + sval[0];
|
2009-07-12 02:01:13 +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
|
|
|
headerTimeSlide(t, sval[0], str);
|
|
|
|
applyTimeSlide(t, sval[0]);
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------- Scaling ----------------------- */
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void initTimeScale(TransInfo *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
|
|
|
{
|
2010-01-18 22:21:32 +00:00
|
|
|
int center[2];
|
|
|
|
|
2011-04-05 11:04:00 +00:00
|
|
|
/* this tool is only really available in the Action Editor
|
|
|
|
* AND NLA Editor (for strip scaling)
|
|
|
|
*/
|
|
|
|
if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA) == 0) {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
t->mode = TFM_TIME_SCALE;
|
|
|
|
t->transform = TimeScale;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-01-18 22:21:32 +00:00
|
|
|
/* recalculate center2d to use CFRA and mouse Y, since that's
|
|
|
|
* what is used in time scale */
|
|
|
|
t->center[0] = t->scene->r.cfra;
|
|
|
|
projectIntView(t, t->center, center);
|
|
|
|
center[1] = t->imval[1];
|
|
|
|
|
|
|
|
/* force a reinit with the center2d used here */
|
|
|
|
initMouseInput(t, &t->mouse, center, t->imval);
|
|
|
|
|
2010-01-18 00:45:33 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
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
|
|
|
|
|
|
|
t->flag |= T_NULL_ONE;
|
|
|
|
t->num.flag |= NUM_NULL_ONE;
|
2009-07-12 02:01:13 +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
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
t->idx_max = 0;
|
|
|
|
t->num.flag = 0;
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 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
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
|
|
|
t->num.increment = t->snap[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
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void headerTimeScale(TransInfo *t, char *str)
|
|
|
|
{
|
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
|
|
|
char tvec[60];
|
2009-07-12 02:01:13 +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
|
|
|
if (hasNumInput(&t->num))
|
|
|
|
outputNumInput(&(t->num), tvec);
|
|
|
|
else
|
2008-12-29 20:37:54 +00:00
|
|
|
sprintf(&tvec[0], "%.4f", t->values[0]);
|
2009-07-12 02:01:13 +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
|
|
|
sprintf(str, "ScaleX: %s", &tvec[0]);
|
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void applyTimeScale(TransInfo *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
|
|
|
Scene *scene = t->scene;
|
|
|
|
TransData *td = t->data;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d = t->data2d;
|
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
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
const short autosnap= getAnimEdit_SnapMode(t);
|
|
|
|
const short doTime= getAnimEdit_DrawTime(t);
|
|
|
|
const double secf= FPS;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
for (i = 0 ; i < t->total; i++, td++, td2d++) {
|
2009-06-23 13:25:31 +00:00
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
2009-07-12 02:01:13 +00:00
|
|
|
* whose active action is where this keyframe comes from
|
2009-06-24 01:41:12 +00:00
|
|
|
* (this is only valid when not in NLA)
|
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
|
|
|
*/
|
2009-06-24 01:41:12 +00:00
|
|
|
AnimData *adt= (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
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 startx= CFRA;
|
2008-12-29 20:37:54 +00:00
|
|
|
float fac= t->values[0];
|
2009-07-12 02:01:13 +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
|
|
|
if (autosnap == SACTSNAP_STEP) {
|
|
|
|
if (doTime)
|
2012-04-29 15:47:02 +00:00
|
|
|
fac= (float)(floor(fac/secf + 0.5f) * secf);
|
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
|
2012-04-29 15:47:02 +00:00
|
|
|
fac= (float)(floor(fac + 0.5f));
|
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
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
/* check if any need to apply nla-mapping */
|
|
|
|
if (adt)
|
2009-06-28 07:32:00 +00:00
|
|
|
startx= BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP);
|
2009-07-12 02:01:13 +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
|
|
|
/* now, calculate the new value */
|
|
|
|
*(td->val) = td->ival - startx;
|
|
|
|
*(td->val) *= fac;
|
|
|
|
*(td->val) += startx;
|
2009-07-12 02:01:13 +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
|
|
|
/* apply nearest snapping */
|
2010-05-06 19:54:43 +00:00
|
|
|
doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap);
|
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-05-12 16:47:36 +00:00
|
|
|
int TimeScale(TransInfo *t, const int UNUSED(mval[2]))
|
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
|
|
|
{
|
|
|
|
char str[200];
|
2010-01-18 00:45:33 +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
|
|
|
/* handle numeric-input stuff */
|
2008-12-29 20:37:54 +00:00
|
|
|
t->vec[0] = t->values[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
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = t->vec[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
|
|
|
headerTimeScale(t, str);
|
2009-07-12 02:01:13 +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
|
|
|
applyTimeScale(t);
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
|
|
ED_area_headerprint(t->sa, str);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************ */
|
|
|
|
|
2011-11-05 11:04:28 +00:00
|
|
|
void BIF_TransformSetUndo(const char *UNUSED(str))
|
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
|
|
|
{
|
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
//Trans.undostr= str;
|
|
|
|
}
|