2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** 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 *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#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_action_types.h" /* for some special action-editor settings */
|
|
|
|
#include "DNA_constraint_types.h"
|
|
|
|
#include "DNA_ipo_types.h" /* some silly ipo flag */
|
|
|
|
#include "DNA_listBase.h"
|
|
|
|
#include "DNA_meshdata_types.h"
|
|
|
|
#include "DNA_mesh_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h" /* PET modes */
|
|
|
|
#include "DNA_screen_types.h" /* area dimensions */
|
|
|
|
#include "DNA_texture_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
2009-01-03 22:15:59 +00:00
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#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_editview.h" /* arrows_move_cursor */
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
//#include "BIF_mywindow.h"
|
|
|
|
//#include "BIF_resources.h"
|
|
|
|
//#include "BIF_screen.h"
|
|
|
|
//#include "BIF_space.h" /* undo */
|
|
|
|
//#include "BIF_toets.h" /* persptoetsen */
|
|
|
|
//#include "BIF_mywindow.h" /* warp_pointer */
|
|
|
|
//#include "BIF_toolbox.h" /* notice */
|
|
|
|
//#include "BIF_editmesh.h"
|
|
|
|
//#include "BIF_editsima.h"
|
|
|
|
//#include "BIF_editparticle.h"
|
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "BKE_action.h"
|
|
|
|
#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_bad_level_calls.h"/* popmenu and error */
|
|
|
|
#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"
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
#include "BKE_context.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
|
|
|
|
|
|
|
//#include "BSE_view.h"
|
|
|
|
|
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_util.h"
|
|
|
|
#include "ED_view3d.h"
|
2009-09-22 08:41:03 +00:00
|
|
|
#include "ED_mesh.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"
|
|
|
|
#include "BLI_editVert.h"
|
2009-09-22 08:41:03 +00:00
|
|
|
#include "BLI_ghash.h"
|
|
|
|
#include "BLI_linklist.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 "PIL_time.h" /* sleep */
|
|
|
|
|
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"
|
|
|
|
|
2010-02-03 21:01:41 +00:00
|
|
|
void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg);
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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)
|
|
|
|
{
|
2009-12-02 19:59:57 +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);
|
|
|
|
}
|
|
|
|
|
|
|
|
void convertViewVec(TransInfo *t, float *vec, short dx, short dy)
|
|
|
|
{
|
|
|
|
if (t->spacetype==SPACE_VIEW3D) {
|
2009-03-28 20:46:38 +00:00
|
|
|
if (t->ar->regiontype == RGN_TYPE_WINDOW)
|
|
|
|
{
|
|
|
|
window_to_3d_delta(t->ar, 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
|
|
|
}
|
|
|
|
else if(t->spacetype==SPACE_IMAGE) {
|
|
|
|
View2D *v2d = t->view;
|
|
|
|
float divx, divy, aspx, aspy;
|
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);
|
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
|
|
|
divx= v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
divy= v2d->mask.ymax-v2d->mask.ymin;
|
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
|
|
|
vec[0]= aspx*(v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
|
|
|
|
vec[1]= aspy*(v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
2009-07-07 05:41:59 +00:00
|
|
|
else if(ELEM(t->spacetype, SPACE_IPO, SPACE_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
|
|
|
View2D *v2d = t->view;
|
|
|
|
float divx, divy;
|
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
|
|
|
divx= v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
divy= v2d->mask.ymax-v2d->mask.ymin;
|
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
|
|
|
vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx) / (divx);
|
|
|
|
vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy) / (divy);
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
2009-01-04 01:08:01 +00:00
|
|
|
else if(t->spacetype==SPACE_NODE) {
|
|
|
|
View2D *v2d = &t->ar->v2d;
|
|
|
|
float divx, divy;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
divx= v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
divy= v2d->mask.ymax-v2d->mask.ymin;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-21 07:01:20 +00:00
|
|
|
vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
|
|
|
|
vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
|
|
|
else if(t->spacetype==SPACE_SEQ) {
|
|
|
|
View2D *v2d = &t->ar->v2d;
|
|
|
|
float divx, divy;
|
|
|
|
|
|
|
|
divx= v2d->mask.xmax-v2d->mask.xmin;
|
|
|
|
divy= v2d->mask.ymax-v2d->mask.ymin;
|
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
vec[0]= (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
|
|
|
|
vec[1]= (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void projectIntView(TransInfo *t, float *vec, int *adr)
|
|
|
|
{
|
|
|
|
if (t->spacetype==SPACE_VIEW3D) {
|
2009-04-15 17:53:12 +00:00
|
|
|
if(t->ar->regiontype == RGN_TYPE_WINDOW)
|
|
|
|
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
|
|
|
}
|
|
|
|
else if(t->spacetype==SPACE_IMAGE) {
|
|
|
|
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
|
|
|
}
|
2010-01-18 22:21:32 +00:00
|
|
|
else if(ELEM3(t->spacetype, SPACE_IPO, SPACE_NLA, SPACE_ACTION)) {
|
2009-01-15 04:13:38 +00:00
|
|
|
int out[2] = {0, 0};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
|
|
|
UI_view2d_view_to_region((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];
|
|
|
|
}
|
2009-01-23 23:14:02 +00:00
|
|
|
else if(t->spacetype==SPACE_SEQ) { /* XXX not tested yet, but should work */
|
|
|
|
int out[2] = {0, 0};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-23 23:14:02 +00:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], out, out+1);
|
|
|
|
adr[0]= out[0];
|
|
|
|
adr[1]= 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
|
|
|
}
|
|
|
|
|
|
|
|
void projectFloatView(TransInfo *t, float *vec, float *adr)
|
|
|
|
{
|
|
|
|
if (t->spacetype==SPACE_VIEW3D) {
|
2009-04-15 17:53:12 +00:00
|
|
|
if(t->ar->regiontype == RGN_TYPE_WINDOW)
|
|
|
|
project_float_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
|
|
|
}
|
|
|
|
else if(t->spacetype==SPACE_IMAGE) {
|
|
|
|
int a[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
|
|
|
projectIntView(t, vec, a);
|
|
|
|
adr[0]= a[0];
|
|
|
|
adr[1]= a[1];
|
|
|
|
}
|
2009-07-07 05:41:59 +00:00
|
|
|
else if(ELEM(t->spacetype, SPACE_IPO, SPACE_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
|
|
|
int a[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
|
|
|
projectIntView(t, vec, a);
|
|
|
|
adr[0]= a[0];
|
|
|
|
adr[1]= a[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-20 20:44:36 +00:00
|
|
|
void applyAspectRatio(TransInfo *t, 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
|
|
|
{
|
2009-01-28 21:43:43 +00:00
|
|
|
SpaceImage *sima= t->sa->spacedata.first;
|
2008-12-29 20:37:54 +00:00
|
|
|
|
2008-12-29 04:23:41 +00:00
|
|
|
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
|
2009-01-28 21:43:43 +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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-20 20:44:36 +00:00
|
|
|
void removeAspectRatio(TransInfo *t, 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
|
|
|
{
|
2009-01-28 21:43:43 +00:00
|
|
|
SpaceImage *sima= t->sa->spacedata.first;
|
|
|
|
|
2008-12-29 04:23:41 +00:00
|
|
|
if ((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
|
2009-01-28 21:43:43 +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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
if (t->spacetype == SPACE_VIEW3D)
|
|
|
|
{
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Do we need more refined tags? */
|
2010-01-25 19:42:33 +00:00
|
|
|
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;
|
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, 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;
|
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME_EDIT, NULL);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2009-07-12 03:42:39 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION|ND_NLA_EDIT, NULL);
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-01-07 16:52:18 +00:00
|
|
|
else if(t->spacetype == SPACE_NODE)
|
|
|
|
{
|
|
|
|
//ED_area_tag_redraw(t->sa);
|
2009-10-20 20:00:12 +00:00
|
|
|
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_NODE_VIEW, NULL);
|
2009-01-02 23:58:03 +00:00
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
else if(t->spacetype == SPACE_SEQ)
|
|
|
|
{
|
|
|
|
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;
|
2009-11-04 09:22:16 +00:00
|
|
|
if(sima->lock) WM_event_add_notifier(C, NC_GEOM|ND_DATA, t->obedit->data);
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void viewRedrawPost(TransInfo *t)
|
|
|
|
{
|
|
|
|
ED_area_headerprint(t->sa, NULL);
|
2010-02-21 11:42:32 +00:00
|
|
|
|
|
|
|
if(t->spacetype == SPACE_VIEW3D) {
|
|
|
|
/* if autokeying is enabled, send notifiers that keyframes were added */
|
|
|
|
if (IS_AUTOKEY_ON(t->scene))
|
|
|
|
WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME_EDIT, 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
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
|
|
|
if(t->spacetype==SPACE_VIEW3D) {
|
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
|
|
|
else if(t->spacetype==SPACE_IMAGE) {
|
|
|
|
allqueue(REDRAWIMAGE, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
|
|
|
else if(ELEM3(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_IPO)) {
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
allqueue(REDRAWIPO, 0);
|
|
|
|
allqueue(REDRAWTIME, 0);
|
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
scrarea_queue_headredraw(curarea);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** TRANSFORMATIONS **************************** */
|
|
|
|
|
|
|
|
void BIF_selectOrientation() {
|
|
|
|
#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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(val >= 0) {
|
|
|
|
G.vd->twmode = val;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static void view_editmove(unsigned short event)
|
|
|
|
{
|
|
|
|
#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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) {
|
|
|
|
case WHEELUPMOUSE:
|
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( G.qual & LR_SHIFTKEY ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
persptoetsen(PAD2);
|
|
|
|
}
|
|
|
|
} else if( G.qual & LR_CTRLKEY ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
persptoetsen(PAD4);
|
|
|
|
}
|
2009-07-12 02:01:13 +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:
|
|
|
|
if( G.qual & LR_SHIFTKEY ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
persptoetsen(PAD8);
|
|
|
|
}
|
|
|
|
} else if( G.qual & LR_CTRLKEY ) {
|
2009-07-12 02:01:13 +00:00
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
persptoetsen(PAD6);
|
|
|
|
}
|
2009-07-12 02:01:13 +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
|
|
|
|
* */
|
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", ""},
|
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}};
|
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +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 */
|
2009-12-21 17:23:44 +00:00
|
|
|
if(keymap) 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
|
|
|
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +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);
|
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-02-20 20:29:09 +00:00
|
|
|
WM_modalkeymap_add_item(keymap, UPARROWKEY, KM_PRESS, 0, 0, NUM_MODAL_INCREMENT_UP);
|
|
|
|
WM_modalkeymap_add_item(keymap, DOWNARROWKEY, KM_PRESS, 0, 0, NUM_MODAL_INCREMENT_DOWN);
|
2010-01-25 17:48:02 +00:00
|
|
|
|
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
|
|
|
{
|
|
|
|
float mati[3][3] = {{1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}};
|
|
|
|
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);
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (event->type == MOUSEMOVE)
|
|
|
|
{
|
2009-12-29 21:20:46 +00:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_SELECT)
|
|
|
|
t->con.mode |= CON_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
|
|
|
t->mval[0] = event->x - t->ar->winrct.xmin;
|
|
|
|
t->mval[1] = event->y - t->ar->winrct.ymin;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_SOFT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
if (t->state == TRANS_STARTING) {
|
|
|
|
t->state = TRANS_RUNNING;
|
|
|
|
}
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applyMouseInput(t, &t->mouse, t->mval, 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-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... */
|
|
|
|
if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
|
|
|
|
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
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_ROTATE:
|
|
|
|
/* only switch when... */
|
|
|
|
if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
|
|
|
|
|
|
|
|
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
|
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;
|
|
|
|
case TFM_MODAL_RESIZE:
|
|
|
|
/* only switch when... */
|
|
|
|
if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
|
|
|
|
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;
|
2009-11-12 19:49:26 +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;
|
2009-12-01 18:26:18 +00:00
|
|
|
break;
|
|
|
|
case TFM_MODAL_REMOVE_SNAP:
|
|
|
|
removeSnapPoint(t);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2009-12-01 18:26:18 +00:00
|
|
|
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 */
|
|
|
|
else if (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
|
|
|
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
|
|
|
|
short 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-12-29 21:20:46 +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... */
|
2009-07-12 02:01:13 +00:00
|
|
|
if( ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
|
|
|
|
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... */
|
2009-07-12 02:01:13 +00:00
|
|
|
if( ELEM3(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
|
|
|
|
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... */
|
|
|
|
if( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
|
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
|
|
|
if (t->mode == TFM_ROTATION) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initTrackball(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
initRotation(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 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);
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
|
|
|
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
|
|
|
}
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
|
|
|
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);
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
2009-10-07 20:55:14 +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-07 20:55:14 +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-07 20:55:14 +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
|
|
|
}
|
2009-12-17 17:34:56 +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);
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
|
|
|
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
|
|
|
}
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
|
|
|
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);
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
2009-10-07 20:55:14 +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-07 20:55:14 +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-07 20:55:14 +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
|
|
|
}
|
2009-12-17 17:34:56 +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);
|
2009-12-17 17:34:56 +00:00
|
|
|
} else {
|
2009-10-07 20:55:14 +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-07 20:55:14 +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-07 20:55:14 +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
|
|
|
}
|
2009-12-17 17:34:56 +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) {
|
|
|
|
t->prop_mode = (t->prop_mode + 1) % 6;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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:
|
2009-03-07 10:28:08 +00:00
|
|
|
if(event->alt && t->flag & T_PROP_EDIT) {
|
|
|
|
t->prop_size *= 1.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
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
case PAGEUPKEY:
|
|
|
|
case WHEELDOWNMOUSE:
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
transform_autoik_update(t, 1);
|
|
|
|
}
|
|
|
|
else if(t->flag & T_PROP_EDIT) {
|
2009-03-06 15:50:15 +00:00
|
|
|
t->prop_size*= 1.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
|
|
|
calculatePropRatio(t);
|
|
|
|
}
|
|
|
|
else view_editmove(event->type);
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
case PADMINUS:
|
2009-03-07 10:28:08 +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 if (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);
|
|
|
|
}
|
|
|
|
else view_editmove(event->type);
|
|
|
|
t->redraw= 1;
|
|
|
|
break;
|
|
|
|
// case NDOFMOTION:
|
|
|
|
// viewmoveNDOF(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
|
2010-02-22 23:25:34 +00:00
|
|
|
t->redraw |= handleNumInput(&(t->num), 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
|
|
|
// NDof input events
|
|
|
|
switch(handleNDofInput(&(t->ndof), event))
|
|
|
|
{
|
|
|
|
case NDOF_CONFIRM:
|
2008-12-29 06:06:59 +00:00
|
|
|
if ((t->options & CTX_NDOF) == 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
|
|
|
{
|
|
|
|
/* Confirm on normal transform only */
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NDOF_CANCEL:
|
2008-12-29 06:06:59 +00:00
|
|
|
if (t->options & CTX_NDOF)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
/* Cancel on pure NDOF transform */
|
2009-07-12 02:01:13 +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
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise, just redraw, NDof input was cancelled */
|
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 NDOF_NOMOVE:
|
2008-12-29 06:06:59 +00:00
|
|
|
if (t->options & CTX_NDOF)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
/* Confirm on pure NDOF transform */
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NDOF_REFRESH:
|
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-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
|
|
|
// Snapping events
|
|
|
|
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
|
|
|
//arrows_move_cursor(event->type);
|
|
|
|
}
|
2009-11-12 19:49:26 +00:00
|
|
|
else if (event->val==KM_RELEASE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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){
|
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:
|
|
|
|
// if(WM_modal_tweak_exit(event, t->event_type))
|
|
|
|
//// 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 */
|
|
|
|
/* XXX Keyrepeat bug in Xorg fucks this up, will test when fixed */
|
2010-03-14 18:58:14 +00:00
|
|
|
if (event->type == t->launch_event && (t->launch_event == LEFTMOUSE || t->launch_event == RIGHTMOUSE) && t->state != TRANS_STARTING)
|
2009-11-12 19:49:26 +00:00
|
|
|
{
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(vec, t->con.center);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 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)
|
|
|
|
{
|
|
|
|
switch(d)
|
|
|
|
{
|
|
|
|
case LEFT:
|
|
|
|
offset = -offset;
|
|
|
|
length = -length;
|
|
|
|
size = -size;
|
|
|
|
case RIGHT:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex2s( offset, 0);
|
|
|
|
glVertex2s( offset + length, 0);
|
|
|
|
glVertex2s( offset + length, 0);
|
|
|
|
glVertex2s( offset + length - size, -size);
|
|
|
|
glVertex2s( offset + length, 0);
|
2009-04-30 11:47:35 +00:00
|
|
|
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);
|
|
|
|
glVertex2s( 0, offset);
|
|
|
|
glVertex2s( 0, offset + length);
|
|
|
|
glVertex2s( 0, offset + length);
|
|
|
|
glVertex2s(-size, offset + length - size);
|
|
|
|
glVertex2s( 0, offset + length);
|
2009-04-30 11:47:35 +00:00
|
|
|
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)
|
|
|
|
{
|
|
|
|
switch(d)
|
|
|
|
{
|
|
|
|
case LEFT:
|
|
|
|
size = -size;
|
|
|
|
case RIGHT:
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINES);
|
|
|
|
glVertex2s( 0, 0);
|
|
|
|
glVertex2s( -size, -size);
|
|
|
|
glVertex2s( 0, 0);
|
2009-04-30 11:47:35 +00:00
|
|
|
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);
|
|
|
|
glVertex2s( 0, 0);
|
|
|
|
glVertex2s(-size, -size);
|
|
|
|
glVertex2s( 0, 0);
|
2009-04-30 11:47:35 +00:00
|
|
|
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
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
for( angle = angle_start; angle < angle_end; angle += delta)
|
|
|
|
{
|
|
|
|
glVertex2f( cosf(angle) * size, sinf(angle) * size);
|
|
|
|
}
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2009-12-07 18:10:11 +00:00
|
|
|
static void drawHelpline(bContext *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;
|
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
if (t->helpline != HLP_NONE && !(t->flag & T_USES_MANIPULATOR))
|
|
|
|
{
|
|
|
|
float vecrot[3], cent[2];
|
2009-12-07 18:10:11 +00:00
|
|
|
int mval[2] = {x, y};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
VECCOPY(vecrot, t->center);
|
|
|
|
if(t->flag & T_EDIT) {
|
|
|
|
Object *ob= t->obedit;
|
2009-11-10 20:43:45 +00:00
|
|
|
if(ob) mul_m4_v3(ob->obmat, vecrot);
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
|
|
|
else if(t->flag & T_POSE) {
|
|
|
|
Object *ob=t->poseobj;
|
2009-11-10 20:43:45 +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();
|
|
|
|
|
|
|
|
switch(t->helpline)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
glVertex2sv(t->mval);
|
|
|
|
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);
|
2009-04-30 11:47:35 +00:00
|
|
|
glRotatef(-180 / M_PI * atan2f(cent[0] - t->mval[0], cent[1] - t->mval[1]), 0, 0, 1);
|
|
|
|
|
|
|
|
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);
|
|
|
|
float delta_angle = MIN2(15 / dist, M_PI/4);
|
|
|
|
float spacing_angle = MIN2(5 / dist, M_PI/12);
|
|
|
|
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);
|
|
|
|
glVertex2sv(t->mval);
|
|
|
|
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);
|
|
|
|
glRotatef(180 / M_PI * (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);
|
|
|
|
glRotatef(180 / M_PI * (angle + delta_angle), 0, 0, 1);
|
|
|
|
|
|
|
|
drawArrowHead(UP, 5);
|
|
|
|
|
|
|
|
glLineWidth(1.0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case HLP_TRACKBALL:
|
|
|
|
{
|
|
|
|
char col[3], col2[3];
|
|
|
|
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
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
UI_make_axis_color(col, col2, 'x');
|
|
|
|
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
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
UI_make_axis_color(col, col2, 'y');
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-20 21:05:22 +00:00
|
|
|
void drawTransformView(const struct bContext *C, struct ARegion *ar, void *arg)
|
2009-01-10 18:33:16 +00:00
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
drawConstraint(C, t);
|
|
|
|
drawPropCircle(C, t);
|
|
|
|
drawSnapping(C, t);
|
2009-10-20 21:05:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void drawTransformPixel(const struct bContext *C, struct ARegion *ar, void *arg)
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
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;
|
2009-01-10 19:45:48 +00:00
|
|
|
|
2009-09-10 11:04:53 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "value"))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2009-09-10 11:04:53 +00:00
|
|
|
if (t->flag & T_AUTOVALUES)
|
|
|
|
{
|
|
|
|
RNA_float_set_array(op->ptr, "value", t->auto_values);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
RNA_float_set_array(op->ptr, "value", t->values);
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* XXX convert stupid flag to enum */
|
|
|
|
switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
|
|
|
|
{
|
|
|
|
case (T_PROP_EDIT|T_PROP_CONNECTED):
|
|
|
|
proportional = 2;
|
|
|
|
break;
|
|
|
|
case T_PROP_EDIT:
|
|
|
|
proportional = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
proportional = 0;
|
|
|
|
}
|
|
|
|
|
2009-10-12 13:37:07 +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-12 13:37:07 +00:00
|
|
|
/* save settings if not set in operator */
|
2009-11-26 19:47:55 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_property_is_set(op->ptr, "proportional")) {
|
2009-10-12 13:37:07 +00:00
|
|
|
ts->proportional = proportional;
|
|
|
|
}
|
|
|
|
|
2009-11-26 19:47:55 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_property_is_set(op->ptr, "proportional_size")) {
|
2009-10-12 13:37:07 +00:00
|
|
|
ts->proportional_size = t->prop_size;
|
|
|
|
}
|
|
|
|
|
2009-11-26 19:47:55 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "proportional_editing_falloff") && !RNA_property_is_set(op->ptr, "proportional_editing_falloff")) {
|
2009-10-12 13:37:07 +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;
|
|
|
|
} else {
|
|
|
|
ts->snap_flag &= ~SCE_SNAP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(t->spacetype == SPACE_VIEW3D) {
|
|
|
|
if (RNA_struct_find_property(op->ptr, "constraint_orientation") && !RNA_property_is_set(op->ptr, "constraint_orientation")) {
|
2009-10-12 13:37:07 +00:00
|
|
|
View3D *v3d = t->view;
|
|
|
|
|
|
|
|
v3d->twmode = t->current_orientation;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "proportional"))
|
|
|
|
{
|
|
|
|
RNA_enum_set(op->ptr, "proportional", proportional);
|
2009-03-07 10:28:08 +00:00
|
|
|
RNA_enum_set(op->ptr, "proportional_editing_falloff", t->prop_mode);
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
|
|
|
|
}
|
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "axis"))
|
|
|
|
{
|
|
|
|
RNA_float_set_array(op->ptr, "axis", t->axis);
|
|
|
|
}
|
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "mirror"))
|
|
|
|
{
|
|
|
|
RNA_boolean_set(op->ptr, "mirror", t->flag & T_MIRROR);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-04-27 15:43:35 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "constraint_axis"))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
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);
|
|
|
|
} else {
|
|
|
|
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY)
|
|
|
|
{
|
|
|
|
if (t->con.mode & CON_AXIS0) {
|
|
|
|
constraint_axis[0] = 1;
|
|
|
|
}
|
|
|
|
if (t->con.mode & CON_AXIS1) {
|
|
|
|
constraint_axis[1] = 1;
|
|
|
|
}
|
|
|
|
if (t->con.mode & CON_AXIS2) {
|
|
|
|
constraint_axis[2] = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
|
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
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;
|
|
|
|
|
2010-03-14 18:58:14 +00:00
|
|
|
if (t->launch_event == EVT_TWEAK_R)
|
|
|
|
{
|
|
|
|
t->launch_event = RIGHTMOUSE;
|
|
|
|
}
|
|
|
|
else if (t->launch_event == EVT_TWEAK_L)
|
|
|
|
{
|
|
|
|
t->launch_event = LEFTMOUSE;
|
|
|
|
}
|
|
|
|
// XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0)
|
|
|
|
// For manipulator only, so assume LEFTMOUSE
|
|
|
|
else if (t->launch_event == 0)
|
|
|
|
{
|
|
|
|
t->launch_event = LEFTMOUSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
if (!initTransInfo(C, t, op, event)) // internal data, mouse, vectors
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2009-03-06 15:50: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
|
|
|
if(t->spacetype == SPACE_VIEW3D)
|
|
|
|
{
|
|
|
|
//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-10-20 21:05:22 +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);
|
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), NULL, 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
|
|
|
}
|
2009-02-09 20:58:31 +00:00
|
|
|
else if(t->spacetype == SPACE_IMAGE) {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->spacemtx);
|
2009-10-20 21:05:22 +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);
|
2009-02-09 20:58:31 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
if(arm->drawtype==ARM_ENVELOPE)
|
|
|
|
initBoneEnvelope(t);
|
|
|
|
else
|
|
|
|
initBoneSize(t);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_BONE_ENVELOPE:
|
|
|
|
initBoneEnvelope(t);
|
|
|
|
break;
|
2009-09-22 08:41:03 +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;
|
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
|
|
|
*/
|
2009-07-07 05:41:59 +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
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
/* overwrite initial values if operator supplied a non-null vector */
|
2009-03-06 15:50:15 +00:00
|
|
|
if (RNA_property_is_set(op->ptr, "value"))
|
2009-01-03 22:15:59 +00:00
|
|
|
{
|
2009-01-25 17:08:56 +00:00
|
|
|
float values[4];
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_float_get_array(op->ptr, "value", values);
|
2009-01-25 17:08:56 +00:00
|
|
|
QUATCOPY(t->values, values);
|
2009-03-06 15:50:15 +00:00
|
|
|
QUATCOPY(t->auto_values, values);
|
|
|
|
t->flag |= T_AUTOVALUES;
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
/* Transformation axis from operator */
|
|
|
|
if (RNA_struct_find_property(op->ptr, "axis") && RNA_property_is_set(op->ptr, "axis"))
|
|
|
|
{
|
|
|
|
RNA_float_get_array(op->ptr, "axis", t->axis);
|
|
|
|
normalize_v3(t->axis);
|
|
|
|
}
|
|
|
|
|
2009-01-10 19:45:48 +00:00
|
|
|
/* Constraint init from operator */
|
2009-03-10 18:10:24 +00:00
|
|
|
if (RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_property_is_set(op->ptr, "constraint_axis"))
|
2009-01-10 19:45:48 +00:00
|
|
|
{
|
2009-03-06 15:50:15 +00:00
|
|
|
int constraint_axis[3];
|
|
|
|
|
|
|
|
RNA_boolean_get_array(op->ptr, "constraint_axis", constraint_axis);
|
|
|
|
|
|
|
|
if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2])
|
2009-01-10 19:45:48 +00:00
|
|
|
{
|
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-07 20:55:14 +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
|
|
|
|
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-02-03 21:01:41 +00:00
|
|
|
void transformApply(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
|
|
|
{
|
2010-02-03 21:01:41 +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;
|
|
|
|
} else if (t->redraw & TREDRAW_SOFT) {
|
|
|
|
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 */
|
2008-12-29 06:06:59 +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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (BKE_ptcache_get_continue_physics())
|
|
|
|
{
|
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
//do_screenhandlers(G.curscreen);
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void drawTransformApply(const struct bContext *C, struct ARegion *ar, void *arg)
|
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
|
|
|
|
|
|
|
if (t->redraw & TREDRAW_SOFT) {
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
transformApply(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
|
|
|
|
2009-11-12 19:49:26 +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 */
|
2009-01-03 22:15:59 +00:00
|
|
|
if(t->state == TRANS_CANCEL)
|
|
|
|
{
|
|
|
|
exit_code = OPERATOR_CANCELLED;
|
2009-01-04 01:08:01 +00:00
|
|
|
restoreTransObjects(t); // calls recalcData()
|
2009-01-03 10:03:26 +00:00
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
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 */
|
|
|
|
viewRedrawPost(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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->state == TRANS_CANCEL) {
|
2009-02-17 15:53:52 +00:00
|
|
|
// 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 {
|
2009-02-17 15:53:52 +00:00
|
|
|
// if(t->undostr) ED_undo_push(C, t->undostr);
|
|
|
|
// 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
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if(protectflag & OB_LOCK_LOCX)
|
|
|
|
vec[0]= 0.0f;
|
|
|
|
if(protectflag & OB_LOCK_LOCY)
|
|
|
|
vec[1]= 0.0f;
|
|
|
|
if(protectflag & OB_LOCK_LOCZ)
|
|
|
|
vec[2]= 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void protectedSizeBits(short protectflag, float *size)
|
|
|
|
{
|
|
|
|
if(protectflag & OB_LOCK_SCALEX)
|
|
|
|
size[0]= 1.0f;
|
|
|
|
if(protectflag & OB_LOCK_SCALEY)
|
|
|
|
size[1]= 1.0f;
|
|
|
|
if(protectflag & OB_LOCK_SCALEZ)
|
|
|
|
size[2]= 1.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void protectedRotateBits(short protectflag, float *eul, float *oldeul)
|
|
|
|
{
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
|
2009-09-12 12:30:23 +00:00
|
|
|
|
|
|
|
/* this function only does the delta rotation */
|
|
|
|
/* axis-angle is usually internally stored as quats... */
|
2009-10-22 02:14:11 +00:00
|
|
|
static void protectedAxisAngleBits(short protectflag, float axis[3], float *angle, float oldAxis[3], float oldAngle)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 12:30:23 +00:00
|
|
|
/* check that protection flags are set */
|
|
|
|
if ((protectflag & (OB_LOCK_ROTX|OB_LOCK_ROTY|OB_LOCK_ROTZ|OB_LOCK_ROTW)) == 0)
|
|
|
|
return;
|
2009-09-12 05:06:28 +00:00
|
|
|
|
2009-09-12 12:30:23 +00:00
|
|
|
if (protectflag & OB_LOCK_ROT4D) {
|
|
|
|
/* axis-angle getting limited as 4D entities that they are... */
|
|
|
|
if (protectflag & OB_LOCK_ROTW)
|
2009-10-22 02:14:11 +00:00
|
|
|
*angle= oldAngle;
|
2009-09-12 12:30:23 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2009-10-22 02:14:11 +00:00
|
|
|
axis[0]= oldAxis[0];
|
2009-09-12 12:30:23 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2009-10-22 02:14:11 +00:00
|
|
|
axis[1]= oldAxis[1];
|
2009-09-12 12:30:23 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2009-10-22 02:14:11 +00:00
|
|
|
axis[2]= oldAxis[2];
|
2009-09-12 12:30:23 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* axis-angle get limited with euler... */
|
2009-10-22 02:14:11 +00:00
|
|
|
float eul[3], oldeul[3];
|
2009-09-12 12:30:23 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_eulO( eul, EULER_ORDER_DEFAULT,axis, *angle);
|
|
|
|
axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,oldAxis, oldAngle);
|
2009-09-12 12:30:23 +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];
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
eulO_to_axis_angle( axis, angle,eul, EULER_ORDER_DEFAULT);
|
2009-09-12 12:30:23 +00:00
|
|
|
|
|
|
|
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
|
2009-10-22 02:14:11 +00:00
|
|
|
if (IS_EQ(axis[0], axis[1]) && IS_EQ(axis[1], axis[2])) {
|
2009-09-12 12:30:23 +00:00
|
|
|
/* for now, rotate around y-axis then (so that it simply becomes the roll) */
|
2009-10-22 02:14:11 +00:00
|
|
|
axis[1]= 1.0f;
|
2009-09-12 12:30:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-12 12:30:23 +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 {
|
|
|
|
/* quaternions get limited with euler... (compatability mode) */
|
|
|
|
float eul[3], oldeul[3], quat1[4];
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
QUATCOPY(quat1, quat);
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_eul( eul,quat);
|
|
|
|
quat_to_eul( oldeul,oldquat);
|
2009-09-12 12:30:23 +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-12 12:30:23 +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-12 12:30:23 +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-09-12 12:30:23 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
eul_to_quat( quat,eul);
|
2009-09-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2009-09-12 12:30:23 +00:00
|
|
|
if ( (quat1[0]<0.0f && quat[0]>0.0f) || (quat1[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 ********************** */
|
|
|
|
|
|
|
|
static void constraintTransLim(TransInfo *t, TransData *td)
|
|
|
|
{
|
|
|
|
if (td->con) {
|
|
|
|
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_LOCLIMIT);
|
|
|
|
bConstraintOb cob;
|
|
|
|
bConstraint *con;
|
2009-09-28 10:19:20 +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
|
|
|
|
*/
|
|
|
|
memset(&cob, 0, sizeof(bConstraintOb));
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(cob.matrix);
|
2009-09-28 10:19:20 +00:00
|
|
|
VECCOPY(cob.matrix[3], td->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
|
|
|
/* Evaluate valid constraints */
|
|
|
|
for (con= td->con; con; con= con->next) {
|
|
|
|
float tmat[4][4];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
VECCOPY(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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void constraintRotLim(TransInfo *t, TransData *td)
|
|
|
|
{
|
|
|
|
if (td->con) {
|
|
|
|
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_ROTLIMIT);
|
|
|
|
bConstraintOb cob;
|
|
|
|
bConstraint *con;
|
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
|
|
|
|
*/
|
|
|
|
memset(&cob, 0, sizeof(bConstraintOb));
|
2009-09-28 10:19:20 +00:00
|
|
|
if (td->rotOrder == ROT_MODE_QUAT) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* quats */
|
|
|
|
if (td->ext)
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_mat4( cob.matrix,td->ext->quat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
return;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-09-12 12:30:23 +00:00
|
|
|
/* axis angle */
|
|
|
|
if (td->ext)
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_mat4( cob.matrix,&td->ext->quat[1], td->ext->quat[0]);
|
2009-09-12 12:30:23 +00:00
|
|
|
else
|
|
|
|
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
|
|
|
else {
|
|
|
|
/* eulers */
|
|
|
|
if (td->ext)
|
2009-11-10 20:43:45 +00:00
|
|
|
eulO_to_mat4( cob.matrix,td->ext->rot, td->rotOrder);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
return;
|
|
|
|
}
|
2009-09-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
if (td->rotOrder == ROT_MODE_QUAT) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* quats */
|
2009-11-10 20:43:45 +00:00
|
|
|
mat4_to_quat( td->ext->quat,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
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-09-12 12:30:23 +00:00
|
|
|
/* axis angle */
|
2009-11-10 20:43:45 +00:00
|
|
|
mat4_to_axis_angle( &td->ext->quat[1], &td->ext->quat[0],cob.matrix);
|
2009-09-12 12:30:23 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
|
|
|
/* eulers */
|
2009-11-10 20:43:45 +00:00
|
|
|
mat4_to_eulO( td->ext->rot, td->rotOrder,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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void constraintSizeLim(TransInfo *t, TransData *td)
|
|
|
|
{
|
|
|
|
if (td->con && td->ext) {
|
|
|
|
bConstraintTypeInfo *cti= get_constraint_typeinfo(CONSTRAINT_TYPE_SIZELIMIT);
|
|
|
|
bConstraintOb cob;
|
|
|
|
bConstraint *con;
|
2009-09-28 10:19:20 +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
|
|
|
|
*/
|
|
|
|
memset(&cob, 0, sizeof(bConstraintOb));
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +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 *************************** */
|
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
void postInputWarp(TransInfo *t, float values[3])
|
|
|
|
{
|
|
|
|
mul_v3_fl(values, (float)(M_PI * 2));
|
|
|
|
|
|
|
|
if (t->customData) /* non-null value indicates reversed input */
|
|
|
|
{
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
2010-03-09 01:19:32 +00:00
|
|
|
t->snap[1] = 5.0f / 180 * M_PI;
|
|
|
|
t->snap[2] = 1.0f / 180 * M_PI;
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
|
|
|
for(i = 0; i < t->total; i++) {
|
|
|
|
float center[3];
|
|
|
|
VECCOPY(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);
|
|
|
|
sub_v3_v3v3(center, 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)
|
2009-11-10 20:43:45 +00:00
|
|
|
minmax_v3_v3v3(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 {
|
|
|
|
VECCOPY(max, center);
|
|
|
|
VECCOPY(min, center);
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->center[0]= (min[0]+max[0])/2.0f;
|
|
|
|
t->center[1]= (min[1]+max[1])/2.0f;
|
|
|
|
t->center[2]= (min[2]+max[2])/2.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
|
|
|
if (max[0] == min[0]) max[0] += 0.1; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2009-07-29 11:53:37 +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
|
|
|
|
if (t->customData == 0)
|
|
|
|
t->customData = (void*)1;
|
|
|
|
else
|
|
|
|
t->customData = 0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Warp(TransInfo *t, short mval[2])
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float vec[3], circumfac, dist, phi0, co, si, *curs, cursor[3], gcursor[3];
|
|
|
|
int i;
|
|
|
|
char str[50];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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.
|
|
|
|
*/
|
|
|
|
VECCOPY(cursor, curs);
|
2009-07-12 02:01:13 +00:00
|
|
|
VECCOPY(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) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(cursor, cursor, t->obedit->obmat[3]);
|
|
|
|
sub_v3_v3v3(gcursor, gcursor, t->obedit->obmat[3]);
|
|
|
|
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);
|
|
|
|
sub_v3_v3v3(cursor, cursor, t->viewmat[3]);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
/* amount of radians for warp */
|
|
|
|
circumfac = t->values[0];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
|
|
|
circumfac = circumfac / 180 * M_PI;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2010-03-09 01:19:32 +00:00
|
|
|
sprintf(str, "Warp: %.3f", circumfac * 180 / M_PI);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0; i < t->total; i++, td++) {
|
|
|
|
float loc[3];
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
|
|
|
VECCOPY(vec, td->iloc);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->mtx, vec);
|
|
|
|
mul_m4_v3(t->viewmat, vec);
|
|
|
|
sub_v3_v3v3(vec, vec, t->viewmat[3]);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(t->viewinv, loc);
|
|
|
|
sub_v3_v3v3(loc, loc, t->viewinv[3]);
|
|
|
|
mul_m3_v3(td->smtx, loc);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(loc, loc, td->iloc);
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 *************************** */
|
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
void postInputShear(TransInfo *t, float values[3])
|
|
|
|
{
|
|
|
|
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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2009-07-29 11:53:37 +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
|
|
|
|
if (t->customData == 0)
|
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
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
{
|
|
|
|
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->customData = 0;
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int Shear(TransInfo *t, short 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(persmat, t->viewmat);
|
|
|
|
invert_m3_m3(persinv, persmat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
value = t->values[0];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(smat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
if (t->customData == 0)
|
|
|
|
smat[1][0] = value;
|
|
|
|
else
|
|
|
|
smat[0][1] = value;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(tmat, smat, persmat);
|
|
|
|
mul_m3_m3m3(totmat, persinv, tmat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(tmat, vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(vec, vec, t->center);
|
|
|
|
sub_v3_v3v3(vec, vec, td->center);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, td->factor);
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
}
|
|
|
|
|
|
|
|
static void headerResize(TransInfo *t, float vec[3], char *str) {
|
|
|
|
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]);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) {
|
|
|
|
switch(t->num.idx_max) {
|
|
|
|
case 0:
|
|
|
|
sprintf(str, "Scale: %s%s %s", &tvec[0], t->con.text, t->proptext);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprintf(str, "Scale: %s : %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf(str, "Scale: %s : %s : %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (t->flag & T_2D_EDIT)
|
|
|
|
sprintf(str, "Scale X: %s Y: %s%s %s", &tvec[0], &tvec[20], t->con.text, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Scale X: %s Y: %s Z: %s%s %s", &tvec[0], &tvec[20], &tvec[40], t->con.text, t->proptext);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#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 */
|
|
|
|
static void TransMat3ToSize( float mat[][3], float smat[][3], float *size)
|
|
|
|
{
|
|
|
|
float vec[3];
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2009-07-12 02:01:13 +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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void ElementResize(TransInfo *t, TransData *td, float mat[3][3]) {
|
|
|
|
float tmat[3][3], smat[3][3], center[3];
|
|
|
|
float vec[3];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (t->around == V3D_LOCAL) {
|
|
|
|
if (t->flag & T_OBJECT) {
|
|
|
|
VECCOPY(center, td->center);
|
|
|
|
}
|
|
|
|
else if (t->flag & T_EDIT) {
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-06-23 00:41:55 +00:00
|
|
|
if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(center, td->center);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(center, t->center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(center, t->center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(center, t->center);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2009-11-10 20:43:45 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
2009-09-28 10:19:20 +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 */
|
2009-10-31 02:54:27 +00:00
|
|
|
*td->val = td->ival * (1 + (fsize[0] - 1) * td->factor);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
|
|
|
*td->val = td->ival;
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(tmat, vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(vec, 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)
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, 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
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, vec, td->center);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, td->factor);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-07-12 02:01:13 +00:00
|
|
|
int Resize(TransInfo *t, short 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2008-12-29 20:37:54 +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;
|
|
|
|
}
|
2008-12-29 20:37:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
if (t->flag & T_AUTOVALUES)
|
|
|
|
{
|
|
|
|
VECCOPY(size, t->auto_values);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
VECCOPY(t->values, size);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
size_to_mat3( mat,size);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(t->mat, mat); // used in manipulator
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0, td=t->data; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
size_to_mat3( mat,size);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0, td=t->data; i < t->total; i++, td++)
|
|
|
|
ElementResize(t, td, mat);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int ToSphere(TransInfo *t, short 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
float tratio;
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, t->center);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
radius = normalize_v3(vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, radius * (1.0f - tratio) + t->val * tratio);
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 *************************** */
|
|
|
|
|
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
void postInputRotation(TransInfo *t, float values[3])
|
|
|
|
{
|
|
|
|
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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->ndof.axis = 16;
|
|
|
|
/* Scale down and flip input for rotation */
|
|
|
|
t->ndof.factor[0] = -0.2f;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 ElementRotation(TransInfo *t, TransData *td, float mat[3][3], short around) {
|
|
|
|
float vec[3], totmat[3][3], smat[3][3];
|
|
|
|
float eul[3], fmat[3][3], quat[4];
|
|
|
|
float *center = t->center;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) {
|
|
|
|
if (t->flag & (T_OBJECT|T_POSE)) {
|
|
|
|
center = td->center;
|
|
|
|
}
|
|
|
|
else {
|
2009-06-23 00:41:55 +00:00
|
|
|
if(around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, center);
|
|
|
|
mul_m3_v3(smat, vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, vec, center);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +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-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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_USEQUAT) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
|
|
|
|
mat3_to_quat( quat,fmat); // Actual transform
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->quat){
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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_NO_LOC) == 0)
|
|
|
|
{
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
2009-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(vec, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(pmtx, vec); // To Global space
|
|
|
|
mul_m3_v3(td->smtx, vec);// To Pose space
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-11 12:05:09 +00:00
|
|
|
/* euler or quaternion/axis-angle? */
|
2009-09-28 10:19:20 +00:00
|
|
|
if (td->rotOrder == ROT_MODE_QUAT) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mat3_to_quat( quat,fmat); // Actual transform
|
2009-09-28 10:19:20 +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-11 12:05:09 +00:00
|
|
|
|
2009-09-11 12:44:09 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-09-11 12:44:09 +00:00
|
|
|
/* calculate effect based on quats */
|
2009-10-22 02:14:11 +00:00
|
|
|
float iquat[4], tquat[4];
|
2009-09-11 12:44:09 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2009-09-11 12:44:09 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
|
|
|
|
mat3_to_quat( quat,fmat); // Actual transform
|
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2009-09-11 12:44:09 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,tquat);
|
2009-09-12 05:06:28 +00:00
|
|
|
|
|
|
|
/* this function works on end result */
|
2009-10-22 02:14:11 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2009-09-02 00:42:12 +00:00
|
|
|
else {
|
2009-03-02 01:22:02 +00:00
|
|
|
float eulmat[3][3];
|
2009-09-02 00:42:12 +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-09-02 00:42:12 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* calculate the total rotatation in eulers */
|
|
|
|
VECCOPY(eul, td->ext->irot);
|
2009-11-10 20:43:45 +00:00
|
|
|
eulO_to_mat3( eulmat,eul, td->rotOrder);
|
2009-09-02 00:42:12 +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-02 00:42:12 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
|
2009-09-02 00:42:12 +00:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* and apply (to end result only) */
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
|
|
|
VECCOPY(td->ext->rot, eul);
|
|
|
|
}
|
2009-09-12 12:30:23 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
|
|
|
if ((td->flag & TD_NO_LOC) == 0)
|
|
|
|
{
|
|
|
|
/* translation */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
|
|
|
mul_m3_v3(mat, vec);
|
|
|
|
add_v3_v3v3(vec, 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-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, vec, td->center);
|
|
|
|
mul_m3_v3(td->smtx, vec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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? */
|
2009-09-28 10:19:20 +00:00
|
|
|
if ((td->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
|
|
|
|
mat3_to_quat( quat,fmat); // Actual transform
|
2009-09-28 10:19:20 +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);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
else if (td->rotOrder == ROT_MODE_AXISANGLE) {
|
|
|
|
/* calculate effect based on quats */
|
2009-10-22 02:14:11 +00:00
|
|
|
float iquat[4], tquat[4];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_serie_m3(fmat, td->mtx, mat, td->smtx, 0, 0, 0, 0, 0);
|
|
|
|
mat3_to_quat( quat,fmat); // Actual transform
|
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_axis_angle( td->ext->rotAxis, td->ext->rotAngle,quat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
/* this function works on end result */
|
2009-10-22 02:14:11 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis, td->ext->irotAngle);
|
2009-09-28 10:19:20 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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-09-28 10:19:20 +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 */
|
|
|
|
eulO_to_mat3( obmat,eul, td->rotOrder);
|
2009-09-28 10:19:20 +00:00
|
|
|
/* mat = transform, obmat = object rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mat3_to_compatible_eulO( eul, td->ext->rot, td->rotOrder,fmat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
/* correct back for delta rot */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(eul, eul, td->ext->drot);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
/* and apply */
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
|
|
|
VECCOPY(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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
vec_rot_to_mat3( mat,axis, angle);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
2009-11-10 20:43:45 +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) {
|
2009-11-10 20:43:45 +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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int Rotation(TransInfo *t, short 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[64];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applyNDofInput(&t->ndof, &final);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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);
|
2010-02-21 14:13:20 +00:00
|
|
|
} else {
|
|
|
|
/* reset axis if constraint is not set */
|
2010-02-26 09:02:52 +00:00
|
|
|
negate_v3_v3(t->axis, t->viewinv[2]);
|
2010-02-21 14:13:20 +00:00
|
|
|
normalize_v3(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
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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, "Rot: %s %s %s", &c[0], t->con.text, t->proptext);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
|
|
|
while (final >= 180.0)
|
|
|
|
final -= 360.0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
while (final <= -180.0)
|
|
|
|
final += 360.0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
final *= (float)(M_PI / 180.0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Rot: %.2f%s %s", 180.0*final/M_PI, t->con.text, t->proptext);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
t->values[0] = final;
|
2010-03-07 15:36:52 +00:00
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
vec_rot_to_mat3( mat, t->axis, final);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-01-04 20:49:42 +00:00
|
|
|
applyRotation(t, final, t->axis);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->ndof.axis = 40;
|
|
|
|
/* Scale down input for rotation */
|
|
|
|
t->ndof.factor[0] = 0.2f;
|
|
|
|
t->ndof.factor[1] = 0.2f;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2009-11-10 20:43:45 +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
|
|
|
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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) {
|
2009-11-10 20:43:45 +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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int Trackball(TransInfo *t, short 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[128];
|
|
|
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(axis1, t->persinv[0]);
|
|
|
|
VECCOPY(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
|
|
|
applyNDofInput(&t->ndof, 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
|
|
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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, "Trackball: %s %s %s", &c[0], &c[20], t->proptext);
|
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
|
|
|
phi[0] *= (float)(M_PI / 180.0);
|
|
|
|
phi[1] *= (float)(M_PI / 180.0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Trackball: %.2f %.2f %s", 180.0*phi[0]/M_PI, 180.0*phi[1]/M_PI, t->proptext);
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +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
|
|
|
{
|
|
|
|
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
|
|
|
|
2009-01-20 19:58:05 +00:00
|
|
|
t->ndof.axis = (t->flag & T_2D_EDIT)? 1|2: 1|2|4;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) {
|
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
|
|
|
}
|
|
|
|
else if(t->spacetype == SPACE_IMAGE) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void headerTranslation(TransInfo *t, float vec[3], char *str) {
|
|
|
|
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];
|
|
|
|
|
|
|
|
VECCOPY(dvec, vec);
|
|
|
|
applyAspectRatio(t, dvec);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3(vec);
|
2009-08-13 07:37:41 +00:00
|
|
|
if(t->scene->unit.system) {
|
|
|
|
int i, do_split= t->scene->unit.flag & USER_UNIT_OPT_SPLIT ? 1:0;
|
2009-08-12 17:02:03 +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
|
|
|
}
|
|
|
|
|
2009-08-13 07:37:41 +00:00
|
|
|
if(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);
|
2009-08-12 17:02:03 +00:00
|
|
|
else if( dist > 1e10 || dist < -1e10 ) /* 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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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_AUTOIK) {
|
2009-06-23 00:41:55 +00:00
|
|
|
short chainlen= t->settings->autoik_chainlen;
|
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(chainlen)
|
|
|
|
sprintf(autoik, "AutoIK-Len: %d", chainlen);
|
|
|
|
else
|
|
|
|
strcpy(autoik, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
strcpy(autoik, "");
|
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
switch(t->num.idx_max) {
|
|
|
|
case 0:
|
|
|
|
sprintf(str, "D: %s (%s)%s %s %s", &tvec[0], distvec, t->con.text, t->proptext, &autoik[0]);
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sprintf(str, "D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext, &autoik[0]);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
sprintf(str, "D: %s D: %s D: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if(t->flag & T_2D_EDIT)
|
|
|
|
sprintf(str, "Dx: %s Dy: %s (%s)%s %s", &tvec[0], &tvec[20], distvec, t->con.text, t->proptext);
|
|
|
|
else
|
|
|
|
sprintf(str, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", &tvec[0], &tvec[20], &tvec[40], distvec, t->con.text, t->proptext, &autoik[0]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void applyTranslation(TransInfo *t, float vec[3]) {
|
|
|
|
TransData *td = t->data;
|
|
|
|
float tvec[3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
|
|
|
if (usingSnappingNormal(t))
|
|
|
|
{
|
|
|
|
if (validSnappingNormal(t))
|
|
|
|
{
|
|
|
|
float *original_normal = td->axismtx[2];
|
|
|
|
float axis[3];
|
|
|
|
float quat[4];
|
|
|
|
float mat[3][3];
|
|
|
|
float angle;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(quat, axis, angle);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
quat_to_mat3( mat,quat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
float mat[3][3];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(mat);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
|
|
|
VECCOPY(tvec, vec);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, tvec);
|
|
|
|
mul_v3_fl(tvec, td->factor);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, tvec);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2009-07-12 02:01:13 +00:00
|
|
|
int Translation(TransInfo *t, short 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];
|
2008-12-29 20:37:54 +00:00
|
|
|
applySnapping(t, t->values);
|
|
|
|
t->con.applyVec(t, NULL, t->values, tvec, pvec);
|
|
|
|
VECCOPY(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
|
|
|
applyNDofInput(&t->ndof, t->values);
|
|
|
|
snapGrid(t, t->values);
|
|
|
|
applyNumInput(&t->num, t->values);
|
2009-01-20 20:44:36 +00:00
|
|
|
if (hasNumInput(&t->num))
|
|
|
|
{
|
|
|
|
removeAspectRatio(t, t->values);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int ShrinkFatten(TransInfo *t, short 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
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
VECCOPY(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->ndof.axis = 16;
|
|
|
|
/* Scale down and flip input for rotation */
|
|
|
|
t->ndof.factor[0] = -0.2f;
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
int Tilt(TransInfo *t, short 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
|
|
|
applyNDofInput(&t->ndof, &final);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
final *= (float)(M_PI / 180.0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Tilt: %.2f %s", 180.0*final/M_PI, t->proptext);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int CurveShrinkFatten(TransInfo *t, short 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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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(td->val) {
|
|
|
|
//*td->val= ratio;
|
|
|
|
*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->ndof.axis = 4;
|
|
|
|
/* Flip direction */
|
|
|
|
t->ndof.factor[0] = -1.0f;
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int PushPull(TransInfo *t, short 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
|
|
|
applyNDofInput(&t->ndof, &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, "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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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);
|
|
|
|
sub_v3_v3v3(vec, 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)
|
|
|
|
{
|
2009-07-29 11:53:37 +00:00
|
|
|
if (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
|
|
|
if(!G.editBMesh) return 0;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Bevel(TransInfo *t, short mval[2])
|
|
|
|
{
|
|
|
|
float distance,d;
|
|
|
|
int i;
|
|
|
|
char str[128];
|
|
|
|
char *mode;
|
|
|
|
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;
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->axismtx[1][0] > 0 && distance > td->axismtx[1][0]) {
|
|
|
|
d = td->axismtx[1][0];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
d = distance;
|
|
|
|
}
|
|
|
|
VECADDFAC(td->loc,td->center,td->axismtx[0],(*td->val)*d);
|
|
|
|
}
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
int BevelWeight(TransInfo *t, short 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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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];
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
int Crease(TransInfo *t, short 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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
static void headerBoneSize(TransInfo *t, float vec[3], char *str) {
|
|
|
|
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];
|
2009-11-10 20:43:45 +00:00
|
|
|
size_to_mat3( sizemat,td->iloc);
|
|
|
|
mul_m3_m3m3(tmat, tmat, sizemat);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int BoneSize(TransInfo *t, short 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-09-28 10:19:20 +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 */
|
2008-12-29 20:37:54 +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;
|
|
|
|
}
|
2008-12-29 20:37:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
size_to_mat3( mat,size);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(t->mat, mat); // used in manipulator
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +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;
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int BoneEnvelope(TransInfo *t, short 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-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-09-22 08:41:03 +00:00
|
|
|
/* ******************** Edge Slide *************** */
|
|
|
|
|
|
|
|
static int createSlideVerts(TransInfo *t)
|
|
|
|
{
|
|
|
|
Mesh *me = t->obedit->data;
|
|
|
|
EditMesh *em = me->edit_mesh;
|
|
|
|
EditFace *efa;
|
|
|
|
EditEdge *eed,*first=NULL,*last=NULL, *temp = NULL;
|
|
|
|
EditVert *ev, *nearest = NULL;
|
|
|
|
LinkNode *edgelist = NULL, *vertlist=NULL, *look;
|
|
|
|
GHash *vertgh;
|
|
|
|
TransDataSlideVert *tempsv;
|
2009-10-22 03:12:44 +00:00
|
|
|
float vertdist; // XXX, projectMat[4][4];
|
|
|
|
int i, j, numsel, numadded=0, timesthrough = 0, vertsel=0;
|
2009-09-22 08:41:03 +00:00
|
|
|
/* UV correction vars */
|
|
|
|
GHash **uvarray= NULL;
|
|
|
|
SlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
|
|
|
int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
|
|
|
|
int uvlay_idx;
|
|
|
|
TransDataSlideUv *slideuvs=NULL, *suv=NULL, *suv_last=NULL;
|
|
|
|
RegionView3D *v3d = t->ar->regiondata;
|
|
|
|
float projectMat[4][4];
|
|
|
|
float start[3] = {0.0f, 0.0f, 0.0f}, end[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
float vec[3];
|
2009-10-22 03:12:44 +00:00
|
|
|
float totvec=0.0;
|
2009-09-22 08:41:03 +00:00
|
|
|
|
2009-09-28 03:28:28 +00:00
|
|
|
if (!v3d) {
|
|
|
|
/*ok, let's try to survive this*/
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(projectMat);
|
2009-09-28 03:28:28 +00:00
|
|
|
} else {
|
|
|
|
view3d_get_object_project_mat(v3d, t->obedit, projectMat);
|
|
|
|
}
|
2009-10-22 03:12:44 +00:00
|
|
|
|
2009-09-22 08:41:03 +00:00
|
|
|
numsel =0;
|
|
|
|
|
|
|
|
// Get number of selected edges and clear some flags
|
|
|
|
for(eed=em->edges.first;eed;eed=eed->next) {
|
|
|
|
eed->f1 = 0;
|
|
|
|
eed->f2 = 0;
|
|
|
|
if(eed->f & SELECT) numsel++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for(ev=em->verts.first;ev;ev=ev->next) {
|
|
|
|
ev->f1 = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Make sure each edge only has 2 faces
|
|
|
|
// make sure loop doesn't cross face
|
|
|
|
for(efa=em->faces.first;efa;efa=efa->next) {
|
|
|
|
int ct = 0;
|
|
|
|
if(efa->e1->f & SELECT) {
|
|
|
|
ct++;
|
|
|
|
efa->e1->f1++;
|
|
|
|
if(efa->e1->f1 > 2) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(efa->e2->f & SELECT) {
|
|
|
|
ct++;
|
|
|
|
efa->e2->f1++;
|
|
|
|
if(efa->e2->f1 > 2) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(efa->e3->f & SELECT) {
|
|
|
|
ct++;
|
|
|
|
efa->e3->f1++;
|
|
|
|
if(efa->e3->f1 > 2) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(efa->e4 && efa->e4->f & SELECT) {
|
|
|
|
ct++;
|
|
|
|
efa->e4->f1++;
|
|
|
|
if(efa->e4->f1 > 2) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "3+ face edge");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Make sure loop is not 2 edges of same face
|
|
|
|
if(ct > 1) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "Loop crosses itself");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get # of selected verts
|
|
|
|
for(ev=em->verts.first;ev;ev=ev->next) {
|
|
|
|
if(ev->f & SELECT) vertsel++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test for multiple segments
|
|
|
|
if(vertsel > numsel+1) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "Please choose a single edge loop");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the edgeloop in order - mark f1 with SELECT once added
|
|
|
|
for(eed=em->edges.first;eed;eed=eed->next) {
|
|
|
|
if((eed->f & SELECT) && !(eed->f1 & SELECT)) {
|
|
|
|
// If this is the first edge added, just put it in
|
|
|
|
if(!edgelist) {
|
|
|
|
BLI_linklist_prepend(&edgelist,eed);
|
|
|
|
numadded++;
|
|
|
|
first = eed;
|
|
|
|
last = eed;
|
|
|
|
eed->f1 = SELECT;
|
|
|
|
} else {
|
|
|
|
if(editedge_getSharedVert(eed, last)) {
|
|
|
|
BLI_linklist_append(&edgelist,eed);
|
|
|
|
eed->f1 = SELECT;
|
|
|
|
numadded++;
|
|
|
|
last = eed;
|
|
|
|
} else if(editedge_getSharedVert(eed, first)) {
|
|
|
|
BLI_linklist_prepend(&edgelist,eed);
|
|
|
|
eed->f1 = SELECT;
|
|
|
|
numadded++;
|
|
|
|
first = eed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(eed->next == NULL && numadded != numsel) {
|
|
|
|
eed=em->edges.first;
|
|
|
|
timesthrough++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// It looks like there was an unexpected case - Hopefully should not happen
|
|
|
|
if(timesthrough >= numsel*2) {
|
|
|
|
BLI_linklist_free(edgelist,NULL);
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "Could not order loop");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Put the verts in order in a linklist
|
|
|
|
look = edgelist;
|
|
|
|
while(look) {
|
|
|
|
eed = look->link;
|
|
|
|
if(!vertlist) {
|
|
|
|
if(look->next) {
|
|
|
|
temp = look->next->link;
|
|
|
|
|
|
|
|
//This is the first entry takes care of extra vert
|
|
|
|
if(eed->v1 != temp->v1 && eed->v1 != temp->v2) {
|
|
|
|
BLI_linklist_append(&vertlist,eed->v1);
|
|
|
|
eed->v1->f1 = 1;
|
|
|
|
} else {
|
|
|
|
BLI_linklist_append(&vertlist,eed->v2);
|
|
|
|
eed->v2->f1 = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//This is the case that we only have 1 edge
|
|
|
|
BLI_linklist_append(&vertlist,eed->v1);
|
|
|
|
eed->v1->f1 = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// for all the entries
|
|
|
|
if(eed->v1->f1 != 1) {
|
|
|
|
BLI_linklist_append(&vertlist,eed->v1);
|
|
|
|
eed->v1->f1 = 1;
|
|
|
|
} else if(eed->v2->f1 != 1) {
|
|
|
|
BLI_linklist_append(&vertlist,eed->v2);
|
|
|
|
eed->v2->f1 = 1;
|
|
|
|
}
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
// populate the SlideVerts
|
|
|
|
|
|
|
|
vertgh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
|
|
|
|
look = vertlist;
|
|
|
|
while(look) {
|
|
|
|
i=0;
|
|
|
|
j=0;
|
|
|
|
ev = look->link;
|
|
|
|
tempsv = (struct TransDataSlideVert*)MEM_mallocN(sizeof(struct TransDataSlideVert),"SlideVert");
|
|
|
|
tempsv->up = NULL;
|
|
|
|
tempsv->down = NULL;
|
|
|
|
tempsv->origvert.co[0] = ev->co[0];
|
|
|
|
tempsv->origvert.co[1] = ev->co[1];
|
|
|
|
tempsv->origvert.co[2] = ev->co[2];
|
|
|
|
tempsv->origvert.no[0] = ev->no[0];
|
|
|
|
tempsv->origvert.no[1] = ev->no[1];
|
|
|
|
tempsv->origvert.no[2] = ev->no[2];
|
|
|
|
// i is total edges that vert is on
|
|
|
|
// j is total selected edges that vert is on
|
|
|
|
|
|
|
|
for(eed=em->edges.first;eed;eed=eed->next) {
|
|
|
|
if(eed->v1 == ev || eed->v2 == ev) {
|
|
|
|
i++;
|
|
|
|
if(eed->f & SELECT) {
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the vert is in the middle of an edge loop, it touches 2 selected edges and 2 unselected edges
|
|
|
|
if(i == 4 && j == 2) {
|
|
|
|
for(eed=em->edges.first;eed;eed=eed->next) {
|
|
|
|
if(editedge_containsVert(eed, ev)) {
|
|
|
|
if(!(eed->f & SELECT)) {
|
|
|
|
if(!tempsv->up) {
|
|
|
|
tempsv->up = eed;
|
|
|
|
} else if (!(tempsv->down)) {
|
|
|
|
tempsv->down = eed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If it is on the end of the loop, it touches 1 selected and as least 2 more unselected
|
|
|
|
if(i >= 3 && j == 1) {
|
|
|
|
for(eed=em->edges.first;eed;eed=eed->next) {
|
|
|
|
if(editedge_containsVert(eed, ev) && eed->f & SELECT) {
|
|
|
|
for(efa = em->faces.first;efa;efa=efa->next) {
|
|
|
|
if(editface_containsEdge(efa, eed)) {
|
|
|
|
if(editedge_containsVert(efa->e1, ev) && efa->e1 != eed) {
|
|
|
|
if(!tempsv->up) {
|
|
|
|
tempsv->up = efa->e1;
|
|
|
|
} else if (!(tempsv->down)) {
|
|
|
|
tempsv->down = efa->e1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(editedge_containsVert(efa->e2, ev) && efa->e2 != eed) {
|
|
|
|
if(!tempsv->up) {
|
|
|
|
tempsv->up = efa->e2;
|
|
|
|
} else if (!(tempsv->down)) {
|
|
|
|
tempsv->down = efa->e2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(editedge_containsVert(efa->e3, ev) && efa->e3 != eed) {
|
|
|
|
if(!tempsv->up) {
|
|
|
|
tempsv->up = efa->e3;
|
|
|
|
} else if (!(tempsv->down)) {
|
|
|
|
tempsv->down = efa->e3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(efa->e4) {
|
|
|
|
if(editedge_containsVert(efa->e4, ev) && efa->e4 != eed) {
|
|
|
|
if(!tempsv->up) {
|
|
|
|
tempsv->up = efa->e4;
|
|
|
|
} else if (!(tempsv->down)) {
|
|
|
|
tempsv->down = efa->e4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(i > 4 && j == 2) {
|
|
|
|
BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
|
|
|
|
BLI_linklist_free(vertlist,NULL);
|
|
|
|
BLI_linklist_free(edgelist,NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
BLI_ghash_insert(vertgh,ev,tempsv);
|
|
|
|
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
// make sure the UPs nad DOWNs are 'faceloops'
|
|
|
|
// Also find the nearest slidevert to the cursor
|
|
|
|
|
|
|
|
look = vertlist;
|
|
|
|
nearest = NULL;
|
|
|
|
vertdist = -1;
|
|
|
|
while(look) {
|
|
|
|
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
|
|
|
|
|
|
|
|
if(!tempsv->up || !tempsv->down) {
|
|
|
|
//BKE_report(op->reports, RPT_ERROR, "Missing rails");
|
|
|
|
BLI_ghash_free(vertgh, NULL, (GHashValFreeFP)MEM_freeN);
|
|
|
|
BLI_linklist_free(vertlist,NULL);
|
|
|
|
BLI_linklist_free(edgelist,NULL);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(me->drawflag & ME_DRAW_EDGELEN) {
|
|
|
|
if(!(tempsv->up->f & SELECT)) {
|
|
|
|
tempsv->up->f |= SELECT;
|
|
|
|
tempsv->up->f2 |= 16;
|
|
|
|
} else {
|
|
|
|
tempsv->up->f2 |= ~16;
|
|
|
|
}
|
|
|
|
if(!(tempsv->down->f & SELECT)) {
|
|
|
|
tempsv->down->f |= SELECT;
|
|
|
|
tempsv->down->f2 |= 16;
|
|
|
|
} else {
|
|
|
|
tempsv->down->f2 |= ~16;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(look->next != NULL) {
|
|
|
|
TransDataSlideVert *sv;
|
|
|
|
|
|
|
|
ev = (EditVert*)look->next->link;
|
|
|
|
sv = BLI_ghash_lookup(vertgh, ev);
|
|
|
|
|
|
|
|
if(sv) {
|
|
|
|
float co[3], co2[3], vec[3];
|
|
|
|
|
2009-09-22 18:47:28 +00:00
|
|
|
ev = (EditVert*)look->link;
|
|
|
|
|
2009-09-22 08:41:03 +00:00
|
|
|
if(!sharesFace(em, tempsv->up,sv->up)) {
|
|
|
|
EditEdge *swap;
|
|
|
|
swap = sv->up;
|
|
|
|
sv->up = sv->down;
|
|
|
|
sv->down = swap;
|
|
|
|
}
|
|
|
|
|
2009-09-28 03:28:28 +00:00
|
|
|
if (v3d) {
|
|
|
|
view3d_project_float(t->ar, tempsv->up->v1->co, co, projectMat);
|
|
|
|
view3d_project_float(t->ar, tempsv->up->v2->co, co2, projectMat);
|
|
|
|
}
|
|
|
|
|
2009-09-22 18:47:28 +00:00
|
|
|
if (ev == tempsv->up->v1) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, co, co2);
|
2009-09-22 08:41:03 +00:00
|
|
|
} else {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, co2, co);
|
2009-09-22 08:41:03 +00:00
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(start, start, vec);
|
2009-09-22 08:41:03 +00:00
|
|
|
|
2009-09-28 03:28:28 +00:00
|
|
|
if (v3d) {
|
|
|
|
view3d_project_float(t->ar, tempsv->down->v1->co, co, projectMat);
|
|
|
|
view3d_project_float(t->ar, tempsv->down->v2->co, co2, projectMat);
|
|
|
|
}
|
|
|
|
|
2009-09-22 18:47:28 +00:00
|
|
|
if (ev == tempsv->down->v1) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, co2, co);
|
2009-09-22 08:41:03 +00:00
|
|
|
} else {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, co, co2);
|
2009-09-22 08:41:03 +00:00
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(end, end, vec);
|
2009-09-22 08:41:03 +00:00
|
|
|
|
|
|
|
totvec += 1.0f;
|
|
|
|
nearest = (EditVert*)look->link;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(start, start, end);
|
|
|
|
mul_v3_fl(start, 0.5*(1.0/totvec));
|
2009-09-22 08:41:03 +00:00
|
|
|
VECCOPY(vec, start);
|
|
|
|
start[0] = t->mval[0];
|
|
|
|
start[1] = t->mval[1];
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(end, start, vec);
|
2009-09-22 08:41:03 +00:00
|
|
|
|
|
|
|
sld->start[0] = (short) start[0];
|
|
|
|
sld->start[1] = (short) start[1];
|
|
|
|
sld->end[0] = (short) end[0];
|
|
|
|
sld->end[1] = (short) end[1];
|
|
|
|
|
|
|
|
if (uvlay_tot) { // XXX && (scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT)) {
|
|
|
|
int maxnum = 0;
|
|
|
|
|
|
|
|
uvarray = MEM_callocN( uvlay_tot * sizeof(GHash *), "SlideUVs Array");
|
|
|
|
sld->totuv = uvlay_tot;
|
|
|
|
suv_last = slideuvs = MEM_callocN( uvlay_tot * (numadded+1) * sizeof(TransDataSlideUv), "SlideUVs"); /* uvLayers * verts */
|
|
|
|
suv = NULL;
|
|
|
|
|
|
|
|
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
|
|
|
|
|
|
|
|
uvarray[uvlay_idx] = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp);
|
|
|
|
|
|
|
|
for(ev=em->verts.first;ev;ev=ev->next) {
|
|
|
|
ev->tmp.l = 0;
|
|
|
|
}
|
|
|
|
look = vertlist;
|
|
|
|
while(look) {
|
|
|
|
float *uv_new;
|
|
|
|
tempsv = BLI_ghash_lookup(vertgh,(EditVert*)look->link);
|
|
|
|
|
|
|
|
ev = look->link;
|
|
|
|
suv = NULL;
|
|
|
|
for(efa = em->faces.first;efa;efa=efa->next) {
|
|
|
|
if (ev->tmp.l != -1) { /* test for self, in this case its invalid */
|
|
|
|
int k=-1; /* face corner */
|
|
|
|
|
|
|
|
/* Is this vert in the faces corner? */
|
|
|
|
if (efa->v1==ev) k=0;
|
|
|
|
else if (efa->v2==ev) k=1;
|
|
|
|
else if (efa->v3==ev) k=2;
|
|
|
|
else if (efa->v4 && efa->v4==ev) k=3;
|
|
|
|
|
|
|
|
if (k != -1) {
|
|
|
|
MTFace *tf = CustomData_em_get_n(&em->fdata, efa->data, CD_MTFACE, uvlay_idx);
|
|
|
|
EditVert *ev_up, *ev_down;
|
|
|
|
|
|
|
|
uv_new = tf->uv[k];
|
|
|
|
|
|
|
|
if (ev->tmp.l) {
|
|
|
|
if (fabs(suv->origuv[0]-uv_new[0]) > 0.0001 || fabs(suv->origuv[1]-uv_new[1])) {
|
|
|
|
ev->tmp.l = -1; /* Tag as invalid */
|
|
|
|
BLI_linklist_free(suv->fuv_list,NULL);
|
|
|
|
suv->fuv_list = NULL;
|
|
|
|
BLI_ghash_remove(uvarray[uvlay_idx],ev, NULL, NULL);
|
|
|
|
suv = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ev->tmp.l = 1;
|
|
|
|
suv = suv_last;
|
|
|
|
|
|
|
|
suv->fuv_list = NULL;
|
|
|
|
suv->uv_up = suv->uv_down = NULL;
|
|
|
|
suv->origuv[0] = uv_new[0];
|
|
|
|
suv->origuv[1] = uv_new[1];
|
|
|
|
|
|
|
|
BLI_linklist_prepend(&suv->fuv_list, uv_new);
|
|
|
|
BLI_ghash_insert(uvarray[uvlay_idx],ev,suv);
|
|
|
|
|
|
|
|
suv_last++; /* advance to next slide UV */
|
|
|
|
maxnum++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now get the uvs along the up or down edge if we can */
|
|
|
|
if (suv) {
|
|
|
|
if (!suv->uv_up) {
|
|
|
|
ev_up = editedge_getOtherVert(tempsv->up,ev);
|
|
|
|
if (efa->v1==ev_up) suv->uv_up = tf->uv[0];
|
|
|
|
else if (efa->v2==ev_up) suv->uv_up = tf->uv[1];
|
|
|
|
else if (efa->v3==ev_up) suv->uv_up = tf->uv[2];
|
|
|
|
else if (efa->v4 && efa->v4==ev_up) suv->uv_up = tf->uv[3];
|
|
|
|
}
|
|
|
|
if (!suv->uv_down) { /* if the first face was apart of the up edge, it cant be apart of the down edge */
|
|
|
|
ev_down = editedge_getOtherVert(tempsv->down,ev);
|
|
|
|
if (efa->v1==ev_down) suv->uv_down = tf->uv[0];
|
|
|
|
else if (efa->v2==ev_down) suv->uv_down = tf->uv[1];
|
|
|
|
else if (efa->v3==ev_down) suv->uv_down = tf->uv[2];
|
|
|
|
else if (efa->v4 && efa->v4==ev_down) suv->uv_down = tf->uv[3];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Copy the pointers to the face UV's */
|
|
|
|
BLI_linklist_prepend(&suv->fuv_list, uv_new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
} /* end uv layer loop */
|
|
|
|
} /* end uvlay_tot */
|
|
|
|
|
|
|
|
sld->uvhash = uvarray;
|
|
|
|
sld->slideuv = slideuvs;
|
|
|
|
sld->vhash = vertgh;
|
|
|
|
sld->nearest = nearest;
|
|
|
|
sld->vertlist = vertlist;
|
|
|
|
sld->edgelist = edgelist;
|
|
|
|
sld->suv_last = suv_last;
|
|
|
|
sld->uvlay_tot = uvlay_tot;
|
|
|
|
|
|
|
|
// we should have enough info now to slide
|
|
|
|
|
|
|
|
t->customData = sld;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-09-22 20:16:56 +00:00
|
|
|
void freeSlideVerts(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransDataSlideUv *suv;
|
|
|
|
SlideData *sld = t->customData;
|
|
|
|
int uvlay_idx;
|
|
|
|
|
|
|
|
//BLI_ghash_free(edgesgh, freeGHash, NULL);
|
|
|
|
BLI_ghash_free(sld->vhash, NULL, (GHashValFreeFP)MEM_freeN);
|
|
|
|
BLI_linklist_free(sld->vertlist, NULL);
|
|
|
|
BLI_linklist_free(sld->edgelist, NULL);
|
|
|
|
|
|
|
|
if (sld->uvlay_tot) {
|
|
|
|
for (uvlay_idx=0; uvlay_idx<sld->uvlay_tot; uvlay_idx++) {
|
|
|
|
BLI_ghash_free(sld->uvhash[uvlay_idx], NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
suv = sld->suv_last-1;
|
|
|
|
while (suv >= sld->slideuv) {
|
|
|
|
if (suv->fuv_list) {
|
|
|
|
BLI_linklist_free(suv->fuv_list,NULL);
|
|
|
|
}
|
|
|
|
suv--;
|
|
|
|
}
|
2009-09-28 03:28:28 +00:00
|
|
|
|
|
|
|
MEM_freeN(sld->slideuv);
|
|
|
|
MEM_freeN(sld->uvhash);
|
2009-09-22 20:16:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MEM_freeN(sld);
|
|
|
|
t->customData = NULL;
|
|
|
|
}
|
|
|
|
|
2009-09-22 08:41:03 +00:00
|
|
|
void initEdgeSlide(TransInfo *t)
|
|
|
|
{
|
|
|
|
SlideData *sld;
|
|
|
|
|
|
|
|
t->mode = TFM_EDGE_SLIDE;
|
|
|
|
t->transform = EdgeSlide;
|
2009-09-22 20:16:56 +00:00
|
|
|
|
2009-09-22 08:41:03 +00:00
|
|
|
createSlideVerts(t);
|
|
|
|
sld = t->customData;
|
|
|
|
|
2009-09-22 09:04:43 +00:00
|
|
|
if (!sld)
|
|
|
|
return;
|
|
|
|
|
2009-09-22 20:16:56 +00:00
|
|
|
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-09-22 08:41:03 +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-09-22 08:41:03 +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;
|
|
|
|
|
2010-02-22 23:25:34 +00:00
|
|
|
t->num.increment = t->snap[1];
|
|
|
|
|
2009-09-22 08:41:03 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
}
|
|
|
|
|
|
|
|
int doEdgeSlide(TransInfo *t, float perc)
|
|
|
|
{
|
|
|
|
Mesh *me= t->obedit->data;
|
|
|
|
EditMesh *em = me->edit_mesh;
|
|
|
|
SlideData *sld = t->customData;
|
|
|
|
EditVert *ev, *nearest = sld->nearest;
|
|
|
|
EditVert *centerVert, *upVert, *downVert;
|
2009-10-22 03:12:44 +00:00
|
|
|
LinkNode *vertlist=sld->vertlist, *look;
|
2009-09-22 08:41:03 +00:00
|
|
|
GHash *vertgh = sld->vhash;
|
|
|
|
TransDataSlideVert *tempsv;
|
2009-10-22 03:12:44 +00:00
|
|
|
float len = 0.0f;
|
|
|
|
int prop=1, flip=0;
|
2009-09-22 08:41:03 +00:00
|
|
|
/* UV correction vars */
|
|
|
|
GHash **uvarray= sld->uvhash;
|
|
|
|
int uvlay_tot= CustomData_number_of_layers(&em->fdata, CD_MTFACE);
|
|
|
|
int uvlay_idx;
|
2009-10-22 03:12:44 +00:00
|
|
|
TransDataSlideUv *suv=sld->slideuv;
|
2009-09-22 08:41:03 +00:00
|
|
|
float uv_tmp[2];
|
|
|
|
LinkNode *fuv_link;
|
|
|
|
|
|
|
|
len = 0.0f;
|
|
|
|
|
|
|
|
tempsv = BLI_ghash_lookup(vertgh,nearest);
|
|
|
|
|
|
|
|
centerVert = editedge_getSharedVert(tempsv->up, tempsv->down);
|
|
|
|
upVert = editedge_getOtherVert(tempsv->up, centerVert);
|
|
|
|
downVert = editedge_getOtherVert(tempsv->down, centerVert);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
len = MIN2(perc, len_v3v3(upVert->co,downVert->co));
|
2009-09-22 08:41:03 +00:00
|
|
|
len = MAX2(len, 0);
|
|
|
|
|
|
|
|
//Adjust Edgeloop
|
|
|
|
if(prop) {
|
|
|
|
look = vertlist;
|
|
|
|
while(look) {
|
|
|
|
EditVert *tempev;
|
|
|
|
ev = look->link;
|
|
|
|
tempsv = BLI_ghash_lookup(vertgh,ev);
|
|
|
|
|
|
|
|
tempev = editedge_getOtherVert((perc>=0)?tempsv->up:tempsv->down, ev);
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v3_v3v3(ev->co, tempsv->origvert.co, tempev->co, fabs(perc));
|
2009-09-22 08:41:03 +00:00
|
|
|
|
|
|
|
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
|
|
|
|
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
|
|
|
|
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
|
|
|
|
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v2_v2v2(uv_tmp, suv->origuv, (perc>=0)?suv->uv_up:suv->uv_down, fabs(perc));
|
2009-09-22 08:41:03 +00:00
|
|
|
fuv_link = suv->fuv_list;
|
|
|
|
while (fuv_link) {
|
|
|
|
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
|
|
|
|
fuv_link = fuv_link->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
//Non prop code
|
|
|
|
look = vertlist;
|
|
|
|
while(look) {
|
|
|
|
float newlen;
|
|
|
|
ev = look->link;
|
|
|
|
tempsv = BLI_ghash_lookup(vertgh,ev);
|
2009-11-10 20:43:45 +00:00
|
|
|
newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co));
|
2009-09-22 08:41:03 +00:00
|
|
|
if(newlen > 1.0) {newlen = 1.0;}
|
|
|
|
if(newlen < 0.0) {newlen = 0.0;}
|
|
|
|
if(flip == 0) {
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->down,ev)->co, editedge_getOtherVert(tempsv->up,ev)->co, fabs(newlen));
|
2009-09-22 08:41:03 +00:00
|
|
|
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
|
|
|
|
/* dont do anything if no UVs */
|
|
|
|
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
|
|
|
|
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
|
|
|
|
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v2_v2v2(uv_tmp, suv->uv_down, suv->uv_up, fabs(newlen));
|
2009-09-22 08:41:03 +00:00
|
|
|
fuv_link = suv->fuv_list;
|
|
|
|
while (fuv_link) {
|
|
|
|
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
|
|
|
|
fuv_link = fuv_link->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else{
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v3_v3v3(ev->co, editedge_getOtherVert(tempsv->up,ev)->co, editedge_getOtherVert(tempsv->down,ev)->co, fabs(newlen));
|
2009-09-22 08:41:03 +00:00
|
|
|
|
|
|
|
if (uvlay_tot) { // XXX scene->toolsettings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) {
|
|
|
|
/* dont do anything if no UVs */
|
|
|
|
for (uvlay_idx=0; uvlay_idx<uvlay_tot; uvlay_idx++) {
|
|
|
|
suv = BLI_ghash_lookup( uvarray[uvlay_idx], ev );
|
|
|
|
if (suv && suv->fuv_list && suv->uv_up && suv->uv_down) {
|
2009-11-10 20:43:45 +00:00
|
|
|
interp_v2_v2v2(uv_tmp, suv->uv_up, suv->uv_down, fabs(newlen));
|
2009-09-22 08:41:03 +00:00
|
|
|
fuv_link = suv->fuv_list;
|
|
|
|
while (fuv_link) {
|
|
|
|
VECCOPY2D(((float *)fuv_link->link), uv_tmp);
|
|
|
|
fuv_link = fuv_link->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
look = look->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int EdgeSlide(TransInfo *t, short mval[2])
|
|
|
|
{
|
|
|
|
char str[50];
|
|
|
|
float final;
|
|
|
|
|
|
|
|
final = t->values[0];
|
|
|
|
|
|
|
|
snapGrid(t, &final);
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
char c[20];
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c);
|
|
|
|
|
|
|
|
sprintf(str, "Edge Slide Percent: %s", &c[0]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Edge Slide Percent: %.2f", final);
|
|
|
|
}
|
|
|
|
|
|
|
|
CLAMP(final, -1.0f, 1.0f);
|
|
|
|
|
|
|
|
/*do stuff here*/
|
2009-09-28 03:28:28 +00:00
|
|
|
if (t->customData)
|
|
|
|
doEdgeSlide(t, final);
|
|
|
|
else {
|
|
|
|
strcpy(str, "Invalid Edge Selection");
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
}
|
2009-09-22 08:41:03 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
/* ******************** 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;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
int BoneRoll(TransInfo *t, short 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]);
|
|
|
|
|
|
|
|
final *= (float)(M_PI / 180.0);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
sprintf(str, "Roll: %.2f", 180.0*final/M_PI);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int BakeTime(TransInfo *t, short 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
|
|
|
|
2008-12-29 20:37:54 +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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int Mirror(TransInfo *t, short 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];
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OPTIMISATION:
|
|
|
|
* 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
|
|
|
|
2009-11-10 20:43:45 +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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(i = 0, td=t->data; i < t->total; i++, td++) {
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
size[0] = size[1] = size[2] = 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +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
|
|
|
for(i = 0, td=t->data; i < t->total; i++, td++) {
|
|
|
|
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
|
|
|
|
2009-09-10 11:04:53 +00:00
|
|
|
if(t->flag & T_2D_EDIT)
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
int Align(TransInfo *t, short mval[2])
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
float center[3];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* saving original center */
|
|
|
|
VECCOPY(center, t->center);
|
|
|
|
|
|
|
|
for(i = 0 ; i < t->total; i++, td++)
|
|
|
|
{
|
|
|
|
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)) {
|
|
|
|
VECCOPY(t->center, td->center);
|
|
|
|
}
|
|
|
|
else {
|
2009-06-23 00:41:55 +00:00
|
|
|
if(t->settings->selectmode & SCE_SELECT_FACE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(t->center, td->center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 */
|
|
|
|
VECCOPY(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->ndof.axis = 1|2;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void applySeqSlide(TransInfo *t, float val[2]) {
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
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];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int SeqSlide(TransInfo *t, short mval[2])
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
VECCOPY(t->values, tvec);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
applyNDofInput(&t->ndof, t->values);
|
|
|
|
snapGrid(t, t->values);
|
|
|
|
applyNumInput(&t->num, t->values);
|
|
|
|
}
|
|
|
|
|
|
|
|
t->values[0] = floor(t->values[0] + 0.5);
|
|
|
|
t->values[1] = floor(t->values[1] + 0.5);
|
|
|
|
|
|
|
|
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
|
|
|
|
*/
|
2009-06-23 13:25:31 +00:00
|
|
|
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, 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) {
|
2008-12-29 06:06:59 +00:00
|
|
|
const Scene *scene= t->scene;
|
|
|
|
const short doTime= getAnimEdit_DrawTime(t);
|
|
|
|
const double secf= FPS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
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
|
|
|
/* 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);
|
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
|
|
|
/* do the snapping to nearest frame/second */
|
|
|
|
if (doTime)
|
|
|
|
val= (float)( floor((val/secf) + 0.5f) * secf );
|
|
|
|
else
|
|
|
|
val= (float)( floor(val+0.5f) );
|
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
|
|
|
/* 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;
|
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
|
|
|
/* 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);
|
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
|
|
|
/* 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);
|
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
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------------- 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
|
|
|
{
|
|
|
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* initialise 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)
|
|
|
|
val= floor(val/secf + 0.5f);
|
|
|
|
else
|
|
|
|
val= floor(val + 0.5f);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (doTime)
|
|
|
|
val= val / secf;
|
|
|
|
}
|
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]);
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
static void applyTimeTranslate(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;
|
|
|
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 deltax, 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
|
|
|
/* 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-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
|
|
|
|
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)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
deltax= (float)( floor((deltax/secf) + 0.5f) * secf );
|
|
|
|
else
|
|
|
|
deltax= (float)( floor(deltax + 0.5f) );
|
|
|
|
}
|
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)
|
|
|
|
val= (float)( floor((deltax/secf) + 0.5f) * secf );
|
|
|
|
else
|
|
|
|
val= (float)( floor(val + 0.5f) );
|
|
|
|
}
|
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 */
|
2009-06-23 13:25:31 +00:00
|
|
|
doAnimEdit_SnapFrame(t, td, 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int TimeTranslate(TransInfo *t, short 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;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* initialise 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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int TimeSlide(TransInfo *t, short 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 */
|
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
|
|
|
|
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]);
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = (maxx-minx) * t->vec[0] / 2.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
|
|
|
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];
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
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
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* initialise 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
|
|
|
}
|
|
|
|
|
|
|
|
static void headerTimeScale(TransInfo *t, char *str) {
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void applyTimeScale(TransInfo *t) {
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
TransData *td = t->data;
|
|
|
|
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
|
|
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (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;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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)
|
|
|
|
fac= (float)( floor(fac/secf + 0.5f) * secf );
|
|
|
|
else
|
|
|
|
fac= (float)( floor(fac + 0.5f) );
|
|
|
|
}
|
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 */
|
2009-06-23 13:25:31 +00:00
|
|
|
doAnimEdit_SnapFrame(t, td, 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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
int TimeScale(TransInfo *t, short 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************ */
|
|
|
|
|
|
|
|
void BIF_TransformSetUndo(char *str)
|
|
|
|
{
|
|
|
|
// TRANSFORM_FIX_ME
|
|
|
|
//Trans.undostr= str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void NDofTransform()
|
|
|
|
{
|
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
|
|
|
float fval[7];
|
|
|
|
float maxval = 50.0f; // also serves as threshold
|
|
|
|
int axis = -1;
|
|
|
|
int mode = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
getndof(fval);
|
|
|
|
|
|
|
|
for(i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
float val = fabs(fval[i]);
|
|
|
|
if (val > maxval)
|
|
|
|
{
|
|
|
|
axis = i;
|
|
|
|
maxval = 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
|
|
|
switch(axis)
|
|
|
|
{
|
|
|
|
case -1:
|
|
|
|
/* No proper axis found */
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
mode = TFM_TRANSLATION;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
mode = TFM_ROTATION;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
case 5:
|
|
|
|
mode = TFM_TRACKBALL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printf("ndof: what we are doing here ?");
|
|
|
|
}
|
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 (mode != 0)
|
|
|
|
{
|
|
|
|
initTransform(mode, CTX_NDOF);
|
|
|
|
Transform();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|