2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup edtransform
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "DNA_gpencil_types.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2018-05-25 22:24:24 +05:30
|
|
|
#include "DNA_mesh_types.h"
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2013-01-12 20:01:09 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
#include "BLI_rect.h"
|
2012-10-05 13:22:09 +00:00
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
#include "BKE_context.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BKE_editmesh.h"
|
2012-09-13 05:29:38 +00:00
|
|
|
#include "BKE_mask.h"
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "BKE_scene.h"
|
2017-07-21 11:53:13 +02:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "ED_clip.h"
|
|
|
|
#include "ED_gpencil.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"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "ED_node.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-01-07 16:52:18 +00:00
|
|
|
#include "WM_api.h"
|
2020-06-02 18:00:52 +10:00
|
|
|
#include "WM_message.h"
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "WM_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
|
|
|
|
2012-10-05 13:22:09 +00:00
|
|
|
#include "UI_interface_icons.h"
|
2009-04-30 11:47:35 +00:00
|
|
|
#include "UI_resources.h"
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "UI_view2d.h"
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2013-01-12 20:01:09 +00:00
|
|
|
#include "RNA_access.h"
|
|
|
|
|
|
|
|
#include "BLF_api.h"
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-01-12 20:01:09 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "transform.h"
|
2020-02-28 21:25:47 -03:00
|
|
|
#include "transform_constraints.h"
|
2019-09-05 14:34:54 -03:00
|
|
|
#include "transform_convert.h"
|
2019-12-20 18:16:44 +11:00
|
|
|
#include "transform_draw_cursors.h"
|
2020-02-14 08:42:17 -03:00
|
|
|
#include "transform_mode.h"
|
2020-10-08 11:42:14 -03:00
|
|
|
#include "transform_orientations.h"
|
2019-10-29 00:45:05 +11:00
|
|
|
#include "transform_snap.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
|
|
|
|
2019-04-17 08:44:58 +02:00
|
|
|
/* Disabling, since when you type you know what you are doing,
|
|
|
|
* and being able to set it to zero is handy. */
|
2014-07-22 01:24:43 +10:00
|
|
|
/* #define USE_NUM_NO_ZERO */
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void drawTransformApply(const struct bContext *C, ARegion *region, void *arg);
|
2010-02-03 21:01:41 +00:00
|
|
|
|
2021-04-28 13:13:43 -05:00
|
|
|
static void initSnapSpatial(TransInfo *t, float r_snap[2]);
|
2015-05-25 10:35:54 +10:00
|
|
|
|
2014-11-27 21:37:42 +01:00
|
|
|
bool transdata_check_local_islands(TransInfo *t, short around)
|
|
|
|
{
|
2020-04-06 14:49:29 +02:00
|
|
|
return ((around == V3D_AROUND_LOCAL_ORIGINS) && ((ELEM(t->obedit_type, OB_MESH, OB_GPENCIL))));
|
2014-11-27 21:37:42 +01:00
|
|
|
}
|
|
|
|
|
2018-09-27 15:49:59 +02:00
|
|
|
/* ************************** SPACE DEPENDENT 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
|
|
|
|
|
|
|
void setTransformViewMatrices(TransInfo *t)
|
|
|
|
{
|
2020-12-28 16:19:23 -03:00
|
|
|
if (!(t->options & CTX_PAINT_CURVE) && (t->spacetype == SPACE_VIEW3D) && t->region &&
|
|
|
|
(t->region->regiontype == RGN_TYPE_WINDOW)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
RegionView3D *rv3d = t->region->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);
|
2018-04-16 16:27:55 +02:00
|
|
|
calculateCenterLocal(t, t->center_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
|
|
|
}
|
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
void setTransformViewAspect(TransInfo *t, float r_aspect[3])
|
|
|
|
{
|
|
|
|
copy_v3_fl(r_aspect, 1.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
ED_space_image_get_aspect(sima, &r_aspect[0], &r_aspect[1]);
|
|
|
|
}
|
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ED_space_image_get_uv_aspect(sima, &r_aspect[0], &r_aspect[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceClip *sclip = t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
|
|
|
ED_space_clip_get_aspect_dimension_aware(sclip, &r_aspect[0], &r_aspect[1]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ED_space_clip_get_aspect(sclip, &r_aspect[0], &r_aspect[1]);
|
|
|
|
}
|
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Depends on context of usage. */
|
2015-06-26 15:45:09 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-25 19:36:59 +00:00
|
|
|
static void convertViewVec2D(View2D *v2d, float r_vec[3], int dx, int dy)
|
2011-11-02 00:17:37 +00:00
|
|
|
{
|
2016-01-22 02:44:33 -05:00
|
|
|
float divx = BLI_rcti_size_x(&v2d->mask);
|
|
|
|
float divy = BLI_rcti_size_y(&v2d->mask);
|
2011-11-02 00:17:37 +00:00
|
|
|
|
2012-09-15 11:48:20 +00:00
|
|
|
r_vec[0] = BLI_rctf_size_x(&v2d->cur) * dx / divx;
|
|
|
|
r_vec[1] = BLI_rctf_size_y(&v2d->cur) * dy / divy;
|
2012-07-25 19:36:59 +00:00
|
|
|
r_vec[2] = 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy)
|
|
|
|
{
|
2016-01-22 02:44:33 -05:00
|
|
|
float divx = BLI_rcti_size_x(&v2d->mask);
|
|
|
|
float divy = BLI_rcti_size_y(&v2d->mask);
|
2012-07-25 19:36:59 +00:00
|
|
|
|
2016-01-22 02:44:33 -05:00
|
|
|
float mulx = BLI_rctf_size_x(&v2d->cur);
|
|
|
|
float muly = BLI_rctf_size_y(&v2d->cur);
|
2012-07-25 19:36:59 +00:00
|
|
|
|
|
|
|
/* difference with convertViewVec2D */
|
|
|
|
/* clamp w/h, mask only */
|
|
|
|
if (mulx / divx < muly / divy) {
|
|
|
|
divy = divx;
|
|
|
|
muly = mulx;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
divx = divy;
|
|
|
|
mulx = muly;
|
|
|
|
}
|
|
|
|
/* end difference */
|
|
|
|
|
|
|
|
r_vec[0] = mulx * dx / divx;
|
|
|
|
r_vec[1] = muly * dy / divy;
|
|
|
|
r_vec[2] = 0.0f;
|
2011-11-02 00:17:37 +00:00
|
|
|
}
|
|
|
|
|
2015-10-30 17:31:07 +11:00
|
|
|
void convertViewVec(TransInfo *t, float r_vec[3], double dx, double 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
|
|
|
{
|
2020-03-06 16:56:42 +01:00
|
|
|
if ((t->spacetype == SPACE_VIEW3D) && (t->region->regiontype == RGN_TYPE_WINDOW)) {
|
2014-07-21 12:02:05 +02:00
|
|
|
if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
r_vec[0] = dx;
|
|
|
|
r_vec[1] = dy;
|
|
|
|
}
|
2014-10-06 21:49:38 +02:00
|
|
|
else {
|
|
|
|
const float mval_f[2] = {(float)dx, (float)dy};
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_view3d_win_to_delta(t->region, mval_f, r_vec, t->zfac);
|
2014-07-21 12:02:05 +02:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2012-07-25 19:36:59 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
convertViewVec2D_mask(t->view, r_vec, dx, dy);
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
r_vec[0] = dx;
|
|
|
|
r_vec[1] = dy;
|
|
|
|
}
|
2012-07-25 19:36:59 +00:00
|
|
|
else {
|
|
|
|
convertViewVec2D(t->view, r_vec, dx, dy);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
r_vec[0] *= t->aspect[0];
|
|
|
|
r_vec[1] *= t->aspect[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
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
|
2012-03-12 06:53:47 +00:00
|
|
|
convertViewVec2D(t->view, r_vec, dx, dy);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (ELEM(t->spacetype, SPACE_NODE, SPACE_SEQ)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
convertViewVec2D(&t->region->v2d, r_vec, dx, dy);
|
2009-01-04 01:08:01 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2012-06-04 16:42:58 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
2012-07-25 19:36:59 +00:00
|
|
|
convertViewVec2D_mask(t->view, r_vec, dx, dy);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
convertViewVec2D(t->view, r_vec, dx, dy);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
r_vec[0] *= t->aspect[0];
|
|
|
|
r_vec[1] *= t->aspect[1];
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2012-03-08 01:22:49 +00:00
|
|
|
else {
|
|
|
|
printf("%s: called in an invalid context\n", __func__);
|
2012-03-12 06:53:47 +00:00
|
|
|
zero_v3(r_vec);
|
2012-03-08 01:22:49 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2013-02-28 11:29:27 +00:00
|
|
|
void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (t->region->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
if (ED_view3d_project_int_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* this is what was done in 2.64, perhaps we can be smarter? */
|
|
|
|
adr[0] = (int)2140000000.0f;
|
2012-10-04 17:52:12 +00:00
|
|
|
adr[1] = (int)2140000000.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
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-26 21:22:42 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
float v[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-13 05:29:38 +00:00
|
|
|
BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_image_point_pos__reverse(sima, t->region, v, v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-26 21:22:42 +00:00
|
|
|
adr[0] = v[0];
|
|
|
|
adr[1] = v[1];
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
adr[0] = vec[0];
|
|
|
|
adr[1] = vec[1];
|
|
|
|
}
|
2012-07-26 22:41:40 +00:00
|
|
|
else {
|
2015-06-26 15:45:09 +10:00
|
|
|
float v[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region(t->view, v[0], v[1], &adr[0], &adr[1]);
|
2012-07-26 21:22: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
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2009-01-15 04:13:38 +00:00
|
|
|
int out[2] = {0, 0};
|
2011-05-01 10:14:09 +00:00
|
|
|
#if 0
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceAction *sact = t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
if (sact->flag & SACTION_DRAWTIME) {
|
|
|
|
// vec[0] = vec[0] / ((t->scene->r.frs_sec / t->scene->r.frs_sec_base));
|
2011-05-01 10:14:09 +00:00
|
|
|
/* same as below */
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-05-01 10:14:09 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
|
2010-05-06 19:54:43 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
adr[0] = out[0];
|
|
|
|
adr[1] = out[1];
|
2010-05-06 19:54:43 +00:00
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA)) {
|
2009-01-15 04:13:38 +00:00
|
|
|
int out[2] = {0, 0};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
|
2012-06-10 19:59:02 +00:00
|
|
|
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
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_SEQ) { /* XXX not tested yet, but should work */
|
2009-01-23 23:14:02 +00:00
|
|
|
int out[2] = {0, 0};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &out[0], &out[1]);
|
2012-06-10 19:59:02 +00:00
|
|
|
adr[0] = out[0];
|
|
|
|
adr[1] = out[1];
|
2009-01-23 23:14:02 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceClip *sc = t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-09-13 05:29:38 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
2014-02-17 12:58:50 +06:00
|
|
|
MovieClip *clip = ED_space_clip_get_clip(sc);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
if (clip) {
|
|
|
|
float v[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
ED_clip_point_stable_pos__reverse(sc, t->region, v, v);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
adr[0] = v[0];
|
|
|
|
adr[1] = v[1];
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
adr[0] = 0;
|
|
|
|
adr[1] = 0;
|
|
|
|
}
|
2012-07-26 21:22:42 +00:00
|
|
|
}
|
2012-09-13 05:29:38 +00:00
|
|
|
else if (t->options & CTX_MOVIECLIP) {
|
2015-06-26 15:45:09 +10:00
|
|
|
float v[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region(t->view, v[0], v[1], &adr[0], &adr[1]);
|
2012-09-13 05:29:38 +00:00
|
|
|
}
|
2012-09-26 19:23:06 +00:00
|
|
|
else {
|
|
|
|
BLI_assert(0);
|
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2012-07-10 13:50:51 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2014-04-21 16:47:16 +10:00
|
|
|
UI_view2d_view_to_region((View2D *)t->view, vec[0], vec[1], &adr[0], &adr[1]);
|
2012-07-10 13:50:51 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-02-28 11:29:27 +00:00
|
|
|
void projectIntView(TransInfo *t, const float vec[3], int adr[2])
|
|
|
|
{
|
|
|
|
projectIntViewEx(t, vec, adr, V3D_PROJ_TEST_NOP);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-02-28 11:29:27 +00:00
|
|
|
void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-03-12 06:53:47 +00:00
|
|
|
switch (t->spacetype) {
|
|
|
|
case SPACE_VIEW3D: {
|
2014-07-21 12:02:05 +02:00
|
|
|
if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
adr[0] = vec[0];
|
|
|
|
adr[1] = vec[1];
|
|
|
|
}
|
2020-03-06 16:56:42 +01:00
|
|
|
else if (t->region->regiontype == RGN_TYPE_WINDOW) {
|
2020-09-30 20:09:02 +10:00
|
|
|
/* allow points behind the view T33643. */
|
2020-03-06 16:56:42 +01:00
|
|
|
if (ED_view3d_project_float_global(t->region, vec, adr, flag) != V3D_PROJ_RET_OK) {
|
2012-10-05 03:57:56 +00:00
|
|
|
/* XXX, 2.64 and prior did this, weak! */
|
2020-03-06 16:56:42 +01:00
|
|
|
adr[0] = t->region->winx / 2.0f;
|
|
|
|
adr[1] = t->region->winy / 2.0f;
|
2012-10-05 03:57:56 +00:00
|
|
|
}
|
2012-03-12 06:53:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2013-12-30 19:23:29 +11:00
|
|
|
default: {
|
|
|
|
int a[2] = {0, 0};
|
2012-03-12 06:53:47 +00:00
|
|
|
projectIntView(t, vec, a);
|
|
|
|
adr[0] = a[0];
|
|
|
|
adr[1] = a[1];
|
2013-12-30 19:23:29 +11:00
|
|
|
break;
|
2012-03-12 06:53:47 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2013-02-28 11:29:27 +00:00
|
|
|
void projectFloatView(TransInfo *t, const float vec[3], float adr[2])
|
|
|
|
{
|
|
|
|
projectFloatViewEx(t, vec, adr, V3D_PROJ_TEST_NOP);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-05-12 22:13:38 +00:00
|
|
|
void applyAspectRatio(TransInfo *t, float vec[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2014-07-21 12:02:05 +02:00
|
|
|
if ((t->spacetype == SPACE_IMAGE) && (t->mode == TFM_TRANSLATION) &&
|
|
|
|
!(t->options & CTX_PAINT_CURVE)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = t->area->spacedata.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-06-10 19:59:02 +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;
|
2012-07-25 16:30:53 +00:00
|
|
|
ED_space_image_get_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
|
|
|
}
|
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
vec[0] /= t->aspect[0];
|
|
|
|
vec[1] /= t->aspect[1];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if ((t->spacetype == SPACE_CLIP) && (t->mode == TFM_TRANSLATION)) {
|
2012-06-04 16:42:58 +00:00
|
|
|
if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
|
2015-06-26 15:45:09 +10:00
|
|
|
vec[0] /= t->aspect[0];
|
|
|
|
vec[1] /= t->aspect[1];
|
2012-04-29 12:32:26 +00:00
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2012-05-12 22:13:38 +00:00
|
|
|
void removeAspectRatio(TransInfo *t, float vec[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((t->spacetype == SPACE_IMAGE) && (t->mode == TFM_TRANSLATION)) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = t->area->spacedata.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-06-10 19:59:02 +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;
|
2012-07-25 16:30:53 +00:00
|
|
|
ED_space_image_get_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;
|
|
|
|
}
|
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
vec[0] *= t->aspect[0];
|
|
|
|
vec[1] *= t->aspect[1];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if ((t->spacetype == SPACE_CLIP) && (t->mode == TFM_TRANSLATION)) {
|
2012-06-04 16:42:58 +00:00
|
|
|
if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
|
2015-06-26 15:45:09 +10:00
|
|
|
vec[0] *= t->aspect[0];
|
|
|
|
vec[1] *= t->aspect[1];
|
2012-04-29 12:32:26 +00:00
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2015-01-07 13:19:49 +13:00
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
2018-07-31 10:22:19 +02:00
|
|
|
bGPdata *gpd = ED_gpencil_data_get_active(C);
|
|
|
|
if (gpd) {
|
2018-12-06 17:52:37 +01:00
|
|
|
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
2015-01-07 13:19:49 +13:00
|
|
|
WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL);
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_VIEW3D) {
|
2014-07-21 12:02:05 +02:00
|
|
|
if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
wmWindow *window = CTX_wm_window(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
WM_paint_cursor_tag_redraw(window, t->region);
|
2014-07-21 12:02:05 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Do we need more refined tags? */
|
2021-02-05 11:56:43 -03:00
|
|
|
if (t->options & CTX_POSE_BONE) {
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
else {
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-28 00:34:14 +11:00
|
|
|
/* For real-time animation record - send notifiers recognized by animation editors */
|
2014-07-21 12:02:05 +02:00
|
|
|
/* XXX: is this notifier a lame duck? */
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
2014-07-21 12:02:05 +02:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2020-04-03 13:25:03 +02:00
|
|
|
// SpaceAction *saction = (SpaceAction *)t->area->spacedata.first;
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
2008-12-29 06:06:59 +00:00
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2020-04-03 13:25:03 +02:00
|
|
|
// SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
2009-01-27 11:09:30 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, NULL);
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2020-04-03 13:25:03 +02:00
|
|
|
// ED_area_tag_redraw(t->area);
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
|
2009-01-02 23:58:03 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_SEQ) {
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, NULL);
|
2021-02-05 16:23:34 +11:00
|
|
|
/* Key-frames on strips has been moved, so make sure related editors are informed. */
|
2019-07-03 16:30:34 +02:00
|
|
|
WM_event_add_notifier(C, NC_ANIMATION, NULL);
|
2009-01-21 07:01:20 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2012-07-25 16:03:08 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
Mask *mask = CTX_data_edit_mask(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-07-25 16:03:08 +00:00
|
|
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
wmWindow *window = CTX_wm_window(C);
|
2020-03-06 16:56:42 +01:00
|
|
|
WM_paint_cursor_tag_redraw(window, t->region);
|
2014-07-21 12:02:05 +02:00
|
|
|
}
|
2021-02-05 11:56:43 -03:00
|
|
|
else if (t->options & CTX_CURSOR) {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(t->area);
|
2019-03-07 13:48:29 +11:00
|
|
|
}
|
2012-07-25 16:03:08 +00:00
|
|
|
else {
|
|
|
|
/* XXX how to deal with lock? */
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceImage *sima = (SpaceImage *)t->area->spacedata.first;
|
2018-04-16 16:27:55 +02:00
|
|
|
if (sima->lock) {
|
|
|
|
WM_event_add_notifier(C, NC_GEOM | ND_DATA, OBEDIT_FROM_VIEW_LAYER(t->view_layer)->data);
|
|
|
|
}
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_tag_redraw(t->area);
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2012-07-25 16:03:08 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceClip *sc = (SpaceClip *)t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-19 14:26:29 +00:00
|
|
|
if (ED_space_clip_check_show_trackedit(sc)) {
|
|
|
|
MovieClip *clip = ED_space_clip_get_clip(sc);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
/* objects could be parented to tracking data, so send this for viewport refresh */
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, clip);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
2012-06-19 14:26:29 +00:00
|
|
|
else if (ED_space_clip_check_show_maskedit(sc)) {
|
2012-07-25 16:03:08 +00:00
|
|
|
Mask *mask = CTX_data_edit_mask(C);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_MASK | NA_EDITED, mask);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2011-02-07 16:41:57 +00:00
|
|
|
static void viewRedrawPost(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2020-04-03 13:25:03 +02:00
|
|
|
ED_area_status_text(t->area, NULL);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2010-02-21 11:42:32 +00:00
|
|
|
/* if autokeying is enabled, send notifiers that keyframes were added */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (IS_AUTOKEY_ON(t->scene)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-11-10 03:05:08 +00:00
|
|
|
/* redraw UV editor */
|
2020-07-01 17:45:27 +10:00
|
|
|
const char uvcalc_correct_flag = ELEM(t->mode, TFM_VERT_SLIDE, TFM_EDGE_SLIDE) ?
|
|
|
|
UVCALC_TRANSFORM_CORRECT_SLIDE :
|
|
|
|
UVCALC_TRANSFORM_CORRECT;
|
|
|
|
|
|
|
|
if ((t->data_type == TC_MESH_VERTS) && (t->settings->uvcalc_flag & uvcalc_correct_flag)) {
|
2012-11-10 03:05:08 +00:00
|
|
|
WM_event_add_notifier(C, NC_GEOM | ND_DATA, NULL);
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-02-07 16:41:57 +00:00
|
|
|
/* XXX temp, first hack to get auto-render in compositor work (ton) */
|
2012-06-10 19:59:02 +00:00
|
|
|
WM_event_add_notifier(C, NC_SCENE | ND_TRANSFORM_DONE, CTX_data_scene(C));
|
2010-02-21 11:42:32 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#if 0 /* TRANSFORM_FIX_ME */
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
allqueue(REDRAWIMAGE, 0);
|
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA, SPACE_GRAPH)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
allqueue(REDRAWVIEW3D, 0);
|
|
|
|
allqueue(REDRAWACTION, 0);
|
|
|
|
allqueue(REDRAWNLA, 0);
|
|
|
|
allqueue(REDRAWIPO, 0);
|
|
|
|
allqueue(REDRAWTIME, 0);
|
|
|
|
allqueue(REDRAWBUTSOBJECT, 0);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
scrarea_queue_headredraw(curarea);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************************************* */
|
|
|
|
|
2018-07-09 08:41:48 +02:00
|
|
|
static bool transform_modal_item_poll(const wmOperator *op, int value)
|
|
|
|
{
|
|
|
|
const TransInfo *t = op->customdata;
|
|
|
|
switch (value) {
|
2018-12-14 14:54:05 +01:00
|
|
|
case TFM_MODAL_CANCEL: {
|
2020-09-03 12:33:28 -03:00
|
|
|
/* TODO: Canceling with LMB is not possible when the operator is activated
|
|
|
|
* through tweak and the LMB is pressed.
|
|
|
|
* Therefore, this item should not appear in the status bar. */
|
2018-12-14 14:54:05 +01:00
|
|
|
break;
|
|
|
|
}
|
2018-07-09 08:41:48 +02:00
|
|
|
case TFM_MODAL_PROPSIZE:
|
|
|
|
case TFM_MODAL_PROPSIZE_UP:
|
|
|
|
case TFM_MODAL_PROPSIZE_DOWN: {
|
|
|
|
if ((t->flag & T_PROP_EDIT) == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TFM_MODAL_ADD_SNAP:
|
|
|
|
case TFM_MODAL_REMOVE_SNAP: {
|
|
|
|
if (t->spacetype != SPACE_VIEW3D) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-07-03 17:25:04 +02:00
|
|
|
if ((t->tsnap.mode & ~(SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) == 0) {
|
2018-07-09 17:58:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
2020-07-03 17:25:04 +02:00
|
|
|
if (!validSnap(t)) {
|
2018-07-09 17:58:58 +02:00
|
|
|
return false;
|
|
|
|
}
|
2018-07-09 08:41:48 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-07-09 18:25:25 +02:00
|
|
|
case TFM_MODAL_AXIS_X:
|
|
|
|
case TFM_MODAL_AXIS_Y:
|
2018-07-09 08:41:48 +02:00
|
|
|
case TFM_MODAL_AXIS_Z:
|
|
|
|
case TFM_MODAL_PLANE_X:
|
|
|
|
case TFM_MODAL_PLANE_Y:
|
2020-12-04 12:30:52 -03:00
|
|
|
case TFM_MODAL_PLANE_Z:
|
|
|
|
case TFM_MODAL_AUTOCONSTRAINTPLANE: {
|
2018-07-09 18:25:25 +02:00
|
|
|
if (t->flag & T_NO_CONSTRAINT) {
|
2018-07-09 08:41:48 +02:00
|
|
|
return false;
|
|
|
|
}
|
2018-07-09 18:25:25 +02:00
|
|
|
if (!ELEM(value, TFM_MODAL_AXIS_X, TFM_MODAL_AXIS_Y)) {
|
|
|
|
if (t->flag & T_2D_EDIT) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-07-09 08:41:48 +02:00
|
|
|
break;
|
|
|
|
}
|
2018-07-09 17:58:58 +02:00
|
|
|
case TFM_MODAL_CONS_OFF: {
|
|
|
|
if ((t->con.mode & CON_APPLY) == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2018-07-09 08:41:48 +02:00
|
|
|
case TFM_MODAL_EDGESLIDE_UP:
|
|
|
|
case TFM_MODAL_EDGESLIDE_DOWN: {
|
|
|
|
if (t->mode != TFM_EDGE_SLIDE) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TFM_MODAL_INSERTOFS_TOGGLE_DIR: {
|
|
|
|
if (t->spacetype != SPACE_NODE) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case TFM_MODAL_AUTOIK_LEN_INC:
|
|
|
|
case TFM_MODAL_AUTOIK_LEN_DEC: {
|
|
|
|
if ((t->flag & T_AUTOIK) == 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-12-07 17:36:11 -03:00
|
|
|
case TFM_MODAL_TRANSLATE:
|
|
|
|
case TFM_MODAL_ROTATE:
|
|
|
|
case TFM_MODAL_RESIZE: {
|
|
|
|
if (!transform_mode_is_changeable(t->mode)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2018-07-09 08:41:48 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
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 */
|
2012-06-10 19:59:02 +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
|
|
|
{
|
2017-10-18 15:07:26 +11:00
|
|
|
static const EnumPropertyItem modal_items[] = {
|
2012-06-10 19:59:02 +00:00
|
|
|
{TFM_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""},
|
2018-07-09 07:29:12 +02:00
|
|
|
{TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
|
2020-10-24 11:42:17 -07:00
|
|
|
{TFM_MODAL_AXIS_X, "AXIS_X", 0, "X Axis", ""},
|
|
|
|
{TFM_MODAL_AXIS_Y, "AXIS_Y", 0, "Y Axis", ""},
|
|
|
|
{TFM_MODAL_AXIS_Z, "AXIS_Z", 0, "Z Axis", ""},
|
|
|
|
{TFM_MODAL_PLANE_X, "PLANE_X", 0, "X Plane", ""},
|
|
|
|
{TFM_MODAL_PLANE_Y, "PLANE_Y", 0, "Y Plane", ""},
|
|
|
|
{TFM_MODAL_PLANE_Z, "PLANE_Z", 0, "Z Plane", ""},
|
2018-07-09 07:39:26 +02:00
|
|
|
{TFM_MODAL_CONS_OFF, "CONS_OFF", 0, "Clear Constraints", ""},
|
2018-07-10 07:41:49 +02:00
|
|
|
{TFM_MODAL_SNAP_INV_ON, "SNAP_INV_ON", 0, "Snap Invert", ""},
|
|
|
|
{TFM_MODAL_SNAP_INV_OFF, "SNAP_INV_OFF", 0, "Snap Invert (Off)", ""},
|
2018-07-09 07:29:12 +02:00
|
|
|
{TFM_MODAL_SNAP_TOGGLE, "SNAP_TOGGLE", 0, "Snap Toggle", ""},
|
2012-06-10 19:59:02 +00:00
|
|
|
{TFM_MODAL_ADD_SNAP, "ADD_SNAP", 0, "Add Snap Point", ""},
|
|
|
|
{TFM_MODAL_REMOVE_SNAP, "REMOVE_SNAP", 0, "Remove Last Snap Point", ""},
|
|
|
|
{NUM_MODAL_INCREMENT_UP, "INCREMENT_UP", 0, "Numinput Increment Up", ""},
|
|
|
|
{NUM_MODAL_INCREMENT_DOWN, "INCREMENT_DOWN", 0, "Numinput Increment Down", ""},
|
|
|
|
{TFM_MODAL_PROPSIZE_UP, "PROPORTIONAL_SIZE_UP", 0, "Increase Proportional Influence", ""},
|
|
|
|
{TFM_MODAL_PROPSIZE_DOWN,
|
|
|
|
"PROPORTIONAL_SIZE_DOWN",
|
|
|
|
0,
|
|
|
|
"Decrease Proportional Influence",
|
|
|
|
""},
|
|
|
|
{TFM_MODAL_AUTOIK_LEN_INC, "AUTOIK_CHAIN_LEN_UP", 0, "Increase Max AutoIK Chain Length", ""},
|
|
|
|
{TFM_MODAL_AUTOIK_LEN_DEC,
|
|
|
|
"AUTOIK_CHAIN_LEN_DOWN",
|
|
|
|
0,
|
|
|
|
"Decrease Max AutoIK Chain Length",
|
|
|
|
""},
|
2020-10-24 11:42:17 -07:00
|
|
|
{TFM_MODAL_EDGESLIDE_UP, "EDGESLIDE_EDGE_NEXT", 0, "Select Next Edge Slide Edge", ""},
|
|
|
|
{TFM_MODAL_EDGESLIDE_DOWN, "EDGESLIDE_PREV_NEXT", 0, "Select Previous Edge Slide Edge", ""},
|
2013-01-01 14:06:02 +00:00
|
|
|
{TFM_MODAL_PROPSIZE, "PROPORTIONAL_SIZE", 0, "Adjust Proportional Influence", ""},
|
2015-08-01 17:39:48 +02:00
|
|
|
{TFM_MODAL_INSERTOFS_TOGGLE_DIR,
|
|
|
|
"INSERTOFS_TOGGLE_DIR",
|
|
|
|
0,
|
2020-10-24 11:42:17 -07:00
|
|
|
"Toggle Direction for Node Auto-Offset",
|
2015-08-01 17:39:48 +02:00
|
|
|
""},
|
2018-09-06 12:13:01 +02:00
|
|
|
{TFM_MODAL_TRANSLATE, "TRANSLATE", 0, "Move", ""},
|
2018-07-09 07:29:12 +02:00
|
|
|
{TFM_MODAL_ROTATE, "ROTATE", 0, "Rotate", ""},
|
|
|
|
{TFM_MODAL_RESIZE, "RESIZE", 0, "Resize", ""},
|
2020-09-03 17:57:42 -03:00
|
|
|
{TFM_MODAL_AUTOCONSTRAINT, "AUTOCONSTRAIN", 0, "Automatic Constraint", ""},
|
2020-11-05 21:26:54 +01:00
|
|
|
{TFM_MODAL_AUTOCONSTRAINTPLANE, "AUTOCONSTRAINPLANE", 0, "Automatic Constraint Plane", ""},
|
2021-02-09 12:28:51 -03:00
|
|
|
{TFM_MODAL_PRECISION, "PRECISION", 0, "Precision Mode", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-06-10 19:59:02 +00:00
|
|
|
};
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-04 15:30:24 +11:00
|
|
|
wmKeyMap *keymap = WM_modalkeymap_ensure(keyconf, "Transform Modal Map", modal_items);
|
2018-07-09 08:41:48 +02:00
|
|
|
keymap->poll_modal_item = transform_modal_item_poll;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-01 09:37:43 -03:00
|
|
|
/* Default modal map values:
|
|
|
|
*
|
|
|
|
* \code{.c}
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_RETKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CONFIRM);
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_ESCKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_CANCEL);
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_PAGEUPKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_INC);
|
|
|
|
* WM_modalkeymap_add_item(
|
|
|
|
* keymap, EVT_PAGEDOWNKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOIK_LEN_DEC);
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_GKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_TRANSLATE);
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_RKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_ROTATE);
|
|
|
|
* WM_modalkeymap_add_item(keymap, EVT_SKEY, KM_PRESS, KM_ANY, 0, TFM_MODAL_RESIZE);
|
|
|
|
* WM_modalkeymap_add_item(keymap, MIDDLEMOUSE, KM_PRESS, KM_ANY, 0, TFM_MODAL_AUTOCONSTRAINT);
|
2020-09-23 10:45:47 -03:00
|
|
|
* WM_modalkeymap_add_item(
|
|
|
|
* keymap, MIDDLEMOUSE, KM_PRESS, KM_SHIFT, 0, TFM_MODAL_AUTOCONSTRAINTPLANE);
|
2020-09-01 09:37:43 -03:00
|
|
|
* \endcode
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-12-04 12:22:50 -03:00
|
|
|
static bool transform_event_modal_constraint(TransInfo *t, short modal_type)
|
2012-05-17 22:52:42 +00:00
|
|
|
{
|
2021-05-24 11:30:44 -03:00
|
|
|
if (t->flag & T_NO_CONSTRAINT) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t->flag & T_2D_EDIT && ELEM(modal_type, TFM_MODAL_AXIS_Z, TFM_MODAL_PLANE_Z)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
int constraint_curr = -1;
|
|
|
|
|
|
|
|
if (t->modifiers & (MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE)) {
|
|
|
|
t->modifiers &= ~(MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE);
|
|
|
|
|
|
|
|
/* Avoid changing orientation in this case. */
|
|
|
|
constraint_curr = -2;
|
|
|
|
}
|
|
|
|
else if (t->con.mode & CON_APPLY) {
|
|
|
|
constraint_curr = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
|
|
|
|
}
|
|
|
|
|
|
|
|
int constraint_new;
|
|
|
|
const char *msg_2d = "", *msg_3d = "";
|
|
|
|
|
|
|
|
/* Initialize */
|
|
|
|
switch (modal_type) {
|
|
|
|
case TFM_MODAL_AXIS_X:
|
|
|
|
msg_2d = TIP_("along X");
|
|
|
|
msg_3d = TIP_("along %s X");
|
|
|
|
constraint_new = CON_AXIS0;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AXIS_Y:
|
|
|
|
msg_2d = TIP_("along Y");
|
|
|
|
msg_3d = TIP_("along %s Y");
|
|
|
|
constraint_new = CON_AXIS1;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AXIS_Z:
|
|
|
|
msg_2d = TIP_("along Z");
|
|
|
|
msg_3d = TIP_("along %s Z");
|
|
|
|
constraint_new = CON_AXIS2;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_X:
|
|
|
|
msg_3d = TIP_("locking %s X");
|
|
|
|
constraint_new = CON_AXIS1 | CON_AXIS2;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_Y:
|
|
|
|
msg_3d = TIP_("locking %s Y");
|
|
|
|
constraint_new = CON_AXIS0 | CON_AXIS2;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PLANE_Z:
|
|
|
|
msg_3d = TIP_("locking %s Z");
|
|
|
|
constraint_new = CON_AXIS0 | CON_AXIS1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Invalid key */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (t->flag & T_2D_EDIT) {
|
|
|
|
BLI_assert(modal_type < TFM_MODAL_PLANE_X);
|
|
|
|
if (constraint_new == CON_AXIS2) {
|
2020-12-04 12:22:50 -03:00
|
|
|
return false;
|
|
|
|
}
|
2021-05-24 11:30:44 -03:00
|
|
|
if (constraint_curr == constraint_new) {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
setUserConstraint(t, constraint_new, msg_2d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
short orient_index = 1;
|
|
|
|
if (t->orient_curr == O_DEFAULT || ELEM(constraint_curr, -1, constraint_new)) {
|
|
|
|
/* Successive presses on existing axis, cycle orientation modes. */
|
|
|
|
orient_index = (short)((t->orient_curr + 1) % (int)ARRAY_SIZE(t->orient));
|
2012-05-17 22:52:42 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-05-24 11:30:44 -03:00
|
|
|
transform_orientations_current_set(t, orient_index);
|
|
|
|
if (orient_index == 0) {
|
|
|
|
stopConstraint(t);
|
2012-05-17 22:52:42 +00:00
|
|
|
}
|
2020-12-04 12:22:50 -03:00
|
|
|
else {
|
2021-05-24 11:30:44 -03:00
|
|
|
setUserConstraint(t, constraint_new, msg_3d);
|
2012-05-17 22:52:42 +00:00
|
|
|
}
|
|
|
|
}
|
2021-05-24 11:30:44 -03:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
return true;
|
2012-05-17 22:52:42 +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
|
|
|
|
2013-03-13 09:03:46 +00:00
|
|
|
int transformEvent(TransInfo *t, const wmEvent *event)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
bool handled = false;
|
2015-01-20 23:14:06 +11:00
|
|
|
const int modifiers_prev = t->modifiers;
|
2019-06-11 13:27:10 +10:00
|
|
|
const int mode_prev = t->mode;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
/* Handle modal numinput events first, if already activated. */
|
|
|
|
if (((event->val == KM_PRESS) || (event->type == EVT_MODAL_MAP)) && hasNumInput(&t->num) &&
|
|
|
|
handleNumInput(t->context, &(t->num), event)) {
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
else if (event->type == MOUSEMOVE) {
|
2021-05-24 11:35:33 -03:00
|
|
|
if (t->modifiers & (MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE)) {
|
2009-12-29 21:20:46 +00:00
|
|
|
t->con.mode |= CON_SELECT;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v2_v2_int(t->mval, event->mval);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Use this for soft redraw. Might cause flicker in object mode */
|
|
|
|
// t->redraw |= TREDRAW_SOFT;
|
2010-11-21 18:31:00 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
if (t->state == TRANS_STARTING) {
|
2010-03-22 09:30:00 +00:00
|
|
|
t->state = TRANS_RUNNING;
|
2009-11-12 19:49:26 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-12-26 20:23:07 +00:00
|
|
|
/* Snapping mouse move events. */
|
|
|
|
t->redraw |= handleSnapping(t, event);
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
handled = true;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2020-12-04 10:35:26 -03:00
|
|
|
/* handle modal keymap first */
|
|
|
|
/* enforce redraw of transform when modifiers are used */
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
else if (event->type == EVT_MODAL_MAP) {
|
2014-01-02 09:33:59 +01:00
|
|
|
switch (event->val) {
|
|
|
|
case TFM_MODAL_CANCEL:
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_CONFIRM:
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_TRANSLATE:
|
|
|
|
/* only switch when... */
|
2020-05-21 10:57:35 -03:00
|
|
|
if (t->mode == TFM_TRANSLATION) {
|
|
|
|
if ((t->obedit_type == OB_MESH) && (t->spacetype == SPACE_VIEW3D)) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
resetTransModal(t);
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
|
|
|
/* first try edge slide */
|
|
|
|
transform_mode_init(t, NULL, TFM_EDGE_SLIDE);
|
|
|
|
/* if that fails, do vertex slide */
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
resetTransModal(t);
|
|
|
|
t->state = TRANS_STARTING;
|
|
|
|
transform_mode_init(t, NULL, TFM_VERT_SLIDE);
|
|
|
|
}
|
|
|
|
/* vert slide can fail on unconnected vertices (rare but possible) */
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
2013-04-24 15:15:01 +00:00
|
|
|
resetTransModal(t);
|
2020-05-21 10:57:35 -03:00
|
|
|
t->state = TRANS_STARTING;
|
|
|
|
restoreTransObjects(t);
|
2013-01-13 14:22:37 +00:00
|
|
|
resetTransRestrictions(t);
|
2020-05-21 10:57:35 -03:00
|
|
|
transform_mode_init(t, NULL, TFM_TRANSLATION);
|
2013-01-13 14:22:37 +00:00
|
|
|
}
|
2020-05-21 10:57:35 -03:00
|
|
|
initSnapping(t, NULL); /* need to reinit after mode change */
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
else if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
|
2020-05-21 10:57:35 -03:00
|
|
|
restoreTransObjects(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-21 10:57:35 -03:00
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2020-05-21 10:57:35 -03:00
|
|
|
else if (transform_mode_is_changeable(t->mode)) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
resetTransModal(t);
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
transform_mode_init(t, NULL, TFM_TRANSLATION);
|
|
|
|
initSnapping(t, NULL); /* need to reinit after mode change */
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
break;
|
|
|
|
case TFM_MODAL_ROTATE:
|
|
|
|
/* only switch when... */
|
2021-02-05 11:56:43 -03:00
|
|
|
if (!(t->options & CTX_TEXTURE_SPACE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
|
2020-05-21 10:57:35 -03:00
|
|
|
if (transform_mode_is_changeable(t->mode)) {
|
2015-08-27 11:09:52 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
resetTransRestrictions(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
if (t->mode == TFM_ROTATION) {
|
2020-02-21 10:04:45 -03:00
|
|
|
transform_mode_init(t, NULL, TFM_TRACKBALL);
|
2011-01-06 14:19:46 +00:00
|
|
|
}
|
|
|
|
else {
|
2020-02-21 10:04:45 -03:00
|
|
|
transform_mode_init(t, NULL, TFM_ROTATION);
|
2011-01-06 14:19:46 +00:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
initSnapping(t, NULL); /* need to reinit after mode change */
|
2011-01-06 14:19:46 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
handled = true;
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
break;
|
|
|
|
case TFM_MODAL_RESIZE:
|
|
|
|
/* only switch when... */
|
2020-05-21 10:57:35 -03:00
|
|
|
if (t->mode == TFM_RESIZE) {
|
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
|
|
|
restoreTransObjects(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-21 10:57:35 -03:00
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (transform_mode_is_changeable(t->mode)) {
|
2014-01-02 09:33:59 +01:00
|
|
|
/* Scale isn't normally very useful after extrude along normals, see T39756 */
|
2020-05-22 12:34:29 -03:00
|
|
|
if ((t->con.mode & CON_APPLY) && (t->orient[t->orient_curr].type == V3D_ORIENT_NORMAL)) {
|
2014-01-02 09:33:59 +01:00
|
|
|
stopConstraint(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
restoreTransObjects(t);
|
|
|
|
resetTransModal(t);
|
|
|
|
resetTransRestrictions(t);
|
2020-02-21 10:04:45 -03:00
|
|
|
transform_mode_init(t, NULL, TFM_RESIZE);
|
2014-01-02 09:33:59 +01:00
|
|
|
initSnapping(t, NULL); /* need to reinit after mode change */
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
case TFM_MODAL_SNAP_INV_ON:
|
|
|
|
t->modifiers |= MOD_SNAP_INVERT;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_SNAP_INV_OFF:
|
|
|
|
t->modifiers &= ~MOD_SNAP_INVERT;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_SNAP_TOGGLE:
|
2018-07-10 06:51:25 +02:00
|
|
|
t->modifiers ^= MOD_SNAP;
|
2014-01-02 09:33:59 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AXIS_X:
|
|
|
|
case TFM_MODAL_AXIS_Y:
|
|
|
|
case TFM_MODAL_AXIS_Z:
|
|
|
|
case TFM_MODAL_PLANE_X:
|
|
|
|
case TFM_MODAL_PLANE_Y:
|
|
|
|
case TFM_MODAL_PLANE_Z:
|
2020-12-04 12:22:50 -03:00
|
|
|
if (transform_event_modal_constraint(t, event->val)) {
|
2014-01-02 09:33:59 +01:00
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_CONS_OFF:
|
2014-10-23 14:16:36 +02:00
|
|
|
if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
2014-01-02 09:33:59 +01:00
|
|
|
stopConstraint(t);
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
break;
|
|
|
|
case TFM_MODAL_ADD_SNAP:
|
|
|
|
addSnapPoint(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_REMOVE_SNAP:
|
|
|
|
removeSnapPoint(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PROPSIZE:
|
|
|
|
/* MOUSEPAN usage... */
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2015-03-19 20:09:34 +11:00
|
|
|
float fac = 1.0f + 0.005f * (event->y - event->prevy);
|
|
|
|
t->prop_size *= fac;
|
2016-06-23 16:43:12 +02:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
|
2019-02-16 12:21:44 +11:00
|
|
|
t->prop_size = max_ff(min_ff(t->prop_size, ((View3D *)t->view)->clip_end),
|
|
|
|
T_PROP_SIZE_MIN);
|
2016-06-23 16:43:12 +02:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->prop_size = max_ff(min_ff(t->prop_size, T_PROP_SIZE_MAX), T_PROP_SIZE_MIN);
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PROPSIZE_UP:
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2015-03-19 20:09:34 +11:00
|
|
|
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
|
2016-06-23 16:43:12 +02:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
|
2019-02-16 12:21:44 +11:00
|
|
|
t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
else {
|
2016-06-23 16:43:12 +02:00
|
|
|
t->prop_size = min_ff(t->prop_size, T_PROP_SIZE_MAX);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_PROPSIZE_DOWN:
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
|
|
|
t->prop_size /= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
|
|
|
|
t->prop_size = max_ff(t->prop_size, T_PROP_SIZE_MIN);
|
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TFM_MODAL_AUTOIK_LEN_INC:
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
transform_autoik_update(t, 1);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2015-08-01 17:39:48 +02:00
|
|
|
case TFM_MODAL_AUTOIK_LEN_DEC:
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
transform_autoik_update(t, -1);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
break;
|
2015-08-01 17:39:48 +02:00
|
|
|
case TFM_MODAL_INSERTOFS_TOGGLE_DIR:
|
|
|
|
if (t->spacetype == SPACE_NODE) {
|
2020-04-03 13:25:03 +02:00
|
|
|
SpaceNode *snode = (SpaceNode *)t->area->spacedata.first;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-03 13:25:03 +02:00
|
|
|
BLI_assert(t->area->spacetype == t->spacetype);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-08-01 17:39:48 +02:00
|
|
|
if (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_RIGHT) {
|
|
|
|
snode->insert_ofs_dir = SNODE_INSERTOFS_DIR_LEFT;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-08-01 17:39:48 +02:00
|
|
|
else if (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_LEFT) {
|
2015-05-08 10:29:59 +02:00
|
|
|
snode->insert_ofs_dir = SNODE_INSERTOFS_DIR_RIGHT;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-05-08 10:29:59 +02:00
|
|
|
else {
|
2015-08-01 17:39:48 +02:00
|
|
|
BLI_assert(0);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2015-05-08 10:29:59 +02:00
|
|
|
t->redraw |= TREDRAW_SOFT;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
break;
|
2020-09-01 09:37:43 -03:00
|
|
|
case TFM_MODAL_AUTOCONSTRAINT:
|
2020-09-23 10:45:47 -03:00
|
|
|
case TFM_MODAL_AUTOCONSTRAINTPLANE:
|
2020-12-04 10:49:45 -03:00
|
|
|
if ((t->flag & T_RELEASE_CONFIRM) && (event->prevval == KM_RELEASE) &&
|
|
|
|
event->prevtype == t->launch_event) {
|
|
|
|
/* Confirm transform if launch key is released after mouse move. */
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
else if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
2021-05-24 11:35:33 -03:00
|
|
|
if (t->modifiers & (MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE)) {
|
2020-11-26 13:42:48 -03:00
|
|
|
/* Confirm. */
|
|
|
|
postSelectConstraint(t);
|
2021-05-24 11:35:33 -03:00
|
|
|
t->modifiers &= ~(MOD_CONSTRAINT_SELECT_AXIS | MOD_CONSTRAINT_SELECT_PLANE);
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
else {
|
2021-02-05 11:56:43 -03:00
|
|
|
if (t->options & CTX_CAMERA) {
|
2020-11-26 13:42:48 -03:00
|
|
|
/* Exception for switching to dolly, or trackball, in camera view. */
|
|
|
|
if (t->mode == TFM_TRANSLATION) {
|
|
|
|
setLocalConstraint(t, (CON_AXIS2), TIP_("along local Z"));
|
|
|
|
}
|
|
|
|
else if (t->mode == TFM_ROTATION) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
transform_mode_init(t, NULL, TFM_TRACKBALL);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2021-05-24 11:35:33 -03:00
|
|
|
t->modifiers |= (event->val == TFM_MODAL_AUTOCONSTRAINT) ?
|
|
|
|
MOD_CONSTRAINT_SELECT_AXIS :
|
|
|
|
MOD_CONSTRAINT_SELECT_PLANE;
|
2020-11-26 13:42:48 -03:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
stopConstraint(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
initSelectConstraint(t);
|
|
|
|
postSelectConstraint(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
|
|
|
}
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
handled = true;
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
break;
|
2021-02-09 12:28:51 -03:00
|
|
|
case TFM_MODAL_PRECISION:
|
|
|
|
if (event->prevval == KM_PRESS) {
|
|
|
|
t->modifiers |= MOD_PRECISION;
|
|
|
|
/* Shift is modifier for higher precision transform. */
|
|
|
|
t->mouse.precision = 1;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
}
|
|
|
|
else if (event->prevval == KM_RELEASE) {
|
|
|
|
t->modifiers &= ~MOD_PRECISION;
|
|
|
|
t->mouse.precision = 0;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
}
|
|
|
|
break;
|
2020-09-01 09:37:43 -03:00
|
|
|
/* Those two are only handled in transform's own handler, see T44634! */
|
|
|
|
case TFM_MODAL_EDGESLIDE_UP:
|
|
|
|
case TFM_MODAL_EDGESLIDE_DOWN:
|
|
|
|
default:
|
2014-01-02 09:33:59 +01:00
|
|
|
break;
|
2020-09-01 09:37:43 -03:00
|
|
|
}
|
|
|
|
}
|
2020-12-04 10:35:26 -03:00
|
|
|
/* Else do non-mapped events. */
|
2020-09-01 09:37:43 -03:00
|
|
|
else if (event->val == KM_PRESS) {
|
|
|
|
switch (event->type) {
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_CKEY:
|
2020-03-06 18:12:56 +11:00
|
|
|
if (event->is_repeat) {
|
|
|
|
break;
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
if (event->alt) {
|
2014-01-15 18:27:39 +11:00
|
|
|
if (!(t->options & CTX_NO_PET)) {
|
|
|
|
t->flag ^= T_PROP_CONNECTED;
|
|
|
|
sort_trans_data_dist(t);
|
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
handled = true;
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
break;
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_OKEY:
|
2020-03-06 18:12:56 +11:00
|
|
|
if (event->is_repeat) {
|
|
|
|
break;
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
if (t->flag & T_PROP_EDIT && event->shift) {
|
|
|
|
t->prop_mode = (t->prop_mode + 1) % PROP_MODE_MAX;
|
|
|
|
calculatePropRatio(t);
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_PADPLUSKEY:
|
2014-01-02 09:33:59 +01:00
|
|
|
if (event->alt && t->flag & T_PROP_EDIT) {
|
2015-03-19 20:09:34 +11:00
|
|
|
t->prop_size *= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
|
2019-04-22 09:19:45 +10:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && t->persp != RV3D_ORTHO) {
|
2019-02-16 12:21:44 +11:00
|
|
|
t->prop_size = min_ff(t->prop_size, ((View3D *)t->view)->clip_end);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
calculatePropRatio(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
t->redraw = TREDRAW_HARD;
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
handled = true;
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
break;
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_PADMINUS:
|
2014-01-02 09:33:59 +01:00
|
|
|
if (event->alt && t->flag & T_PROP_EDIT) {
|
2015-03-19 20:09:34 +11:00
|
|
|
t->prop_size /= (t->modifiers & MOD_PRECISION) ? 1.01f : 1.1f;
|
2014-01-02 09:33:59 +01:00
|
|
|
calculatePropRatio(t);
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
handled = true;
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
break;
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_LEFTALTKEY:
|
|
|
|
case EVT_RIGHTALTKEY:
|
2014-01-02 09:33:59 +01:00
|
|
|
if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
|
|
|
|
t->flag |= T_ALT_TRANSFORM;
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
|
|
|
break;
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_NKEY:
|
2020-03-06 18:12:56 +11:00
|
|
|
if (event->is_repeat) {
|
|
|
|
break;
|
|
|
|
}
|
2018-05-25 22:24:24 +05:30
|
|
|
if (ELEM(t->mode, TFM_ROTATION)) {
|
|
|
|
if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
|
|
|
|
restoreTransObjects(t);
|
|
|
|
resetTransModal(t);
|
|
|
|
resetTransRestrictions(t);
|
2020-02-21 10:04:45 -03:00
|
|
|
transform_mode_init(t, NULL, TFM_NORMAL_ROTATION);
|
2018-05-25 22:24:24 +05:30
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2018-05-25 22:24:24 +05:30
|
|
|
break;
|
2014-01-02 09:33:59 +01:00
|
|
|
default:
|
|
|
|
break;
|
2013-10-23 06:48:36 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
/* Snapping key events */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->redraw |= handleSnapping(t, event);
|
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (event->val == KM_RELEASE) {
|
2012-02-23 02:23:42 +00:00
|
|
|
switch (event->type) {
|
2020-03-18 10:38:37 -06:00
|
|
|
case EVT_LEFTALTKEY:
|
|
|
|
case EVT_RIGHTALTKEY:
|
2020-09-01 09:37:43 -03:00
|
|
|
/* TODO: Modal Map */
|
2012-11-09 05:37:36 +00:00
|
|
|
if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
|
2012-11-05 10:15:58 +00:00
|
|
|
t->flag &= ~T_ALT_TRANSFORM;
|
2012-11-09 05:37:36 +00:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
Support units in modal numinput
Summary:
This completly changes the way modal numinput is handled. Now, edited expression is a string, which then gets unit- and py-evaluated to get a float value.
We gain many power and flexibility, but lose a few "shortcuts" like '-' to negate, or '/' to inverse (if they are really needed, we still can add them with modifiers, like e.g. ctrl-/ or so).
Features:
- units (cm, ", deg, etc.).
- basic operations from python/BKE_unit (+, *, **, etc.), and math constants and functions (pi, sin, etc.).
- you can navigate in edited value (left/right key, ctrl to move by block) and insert/delete chars, e.g. to fix a typo without having to rewrite everything.
- you can go to next/previous value with (ctrl-)TAB key.
- As before, hitting backspace after having deleted all leading chars will first reset the edited value to init state, and on second press, the whole "modal numinput" editing will be cancelled, going back to usual transform with mouse.
Notes:
- Did not touch to how values are shown in header when modal numinput is not enabled (would do that in another commit), so this is still quite inconsistent.
- Added back radian support in BKE_unit.
- Added arcminute/arcsecond to BKE_unit.
(those unit changes affect all angle UI controls, btw, so you can now enter radians or longitude/latitude values when in degrees units).
Related to T37600.
Reviewers: brecht, campbellbarton, carter2422
Reviewed By: brecht, campbellbarton, carter2422
Thanks everybody!
Differential Revision: http://developer.blender.org/D61
2013-12-21 17:11:43 +01:00
|
|
|
handled = true;
|
2012-11-09 05:37:36 +00:00
|
|
|
}
|
2012-11-05 10:15:58 +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
|
|
|
}
|
2020-12-04 10:35:26 -03:00
|
|
|
|
|
|
|
/* confirm transform if launch key is released after mouse move */
|
|
|
|
if ((t->flag & T_RELEASE_CONFIRM) && event->type == t->launch_event) {
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2015-01-20 23:14:06 +11:00
|
|
|
/* if we change snap options, get the unsnapped values back */
|
2019-06-11 13:27:10 +10:00
|
|
|
if ((mode_prev != t->mode) || ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) !=
|
|
|
|
(modifiers_prev & (MOD_SNAP | MOD_SNAP_INVERT)))) {
|
2015-02-11 18:38:41 +11:00
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
2015-01-20 23:14:06 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-02-24 19:34:36 +11:00
|
|
|
/* Per transform event, if present */
|
|
|
|
if (t->handleEvent && (!handled ||
|
2020-09-30 20:09:02 +10:00
|
|
|
/* Needed for vertex slide, see T38756. */
|
2014-02-24 19:34:36 +11:00
|
|
|
(event->type == MOUSEMOVE))) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->redraw |= t->handleEvent(t, event);
|
2014-02-24 19:34:36 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
/* Try to init modal numinput now, if possible. */
|
|
|
|
if (!(handled || t->redraw) && ((event->val == KM_PRESS) || (event->type == EVT_MODAL_MAP)) &&
|
|
|
|
handleNumInput(t->context, &(t->num), event)) {
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
handled = true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-09 17:58:58 +02:00
|
|
|
if (t->redraw && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
|
|
|
|
WM_window_status_area_tag_redraw(CTX_wm_window(t->context));
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-10-05 13:22:09 +00:00
|
|
|
if (handled || t->redraw) {
|
2009-11-29 16:49:26 +00:00
|
|
|
return 0;
|
2012-10-05 13:22:09 +00:00
|
|
|
}
|
2020-07-03 17:25:04 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-04-17 13:46:34 +10:00
|
|
|
bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[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
|
|
|
{
|
|
|
|
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
|
2014-04-01 11:34:00 +11:00
|
|
|
bool success;
|
2018-05-20 17:44:50 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->context = C;
|
|
|
|
|
2013-08-14 08:14:50 +00:00
|
|
|
t->state = TRANS_RUNNING;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-04-04 21:40:39 +00:00
|
|
|
/* avoid calculating PET */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->options = CTX_NO_PET;
|
|
|
|
|
2013-11-25 07:49:49 +11:00
|
|
|
t->mode = TFM_DUMMY;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2015-12-01 18:52:24 +11:00
|
|
|
initTransInfo(C, t, NULL, NULL);
|
2013-04-04 21:40:39 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
/* avoid doing connectivity lookups (when V3D_AROUND_LOCAL_ORIGINS is set) */
|
|
|
|
t->around = V3D_AROUND_CENTER_BOUNDS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-06-10 19:59:02 +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
|
|
|
|
2021-02-05 16:23:34 +11:00
|
|
|
t->around = centerMode; /* override user-defined 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 (t->data_len_all == 0) {
|
|
|
|
success = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
else {
|
2014-04-01 11:34:00 +11:00
|
|
|
success = true;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-10-12 03:42:06 +00:00
|
|
|
calculateCenter(t);
|
2012-05-22 22:03:41 +00:00
|
|
|
|
|
|
|
if (cent2d) {
|
2015-06-26 16:19:39 +10:00
|
|
|
copy_v2_v2(cent2d, t->center2d);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2012-05-22 22:03:41 +00:00
|
|
|
if (cent3d) {
|
2012-05-16 14:30:41 +00:00
|
|
|
/* Copy center from constraint center. Transform center can be local */
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(cent3d, t->center_global);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-04-25 13:19:21 +12:00
|
|
|
/* aftertrans does insert keyframes, and clears base flags; doesn't 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;
|
|
|
|
}
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *region)
|
2018-12-19 12:26:33 +11:00
|
|
|
{
|
|
|
|
/* Don't show overlays when not the active view and when overlay is disabled: T57139 */
|
|
|
|
bool ok = false;
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region == t->region) {
|
2018-12-19 12:26:33 +11:00
|
|
|
ok = true;
|
|
|
|
}
|
|
|
|
else {
|
2020-04-03 13:25:03 +02:00
|
|
|
ScrArea *area = CTX_wm_area(C);
|
|
|
|
if (area->spacetype == SPACE_VIEW3D) {
|
|
|
|
View3D *v3d = area->spacedata.first;
|
2019-03-05 15:09:25 +11:00
|
|
|
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0) {
|
2018-12-19 12:26:33 +11:00
|
|
|
ok = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void drawTransformView(const struct bContext *C, ARegion *region, void *arg)
|
2009-01-10 18:33:16 +00:00
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (!transinfo_show_overlay(C, t, region)) {
|
2018-12-19 12:26:33 +11:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
drawConstraint(t);
|
2009-03-28 20:46:38 +00:00
|
|
|
drawPropCircle(C, t);
|
|
|
|
drawSnapping(C, t);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region == t->region) {
|
2018-12-19 12:26:33 +11:00
|
|
|
/* edge slide, vert slide */
|
|
|
|
drawEdgeSlide(t);
|
|
|
|
drawVertSlide(t);
|
2018-10-03 16:25:10 -03:00
|
|
|
|
2018-12-19 12:26:33 +11:00
|
|
|
/* Rotation */
|
|
|
|
drawDial3d(t);
|
|
|
|
}
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* just draw a little warning message in the top-right corner of the viewport
|
|
|
|
* to warn that autokeying is enabled */
|
2020-03-06 16:56:42 +01:00
|
|
|
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *region)
|
2009-11-01 00:06:53 +00:00
|
|
|
{
|
2013-03-21 14:46:37 +00:00
|
|
|
const char *printable = IFACE_("Auto Keying On");
|
2012-10-11 23:42:26 +00:00
|
|
|
float printable_size[2];
|
2012-10-11 09:53:17 +00:00
|
|
|
int xco, yco;
|
2012-10-11 23:42:26 +00:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
const rcti *rect = ED_region_visible_rect(region);
|
2017-02-05 00:54:21 -05:00
|
|
|
|
|
|
|
const int font_id = BLF_default();
|
|
|
|
BLF_width_and_height(
|
|
|
|
font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2019-08-16 05:41:43 +10:00
|
|
|
xco = (rect->xmax - U.widget_unit) - (int)printable_size[0];
|
|
|
|
yco = (rect->ymax - U.widget_unit);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-10-11 09:53:17 +00:00
|
|
|
/* warning text (to clarify meaning of overlays)
|
|
|
|
* - original color was red to match the icon, but that clashes badly with a less nasty border
|
2012-10-05 13:22:09 +00:00
|
|
|
*/
|
2020-04-03 16:21:24 +11:00
|
|
|
uchar color[3];
|
2017-02-05 00:54:21 -05:00
|
|
|
UI_GetThemeColorShade3ubv(TH_TEXT_HI, -50, color);
|
|
|
|
BLF_color3ubv(font_id, color);
|
2013-02-20 08:39:31 +00:00
|
|
|
#ifdef WITH_INTERNATIONAL
|
2014-09-04 15:56:40 +10:00
|
|
|
BLF_draw_default(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX);
|
2013-02-20 08:39:31 +00:00
|
|
|
#else
|
2014-09-04 15:56:40 +10:00
|
|
|
BLF_draw_default_ascii(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX);
|
2013-02-20 08:39:31 +00:00
|
|
|
#endif
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-10-11 09:53:17 +00:00
|
|
|
/* autokey recording icon... */
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-09-04 15:56:40 +10:00
|
|
|
xco -= U.widget_unit;
|
|
|
|
yco -= (int)printable_size[1] / 2;
|
|
|
|
|
2012-10-11 09:53:17 +00:00
|
|
|
UI_icon_draw(xco, yco, ICON_REC);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_NONE);
|
2012-10-05 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void drawTransformPixel(const struct bContext *C, ARegion *region, void *arg)
|
2018-05-13 06:44:03 +02:00
|
|
|
{
|
2012-10-05 13:22:09 +00:00
|
|
|
TransInfo *t = arg;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (!transinfo_show_overlay(C, t, region)) {
|
2018-12-19 12:26:33 +11:00
|
|
|
return;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region == t->region) {
|
2018-12-19 12:26:33 +11:00
|
|
|
Scene *scene = t->scene;
|
|
|
|
ViewLayer *view_layer = t->view_layer;
|
|
|
|
Object *ob = OBACT(view_layer);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-10 08:40:49 +02:00
|
|
|
/* draw auto-key-framing hint in the corner
|
2018-12-19 12:26:33 +11:00
|
|
|
* - only draw if enabled (advanced users may be distracted/annoyed),
|
|
|
|
* for objects that will be autokeyframed (no point otherwise),
|
|
|
|
* AND only for the active region (as showing all is too overwhelming)
|
|
|
|
*/
|
|
|
|
if ((U.autokey_flag & AUTOKEY_FLAG_NOWARNING) == 0) {
|
2020-03-06 16:56:42 +01:00
|
|
|
if (region == t->region) {
|
2021-02-05 11:56:43 -03:00
|
|
|
if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) {
|
2018-12-19 12:26:33 +11:00
|
|
|
if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
|
2020-03-06 16:56:42 +01:00
|
|
|
drawAutoKeyWarning(t, region);
|
2018-12-19 12:26:33 +11:00
|
|
|
}
|
2012-10-24 11:53:48 +00:00
|
|
|
}
|
2012-10-09 10:36:07 +00:00
|
|
|
}
|
2012-10-09 00:59:40 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-10 18:33:16 +00:00
|
|
|
}
|
|
|
|
|
2015-11-24 16:50:21 +11:00
|
|
|
/**
|
|
|
|
* \see #initTransform which reads values from the operator.
|
|
|
|
*/
|
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);
|
2011-08-18 12:09:53 +00:00
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-09-27 01:28:15 +00:00
|
|
|
/* Save back mode in case we're in the generic operator */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "mode"))) {
|
2011-09-27 01:28:15 +00:00
|
|
|
RNA_property_enum_set(op->ptr, prop, t->mode);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "value"))) {
|
2011-08-18 12:09:53 +00:00
|
|
|
if (RNA_property_array_check(prop)) {
|
2019-08-02 01:15:33 -03:00
|
|
|
RNA_property_float_set_array(op->ptr, prop, t->values_final);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2011-08-18 12:09:53 +00:00
|
|
|
else {
|
2019-08-02 01:15:33 -03:00
|
|
|
RNA_property_float_set(op->ptr, prop, t->values_final[0]);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-27 14:19:43 -03:00
|
|
|
bool use_prop_edit = false;
|
|
|
|
int prop_edit_flag = 0;
|
2019-04-30 13:42:18 +10:00
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2020-06-27 14:19:43 -03:00
|
|
|
use_prop_edit = true;
|
2019-04-30 13:42:18 +10:00
|
|
|
}
|
|
|
|
if (t->flag & T_PROP_CONNECTED) {
|
2020-06-27 14:19:43 -03:00
|
|
|
prop_edit_flag |= PROP_EDIT_CONNECTED;
|
2019-04-30 13:42:18 +10:00
|
|
|
}
|
|
|
|
if (t->flag & T_PROP_PROJECTED) {
|
2020-06-27 14:19:43 -03:00
|
|
|
prop_edit_flag |= PROP_EDIT_PROJECTED;
|
2019-04-30 13:42:18 +10:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* If modal, save settings back in scene if not set as operator argument */
|
2018-01-19 21:09:16 +11:00
|
|
|
if ((t->flag & T_MODAL) || (op->flag & OP_IS_REPEAT)) {
|
2009-10-22 23:22:05 +00:00
|
|
|
/* save settings if not set in operator */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-08-21 12:20:40 +00:00
|
|
|
/* skip saving proportional edit if it was not actually used */
|
|
|
|
if (!(t->options & CTX_NO_PET)) {
|
2019-04-30 13:42:18 +10:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit")) &&
|
2014-01-12 22:05:24 +11:00
|
|
|
!RNA_property_is_set(op->ptr, prop)) {
|
2020-06-27 14:19:43 -03:00
|
|
|
const Object *obact = OBACT(t->view_layer);
|
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (t->spacetype == SPACE_GRAPH) {
|
2020-06-27 14:19:43 -03:00
|
|
|
ts->proportional_fcurve = use_prop_edit;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2020-06-27 14:19:43 -03:00
|
|
|
ts->proportional_action = use_prop_edit;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
else if (t->options & CTX_MASK) {
|
2020-06-27 14:19:43 -03:00
|
|
|
ts->proportional_mask = use_prop_edit;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2020-06-27 14:19:43 -03:00
|
|
|
else if (obact && obact->mode == OB_MODE_OBJECT) {
|
|
|
|
ts->proportional_objects = use_prop_edit;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (use_prop_edit) {
|
|
|
|
ts->proportional_edit |= PROP_EDIT_USE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ts->proportional_edit &= ~PROP_EDIT_USE;
|
|
|
|
}
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2013-08-21 12:20:40 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-01-19 21:09:16 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional_size"))) {
|
|
|
|
ts->proportional_size = RNA_property_is_set(op->ptr, prop) ?
|
|
|
|
RNA_property_float_get(op->ptr, prop) :
|
|
|
|
t->prop_size;
|
2013-08-21 12:20:40 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-08-21 12:20:40 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
|
2014-01-12 22:05:24 +11:00
|
|
|
!RNA_property_is_set(op->ptr, prop)) {
|
2013-08-21 12:20:40 +00:00
|
|
|
ts->prop_mode = t->prop_mode;
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-24 17:07:55 +10:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
/* do we check for parameter? */
|
|
|
|
if (transformModeUseSnap(t)) {
|
2020-06-02 18:00:52 +10:00
|
|
|
if (!(t->modifiers & MOD_SNAP) != !(ts->snap_flag & SCE_SNAP)) {
|
|
|
|
if (t->modifiers & MOD_SNAP) {
|
|
|
|
ts->snap_flag |= SCE_SNAP;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
ts->snap_flag &= ~SCE_SNAP;
|
|
|
|
}
|
|
|
|
WM_msg_publish_rna_prop(t->mbus, &t->scene->id, ts, ToolSettings, use_snap);
|
2019-07-24 17:07:55 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-01 08:29:42 +10:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) {
|
2020-06-27 14:19:43 -03:00
|
|
|
RNA_property_boolean_set(op->ptr, prop, use_prop_edit);
|
|
|
|
RNA_boolean_set(op->ptr, "use_proportional_connected", prop_edit_flag & PROP_EDIT_CONNECTED);
|
|
|
|
RNA_boolean_set(op->ptr, "use_proportional_projected", prop_edit_flag & PROP_EDIT_PROJECTED);
|
2010-08-18 03:24:52 +00:00
|
|
|
RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode);
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 17:25:45 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
|
|
|
|
RNA_property_boolean_set(op->ptr, prop, (t->flag & T_NO_MIRROR) == 0);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "orient_axis"))) {
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
int orient_axis = constraintModeToIndex(t);
|
|
|
|
if (orient_axis != -1) {
|
|
|
|
RNA_property_enum_set(op->ptr, prop, orient_axis);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-02-26 20:22:54 +11:00
|
|
|
}
|
2019-02-28 00:19:37 +11:00
|
|
|
else {
|
|
|
|
RNA_property_enum_set(op->ptr, prop, t->orient_axis);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
}
|
2019-02-28 00:19:37 +11:00
|
|
|
}
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) {
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
RNA_property_enum_set(op->ptr, prop, t->orient_axis_ortho);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-02-26 20:22:54 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-04-29 08:07:25 -03:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "orient_type"))) {
|
2020-05-22 12:34:29 -03:00
|
|
|
short orient_type_set, orient_type_curr;
|
|
|
|
orient_type_set = RNA_property_is_set(op->ptr, prop) ? RNA_property_enum_get(op->ptr, prop) :
|
|
|
|
-1;
|
|
|
|
orient_type_curr = t->orient[t->orient_curr].type;
|
2020-04-29 08:07:25 -03:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
if (!ELEM(orient_type_curr, orient_type_set, V3D_ORIENT_CUSTOM_MATRIX)) {
|
|
|
|
RNA_property_enum_set(op->ptr, prop, orient_type_curr);
|
|
|
|
orient_type_set = orient_type_curr;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-04-29 08:07:25 -03:00
|
|
|
if (((prop = RNA_struct_find_property(op->ptr, "orient_matrix_type")) &&
|
|
|
|
!RNA_property_is_set(op->ptr, prop))) {
|
|
|
|
/* Set the first time to register on redo. */
|
2020-05-22 12:34:29 -03:00
|
|
|
RNA_property_enum_set(op->ptr, prop, orient_type_set);
|
2020-05-07 16:51:30 -03:00
|
|
|
RNA_float_set_array(op->ptr, "orient_matrix", &t->spacemtx[0][0]);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2019-02-28 02:30:26 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-02-27 17:25:45 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
|
2020-04-30 08:52:38 -03:00
|
|
|
bool constraint_axis[3] = {false, false, false};
|
2020-05-07 16:51:30 -03:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
if (t->con.mode & CON_AXIS0) {
|
|
|
|
constraint_axis[0] = true;
|
2019-02-21 21:52:56 +11:00
|
|
|
}
|
2020-05-07 16:51:30 -03:00
|
|
|
if (t->con.mode & CON_AXIS1) {
|
|
|
|
constraint_axis[1] = true;
|
|
|
|
}
|
|
|
|
if (t->con.mode & CON_AXIS2) {
|
|
|
|
constraint_axis[2] = true;
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2020-05-07 16:51:30 -03:00
|
|
|
RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
|
2020-04-29 08:07:25 -03:00
|
|
|
}
|
|
|
|
else {
|
2020-05-07 16:51:30 -03:00
|
|
|
RNA_property_unset(op->ptr, prop);
|
2019-02-21 21:52:56 +11:00
|
|
|
}
|
2018-07-26 15:44:27 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-05-25 15:45:56 +10:00
|
|
|
{
|
|
|
|
const char *prop_id = NULL;
|
2018-10-03 13:10:11 +10:00
|
|
|
bool prop_state = true;
|
2015-05-25 15:45:56 +10:00
|
|
|
if (t->mode == TFM_SHRINKFATTEN) {
|
|
|
|
prop_id = "use_even_offset";
|
2018-10-03 13:10:11 +10:00
|
|
|
prop_state = false;
|
2015-05-25 15:45:56 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-05-25 15:45:56 +10:00
|
|
|
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) {
|
2019-01-03 15:13:46 +11:00
|
|
|
RNA_property_boolean_set(op->ptr, prop, ((t->flag & T_ALT_TRANSFORM) == 0) == prop_state);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2015-05-25 15:45:56 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-12-18 18:25:37 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "correct_uv"))) {
|
|
|
|
RNA_property_boolean_set(
|
2020-07-01 17:45:27 +10:00
|
|
|
op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT_SLIDE) != 0);
|
2015-12-18 18:25:37 +11:00
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
2020-10-08 09:45:45 -03:00
|
|
|
static void initSnapSpatial(TransInfo *t, float r_snap[2])
|
2020-02-14 08:42:17 -03:00
|
|
|
{
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2020-11-02 16:13:51 -03:00
|
|
|
if (t->region->regiondata) {
|
2020-04-03 13:25:03 +02:00
|
|
|
View3D *v3d = t->area->spacedata.first;
|
2020-11-02 16:13:51 -03:00
|
|
|
r_snap[0] = ED_view3d_grid_view_scale(t->scene, v3d, t->region, NULL) * 1.0f;
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[1] = r_snap[0] * 0.1f;
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[0] = 0.0625f;
|
|
|
|
r_snap[1] = 0.03125f;
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[0] = 0.125f;
|
|
|
|
r_snap[1] = 0.0625f;
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[0] = r_snap[1] = ED_node_grid_size();
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[0] = 1.0;
|
|
|
|
r_snap[1] = 0.1f;
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
else {
|
2020-10-08 09:45:45 -03:00
|
|
|
r_snap[0] = r_snap[1] = 1.0f;
|
2020-02-14 08:42:17 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-10-30 21:52:58 +01:00
|
|
|
/**
|
|
|
|
* \note caller needs to free 't' on a 0 return
|
2021-05-12 21:55:25 +10:00
|
|
|
* \warning \a event might be NULL (when tweaking from redo panel)
|
2015-11-24 16:50:21 +11:00
|
|
|
* \see #saveTransform which writes these values back.
|
2015-10-30 21:52:58 +01:00
|
|
|
*/
|
2014-04-17 13:46:34 +10:00
|
|
|
bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-03-10 18:10:24 +00:00
|
|
|
int options = 0;
|
2012-01-14 04:42:41 +00:00
|
|
|
PropertyRNA *prop;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-22 19:06:04 -03:00
|
|
|
mode = transform_mode_really_used(C, mode);
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
t->state = TRANS_STARTING;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-25 19:43:23 +02:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "cursor_transform")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
|
|
|
options |= CTX_CURSOR;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2012-06-10 22:13:17 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "texture_space")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
2021-02-05 11:56:43 -03:00
|
|
|
options |= CTX_TEXTURE_SPACE;
|
2012-01-14 04:42:41 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
- Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
to enter "Stroke Edit Mode". In this mode, many common editing tools will
operate on Grease Pencil stroke points instead.
- Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
- Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
NOTE: Currently drivers don't work, but if time allows, this may still be
added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
colour/opacity settings to the ones used for the lines themselves.
This makes use of OpenGL filled polys, which has the limitation of only
being able to fill convex shapes. Some artifacts may be visible on concave
shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
has been added which draws strokes as a series of screen-aligned discs.
While this was originally a partial experimental technique at getting better
quality 3D lines, the effects possible using this technique were interesting
enough to warrant making this a dedicated feature. Best results when partial
opacity and large stroke widths are used.
5) Improved Onion Skinning Support
- Different colours can be selected for the before/after ghosts. To do so,
enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
the colours accordingly.
- Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
the active object.
- For a long time, the object-attachment has proved to be quite problematic
for users to keep track of. Now that this is done at scene level, it is
easier for most users to use.
- An exception for old files (and for any addons which may benefit from object
attachment instead), is that if the active object has a Grease Pencil datablock,
that will be used instead.
- It is not currently possible to choose object-attachment from the UI, but
it is simple to do this from the console instead, by doing:
context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
- The layers UI has been cleaned up to use a list instead of the nested-panels
design. Apart from saving space, this is also much nicer to look at now.
- The UI code is now all defined in Python. To support this, it has been necessary
to add some new context properties to make it easier to access these settings.
e.g. "gpencil_data" for the datablock
"active_gpencil_layer" and "active_gpencil_frame" for active data,
"editable_gpencil_strokes" for the strokes that can be edited
- The "stroke placement/alignment" settings (previously "Drawing Settings" at the
bottom of the Grease Pencil panel in the Properties Region) is now located in
the toolbar. These were more toolsettings than properties for how GPencil got drawn.
- "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
suggestion for an earlier discussion on developer.blender.org
- By default, the painting operator will wait for a mouse button to be pressed
before it starts creating the stroke. This is to make it easier to include
this operator in various toolbars/menus/etc. To get it immediately starting
(as when you hold down DKEy to draw), set "wait_for_input" to False.
- GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
- Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
A set of experimental pie menus has been included for quick access to many
tools and settings. It is not necessary to use these to get things done,
but they have been designed to help make certain common tasks easier.
- Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
spatially stable manner.
- D Q = "Quick Settings" pie. This allows quick access to the active
layer's settings. Notably, colours, thickness, and turning
onion skinning on/off.
2014-12-01 01:52:06 +13:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "gpencil_strokes")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
|
|
|
options |= CTX_GPENCIL_STROKES;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
t->options = options;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-12-04 10:35:26 -03:00
|
|
|
/* Needed to translate tweak events to mouse buttons. */
|
|
|
|
t->launch_event = event ? WM_userdef_event_type_from_keymap_type(event->type) : -1;
|
|
|
|
t->is_launch_event_tweak = event ? ISTWEAK(event->type) : false;
|
|
|
|
|
|
|
|
/* XXX Remove this when wm_operator_call_internal doesn't use window->eventstate
|
|
|
|
* (which can have type = 0) */
|
|
|
|
/* For gizmo only, so assume LEFTMOUSE. */
|
|
|
|
if (t->launch_event == 0) {
|
|
|
|
t->launch_event = LEFTMOUSE;
|
|
|
|
}
|
|
|
|
|
2015-09-09 02:05:10 +10:00
|
|
|
unit_m3(t->spacemtx);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-11-25 07:49:49 +11:00
|
|
|
initTransInfo(C, t, op, event);
|
2020-05-01 17:40:54 -03:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2010-02-03 21:01:41 +00:00
|
|
|
t->draw_handle_apply = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2012-10-05 13:22:09 +00:00
|
|
|
t->draw_handle_pixel = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2009-02-09 20:58:31 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2012-06-29 14:34:46 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2012-06-29 14:34:46 +00:00
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2015-03-27 15:23:39 +01:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2015-03-27 15:23:39 +01:00
|
|
|
}
|
2015-04-07 16:45:29 +02:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(
|
2020-03-06 16:56:42 +01:00
|
|
|
t->region->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2020-06-04 18:35:43 +10:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY, transform_draw_cursor_poll, transform_draw_cursor_draw, t);
|
2015-04-07 16:45:29 +02:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
createTransData(C, t); /* Make #TransData structs from selection. */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (t->data_len_all == 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
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-16 16:44:05 +10:00
|
|
|
/* When proportional editing is enabled, data_len_all can be non zero when
|
|
|
|
* nothing is selected, if this is the case we can end the transform early.
|
|
|
|
*
|
|
|
|
* By definition transform-data has selected items in beginning,
|
|
|
|
* so only the first item in each container needs to be checked
|
|
|
|
* when looking for the presence of selected data. */
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
|
|
|
bool has_selected_any = false;
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
if (tc->data->flag & TD_SELECTED) {
|
|
|
|
has_selected_any = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!has_selected_any) {
|
|
|
|
postTrans(C, t);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-12-04 10:35:26 -03:00
|
|
|
if (event) {
|
|
|
|
/* keymap for shortcut header prints */
|
|
|
|
t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
|
|
|
|
|
|
|
|
/* Stupid code to have Ctrl-Click on gizmo work ok.
|
|
|
|
*
|
|
|
|
* Do this only for translation/rotation/resize because only these
|
|
|
|
* modes are available from gizmo and doing such check could
|
|
|
|
* lead to keymap conflicts for other modes (see T31584)
|
|
|
|
*/
|
|
|
|
if (ELEM(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
|
|
|
|
wmKeyMapItem *kmi;
|
|
|
|
|
|
|
|
for (kmi = t->keymap->items.first; kmi; kmi = kmi->next) {
|
|
|
|
if (kmi->flag & KMI_INACTIVE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
|
|
|
|
if ((ELEM(kmi->type, EVT_LEFTCTRLKEY, EVT_RIGHTCTRLKEY) && event->ctrl) ||
|
|
|
|
(ELEM(kmi->type, EVT_LEFTSHIFTKEY, EVT_RIGHTSHIFTKEY) && event->shift) ||
|
|
|
|
(ELEM(kmi->type, EVT_LEFTALTKEY, EVT_RIGHTALTKEY) && event->alt) ||
|
|
|
|
((kmi->type == EVT_OSKEY) && event->oskey)) {
|
|
|
|
t->modifiers |= MOD_SNAP_INVERT;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-29 19:52:53 +00:00
|
|
|
initSnapping(t, op); /* Initialize snapping data AFTER mode flags */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-30 18:57:17 +10:00
|
|
|
initSnapSpatial(t, t->snap_spatial);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* EVIL! posemode code can switch translation to rotate when 1 bone is selected.
|
|
|
|
* will be removed (ton) */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* EVIL2: we gave as argument also texture space context bit... was cleared */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* EVIL3: extend mode for animation editors also switches modes...
|
|
|
|
* but is best way to avoid duplicate 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
|
|
|
mode = t->mode;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-10-30 21:52:58 +01:00
|
|
|
if (event) {
|
2017-03-02 12:18:07 +01:00
|
|
|
/* Initialize accurate transform to settings requested by keymap. */
|
|
|
|
bool use_accurate = false;
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "use_accurate")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
|
|
|
use_accurate = true;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2017-03-02 12:18:07 +01:00
|
|
|
initMouseInput(t, &t->mouse, t->center2d, event->mval, use_accurate);
|
2015-10-30 21:52:58 +01:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-02-21 10:04:45 -03:00
|
|
|
transform_mode_init(t, op, mode);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2011-03-27 22:15:37 +00:00
|
|
|
postTrans(C, t);
|
|
|
|
return 0;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 18:39:11 +11:00
|
|
|
/* Transformation axis from operator */
|
2019-02-26 20:22:54 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "orient_axis")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
t->orient_axis = RNA_property_enum_get(op->ptr, prop);
|
2019-01-15 18:39:11 +11:00
|
|
|
}
|
2019-02-26 20:22:54 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop);
|
2019-01-15 18:39:11 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 18:39:11 +11:00
|
|
|
/* Constraint init from operator */
|
2020-04-29 08:07:25 -03:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2020-09-24 19:16:41 -03:00
|
|
|
setUserConstraint(t, t->con.mode, "%s");
|
2019-01-15 18:39:11 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-17 08:44:58 +02:00
|
|
|
/* Don't write into the values when non-modal because they are already set from operator redo
|
|
|
|
* values. */
|
2019-01-15 18:39:11 +11:00
|
|
|
if (t->flag & T_MODAL) {
|
2019-01-15 18:54:43 +11:00
|
|
|
/* Setup the mouse input with initial values. */
|
|
|
|
applyMouseInput(t, &t->mouse, t->mouse.imval, t->values);
|
2019-01-15 18:39:11 +11:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "preserve_clnor"))) {
|
|
|
|
if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-21 04:40:16 +10:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-05-25 22:24:24 +05:30
|
|
|
if ((((Mesh *)(tc->obedit->data))->flag & ME_AUTOSMOOTH)) {
|
|
|
|
BMEditMesh *em = NULL; /* BKE_editmesh_from_object(t->obedit); */
|
|
|
|
bool do_skip = false;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Currently only used for two of three most frequent transform ops,
|
|
|
|
* can include more ops.
|
|
|
|
* Note that scaling cannot be included here,
|
|
|
|
* non-uniform scaling will affect normals. */
|
2018-05-25 22:24:24 +05:30
|
|
|
if (ELEM(t->mode, TFM_TRANSLATION, TFM_ROTATION)) {
|
|
|
|
if (em->bm->totvertsel == em->bm->totvert) {
|
|
|
|
/* No need to invalidate if whole mesh is selected. */
|
|
|
|
do_skip = true;
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
RNA_property_boolean_set(op->ptr, prop, false);
|
|
|
|
}
|
|
|
|
else if (!do_skip) {
|
|
|
|
const bool preserve_clnor = RNA_property_boolean_get(op->ptr, prop);
|
|
|
|
if (preserve_clnor) {
|
2020-01-07 14:20:49 +11:00
|
|
|
BKE_editmesh_lnorspace_update(em, tc->obedit->data);
|
2018-05-25 22:24:24 +05:30
|
|
|
t->flag |= T_CLNOR_REBUILD;
|
|
|
|
}
|
|
|
|
BM_lnorspace_invalidate(em->bm, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
2019-04-17 06:17:24 +02: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-11-20 21:43:16 +00:00
|
|
|
void transformApply(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
selectConstraint(t);
|
|
|
|
if (t->transform) {
|
|
|
|
t->transform(t, t->mval); /* calls recalcData() */
|
2009-01-07 16:52:18 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw = TREDRAW_NOTHING;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else if (t->redraw & TREDRAW_SOFT) {
|
2010-02-03 21:01:41 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* If auto confirm is on, break after one pass */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->options & CTX_AUTOCONFIRM) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
}
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
2010-02-03 21:01:41 +00:00
|
|
|
}
|
|
|
|
|
2020-03-06 16:56:42 +01:00
|
|
|
static void drawTransformApply(const bContext *C, ARegion *UNUSED(region), void *arg)
|
2010-02-03 21:01:41 +00:00
|
|
|
{
|
|
|
|
TransInfo *t = arg;
|
|
|
|
|
|
|
|
if (t->redraw & TREDRAW_SOFT) {
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
2010-11-20 21:43:16 +00:00
|
|
|
transformApply((bContext *)C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
int transformEnd(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-01-03 22:15:59 +00:00
|
|
|
int exit_code = OPERATOR_RUNNING_MODAL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
2020-11-06 12:30:59 +11:00
|
|
|
if (!ELEM(t->state, TRANS_STARTING, TRANS_RUNNING)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* handle restoring objects */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2009-01-03 22:15:59 +00:00
|
|
|
exit_code = OPERATOR_CANCELLED;
|
2012-06-10 19:59:02 +00:00
|
|
|
restoreTransObjects(t); /* calls recalcData() */
|
2009-01-03 10:03:26 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2018-05-25 22:24:24 +05:30
|
|
|
if (t->flag & T_CLNOR_REBUILD) {
|
2019-04-21 04:40:16 +10:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-05-25 22:24:24 +05:30
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
|
|
|
BM_lnorspace_rebuild(em->bm, true);
|
|
|
|
}
|
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
exit_code = OPERATOR_FINISHED;
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-04-25 13:19:21 +12:00
|
|
|
/* aftertrans does insert keyframes, and clears base flags; doesn't read transdata */
|
2009-12-14 03:20:17 +00:00
|
|
|
special_aftertrans_update(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2020-01-10 13:33:25 +01:00
|
|
|
/* Free data, also handles overlap [in freeTransCustomData()]. */
|
2009-12-07 18:10:11 +00:00
|
|
|
postTrans(C, t);
|
2009-11-01 02:52:38 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* send events out for redraws */
|
2011-02-07 16:41:57 +00:00
|
|
|
viewRedrawPost(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-20 19:18:22 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
return exit_code;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2018-06-30 10:29:40 +02:00
|
|
|
/* TODO, move to: transform_query.c */
|
2013-05-01 05:26:10 +00:00
|
|
|
bool checkUseAxisMatrix(TransInfo *t)
|
|
|
|
{
|
2014-04-24 16:58:37 +12:00
|
|
|
/* currently only checks for editmode */
|
2013-05-01 05:26:10 +00:00
|
|
|
if (t->flag & T_EDIT) {
|
2015-12-01 18:52:24 +11:00
|
|
|
if ((t->around == V3D_AROUND_LOCAL_ORIGINS) &&
|
2018-04-16 16:27:55 +02:00
|
|
|
(ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE))) {
|
2013-05-01 05:26:10 +00:00
|
|
|
/* not all editmode supports axis-matrix */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-05-01 05:26:10 +00:00
|
|
|
return false;
|
|
|
|
}
|