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 <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <float.h>
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "DNA_anim_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "DNA_armature_types.h"
|
|
|
|
|
#include "DNA_constraint_types.h"
|
2012-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"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "DNA_movieclip_types.h"
|
2012-06-10 19:59:02 +00:00
|
|
|
#include "DNA_scene_types.h" /* PET modes */
|
2017-06-13 12:02:08 +02:00
|
|
|
#include "DNA_workspace_types.h"
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "DNA_gpencil_types.h"
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2015-02-16 18:49:18 +11:00
|
|
|
#include "BLI_alloca.h"
|
2013-01-12 20:01:09 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
#include "BLI_math.h"
|
|
|
|
|
#include "BLI_rect.h"
|
|
|
|
|
#include "BLI_listbase.h"
|
|
|
|
|
#include "BLI_string.h"
|
|
|
|
|
#include "BLI_ghash.h"
|
2017-09-19 20:16:05 +10:00
|
|
|
#include "BLI_utildefines_stack.h"
|
2015-02-11 19:40:54 +11:00
|
|
|
#include "BLI_memarena.h"
|
2012-10-05 13:22:09 +00:00
|
|
|
|
2009-06-23 13:25:31 +00:00
|
|
|
#include "BKE_nla.h"
|
2015-04-29 19:39:58 +10:00
|
|
|
#include "BKE_editmesh.h"
|
2013-04-16 05:23:34 +00:00
|
|
|
#include "BKE_editmesh_bvh.h"
|
2008-12-31 17:11:42 +00:00
|
|
|
#include "BKE_context.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_constraint.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "BKE_particle.h"
|
2009-08-12 17:02:03 +00:00
|
|
|
#include "BKE_unit.h"
|
2018-04-18 09:12:44 +02:00
|
|
|
#include "BKE_scene.h"
|
2012-09-13 05:29:38 +00:00
|
|
|
#include "BKE_mask.h"
|
2018-05-25 22:24:24 +05:30
|
|
|
#include "BKE_mesh.h"
|
2014-09-28 16:48:22 +13:00
|
|
|
#include "BKE_report.h"
|
2017-06-01 20:41:18 +02:00
|
|
|
#include "BKE_workspace.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
|
|
|
|
2017-07-21 11:53:13 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
#include "GPU_immediate.h"
|
2017-04-05 18:30:14 +10:00
|
|
|
#include "GPU_immediate_util.h"
|
2017-01-19 00:46:01 -05:00
|
|
|
#include "GPU_matrix.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_image.h"
|
2009-08-01 06:03:08 +00:00
|
|
|
#include "ED_keyframing.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "ED_screen.h"
|
2009-01-10 18:33:16 +00:00
|
|
|
#include "ED_space_api.h"
|
2009-05-09 02:37:12 +00:00
|
|
|
#include "ED_markers.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_view3d.h"
|
2009-10-22 23:22:05 +00:00
|
|
|
#include "ED_mesh.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "ED_clip.h"
|
2013-11-06 17:46:32 +00:00
|
|
|
#include "ED_node.h"
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "ED_gpencil.h"
|
2009-01-10 18:33:16 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "WM_types.h"
|
2009-01-07 16:52:18 +00:00
|
|
|
#include "WM_api.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-01-12 20:01:09 +00:00
|
|
|
#include "UI_view2d.h"
|
2016-05-14 10:00:52 +02:00
|
|
|
#include "UI_interface.h"
|
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"
|
|
|
|
|
|
2013-01-12 20:01:09 +00:00
|
|
|
#include "RNA_access.h"
|
2018-05-25 22:24:24 +05:30
|
|
|
#include "RNA_define.h"
|
2013-01-12 20:01:09 +00:00
|
|
|
|
|
|
|
|
#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"
|
|
|
|
|
|
2014-07-22 01:24:43 +10:00
|
|
|
/* Disabling, since when you type you know what you are doing, and being able to set it to zero is handy. */
|
|
|
|
|
// #define USE_NUM_NO_ZERO
|
|
|
|
|
|
2012-07-26 22:47:05 +00:00
|
|
|
static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
|
2015-01-12 02:18:20 +11:00
|
|
|
static void doEdgeSlide(TransInfo *t, float perc);
|
|
|
|
|
static void doVertSlide(TransInfo *t, float perc);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2015-05-07 20:10:05 +10:00
|
|
|
static void drawEdgeSlide(TransInfo *t);
|
|
|
|
|
static void drawVertSlide(TransInfo *t);
|
2013-10-13 01:09:23 +00:00
|
|
|
static void postInputRotation(TransInfo *t, float values[3]);
|
2010-02-03 21:01:41 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void ElementRotation(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const short around);
|
2015-06-30 18:57:17 +10:00
|
|
|
static void initSnapSpatial(TransInfo *t, float r_snap[3]);
|
2015-05-25 10:35:54 +10:00
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
static void storeCustomLNorValue(TransDataContainer *t, BMesh *bm);
|
2013-10-23 03:57:42 +00:00
|
|
|
|
|
|
|
|
/* Transform Callbacks */
|
2013-11-20 12:14:10 +11:00
|
|
|
static void initBend(TransInfo *t);
|
|
|
|
|
static eRedrawFlag handleEventBend(TransInfo *t, const struct wmEvent *event);
|
|
|
|
|
static void Bend(TransInfo *t, const int mval[2]);
|
2013-10-23 03:57:42 +00:00
|
|
|
|
|
|
|
|
static void initShear(TransInfo *t);
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventShear(TransInfo *t, const struct wmEvent *event);
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyShear(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initResize(TransInfo *t);
|
|
|
|
|
static void applyResize(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initSkinResize(TransInfo *t);
|
|
|
|
|
static void applySkinResize(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initTranslation(TransInfo *t);
|
|
|
|
|
static void applyTranslation(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initToSphere(TransInfo *t);
|
|
|
|
|
static void applyToSphere(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initRotation(TransInfo *t);
|
|
|
|
|
static void applyRotation(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
static void initNormalRotation(TransInfo *t);
|
|
|
|
|
static void applyNormalRotation(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initShrinkFatten(TransInfo *t);
|
|
|
|
|
static void applyShrinkFatten(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initTilt(TransInfo *t);
|
|
|
|
|
static void applyTilt(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initCurveShrinkFatten(TransInfo *t);
|
|
|
|
|
static void applyCurveShrinkFatten(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initMaskShrinkFatten(TransInfo *t);
|
|
|
|
|
static void applyMaskShrinkFatten(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2015-02-13 02:46:14 +13:00
|
|
|
static void initGPShrinkFatten(TransInfo *t);
|
|
|
|
|
static void applyGPShrinkFatten(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initTrackball(TransInfo *t);
|
|
|
|
|
static void applyTrackball(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initPushPull(TransInfo *t);
|
|
|
|
|
static void applyPushPull(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initBevelWeight(TransInfo *t);
|
|
|
|
|
static void applyBevelWeight(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initCrease(TransInfo *t);
|
|
|
|
|
static void applyCrease(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initBoneSize(TransInfo *t);
|
|
|
|
|
static void applyBoneSize(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initBoneEnvelope(TransInfo *t);
|
|
|
|
|
static void applyBoneEnvelope(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initBoneRoll(TransInfo *t);
|
|
|
|
|
static void applyBoneRoll(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2015-10-15 01:46:28 +02:00
|
|
|
static void initEdgeSlide_ex(TransInfo *t, bool use_double_side, bool use_even, bool flipped, bool use_clamp);
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initEdgeSlide(TransInfo *t);
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventEdgeSlide(TransInfo *t, const struct wmEvent *event);
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyEdgeSlide(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
2015-10-15 01:46:28 +02:00
|
|
|
static void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp);
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initVertSlide(TransInfo *t);
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventVertSlide(TransInfo *t, const struct wmEvent *event);
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyVertSlide(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initTimeTranslate(TransInfo *t);
|
|
|
|
|
static void applyTimeTranslate(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initTimeSlide(TransInfo *t);
|
|
|
|
|
static void applyTimeSlide(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initTimeScale(TransInfo *t);
|
|
|
|
|
static void applyTimeScale(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initBakeTime(TransInfo *t);
|
|
|
|
|
static void applyBakeTime(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initMirror(TransInfo *t);
|
|
|
|
|
static void applyMirror(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initAlign(TransInfo *t);
|
|
|
|
|
static void applyAlign(TransInfo *t, const int mval[2]);
|
|
|
|
|
|
|
|
|
|
static void initSeqSlide(TransInfo *t);
|
|
|
|
|
static void applySeqSlide(TransInfo *t, const int mval[2]);
|
|
|
|
|
/* end transform callbacks */
|
|
|
|
|
|
|
|
|
|
|
2013-12-12 14:35:37 +06:00
|
|
|
static bool transdata_check_local_center(TransInfo *t, short around)
|
2013-02-18 15:47:13 +00:00
|
|
|
{
|
2015-12-01 18:52:24 +11:00
|
|
|
return ((around == V3D_AROUND_LOCAL_ORIGINS) && (
|
2013-02-18 15:47:13 +00:00
|
|
|
(t->flag & (T_OBJECT | T_POSE)) ||
|
2018-04-16 16:27:55 +02:00
|
|
|
/* implicit: (t->flag & T_EDIT) */
|
2019-01-04 17:01:39 +01:00
|
|
|
(ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) ||
|
2019-02-16 16:42:11 +11:00
|
|
|
(t->spacetype == SPACE_GRAPH) ||
|
2014-07-21 12:02:05 +02:00
|
|
|
(t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE)))
|
2013-02-18 15:47:13 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-27 21:37:42 +01:00
|
|
|
bool transdata_check_local_islands(TransInfo *t, short around)
|
|
|
|
|
{
|
2015-12-01 18:52:24 +11:00
|
|
|
return ((around == V3D_AROUND_LOCAL_ORIGINS) && (
|
2018-04-16 16:27:55 +02:00
|
|
|
(ELEM(t->obedit_type, OB_MESH))));
|
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)
|
|
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
RegionView3D *rv3d = t->ar->regiondata;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(t->viewmat, rv3d->viewmat);
|
|
|
|
|
copy_m4_m4(t->viewinv, rv3d->viewinv);
|
|
|
|
|
copy_m4_m4(t->persmat, rv3d->persmat);
|
|
|
|
|
copy_m4_m4(t->persinv, rv3d->persinv);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
t->persp = rv3d->persp;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(t->viewmat);
|
|
|
|
|
unit_m4(t->viewinv);
|
|
|
|
|
unit_m4(t->persmat);
|
|
|
|
|
unit_m4(t->persinv);
|
2009-10-27 02:54:25 +00:00
|
|
|
t->persp = RV3D_ORTHO;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter2D(t);
|
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);
|
|
|
|
|
|
|
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
SpaceClip *sclip = t->sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
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) {
|
2015-06-26 15:45:09 +10:00
|
|
|
/* depemds on context of usage */
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2012-03-08 01:22:49 +00:00
|
|
|
if ((t->spacetype == SPACE_VIEW3D) && (t->ar->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};
|
2014-07-21 12:02:05 +02:00
|
|
|
ED_view3d_win_to_delta(t->ar, mval_f, r_vec, t->zfac);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
|
|
|
|
}
|
2012-07-25 16:03:08 +00: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)) {
|
2012-03-12 06:53:47 +00:00
|
|
|
convertViewVec2D(&t->ar->v2d, r_vec, dx, dy);
|
2009-01-04 01:08:01 +00:00
|
|
|
}
|
2012-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
|
|
|
}
|
|
|
|
|
|
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) {
|
2012-10-04 17:52:12 +00:00
|
|
|
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
|
2013-02-28 11:29:27 +00:00
|
|
|
if (ED_view3d_project_int_global(t->ar, 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) {
|
2012-09-13 05:29:38 +00:00
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
|
|
|
|
|
2012-07-26 21:22:42 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
|
float v[2];
|
2012-09-13 05:29:38 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2012-09-13 05:29:38 +00:00
|
|
|
|
|
|
|
|
BKE_mask_coord_to_image(sima->image, &sima->iuser, v, v);
|
|
|
|
|
|
|
|
|
|
ED_image_point_pos__reverse(sima, t->ar, v, v);
|
|
|
|
|
|
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];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2009-07-12 02:01:13 +00: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
|
|
|
|
|
SpaceAction *sact = t->sa->spacedata.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
if (sact->flag & SACTION_DRAWTIME) {
|
|
|
|
|
//vec[0] = vec[0]/((t->scene->r.frs_sec / t->scene->r.frs_sec_base));
|
2011-05-01 10:14:09 +00:00
|
|
|
/* same as below */
|
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
|
|
|
}
|
|
|
|
|
|
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};
|
2009-07-12 02:01:13 +00: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};
|
2009-07-12 02:01:13 +00: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) {
|
2012-09-13 05:29:38 +00:00
|
|
|
SpaceClip *sc = t->sa->spacedata.first;
|
2012-04-29 12:32:26 +00: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);
|
2012-04-29 12:32:26 +00:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
if (clip) {
|
|
|
|
|
float v[2];
|
2012-09-13 05:29:38 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2012-09-13 05:29:38 +00:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, v, v);
|
2012-09-13 05:29:38 +00:00
|
|
|
|
2014-02-17 12:58:50 +06:00
|
|
|
ED_clip_point_stable_pos__reverse(sc, t->ar, v, v);
|
|
|
|
|
|
|
|
|
|
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];
|
2012-06-04 16:42:58 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
v[0] = vec[0] / t->aspect[0];
|
|
|
|
|
v[1] = vec[1] / t->aspect[1];
|
2012-06-04 16:42:58 +00: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];
|
|
|
|
|
}
|
|
|
|
|
else if (t->ar->regiontype == RGN_TYPE_WINDOW) {
|
2012-12-21 03:49:47 +00:00
|
|
|
/* allow points behind the view [#33643] */
|
2013-02-28 11:29:27 +00:00
|
|
|
if (ED_view3d_project_float_global(t->ar, vec, adr, flag) != V3D_PROJ_RET_OK) {
|
2012-10-05 03:57:56 +00:00
|
|
|
/* XXX, 2.64 and prior did this, weak! */
|
|
|
|
|
adr[0] = t->ar->winx / 2.0f;
|
|
|
|
|
adr[1] = t->ar->winy / 2.0f;
|
|
|
|
|
}
|
2012-03-12 06:53:47 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2013-12-30 19:23:29 +11:00
|
|
|
default:
|
2012-03-12 06:53:47 +00:00
|
|
|
{
|
2013-12-30 19:23:29 +11:00
|
|
|
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)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
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)) {
|
|
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
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);
|
|
|
|
|
WM_paint_cursor_tag_redraw(window, t->ar);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Do we need more refined tags? */
|
|
|
|
|
if (t->flag & T_POSE)
|
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
|
|
|
|
|
else
|
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
|
2013-01-07 21:42:40 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
/* for realtime animation record - send notifiers recognised by animation editors */
|
|
|
|
|
// XXX: is this notifier a lame duck?
|
|
|
|
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene))
|
|
|
|
|
WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
|
|
|
|
|
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2012-10-26 04:14:10 +00:00
|
|
|
//SpaceAction *saction = (SpaceAction *)t->sa->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) {
|
2019-02-16 10:16:16 +11:00
|
|
|
//SpaceGraph *sipo = (SpaceGraph *)t->sa->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) {
|
2009-01-07 16:52:18 +00:00
|
|
|
//ED_area_tag_redraw(t->sa);
|
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);
|
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);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
WM_paint_cursor_tag_redraw(window, t->ar);
|
|
|
|
|
}
|
2012-07-25 16:03:08 +00:00
|
|
|
else {
|
|
|
|
|
// XXX how to deal with lock?
|
|
|
|
|
SpaceImage *sima = (SpaceImage *)t->sa->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 {
|
|
|
|
|
ED_area_tag_redraw(t->sa);
|
|
|
|
|
}
|
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) {
|
|
|
|
|
SpaceClip *sc = (SpaceClip *)t->sa->spacedata.first;
|
2011-11-07 12:55:18 +00: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);
|
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);
|
2011-11-07 12:55:18 +00: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);
|
2012-06-04 16:42:58 +00: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
|
|
|
{
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, NULL);
|
2018-05-13 06:44:03 +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 */
|
|
|
|
|
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);
|
2012-11-10 03:05:08 +00:00
|
|
|
|
|
|
|
|
/* redraw UV editor */
|
2015-01-12 02:18:20 +11:00
|
|
|
if (ELEM(t->mode, TFM_VERT_SLIDE, TFM_EDGE_SLIDE) &&
|
|
|
|
|
(t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT))
|
|
|
|
|
{
|
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
|
|
|
}
|
2018-05-13 06:44:03 +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));
|
2011-02-07 16:41:57 +00:00
|
|
|
|
2010-02-21 11:42:32 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scrarea_queue_headredraw(curarea);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************** TRANSFORMATIONS **************************** */
|
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void view_editmove(unsigned short UNUSED(event))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
#if 0 // TRANSFORM_FIX_ME
|
|
|
|
|
int refresh = 0;
|
|
|
|
|
/* Regular: Zoom in */
|
|
|
|
|
/* Shift: Scroll up */
|
|
|
|
|
/* Ctrl: Scroll right */
|
|
|
|
|
/* Alt-Shift: Rotate up */
|
|
|
|
|
/* Alt-Ctrl: Rotate right */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only work in 3D window for now
|
|
|
|
|
* In the end, will have to send to event to a 2D window handler instead
|
|
|
|
|
*/
|
|
|
|
|
if (Trans.flag & T_2D_EDIT)
|
|
|
|
|
return;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (event) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
case WHEELUPMOUSE:
|
2012-06-10 19:59:02 +00:00
|
|
|
if (G.qual & LR_SHIFTKEY) {
|
|
|
|
|
if (G.qual & LR_ALTKEY) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
G.qual &= ~LR_SHIFTKEY;
|
|
|
|
|
persptoetsen(PAD2);
|
|
|
|
|
G.qual |= LR_SHIFTKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PAD2);
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (G.qual & LR_CTRLKEY) {
|
|
|
|
|
if (G.qual & LR_ALTKEY) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
G.qual &= ~LR_CTRLKEY;
|
|
|
|
|
persptoetsen(PAD4);
|
|
|
|
|
G.qual |= LR_CTRLKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PAD4);
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else if (U.uiflag & USER_WHEELZOOMDIR)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PADMINUS);
|
|
|
|
|
else
|
|
|
|
|
persptoetsen(PADPLUSKEY);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
refresh = 1;
|
|
|
|
|
break;
|
|
|
|
|
case WHEELDOWNMOUSE:
|
2012-06-10 19:59:02 +00:00
|
|
|
if (G.qual & LR_SHIFTKEY) {
|
|
|
|
|
if (G.qual & LR_ALTKEY) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
G.qual &= ~LR_SHIFTKEY;
|
|
|
|
|
persptoetsen(PAD8);
|
|
|
|
|
G.qual |= LR_SHIFTKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PAD8);
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (G.qual & LR_CTRLKEY) {
|
|
|
|
|
if (G.qual & LR_ALTKEY) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
G.qual &= ~LR_CTRLKEY;
|
|
|
|
|
persptoetsen(PAD6);
|
|
|
|
|
G.qual |= LR_CTRLKEY;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PAD6);
|
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else if (U.uiflag & USER_WHEELZOOMDIR)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
persptoetsen(PADPLUSKEY);
|
|
|
|
|
else
|
|
|
|
|
persptoetsen(PADMINUS);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
refresh = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (refresh)
|
|
|
|
|
setTransformViewMatrices(&Trans);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************************************* */
|
|
|
|
|
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
|
2015-05-08 10:38:53 +02:00
|
|
|
enum {
|
|
|
|
|
TFM_MODAL_CANCEL = 1,
|
|
|
|
|
TFM_MODAL_CONFIRM = 2,
|
|
|
|
|
TFM_MODAL_TRANSLATE = 3,
|
|
|
|
|
TFM_MODAL_ROTATE = 4,
|
|
|
|
|
TFM_MODAL_RESIZE = 5,
|
|
|
|
|
TFM_MODAL_SNAP_INV_ON = 6,
|
|
|
|
|
TFM_MODAL_SNAP_INV_OFF = 7,
|
|
|
|
|
TFM_MODAL_SNAP_TOGGLE = 8,
|
|
|
|
|
TFM_MODAL_AXIS_X = 9,
|
|
|
|
|
TFM_MODAL_AXIS_Y = 10,
|
|
|
|
|
TFM_MODAL_AXIS_Z = 11,
|
|
|
|
|
TFM_MODAL_PLANE_X = 12,
|
|
|
|
|
TFM_MODAL_PLANE_Y = 13,
|
|
|
|
|
TFM_MODAL_PLANE_Z = 14,
|
|
|
|
|
TFM_MODAL_CONS_OFF = 15,
|
|
|
|
|
TFM_MODAL_ADD_SNAP = 16,
|
|
|
|
|
TFM_MODAL_REMOVE_SNAP = 17,
|
|
|
|
|
|
2018-11-14 12:53:15 +11:00
|
|
|
/* 18 and 19 used by numinput, defined in transform.h */
|
2015-05-08 10:38:53 +02:00
|
|
|
|
|
|
|
|
TFM_MODAL_PROPSIZE_UP = 20,
|
|
|
|
|
TFM_MODAL_PROPSIZE_DOWN = 21,
|
|
|
|
|
TFM_MODAL_AUTOIK_LEN_INC = 22,
|
|
|
|
|
TFM_MODAL_AUTOIK_LEN_DEC = 23,
|
|
|
|
|
|
|
|
|
|
TFM_MODAL_EDGESLIDE_UP = 24,
|
|
|
|
|
TFM_MODAL_EDGESLIDE_DOWN = 25,
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2013-01-01 14:06:02 +00:00
|
|
|
/* for analog input, like trackpad */
|
2015-05-08 10:38:53 +02:00
|
|
|
TFM_MODAL_PROPSIZE = 26,
|
2015-08-01 17:39:48 +02:00
|
|
|
/* node editor insert offset (aka auto-offset) direction toggle */
|
|
|
|
|
TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27,
|
2015-05-08 10:38:53 +02:00
|
|
|
};
|
2013-01-01 14:06:02 +00:00
|
|
|
|
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:
|
|
|
|
|
{
|
|
|
|
|
if ((t->flag & T_RELEASE_CONFIRM) && ISMOUSE(t->launch_event)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
2018-07-09 17:58:58 +02:00
|
|
|
else if (t->tsnap.mode & (SCE_SNAP_MODE_INCREMENT | SCE_SNAP_MODE_GRID)) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (!validSnap(t)) {
|
|
|
|
|
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:
|
|
|
|
|
case TFM_MODAL_PLANE_Z:
|
|
|
|
|
{
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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", ""},
|
2018-07-09 07:39:26 +02: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", ""},
|
|
|
|
|
{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", ""},
|
|
|
|
|
{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, "Toggle Direction for Node Auto-offset", ""},
|
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", ""},
|
2019-02-03 14:01:45 +11:00
|
|
|
{0, NULL, 0, NULL, NULL},
|
2012-06-10 19:59:02 +00:00
|
|
|
};
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
wmKeyMap *keymap = WM_modalkeymap_get(keyconf, "Transform Modal Map");
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
keymap = WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
|
2018-07-09 08:41:48 +02:00
|
|
|
keymap->poll_modal_item = transform_modal_item_poll;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-12-21 17:23:44 +00:00
|
|
|
return keymap;
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-10 06:51:25 +02:00
|
|
|
static void transform_event_xyz_constraint(TransInfo *t, short key_type, char cmode, bool is_plane)
|
2012-05-17 22:52:42 +00:00
|
|
|
{
|
|
|
|
|
if (!(t->flag & T_NO_CONSTRAINT)) {
|
|
|
|
|
int constraint_axis, constraint_plane;
|
2015-04-20 23:37:04 +10:00
|
|
|
const bool edit_2d = (t->flag & T_2D_EDIT) != 0;
|
2013-02-19 15:45:56 +00:00
|
|
|
const char *msg1 = "", *msg2 = "", *msg3 = "";
|
2012-05-17 22:52:42 +00:00
|
|
|
char axis;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-17 22:52:42 +00:00
|
|
|
/* Initialize */
|
2012-05-22 22:03:41 +00:00
|
|
|
switch (key_type) {
|
2012-05-17 22:52:42 +00:00
|
|
|
case XKEY:
|
2013-02-19 15:45:56 +00:00
|
|
|
msg1 = IFACE_("along X");
|
|
|
|
|
msg2 = IFACE_("along %s X");
|
|
|
|
|
msg3 = IFACE_("locking %s X");
|
2012-05-17 22:52:42 +00:00
|
|
|
axis = 'X';
|
|
|
|
|
constraint_axis = CON_AXIS0;
|
|
|
|
|
break;
|
|
|
|
|
case YKEY:
|
2013-02-19 15:45:56 +00:00
|
|
|
msg1 = IFACE_("along Y");
|
|
|
|
|
msg2 = IFACE_("along %s Y");
|
|
|
|
|
msg3 = IFACE_("locking %s Y");
|
2012-05-17 22:52:42 +00:00
|
|
|
axis = 'Y';
|
|
|
|
|
constraint_axis = CON_AXIS1;
|
|
|
|
|
break;
|
|
|
|
|
case ZKEY:
|
2013-02-19 15:45:56 +00:00
|
|
|
msg1 = IFACE_("along Z");
|
|
|
|
|
msg2 = IFACE_("along %s Z");
|
|
|
|
|
msg3 = IFACE_("locking %s Z");
|
2012-05-17 22:52:42 +00:00
|
|
|
axis = 'Z';
|
|
|
|
|
constraint_axis = CON_AXIS2;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
/* Invalid key */
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
constraint_plane = ((CON_AXIS0 | CON_AXIS1 | CON_AXIS2) & (~constraint_axis));
|
2012-05-17 22:52:42 +00:00
|
|
|
|
|
|
|
|
if (edit_2d && (key_type != ZKEY)) {
|
|
|
|
|
if (cmode == axis) {
|
|
|
|
|
stopConstraint(t);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-02-08 15:14:54 +11:00
|
|
|
setUserConstraint(t, V3D_ORIENT_GLOBAL, constraint_axis, msg1);
|
2012-05-17 22:52:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (!edit_2d) {
|
2018-11-28 10:01:16 +11:00
|
|
|
if (cmode != axis) {
|
|
|
|
|
/* First press, constraint to an axis. */
|
2018-11-29 12:49:02 +11:00
|
|
|
t->orientation.index = 0;
|
|
|
|
|
const short *orientation_ptr = t->orientation.types[t->orientation.index];
|
2019-02-08 15:14:54 +11:00
|
|
|
const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
|
2018-11-28 10:01:16 +11:00
|
|
|
if (is_plane == false) {
|
|
|
|
|
setUserConstraint(t, orientation, constraint_axis, msg2);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
setUserConstraint(t, orientation, constraint_plane, msg3);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Successive presses on existing axis, cycle orientation modes. */
|
|
|
|
|
t->orientation.index = (t->orientation.index + 1) % ARRAY_SIZE(t->orientation.types);
|
|
|
|
|
|
|
|
|
|
if (t->orientation.index == 0) {
|
2012-05-17 22:52:42 +00:00
|
|
|
stopConstraint(t);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-11-29 12:49:02 +11:00
|
|
|
const short *orientation_ptr = t->orientation.types[t->orientation.index];
|
2019-02-08 15:14:54 +11:00
|
|
|
const short orientation = orientation_ptr ? *orientation_ptr : V3D_ORIENT_GLOBAL;
|
2018-07-10 06:51:25 +02:00
|
|
|
if (is_plane == false) {
|
2012-05-17 22:52:42 +00:00
|
|
|
setUserConstraint(t, orientation, constraint_axis, msg2);
|
2018-07-10 06:51:25 +02:00
|
|
|
}
|
|
|
|
|
else {
|
2012-05-17 22:52:42 +00:00
|
|
|
setUserConstraint(t, orientation, constraint_plane, msg3);
|
2018-07-10 06:51:25 +02:00
|
|
|
}
|
2012-05-17 22:52:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
}
|
|
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
|
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
|
|
|
{
|
|
|
|
|
char cmode = constraintModeToChar(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
|
|
|
bool handled = false;
|
2015-01-20 23:14:06 +11:00
|
|
|
const int modifiers_prev = t->modifiers;
|
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
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->redraw |= handleMouseInput(t, &t->mouse, event);
|
|
|
|
|
|
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) {
|
2009-12-29 21:20:46 +00:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_SELECT)
|
|
|
|
|
t->con.mode |= CON_SELECT;
|
|
|
|
|
|
2011-11-07 01:38:32 +00:00
|
|
|
copy_v2_v2_int(t->mval, event->mval);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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;
|
|
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
if (t->state == TRANS_STARTING) {
|
2010-03-22 09:30:00 +00:00
|
|
|
t->state = TRANS_RUNNING;
|
2009-11-12 19:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
2011-12-26 20:23:07 +00:00
|
|
|
|
|
|
|
|
// Snapping mouse move events
|
|
|
|
|
t->redraw |= handleSnapping(t, event);
|
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
|
|
|
}
|
2.5
Modal keymaps.
I've tried to make it as simple as possible, yet still using sufficient facilities to enable self-documenting UIs, saving/reading in files, and proper Python support.
The simplicity is: the 'modal keymap' just checks an event, uses event matching similarly to other keymap matching, and if there's a match it changes the event type, and sets the event value to what the modal keymap has defined. The event values are being defined using EnumPropertyItem structs, so the UI will be able to show all options in self-documenting way.
This system also allows to still handle hardcoded own events.
Tech doc:
1) define keymap
- Create map with unique name, WM_modalkeymap_add()
- Give map property definitions (EnumPropertyItem *)
This only for UI, so user can get information on available options
2) items
- WM_modalkeymap_add_item(): give it an enum value for events
3) activate
- In keymap definition code, assign the modal keymap to operatortype
WM_modalkeymap_assign()
4) event manager
- The event handler will check for modal keymap, if so:
- If the modal map has a match:
- Sets event->type to EVT_MODAL_MAP
- Sets event->val to the enum value
5) modal handler
- If event type is EVT_MODAL_MAP:
- Check event->val, handle it
- Other events can just be handled still
Two examples added in the code:
editors/transform/transform.c: transform_modal_keymap()
editors/screen/screen_ops.c: keymap_modal_set()
Also: to support 'key release' the define KM_RELEASE now is officially
used in event manager, this is not '0', so don't check key events with
the old convention if(event->val) but use if(event->val==KM_PRESS)
2009-07-21 11:03:07 +00:00
|
|
|
/* handle modal keymap first */
|
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... */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
|
2015-07-21 14:15:31 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
initTranslation(t);
|
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
WM_event_add_mousemove(t->context);
|
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
|
|
|
}
|
|
|
|
|
else if (t->mode == TFM_SEQ_SLIDE) {
|
|
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
if (t->obedit_type == OB_MESH) {
|
2014-05-19 21:34:57 +10:00
|
|
|
if ((t->mode == TFM_TRANSLATION) && (t->spacetype == SPACE_VIEW3D)) {
|
2015-07-21 14:15:31 +10:00
|
|
|
restoreTransObjects(t);
|
2013-04-24 15:15:01 +00:00
|
|
|
resetTransModal(t);
|
2013-01-13 14:22:37 +00:00
|
|
|
resetTransRestrictions(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
|
|
|
|
|
/* first try edge slide */
|
|
|
|
|
initEdgeSlide(t);
|
|
|
|
|
/* if that fails, do vertex slide */
|
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
2018-04-26 10:08:41 +02:00
|
|
|
resetTransModal(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
t->state = TRANS_STARTING;
|
|
|
|
|
initVertSlide(t);
|
2013-01-13 14:22:37 +00:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
/* vert slide can fail on unconnected vertices (rare but possible) */
|
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
2018-04-26 10:08:41 +02:00
|
|
|
resetTransModal(t);
|
2015-10-01 12:03:09 +02:00
|
|
|
t->mode = TFM_TRANSLATION;
|
2014-01-02 09:33:59 +01:00
|
|
|
t->state = TRANS_STARTING;
|
2013-01-21 00:39:54 +00:00
|
|
|
restoreTransObjects(t);
|
2015-07-21 14:15:31 +10:00
|
|
|
resetTransRestrictions(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
initTranslation(t);
|
2013-01-21 00:39:54 +00:00
|
|
|
}
|
2013-01-13 14:22:37 +00:00
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
|
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
|
|
|
WM_event_add_mousemove(t->context);
|
2013-01-13 14:22:37 +00:00
|
|
|
}
|
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
else if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
|
|
|
|
|
if (t->mode == TFM_TRANSLATION) {
|
2013-01-13 14:22:37 +00:00
|
|
|
restoreTransObjects(t);
|
|
|
|
|
|
|
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
|
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;
|
2013-01-13 14:22:37 +00:00
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_ROTATE:
|
|
|
|
|
/* only switch when... */
|
|
|
|
|
if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
|
2015-08-27 11:09:52 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
if (t->mode == TFM_ROTATION) {
|
|
|
|
|
initTrackball(t);
|
2011-01-06 14:19:46 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2014-01-02 09:33:59 +01:00
|
|
|
initRotation(t);
|
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;
|
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
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_RESIZE:
|
|
|
|
|
/* only switch when... */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL, TFM_EDGE_SLIDE, TFM_VERT_SLIDE)) {
|
2014-04-17 04:02:42 +10:00
|
|
|
|
|
|
|
|
/* Scale isn't normally very useful after extrude along normals, see T39756 */
|
2019-02-08 15:14:54 +11:00
|
|
|
if ((t->con.mode & CON_APPLY) && (t->con.orientation == V3D_ORIENT_NORMAL)) {
|
2014-04-17 04:02:42 +10:00
|
|
|
stopConstraint(t);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-21 14:15:31 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
initResize(t);
|
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
else if (t->mode == TFM_SHRINKFATTEN) {
|
|
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
else if (t->mode == TFM_RESIZE) {
|
|
|
|
|
if (t->options & CTX_MOVIECLIP) {
|
|
|
|
|
restoreTransObjects(t);
|
|
|
|
|
|
|
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
Planar tracking support for motion tracking
===========================================
Major list of changes done in tomato branch:
- Add a planar tracking implementation to libmv
This adds a new planar tracking implementation to libmv. The
tracker is based on Ceres[1], the new nonlinear minimizer that
myself and Sameer released from Google as open source. Since
the motion model is more involved, the interface is
different than the RegionTracker interface used previously
in Blender.
The start of a C API in libmv-capi.{cpp,h} is also included.
- Migrate from pat_{min,max} for markers to 4 corners representation
Convert markers in the movie clip editor / 2D tracker from using
pat_min and pat_max notation to using the a more general, 4-corner
representation.
There is still considerable porting work to do; in particular
sliding from preview widget does not work correct for rotated
markers.
All other areas should be ported to new representation:
* Added support of sliding individual corners. LMB slide + Ctrl
would scale the whole pattern
* S would scale the whole marker, S-S would scale pattern only
* Added support of marker's rotation which is currently rotates
only patterns around their centers or all markers around median,
Rotation or other non-translation/scaling transformation of search
area doesn't make sense.
* Track Preview widget would display transformed pattern which
libmv actually operates with.
- "Efficient Second-order Minimization" for the planar tracker
This implements the "Efficient Second-order Minimization"
scheme, as supported by the existing translation tracker.
This increases the amount of per-iteration work, but
decreases the number of iterations required to converge and
also increases the size of the basin of attraction for the
optimization.
- Remove the use of the legacy RegionTracker API from Blender,
and replaces it with the new TrackRegion API. This also
adds several features to the planar tracker in libmv:
* Do a brute-force initialization of tracking similar to "Hybrid"
mode in the stable release, but using all floats. This is slower
but more accurate. It is still necessary to evaluate if the
performance loss is worth it. In particular, this change is
necessary to support high bit depth imagery.
* Add support for masks over the search window. This is a step
towards supporting user-defined tracker masks. The tracker masks
will make it easy for users to make a mask for e.g. a ball.
Not exposed into interface yet/
* Add Pearson product moment correlation coefficient checking (aka
"Correlation" in the UI. This causes tracking failure if the
tracked patch is not linearly related to the template.
* Add support for warping a few points in addition to the supplied
points. This is useful because the tracking code deliberately
does not expose the underlying warp representation. Instead,
warps are specified in an aparametric way via the correspondences.
- Replace the old style tracker configuration panel with the
new planar tracking panel. From a users perspective, this means:
* The old "tracking algorithm" picker is gone. There is only 1
algorithm now. We may revisit this later, but I would much
prefer to have only 1 algorithm. So far no optimization work
has been done so the speed is not there yet.
* There is now a dropdown to select the motion model. Choices:
* Translation
* Translation, rotation
* Translation, scale
* Translation, rotation, scale
* Affine
* Perspective
* The old "Hybrid" mode is gone; instead there is a toggle to
enable or disable translation-only tracker initialization. This
is the equivalent of the hyrbid mode before, but rewritten to work
with the new planar tracking modes.
* The pyramid levels setting is gone. At a future date, the planar
tracker will decide to use pyramids or not automatically. The
pyramid setting was ultimately a mistake; with the brute force
initialization it is unnecessary.
- Add light-normalized tracking
Added the ability to normalize patterns by their average value while
tracking, to make them invariant to global illumination changes.
Additional details could be found at wiki page [2]
[1] http://code.google.com/p/ceres-solver
[2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker
2012-06-10 15:28:19 +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;
|
Planar tracking support for motion tracking
===========================================
Major list of changes done in tomato branch:
- Add a planar tracking implementation to libmv
This adds a new planar tracking implementation to libmv. The
tracker is based on Ceres[1], the new nonlinear minimizer that
myself and Sameer released from Google as open source. Since
the motion model is more involved, the interface is
different than the RegionTracker interface used previously
in Blender.
The start of a C API in libmv-capi.{cpp,h} is also included.
- Migrate from pat_{min,max} for markers to 4 corners representation
Convert markers in the movie clip editor / 2D tracker from using
pat_min and pat_max notation to using the a more general, 4-corner
representation.
There is still considerable porting work to do; in particular
sliding from preview widget does not work correct for rotated
markers.
All other areas should be ported to new representation:
* Added support of sliding individual corners. LMB slide + Ctrl
would scale the whole pattern
* S would scale the whole marker, S-S would scale pattern only
* Added support of marker's rotation which is currently rotates
only patterns around their centers or all markers around median,
Rotation or other non-translation/scaling transformation of search
area doesn't make sense.
* Track Preview widget would display transformed pattern which
libmv actually operates with.
- "Efficient Second-order Minimization" for the planar tracker
This implements the "Efficient Second-order Minimization"
scheme, as supported by the existing translation tracker.
This increases the amount of per-iteration work, but
decreases the number of iterations required to converge and
also increases the size of the basin of attraction for the
optimization.
- Remove the use of the legacy RegionTracker API from Blender,
and replaces it with the new TrackRegion API. This also
adds several features to the planar tracker in libmv:
* Do a brute-force initialization of tracking similar to "Hybrid"
mode in the stable release, but using all floats. This is slower
but more accurate. It is still necessary to evaluate if the
performance loss is worth it. In particular, this change is
necessary to support high bit depth imagery.
* Add support for masks over the search window. This is a step
towards supporting user-defined tracker masks. The tracker masks
will make it easy for users to make a mask for e.g. a ball.
Not exposed into interface yet/
* Add Pearson product moment correlation coefficient checking (aka
"Correlation" in the UI. This causes tracking failure if the
tracked patch is not linearly related to the template.
* Add support for warping a few points in addition to the supplied
points. This is useful because the tracking code deliberately
does not expose the underlying warp representation. Instead,
warps are specified in an aparametric way via the correspondences.
- Replace the old style tracker configuration panel with the
new planar tracking panel. From a users perspective, this means:
* The old "tracking algorithm" picker is gone. There is only 1
algorithm now. We may revisit this later, but I would much
prefer to have only 1 algorithm. So far no optimization work
has been done so the speed is not there yet.
* There is now a dropdown to select the motion model. Choices:
* Translation
* Translation, rotation
* Translation, scale
* Translation, rotation, scale
* Affine
* Perspective
* The old "Hybrid" mode is gone; instead there is a toggle to
enable or disable translation-only tracker initialization. This
is the equivalent of the hyrbid mode before, but rewritten to work
with the new planar tracking modes.
* The pyramid levels setting is gone. At a future date, the planar
tracker will decide to use pyramids or not automatically. The
pyramid setting was ultimately a mistake; with the brute force
initialization it is unnecessary.
- Add light-normalized tracking
Added the ability to normalize patterns by their average value while
tracking, to make them invariant to global illumination changes.
Additional details could be found at wiki page [2]
[1] http://code.google.com/p/ceres-solver
[2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker
2012-06-10 15:28:19 +00:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
}
|
|
|
|
|
break;
|
2018-05-13 06:44:03 +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:
|
|
|
|
|
t->modifiers ^= MOD_SNAP;
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_AXIS_X:
|
2014-10-23 14:16:36 +02:00
|
|
|
if (!(t->flag & T_NO_CONSTRAINT)) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, XKEY, cmode, false);
|
2014-01-02 09:33:59 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_AXIS_Y:
|
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, YKEY, cmode, false);
|
2014-01-02 09:33:59 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_AXIS_Z:
|
2014-10-23 14:16:36 +02:00
|
|
|
if ((t->flag & (T_NO_CONSTRAINT)) == 0) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, ZKEY, cmode, false);
|
2010-02-03 21:01:41 +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;
|
|
|
|
|
case TFM_MODAL_PLANE_X:
|
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, XKEY, cmode, true);
|
2010-02-03 21:01:41 +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;
|
|
|
|
|
case TFM_MODAL_PLANE_Y:
|
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, YKEY, cmode, true);
|
2010-02-03 21:01:41 +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;
|
|
|
|
|
case TFM_MODAL_PLANE_Z:
|
|
|
|
|
if ((t->flag & (T_NO_CONSTRAINT | T_2D_EDIT)) == 0) {
|
2018-07-10 06:51:25 +02:00
|
|
|
transform_event_xyz_constraint(t, ZKEY, cmode, true);
|
2014-01-02 09:33:59 +01:00
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_CONS_OFF:
|
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
|
|
|
|
stopConstraint(t);
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_ADD_SNAP:
|
|
|
|
|
addSnapPoint(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;
|
|
|
|
|
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) {
|
|
|
|
|
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);
|
2016-06-23 16:43:12 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
t->prop_size = min_ff(t->prop_size, T_PROP_SIZE_MAX);
|
|
|
|
|
}
|
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) {
|
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
|
|
|
t->prop_size = max_ff(t->prop_size, T_PROP_SIZE_MIN);
|
2014-01-02 09:33:59 +01:00
|
|
|
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;
|
|
|
|
|
case TFM_MODAL_AUTOIK_LEN_DEC:
|
|
|
|
|
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_INSERTOFS_TOGGLE_DIR:
|
|
|
|
|
if (t->spacetype == SPACE_NODE) {
|
|
|
|
|
SpaceNode *snode = (SpaceNode *)t->sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
BLI_assert(t->sa->spacetype == t->spacetype);
|
|
|
|
|
|
|
|
|
|
if (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_RIGHT) {
|
|
|
|
|
snode->insert_ofs_dir = SNODE_INSERTOFS_DIR_LEFT;
|
|
|
|
|
}
|
|
|
|
|
else if (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_LEFT) {
|
|
|
|
|
snode->insert_ofs_dir = SNODE_INSERTOFS_DIR_RIGHT;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t->redraw |= TREDRAW_SOFT;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2015-05-08 10:29:59 +02:00
|
|
|
/* Those two are only handled in transform's own handler, see T44634! */
|
|
|
|
|
case TFM_MODAL_EDGESLIDE_UP:
|
|
|
|
|
case TFM_MODAL_EDGESLIDE_DOWN:
|
2014-01-02 09:33:59 +01:00
|
|
|
default:
|
|
|
|
|
break;
|
2013-10-23 06:48:36 +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
|
|
|
}
|
|
|
|
|
/* else do non-mapped events */
|
2012-04-28 06:31:57 +00:00
|
|
|
else if (event->val == KM_PRESS) {
|
2014-01-02 09:33:59 +01:00
|
|
|
switch (event->type) {
|
|
|
|
|
case RIGHTMOUSE:
|
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
/* enforce redraw of transform when modifiers are used */
|
|
|
|
|
case LEFTSHIFTKEY:
|
|
|
|
|
case RIGHTSHIFTKEY:
|
|
|
|
|
t->modifiers |= MOD_CONSTRAINT_PLANE;
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
case SPACEKEY:
|
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
|
|
|
|
/* exception for switching to dolly, or trackball, in camera view */
|
|
|
|
|
if (t->flag & T_CAMERA) {
|
|
|
|
|
if (t->mode == TFM_TRANSLATION)
|
|
|
|
|
setLocalConstraint(t, (CON_AXIS2), IFACE_("along local Z"));
|
|
|
|
|
else if (t->mode == TFM_ROTATION) {
|
|
|
|
|
restoreTransObjects(t);
|
|
|
|
|
initTrackball(t);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
t->modifiers |= MOD_CONSTRAINT_SELECT;
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
stopConstraint(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
|
|
|
}
|
|
|
|
|
else {
|
2018-11-29 21:52:16 +11:00
|
|
|
if (event->shift) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* bit hackish... but it prevents mmb select to print the
|
|
|
|
|
* orientation from menu */
|
2018-11-29 21:52:16 +11:00
|
|
|
float mati[3][3];
|
|
|
|
|
strcpy(t->spacename, "global");
|
|
|
|
|
unit_m3(mati);
|
|
|
|
|
initSelectConstraint(t, mati);
|
|
|
|
|
}
|
2018-12-19 20:44:14 +11:00
|
|
|
else {
|
|
|
|
|
initSelectConstraint(t, t->spacemtx);
|
|
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
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;
|
|
|
|
|
case ESCKEY:
|
|
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
case PADENTER:
|
|
|
|
|
case RETKEY:
|
|
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
case GKEY:
|
|
|
|
|
/* only switch when... */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
|
2015-07-21 14:15:31 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
initTranslation(t);
|
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
|
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;
|
|
|
|
|
case SKEY:
|
|
|
|
|
/* only switch when... */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL)) {
|
2015-07-21 14:15:31 +10:00
|
|
|
restoreTransObjects(t);
|
2014-01-02 09:33:59 +01:00
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
initResize(t);
|
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case RKEY:
|
|
|
|
|
/* only switch when... */
|
|
|
|
|
if (!(t->options & CTX_TEXTURE)) {
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION)) {
|
2015-08-27 11:09:52 +10:00
|
|
|
restoreTransObjects(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
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
2012-06-10 19:59:02 +00:00
|
|
|
|
2014-01-02 09:33:59 +01:00
|
|
|
if (t->mode == TFM_ROTATION) {
|
|
|
|
|
initTrackball(t);
|
2012-06-10 19:59:02 +00:00
|
|
|
}
|
2014-01-02 09:33:59 +01:00
|
|
|
else {
|
|
|
|
|
initRotation(t);
|
|
|
|
|
}
|
|
|
|
|
initSnapping(t, NULL); // need to reinit after mode change
|
2012-06-10 19:59:02 +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;
|
|
|
|
|
case CKEY:
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case OKEY:
|
|
|
|
|
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;
|
|
|
|
|
case PADPLUSKEY:
|
|
|
|
|
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
|
|
|
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);
|
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;
|
|
|
|
|
case PAGEUPKEY:
|
|
|
|
|
case WHEELDOWNMOUSE:
|
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
|
transform_autoik_update(t, 1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
view_editmove(event->type);
|
|
|
|
|
}
|
|
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
break;
|
|
|
|
|
case PADMINUS:
|
|
|
|
|
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;
|
|
|
|
|
case PAGEDOWNKEY:
|
|
|
|
|
case WHEELUPMOUSE:
|
|
|
|
|
if (t->flag & T_AUTOIK) {
|
|
|
|
|
transform_autoik_update(t, -1);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
view_editmove(event->type);
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
case LEFTALTKEY:
|
|
|
|
|
case RIGHTALTKEY:
|
|
|
|
|
if (ELEM(t->spacetype, SPACE_SEQ, SPACE_VIEW3D)) {
|
|
|
|
|
t->flag |= T_ALT_TRANSFORM;
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2018-05-25 22:24:24 +05:30
|
|
|
case NKEY:
|
|
|
|
|
if (ELEM(t->mode, TFM_ROTATION)) {
|
|
|
|
|
if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) {
|
|
|
|
|
restoreTransObjects(t);
|
|
|
|
|
resetTransModal(t);
|
|
|
|
|
resetTransRestrictions(t);
|
|
|
|
|
initNormalRotation(t);
|
|
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
|
handled = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
2014-01-02 09:33:59 +01:00
|
|
|
default:
|
|
|
|
|
break;
|
2013-10-23 06:48:36 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00: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) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case LEFTSHIFTKEY:
|
|
|
|
|
case RIGHTSHIFTKEY:
|
|
|
|
|
t->modifiers &= ~MOD_CONSTRAINT_PLANE;
|
2010-02-03 21:01:41 +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-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MIDDLEMOUSE:
|
|
|
|
|
if ((t->flag & T_NO_CONSTRAINT) == 0) {
|
|
|
|
|
t->modifiers &= ~MOD_CONSTRAINT_SELECT;
|
|
|
|
|
postSelectConstraint(t);
|
|
|
|
|
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-06-10 19:59:02 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2012-11-05 10:15:58 +00:00
|
|
|
case LEFTALTKEY:
|
|
|
|
|
case RIGHTALTKEY:
|
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;
|
2012-06-10 19:59:02 +00:00
|
|
|
default:
|
|
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-11-12 19:49:26 +00:00
|
|
|
|
|
|
|
|
/* confirm transform if launch key is released after mouse move */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->flag & T_RELEASE_CONFIRM) {
|
2014-04-07 20:43:40 +10:00
|
|
|
/* XXX Keyrepeat bug in Xorg messes this up, will test when fixed */
|
2018-06-08 08:48:21 +02:00
|
|
|
if ((event->type == t->launch_event) && ISMOUSE(t->launch_event)) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
|
}
|
2009-11-12 19:49:26 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-01-20 23:14:06 +11:00
|
|
|
/* if we change snap options, get the unsnapped values back */
|
|
|
|
|
if ((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
|
|
|
}
|
|
|
|
|
|
2014-02-24 19:34:36 +11:00
|
|
|
/* Per transform event, if present */
|
|
|
|
|
if (t->handleEvent &&
|
|
|
|
|
(!handled ||
|
|
|
|
|
/* Needed for vertex slide, see [#38756] */
|
|
|
|
|
(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
|
|
|
}
|
2009-11-29 16:49:26 +00: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;
|
|
|
|
|
}
|
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
else {
|
2009-11-29 16:49:26 +00:00
|
|
|
return OPERATOR_PASS_THROUGH;
|
2012-10-05 13:22: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
|
|
|
}
|
|
|
|
|
|
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;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-05-20 17:44:50 +02:00
|
|
|
t->context = C;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->state = TRANS_RUNNING;
|
|
|
|
|
|
2013-04-04 21:40:39 +00:00
|
|
|
/* avoid calculating PET */
|
2013-08-14 08:14:50 +00:00
|
|
|
t->options = CTX_NO_PET;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = TFM_DUMMY;
|
|
|
|
|
|
2013-11-25 07:49:49 +11:00
|
|
|
initTransInfo(C, t, NULL, NULL);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2015-12-01 18:52:24 +11:00
|
|
|
/* avoid doing connectivity lookups (when V3D_AROUND_LOCAL_ORIGINS is set) */
|
|
|
|
|
t->around = V3D_AROUND_CENTER_BOUNDS;
|
2013-04-04 21:40:39 +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
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->around = centerMode; // override userdefined 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
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (t->data_len_all == 0) {
|
2014-04-01 11:34:00 +11:00
|
|
|
success = false;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2014-04-01 11:34:00 +11:00
|
|
|
success = true;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-05-22 22:03:41 +00:00
|
|
|
if (cent2d) {
|
2013-10-12 03:42:06 +00:00
|
|
|
copy_v2_v2(cent2d, t->center2d);
|
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
|
2015-06-26 16:19:39 +10:00
|
|
|
copy_v3_v3(cent3d, t->center_global);
|
2012-05-16 14:30:41 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
typedef enum {
|
|
|
|
|
UP,
|
|
|
|
|
DOWN,
|
|
|
|
|
LEFT,
|
|
|
|
|
RIGHT
|
|
|
|
|
} ArrowDirection;
|
2017-01-19 00:46:01 -05:00
|
|
|
|
|
|
|
|
#define POS_INDEX 0
|
2018-07-18 00:12:21 +02:00
|
|
|
/* NOTE: this --^ is a bit hackish, but simplifies GPUVertFormat usage among functions
|
2017-01-19 00:46:01 -05:00
|
|
|
* private to this file - merwin
|
|
|
|
|
*/
|
|
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
static void drawArrow(ArrowDirection d, short offset, short length, short size)
|
|
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 6);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (d) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case LEFT:
|
|
|
|
|
offset = -offset;
|
|
|
|
|
length = -length;
|
|
|
|
|
size = -size;
|
2017-05-20 14:01:03 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2009-04-30 11:47:35 +00:00
|
|
|
case RIGHT:
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, offset, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, offset + length, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, offset + length, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, offset + length - size, -size);
|
|
|
|
|
immVertex2f(POS_INDEX, offset + length, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, offset + length - size, size);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
case DOWN:
|
|
|
|
|
offset = -offset;
|
|
|
|
|
length = -length;
|
|
|
|
|
size = -size;
|
2017-05-20 14:01:03 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2009-04-30 11:47:35 +00:00
|
|
|
case UP:
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, 0, offset);
|
|
|
|
|
immVertex2f(POS_INDEX, 0, offset + length);
|
|
|
|
|
immVertex2f(POS_INDEX, 0, offset + length);
|
|
|
|
|
immVertex2f(POS_INDEX, -size, offset + length - size);
|
|
|
|
|
immVertex2f(POS_INDEX, 0, offset + length);
|
|
|
|
|
immVertex2f(POS_INDEX, size, offset + length - size);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
|
|
|
|
|
immEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void drawArrowHead(ArrowDirection d, short size)
|
|
|
|
|
{
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 4);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (d) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case LEFT:
|
|
|
|
|
size = -size;
|
2017-05-20 14:01:03 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2009-04-30 11:47:35 +00:00
|
|
|
case RIGHT:
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, 0, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, -size, -size);
|
|
|
|
|
immVertex2f(POS_INDEX, 0, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, -size, size);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
2013-07-21 08:16:37 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
case DOWN:
|
|
|
|
|
size = -size;
|
2017-05-20 14:01:03 +10:00
|
|
|
ATTR_FALLTHROUGH;
|
2009-04-30 11:47:35 +00:00
|
|
|
case UP:
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, 0, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, -size, -size);
|
|
|
|
|
immVertex2f(POS_INDEX, 0, 0);
|
|
|
|
|
immVertex2f(POS_INDEX, size, -size);
|
2009-04-30 11:47:35 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
|
|
|
|
|
immEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void drawArc(float size, float angle_start, float angle_end, int segments)
|
|
|
|
|
{
|
|
|
|
|
float delta = (angle_end - angle_start) / segments;
|
|
|
|
|
float angle;
|
2012-07-26 09:29:37 +00:00
|
|
|
int a;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINE_STRIP, segments + 1);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-07-26 09:29:37 +00:00
|
|
|
for (angle = angle_start, a = 0; a < segments; angle += delta, a++) {
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, cosf(angle) * size, sinf(angle) * size);
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex2f(POS_INDEX, cosf(angle_end) * size, sinf(angle_end) * size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
|
|
|
|
|
2018-07-02 11:47:00 +02:00
|
|
|
static bool helpline_poll(bContext *C)
|
2011-03-04 18:39:58 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
ARegion *ar = CTX_wm_region(C);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (ar && ar->regiontype == RGN_TYPE_WINDOW)
|
2011-03-04 18:39:58 +00:00
|
|
|
return 1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-04 10:39:03 +11:00
|
|
|
static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
|
2009-04-30 11:47:35 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
TransInfo *t = (TransInfo *)customdata;
|
2009-12-07 18:10:11 +00:00
|
|
|
|
2017-04-07 00:35:57 +10:00
|
|
|
if (t->helpline != HLP_NONE) {
|
2018-04-09 12:39:43 +02:00
|
|
|
float cent[2];
|
2018-05-03 12:57:34 +02:00
|
|
|
float mval[3] = {
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
0.0f,
|
|
|
|
|
};
|
|
|
|
|
float tmval[2] = {
|
|
|
|
|
(float)t->mval[0],
|
|
|
|
|
(float)t->mval[1],
|
|
|
|
|
};
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-12-03 16:26:31 +01:00
|
|
|
projectFloatViewEx(t, t->center_global, cent, V3D_PROJ_TEST_CLIP_ZERO);
|
2018-05-03 12:57:34 +02:00
|
|
|
/* Offset the values for the area region. */
|
|
|
|
|
const float offset[2] = {
|
|
|
|
|
t->ar->winrct.xmin,
|
|
|
|
|
t->ar->winrct.ymin,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++) {
|
|
|
|
|
cent[i] += offset[i];
|
|
|
|
|
tmval[i] += offset[i];
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2017-04-27 15:27:00 +02:00
|
|
|
/* Dashed lines first. */
|
|
|
|
|
if (ELEM(t->helpline, HLP_SPRING, HLP_ANGLE)) {
|
2018-07-18 00:12:21 +02:00
|
|
|
const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
UNUSED_VARS_NDEBUG(shdr_pos); /* silence warning */
|
|
|
|
|
BLI_assert(shdr_pos == POS_INDEX);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
2017-07-13 16:44:02 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
|
|
|
|
float viewport_size[4];
|
2018-07-02 18:27:05 +02:00
|
|
|
GPU_viewport_size_get_f(viewport_size);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
|
|
|
|
|
2018-07-01 08:42:16 +02:00
|
|
|
immUniform1i("colors_len", 0); /* "simple" mode */
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform1f("dash_width", 6.0f);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniform1f("dash_factor", 0.5f);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
2017-04-27 15:27:00 +02:00
|
|
|
immVertex2fv(POS_INDEX, cent);
|
2018-05-03 12:57:34 +02:00
|
|
|
immVertex2f(POS_INDEX, tmval[0], tmval[1]);
|
2017-04-27 15:27:00 +02:00
|
|
|
immEnd();
|
|
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* And now, solid lines. */
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
2017-04-27 15:27:00 +02:00
|
|
|
UNUSED_VARS_NDEBUG(pos); /* silence warning */
|
2017-01-19 00:46:01 -05:00
|
|
|
BLI_assert(pos == POS_INDEX);
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->helpline) {
|
2009-04-30 11:47:35 +00:00
|
|
|
case HLP_SPRING:
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3fv(mval);
|
|
|
|
|
GPU_matrix_rotate_axis(-RAD2DEGF(atan2f(cent[0] - tmval[0], cent[1] - tmval[1])), 'Z');
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(3.0f);
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
|
break;
|
|
|
|
|
case HLP_HARROW:
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3fv(mval);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(3.0f);
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(RIGHT, 5, 10, 5);
|
|
|
|
|
drawArrow(LEFT, 5, 10, 5);
|
|
|
|
|
break;
|
|
|
|
|
case HLP_VARROW:
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3fv(mval);
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(3.0f);
|
2009-04-30 11:47:35 +00:00
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
|
break;
|
2018-10-17 17:12:57 +11:00
|
|
|
case HLP_CARROW:
|
|
|
|
|
{
|
|
|
|
|
/* Draw arrow based on direction defined by custom-points. */
|
|
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
|
|
|
|
|
|
|
|
|
GPU_matrix_translate_3fv(mval);
|
|
|
|
|
|
|
|
|
|
GPU_line_width(3.0f);
|
|
|
|
|
|
|
|
|
|
const int *data = t->mouse.data;
|
|
|
|
|
const float dx = data[2] - data[0], dy = data[3] - data[1];
|
|
|
|
|
const float angle = -atan2f(dx, dy);
|
|
|
|
|
|
|
|
|
|
GPU_matrix_push();
|
|
|
|
|
|
|
|
|
|
GPU_matrix_rotate_axis(RAD2DEGF(angle), 'Z');
|
|
|
|
|
|
|
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
|
|
|
|
|
|
GPU_matrix_pop();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-04-30 11:47:35 +00:00
|
|
|
case HLP_ANGLE:
|
2012-06-10 19:59:02 +00:00
|
|
|
{
|
2018-05-03 12:57:34 +02:00
|
|
|
float dx = tmval[0] - cent[0], dy = tmval[1] - cent[1];
|
2012-06-10 19:59:02 +00:00
|
|
|
float angle = atan2f(dy, dx);
|
2014-06-14 17:27:50 +10:00
|
|
|
float dist = hypotf(dx, dy);
|
2012-10-23 13:28:22 +00:00
|
|
|
float delta_angle = min_ff(15.0f / dist, (float)M_PI / 4.0f);
|
|
|
|
|
float spacing_angle = min_ff(5.0f / dist, (float)M_PI / 12.0f);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
|
|
|
|
immUniformThemeColor(TH_VIEW_OVERLAY);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3f(cent[0] - tmval[0] + mval[0], cent[1] - tmval[1] + mval[1], 0);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(3.0f);
|
2012-06-10 19:59:02 +00:00
|
|
|
drawArc(dist, angle - delta_angle, angle - spacing_angle, 10);
|
|
|
|
|
drawArc(dist, angle + spacing_angle, angle + delta_angle, 10);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3f(cosf(angle - delta_angle) * dist, sinf(angle - delta_angle) * dist, 0);
|
|
|
|
|
GPU_matrix_rotate_axis(RAD2DEGF(angle - delta_angle), 'Z');
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
drawArrowHead(DOWN, 5);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3f(cosf(angle + delta_angle) * dist, sinf(angle + delta_angle) * dist, 0);
|
|
|
|
|
GPU_matrix_rotate_axis(RAD2DEGF(angle + delta_angle), 'Z');
|
2009-04-30 11:47:35 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
drawArrowHead(UP, 5);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case HLP_TRACKBALL:
|
|
|
|
|
{
|
|
|
|
|
unsigned char col[3], col2[3];
|
|
|
|
|
UI_GetThemeColor3ubv(TH_GRID, col);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_translate_3fv(mval);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(3.0f);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
UI_make_axis_color(col, col2, 'X');
|
2018-06-27 22:47:25 -06:00
|
|
|
immUniformColor3ubv(col2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
drawArrow(RIGHT, 5, 10, 5);
|
|
|
|
|
drawArrow(LEFT, 5, 10, 5);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
UI_make_axis_color(col, col2, 'Y');
|
2018-06-27 22:47:25 -06:00
|
|
|
immUniformColor3ubv(col2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
drawArrow(UP, 5, 10, 5);
|
|
|
|
|
drawArrow(DOWN, 5, 10, 5);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immUnbindProgram();
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2009-04-30 11:47:35 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-19 12:26:33 +11:00
|
|
|
static bool transinfo_show_overlay(const struct bContext *C, TransInfo *t, ARegion *ar)
|
|
|
|
|
{
|
|
|
|
|
/* Don't show overlays when not the active view and when overlay is disabled: T57139 */
|
|
|
|
|
bool ok = false;
|
|
|
|
|
if (ar == t->ar) {
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
|
|
|
|
if (sa->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
View3D *v3d = sa->spacedata.first;
|
|
|
|
|
if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
|
|
|
|
|
ok = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ok;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
|
2009-01-10 18:33:16 +00:00
|
|
|
{
|
|
|
|
|
TransInfo *t = arg;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-12-19 12:26:33 +11:00
|
|
|
if (!transinfo_show_overlay(C, t, ar)) {
|
|
|
|
|
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
|
|
|
|
2018-12-19 12:26:33 +11:00
|
|
|
if (ar == t->ar) {
|
|
|
|
|
/* 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 */
|
2012-10-11 23:42:26 +00:00
|
|
|
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
|
2009-11-01 00:06:53 +00:00
|
|
|
{
|
2012-12-18 13:59:47 +00:00
|
|
|
rcti rect;
|
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
|
|
|
|
2012-12-18 13:59:47 +00:00
|
|
|
ED_region_visible_rect(ar, &rect);
|
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
|
|
|
|
2014-09-04 15:56:40 +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
|
|
|
*/
|
2017-02-05 00:54:21 -05:00
|
|
|
unsigned char color[3];
|
|
|
|
|
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... */
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
GPU_blend(true);
|
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
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2012-10-05 13:22:09 +00:00
|
|
|
}
|
|
|
|
|
|
2018-12-19 12:26:33 +11:00
|
|
|
static void drawTransformPixel(const struct bContext *C, ARegion *ar, void *arg)
|
2018-05-13 06:44:03 +02:00
|
|
|
{
|
2012-10-05 13:22:09 +00:00
|
|
|
TransInfo *t = arg;
|
2018-12-19 12:26:33 +11:00
|
|
|
|
|
|
|
|
if (!transinfo_show_overlay(C, t, ar)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ar == t->ar) {
|
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
|
ViewLayer *view_layer = t->view_layer;
|
|
|
|
|
Object *ob = OBACT(view_layer);
|
|
|
|
|
|
|
|
|
|
/* draw autokeyframing hint in the corner
|
|
|
|
|
* - 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) {
|
|
|
|
|
if (ar == t->ar) {
|
|
|
|
|
if (t->flag & (T_OBJECT | T_POSE)) {
|
|
|
|
|
if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) {
|
|
|
|
|
drawAutoKeyWarning(t, ar);
|
|
|
|
|
}
|
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);
|
2018-07-01 15:47:09 +02:00
|
|
|
bool constraint_axis[3] = {false, false, false};
|
2009-03-06 15:50:15 +00:00
|
|
|
int proportional = 0;
|
2011-08-18 12:09:53 +00:00
|
|
|
PropertyRNA *prop;
|
2009-01-10 19:45:48 +00:00
|
|
|
|
2011-09-27 01:28:15 +00:00
|
|
|
// Save back mode in case we're in the generic operator
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "value"))) {
|
2015-11-12 02:12:03 +11:00
|
|
|
float values[4];
|
|
|
|
|
|
|
|
|
|
copy_v4_v4(values, (t->flag & T_AUTOVALUES) ? t->auto_values : t->values);
|
|
|
|
|
|
2011-08-18 12:09:53 +00:00
|
|
|
if (RNA_property_array_check(prop)) {
|
|
|
|
|
RNA_property_float_set_array(op->ptr, prop, values);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2011-08-18 12:09:53 +00:00
|
|
|
else {
|
|
|
|
|
RNA_property_float_set(op->ptr, prop, values[0]);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
2010-07-31 19:26:21 +00:00
|
|
|
/* convert flag to enum */
|
2013-06-20 13:24:07 +00:00
|
|
|
switch (t->flag & T_PROP_EDIT_ALL) {
|
|
|
|
|
case T_PROP_EDIT:
|
|
|
|
|
proportional = PROP_EDIT_ON;
|
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
case (T_PROP_EDIT | T_PROP_CONNECTED):
|
2012-04-28 06:31:57 +00:00
|
|
|
proportional = PROP_EDIT_CONNECTED;
|
|
|
|
|
break;
|
2013-06-20 13:24:07 +00:00
|
|
|
case (T_PROP_EDIT | T_PROP_PROJECTED):
|
|
|
|
|
proportional = PROP_EDIT_PROJECTED;
|
2012-04-28 06:31:57 +00:00
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
proportional = PROP_EDIT_OFF;
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
// If modal, save settings back in scene if not set as operator argument
|
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 */
|
|
|
|
|
|
2013-08-21 12:20:40 +00:00
|
|
|
/* skip saving proportional edit if it was not actually used */
|
|
|
|
|
if (!(t->options & CTX_NO_PET)) {
|
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional")) &&
|
2014-01-12 22:05:24 +11:00
|
|
|
!RNA_property_is_set(op->ptr, prop))
|
2013-08-21 12:20:40 +00:00
|
|
|
{
|
2019-02-16 16:42:11 +11:00
|
|
|
if (t->spacetype == SPACE_GRAPH)
|
2015-04-10 13:41:57 +10:00
|
|
|
ts->proportional_fcurve = proportional;
|
2015-04-09 18:29:58 +02:00
|
|
|
else if (t->spacetype == SPACE_ACTION)
|
|
|
|
|
ts->proportional_action = proportional;
|
2018-04-16 16:27:55 +02:00
|
|
|
else if (t->obedit_type != -1)
|
2013-08-21 12:20:40 +00:00
|
|
|
ts->proportional = proportional;
|
|
|
|
|
else if (t->options & CTX_MASK)
|
|
|
|
|
ts->proportional_mask = (proportional != PROP_EDIT_OFF);
|
|
|
|
|
else
|
|
|
|
|
ts->proportional_objects = (proportional != PROP_EDIT_OFF);
|
|
|
|
|
}
|
2012-01-14 04:42:41 +00: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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-26 19:47:55 +00:00
|
|
|
/* do we check for parameter? */
|
2018-12-18 11:54:02 +01:00
|
|
|
if (transformModeUseSnap(t)) {
|
|
|
|
|
if (t->modifiers & MOD_SNAP) {
|
|
|
|
|
ts->snap_flag |= SCE_SNAP;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ts->snap_flag &= ~SCE_SNAP;
|
|
|
|
|
}
|
2009-11-26 19:47:55 +00:00
|
|
|
}
|
|
|
|
|
|
2012-01-14 04:42:41 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
|
2018-11-21 12:47:25 +11:00
|
|
|
!RNA_property_is_set(op->ptr, prop) &&
|
2019-02-08 15:14:54 +11:00
|
|
|
(t->orientation.user != V3D_ORIENT_CUSTOM_MATRIX))
|
2012-01-14 04:42:41 +00:00
|
|
|
{
|
2018-12-19 20:51:04 +11:00
|
|
|
TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT];
|
|
|
|
|
orient_slot->type = t->orientation.user;
|
|
|
|
|
BLI_assert(((orient_slot->index_custom == -1) && (t->orientation.custom == NULL)) ||
|
2018-04-18 09:12:44 +02:00
|
|
|
(BKE_scene_transform_orientation_get_index(
|
2018-12-19 20:51:04 +11:00
|
|
|
t->scene, t->orientation.custom) == orient_slot->index_custom));
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-02-17 13:09:21 +11:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "proportional"))) {
|
|
|
|
|
RNA_property_enum_set(op->ptr, prop, proportional);
|
2010-08-18 03:24:52 +00:00
|
|
|
RNA_enum_set(op->ptr, "proportional_edit_falloff", t->prop_mode);
|
2009-03-06 15:50:15 +00:00
|
|
|
RNA_float_set(op->ptr, "proportional_size", t->prop_size);
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-10-16 21:52:30 +11:00
|
|
|
}
|
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "mirror"))) {
|
2019-01-14 14:59:18 +11:00
|
|
|
RNA_property_boolean_set(op->ptr, prop, (t->flag & T_NO_MIRROR) == 0);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis"))) {
|
2017-06-01 20:41:18 +02:00
|
|
|
/* constraint orientation can be global, even if user selects something else
|
|
|
|
|
* so use the orientation in the constraint if set */
|
2019-02-26 20:17:40 +11:00
|
|
|
short orientation = (t->con.mode & CON_APPLY) ? t->con.orientation : t->orientation.unset;
|
2017-06-01 20:41:18 +02:00
|
|
|
|
2019-02-08 15:14:54 +11:00
|
|
|
if (orientation == V3D_ORIENT_CUSTOM) {
|
2018-04-18 09:12:44 +02:00
|
|
|
const int orientation_index_custom = BKE_scene_transform_orientation_get_index(
|
2018-11-28 10:01:16 +11:00
|
|
|
t->scene, t->orientation.custom);
|
2017-06-01 20:41:18 +02:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Maybe we need a t->con.custom_orientation?
|
|
|
|
|
* Seems like it would always match t->orientation.custom. */
|
2019-02-08 15:14:54 +11:00
|
|
|
orientation = V3D_ORIENT_CUSTOM + orientation_index_custom;
|
|
|
|
|
BLI_assert(orientation >= V3D_ORIENT_CUSTOM);
|
2009-12-17 17:34:56 +00:00
|
|
|
}
|
2018-11-01 07:24:10 +11:00
|
|
|
|
|
|
|
|
/* Use 'constraint_matrix' instead. */
|
2019-02-08 15:14:54 +11:00
|
|
|
if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
|
2018-11-01 07:24:10 +11:00
|
|
|
RNA_enum_set(op->ptr, "constraint_orientation", orientation);
|
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
if (orientation != V3D_ORIENT_CUSTOM_MATRIX) {
|
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
RNA_enum_set(op->ptr, "constraint_matrix_orientation", orientation);
|
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2019-02-26 20:22:54 +11:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2019-02-21 21:52:56 +11:00
|
|
|
RNA_float_set_array(op->ptr, "constraint_matrix", &t->con.mtx[0][0]);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2019-02-26 20:22:54 +11:00
|
|
|
else if (t->orient_matrix_is_set) {
|
|
|
|
|
RNA_float_set_array(op->ptr, "constraint_matrix", &t->orient_matrix[0][0]);
|
|
|
|
|
}
|
2019-02-21 21:52:56 +11:00
|
|
|
else {
|
|
|
|
|
RNA_float_set_array(op->ptr, "constraint_matrix", &t->spacemtx[0][0]);
|
|
|
|
|
}
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
if (t->con.mode & CON_AXIS0) {
|
|
|
|
|
constraint_axis[0] = true;
|
|
|
|
|
}
|
|
|
|
|
if (t->con.mode & CON_AXIS1) {
|
|
|
|
|
constraint_axis[1] = true;
|
|
|
|
|
}
|
|
|
|
|
if (t->con.mode & CON_AXIS2) {
|
|
|
|
|
constraint_axis[2] = true;
|
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
/* Only set if needed, so we can hide in the UI when nothing is set.
|
|
|
|
|
* See 'transform_poll_property'. */
|
|
|
|
|
if (ELEM(true, UNPACK3(constraint_axis))) {
|
|
|
|
|
RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
|
|
|
|
|
}
|
2018-07-26 15:44:27 +10:00
|
|
|
}
|
2009-03-06 15:50:15 +00: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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
2015-05-25 15:45:56 +10:00
|
|
|
}
|
|
|
|
|
}
|
2015-12-18 18:25:37 +11:00
|
|
|
|
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "correct_uv"))) {
|
|
|
|
|
RNA_property_boolean_set(op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) != 0);
|
|
|
|
|
}
|
2018-10-18 13:55:01 +11:00
|
|
|
|
|
|
|
|
if (t->mode == TFM_SHEAR) {
|
|
|
|
|
prop = RNA_struct_find_property(op->ptr, "shear_axis");
|
|
|
|
|
t->custom.mode.data = POINTER_FROM_INT(RNA_property_enum_get(op->ptr, prop));
|
|
|
|
|
RNA_property_enum_set(op->ptr, prop, POINTER_AS_INT(t->custom.mode.data));
|
|
|
|
|
}
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-30 21:52:58 +01:00
|
|
|
/**
|
|
|
|
|
* \note caller needs to free 't' on a 0 return
|
|
|
|
|
* \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;
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* added initialize, for external calls to set stuff in TransInfo, like undo string */
|
|
|
|
|
|
2009-11-12 19:49:26 +00:00
|
|
|
t->state = TRANS_STARTING;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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)) {
|
2011-01-06 11:16:35 +00:00
|
|
|
options |= CTX_TEXTURE;
|
2012-01-14 04:42:41 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-09-17 13:07:48 +00:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
t->options = options;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = mode;
|
|
|
|
|
|
2018-06-08 08:48:21 +02:00
|
|
|
/* Needed to translate tweak events to mouse buttons. */
|
|
|
|
|
t->launch_event = event ? WM_userdef_event_type_from_keymap_type(event->type) : -1;
|
2010-03-19 03:26:31 +00:00
|
|
|
|
2010-03-14 18:58:14 +00:00
|
|
|
// XXX Remove this when wm_operator_call_internal doesn't use window->eventstate (which can have type = 0)
|
2018-07-14 23:49:00 +02:00
|
|
|
// For gizmo only, so assume LEFTMOUSE
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->launch_event == 0) {
|
2010-03-14 18:58:14 +00:00
|
|
|
t->launch_event = LEFTMOUSE;
|
|
|
|
|
}
|
|
|
|
|
|
2015-09-09 02:05:10 +10:00
|
|
|
unit_m3(t->spacemtx);
|
|
|
|
|
|
2013-11-25 07:49:49 +11:00
|
|
|
initTransInfo(C, t, op, event);
|
2015-09-09 02:05:10 +10:00
|
|
|
initTransformOrientation(C, t);
|
2009-03-06 15:50:15 +00: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(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2012-10-05 13:22:09 +00:00
|
|
|
t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2009-11-01 00:06:53 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2009-12-07 18:10:11 +00:00
|
|
|
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, t);
|
2009-02-09 20:58:31 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2011-11-07 12:55:18 +00:00
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, 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_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);*/
|
|
|
|
|
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, 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(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
|
|
|
|
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, 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(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
|
|
|
|
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
2018-10-25 16:06:47 +11:00
|
|
|
t->draw_handle_cursor = WM_paint_cursor_activate(
|
|
|
|
|
CTX_wm_manager(C),
|
|
|
|
|
SPACE_TYPE_ANY, RGN_TYPE_ANY,
|
|
|
|
|
helpline_poll, drawHelpline, t);
|
2015-04-07 16:45:29 +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
|
|
|
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
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event) {
|
2013-04-22 21:27:44 +00:00
|
|
|
/* keymap for shortcut header prints */
|
|
|
|
|
t->keymap = WM_keymap_active(CTX_wm_manager(C), op->type->modalkeymap);
|
|
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
/* Stupid code to have Ctrl-Click on gizmo work ok
|
2013-04-22 21:27:44 +00:00
|
|
|
*
|
|
|
|
|
* do this only for translation/rotation/resize due to only this
|
2018-07-14 23:49:00 +02:00
|
|
|
* moded are available from gizmo and doing such check could
|
2012-07-12 14:41:52 +00:00
|
|
|
* lead to keymap conflicts for other modes (see #31584)
|
|
|
|
|
*/
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
|
2012-07-12 14:41:52 +00:00
|
|
|
wmKeyMapItem *kmi;
|
|
|
|
|
|
2013-04-22 21:27:44 +00:00
|
|
|
for (kmi = t->keymap->items.first; kmi; kmi = kmi->next) {
|
2012-07-12 14:41:52 +00:00
|
|
|
if (kmi->propvalue == TFM_MODAL_SNAP_INV_ON && kmi->val == KM_PRESS) {
|
|
|
|
|
if ((ELEM(kmi->type, LEFTCTRLKEY, RIGHTCTRLKEY) && event->ctrl) ||
|
|
|
|
|
(ELEM(kmi->type, LEFTSHIFTKEY, RIGHTSHIFTKEY) && event->shift) ||
|
|
|
|
|
(ELEM(kmi->type, LEFTALTKEY, RIGHTALTKEY) && event->alt) ||
|
|
|
|
|
((kmi->type == OSKEY) && event->oskey) )
|
|
|
|
|
{
|
|
|
|
|
t->modifiers |= MOD_SNAP_INVERT;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2010-03-14 19:38:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-29 19:52:53 +00:00
|
|
|
initSnapping(t, op); // Initialize snapping data AFTER mode flags
|
2009-03-28 20:46:38 +00:00
|
|
|
|
2015-06-30 18:57:17 +10:00
|
|
|
initSnapSpatial(t, t->snap_spatial);
|
|
|
|
|
|
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) */
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-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;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculatePropRatio(t);
|
|
|
|
|
calculateCenter(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-05-06 11:48:32 +02:00
|
|
|
/* Overwrite initial values if operator supplied a non-null vector.
|
|
|
|
|
*
|
|
|
|
|
* Run before init functions so 'values_modal_offset' can be applied on mouse input.
|
|
|
|
|
*/
|
|
|
|
|
BLI_assert(is_zero_v4(t->values_modal_offset));
|
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
|
float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */
|
|
|
|
|
|
|
|
|
|
if (RNA_property_array_check(prop)) {
|
|
|
|
|
RNA_float_get_array(op->ptr, "value", values);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
values[0] = RNA_float_get(op->ptr, "value");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
copy_v4_v4(t->values, values);
|
|
|
|
|
|
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
copy_v4_v4(t->values_modal_offset, values);
|
|
|
|
|
t->redraw = TREDRAW_HARD;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v4_v4(t->auto_values, values);
|
|
|
|
|
t->flag |= T_AUTOVALUES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
initMouseInput(t, &t->mouse, t->center2d, event->mval, use_accurate);
|
2015-10-30 21:52:58 +01:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
switch (mode) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case TFM_TRANSLATION:
|
|
|
|
|
initTranslation(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_ROTATION:
|
|
|
|
|
initRotation(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_RESIZE:
|
|
|
|
|
initResize(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_SKIN_RESIZE:
|
|
|
|
|
initSkinResize(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TOSPHERE:
|
|
|
|
|
initToSphere(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_SHEAR:
|
2018-10-18 13:55:01 +11:00
|
|
|
prop = RNA_struct_find_property(op->ptr, "shear_axis");
|
|
|
|
|
t->custom.mode.data = POINTER_FROM_INT(RNA_property_enum_get(op->ptr, prop));
|
2012-06-10 19:59:02 +00:00
|
|
|
initShear(t);
|
|
|
|
|
break;
|
2013-11-20 12:14:10 +11:00
|
|
|
case TFM_BEND:
|
|
|
|
|
initBend(t);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case TFM_SHRINKFATTEN:
|
|
|
|
|
initShrinkFatten(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TILT:
|
|
|
|
|
initTilt(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_CURVE_SHRINKFATTEN:
|
|
|
|
|
initCurveShrinkFatten(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MASK_SHRINKFATTEN:
|
|
|
|
|
initMaskShrinkFatten(t);
|
|
|
|
|
break;
|
2015-02-13 02:46:14 +13:00
|
|
|
case TFM_GPENCIL_SHRINKFATTEN:
|
|
|
|
|
initGPShrinkFatten(t);
|
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
case TFM_TRACKBALL:
|
|
|
|
|
initTrackball(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_PUSHPULL:
|
|
|
|
|
initPushPull(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_CREASE:
|
|
|
|
|
initCrease(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_BONESIZE:
|
|
|
|
|
{ /* used for both B-Bone width (bonesize) as for deform-dist (envelope) */
|
2018-04-16 16:27:55 +02:00
|
|
|
/* Note: we have to pick one, use the active object. */
|
|
|
|
|
TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t);
|
|
|
|
|
bArmature *arm = tc->poseobj->data;
|
2015-06-17 12:30:30 +02:00
|
|
|
if (arm->drawtype == ARM_ENVELOPE) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
initBoneEnvelope(t);
|
2015-06-17 12:30:30 +02:00
|
|
|
t->mode = TFM_BONE_ENVELOPE_DIST;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
initBoneSize(t);
|
2015-06-17 12:30:30 +02:00
|
|
|
}
|
2013-07-19 15:23:42 +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
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
case TFM_BONE_ENVELOPE:
|
|
|
|
|
initBoneEnvelope(t);
|
|
|
|
|
break;
|
2015-06-17 12:30:30 +02:00
|
|
|
case TFM_BONE_ENVELOPE_DIST:
|
|
|
|
|
initBoneEnvelope(t);
|
|
|
|
|
t->mode = TFM_BONE_ENVELOPE_DIST;
|
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
case TFM_EDGE_SLIDE:
|
2013-01-13 14:08:53 +00:00
|
|
|
case TFM_VERT_SLIDE:
|
2015-10-12 16:44:07 +02:00
|
|
|
{
|
|
|
|
|
const bool use_even = (op ? RNA_boolean_get(op->ptr, "use_even") : false);
|
|
|
|
|
const bool flipped = (op ? RNA_boolean_get(op->ptr, "flipped") : false);
|
2015-10-15 01:46:28 +02:00
|
|
|
const bool use_clamp = (op ? RNA_boolean_get(op->ptr, "use_clamp") : true);
|
|
|
|
|
if (mode == TFM_EDGE_SLIDE) {
|
|
|
|
|
const bool use_double_side = (op ? !RNA_boolean_get(op->ptr, "single_side") : true);
|
|
|
|
|
initEdgeSlide_ex(t, use_double_side, use_even, flipped, use_clamp);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
initVertSlide_ex(t, use_even, flipped, use_clamp);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
break;
|
2015-10-12 16:44:07 +02:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
case TFM_BONE_ROLL:
|
|
|
|
|
initBoneRoll(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TIME_TRANSLATE:
|
2009-01-28 02:56:58 +00:00
|
|
|
initTimeTranslate(t);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case TFM_TIME_SLIDE:
|
|
|
|
|
initTimeSlide(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TIME_SCALE:
|
|
|
|
|
initTimeScale(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TIME_DUPLICATE:
|
|
|
|
|
/* same as TFM_TIME_EXTEND, but we need the mode info for later
|
|
|
|
|
* so that duplicate-culling will work properly
|
|
|
|
|
*/
|
2019-02-16 16:42:11 +11:00
|
|
|
if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
|
2012-06-10 19:59:02 +00:00
|
|
|
initTranslation(t);
|
|
|
|
|
else
|
|
|
|
|
initTimeTranslate(t);
|
|
|
|
|
t->mode = mode;
|
|
|
|
|
break;
|
|
|
|
|
case TFM_TIME_EXTEND:
|
|
|
|
|
/* now that transdata has been made, do like for TFM_TIME_TRANSLATE (for most Animation
|
|
|
|
|
* Editors because they have only 1D transforms for time values) or TFM_TRANSLATION
|
|
|
|
|
* (for Graph/NLA Editors only since they uses 'standard' transforms to get 2D movement)
|
|
|
|
|
* depending on which editor this was called from
|
|
|
|
|
*/
|
2019-02-16 16:42:11 +11:00
|
|
|
if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_NLA))
|
2012-06-10 19:59:02 +00:00
|
|
|
initTranslation(t);
|
|
|
|
|
else
|
|
|
|
|
initTimeTranslate(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_BAKE_TIME:
|
|
|
|
|
initBakeTime(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MIRROR:
|
|
|
|
|
initMirror(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_BWEIGHT:
|
|
|
|
|
initBevelWeight(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_ALIGN:
|
|
|
|
|
initAlign(t);
|
|
|
|
|
break;
|
|
|
|
|
case TFM_SEQ_SLIDE:
|
|
|
|
|
initSeqSlide(t);
|
|
|
|
|
break;
|
2018-05-25 22:24:24 +05:30
|
|
|
case TFM_NORMAL_ROTATION:
|
|
|
|
|
initNormalRotation(t);
|
|
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2011-03-27 22:15:37 +00:00
|
|
|
postTrans(C, t);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Constraint init from operator */
|
2019-02-21 21:52:56 +11:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) &&
|
|
|
|
|
RNA_property_is_set(op->ptr, prop))
|
|
|
|
|
{
|
|
|
|
|
bool constraint_axis[3];
|
2019-01-15 18:39:11 +11:00
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
RNA_property_boolean_get_array(op->ptr, prop, constraint_axis);
|
2019-01-15 18:39:11 +11:00
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
if (constraint_axis[0] || constraint_axis[1] || constraint_axis[2]) {
|
|
|
|
|
t->con.mode |= CON_APPLY;
|
2019-01-15 18:39:11 +11:00
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
/* Only for interactive operation, when redoing, ignore these values since the numbers
|
|
|
|
|
* will be constrainted already. */
|
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
if (constraint_axis[0]) {
|
|
|
|
|
t->con.mode |= CON_AXIS0;
|
|
|
|
|
}
|
|
|
|
|
if (constraint_axis[1]) {
|
|
|
|
|
t->con.mode |= CON_AXIS1;
|
|
|
|
|
}
|
|
|
|
|
if (constraint_axis[2]) {
|
|
|
|
|
t->con.mode |= CON_AXIS2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
t->con.mode |= CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
|
|
|
|
|
}
|
2019-01-15 18:39:11 +11:00
|
|
|
|
2019-02-21 21:52:56 +11:00
|
|
|
setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* So we can adjust in non global orientation. */
|
|
|
|
|
if (t->orientation.user != V3D_ORIENT_GLOBAL) {
|
|
|
|
|
t->con.mode |= CON_APPLY | CON_AXIS0 | CON_AXIS1 | CON_AXIS2;
|
2019-01-15 18:39:11 +11:00
|
|
|
setUserConstraint(t, t->orientation.user, t->con.mode, "%s");
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-01-15 18:54:43 +11: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
|
|
|
}
|
|
|
|
|
|
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) {
|
|
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
|
|
|
|
|
if ((((Mesh *)(tc->obedit->data))->flag & ME_AUTOSMOOTH)) {
|
|
|
|
|
BMEditMesh *em = NULL;// BKE_editmesh_from_object(t->obedit);
|
|
|
|
|
bool do_skip = false;
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
BKE_editmesh_lnorspace_update(em);
|
|
|
|
|
t->flag |= T_CLNOR_REBUILD;
|
|
|
|
|
}
|
|
|
|
|
BM_lnorspace_invalidate(em->bm, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
|
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
return 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
void transformApply(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
selectConstraint(t);
|
|
|
|
|
if (t->transform) {
|
|
|
|
|
t->transform(t, t->mval); // calls recalcData()
|
2009-01-07 16:52:18 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2010-02-03 21:01:41 +00:00
|
|
|
t->redraw = TREDRAW_NOTHING;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else if (t->redraw & TREDRAW_SOFT) {
|
2010-02-03 21:01:41 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* If auto confirm is on, break after one pass */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->options & CTX_AUTOCONFIRM) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->state = TRANS_CONFIRM;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
2010-02-03 21:01:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-26 22:47:05 +00:00
|
|
|
static void drawTransformApply(const bContext *C, ARegion *UNUSED(ar), void *arg)
|
2010-02-03 21:01:41 +00:00
|
|
|
{
|
|
|
|
|
TransInfo *t = arg;
|
|
|
|
|
|
|
|
|
|
if (t->redraw & TREDRAW_SOFT) {
|
|
|
|
|
t->redraw |= TREDRAW_HARD;
|
2010-11-20 21:43:16 +00:00
|
|
|
transformApply((bContext *)C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-31 17:11:42 +00:00
|
|
|
int transformEnd(bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-01-03 22:15:59 +00:00
|
|
|
int exit_code = OPERATOR_RUNNING_MODAL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = C;
|
|
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state != TRANS_STARTING && t->state != TRANS_RUNNING) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* handle restoring objects */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
2010-12-22 19:12:00 +00:00
|
|
|
/* exception, edge slide transformed UVs too */
|
2015-02-11 07:22:19 +11:00
|
|
|
if (t->mode == TFM_EDGE_SLIDE) {
|
2010-12-22 19:12:00 +00:00
|
|
|
doEdgeSlide(t, 0.0f);
|
2015-02-11 07:22:19 +11:00
|
|
|
}
|
|
|
|
|
else if (t->mode == TFM_VERT_SLIDE) {
|
|
|
|
|
doVertSlide(t, 0.0f);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
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) {
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
|
|
|
|
|
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
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
/* free data */
|
2009-12-07 18:10:11 +00:00
|
|
|
postTrans(C, t);
|
2009-11-01 02:52:38 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* send events out for redraws */
|
2011-02-07 16:41:57 +00:00
|
|
|
viewRedrawPost(C, t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-20 19:18:22 +00:00
|
|
|
viewRedrawForce(C, t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-11-20 21:43:16 +00:00
|
|
|
t->context = NULL;
|
|
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
return exit_code;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************** TRANSFORM LOCKS **************************** */
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void protectedTransBits(short protectflag, float vec[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCX)
|
2012-06-10 19:59:02 +00:00
|
|
|
vec[0] = 0.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCY)
|
2012-06-10 19:59:02 +00:00
|
|
|
vec[1] = 0.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_LOCZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
vec[2] = 0.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void protectedSizeBits(short protectflag, float size[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEX)
|
2012-06-10 19:59:02 +00:00
|
|
|
size[0] = 1.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEY)
|
2012-06-10 19:59:02 +00:00
|
|
|
size[1] = 1.0f;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_SCALEZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
size[2] = 1.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void protectedRotateBits(short protectflag, float eul[3], const float oldeul[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[0] = oldeul[0];
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[1] = oldeul[1];
|
2012-03-24 06:38:07 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[2] = oldeul[2];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* this function only does the delta rotation */
|
|
|
|
|
/* axis-angle is usually internally stored as quats... */
|
2009-11-01 00:06:53 +00:00
|
|
|
static void protectedAxisAngleBits(short protectflag, float axis[3], float *angle, float oldAxis[3], float oldAngle)
|
2009-09-16 17:43:09 +00:00
|
|
|
{
|
|
|
|
|
/* check that protection flags are set */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0)
|
2009-09-16 17:43:09 +00:00
|
|
|
return;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROT4D) {
|
|
|
|
|
/* axis-angle getting limited as 4D entities that they are... */
|
|
|
|
|
if (protectflag & OB_LOCK_ROTW)
|
2012-06-10 19:59:02 +00:00
|
|
|
*angle = oldAngle;
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2012-06-10 19:59:02 +00:00
|
|
|
axis[0] = oldAxis[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2012-06-10 19:59:02 +00:00
|
|
|
axis[1] = oldAxis[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
axis[2] = oldAxis[2];
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* axis-angle get limited with euler... */
|
2009-11-01 00:06:53 +00:00
|
|
|
float eul[3], oldeul[3];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
axis_angle_to_eulO(eul, EULER_ORDER_DEFAULT, axis, *angle);
|
|
|
|
|
axis_angle_to_eulO(oldeul, EULER_ORDER_DEFAULT, oldAxis, oldAngle);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[0] = oldeul[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[1] = oldeul[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[2] = oldeul[2];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_axis_angle(axis, angle, eul, EULER_ORDER_DEFAULT);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* when converting to axis-angle, we need a special exception for the case when there is no axis */
|
2011-03-28 17:06:15 +00:00
|
|
|
if (IS_EQF(axis[0], axis[1]) && IS_EQF(axis[1], axis[2])) {
|
2009-09-16 17:43:09 +00:00
|
|
|
/* for now, rotate around y-axis then (so that it simply becomes the roll) */
|
2012-06-10 19:59:02 +00:00
|
|
|
axis[1] = 1.0f;
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* this function only does the delta rotation */
|
2013-10-23 03:57:42 +00:00
|
|
|
static void protectedQuaternionBits(short protectflag, float quat[4], const float oldquat[4])
|
2009-09-16 17:43:09 +00:00
|
|
|
{
|
|
|
|
|
/* check that protection flags are set */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((protectflag & (OB_LOCK_ROTX | OB_LOCK_ROTY | OB_LOCK_ROTZ | OB_LOCK_ROTW)) == 0)
|
2009-09-16 17:43:09 +00:00
|
|
|
return;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROT4D) {
|
|
|
|
|
/* quaternions getting limited as 4D entities that they are... */
|
|
|
|
|
if (protectflag & OB_LOCK_ROTW)
|
2012-06-10 19:59:02 +00:00
|
|
|
quat[0] = oldquat[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2012-06-10 19:59:02 +00:00
|
|
|
quat[1] = oldquat[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2012-06-10 19:59:02 +00:00
|
|
|
quat[2] = oldquat[2];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
quat[3] = oldquat[3];
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2011-10-15 14:14:22 +00:00
|
|
|
/* quaternions get limited with euler... (compatibility mode) */
|
2010-12-07 01:56:32 +00:00
|
|
|
float eul[3], oldeul[3], nquat[4], noldquat[4];
|
|
|
|
|
float qlen;
|
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
qlen = normalize_qt_qt(nquat, quat);
|
2010-12-07 01:56:32 +00:00
|
|
|
normalize_qt_qt(noldquat, oldquat);
|
|
|
|
|
|
|
|
|
|
quat_to_eul(eul, nquat);
|
|
|
|
|
quat_to_eul(oldeul, noldquat);
|
|
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTX)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[0] = oldeul[0];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTY)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[1] = oldeul[1];
|
2009-09-16 17:43:09 +00:00
|
|
|
if (protectflag & OB_LOCK_ROTZ)
|
2012-06-10 19:59:02 +00:00
|
|
|
eul[2] = oldeul[2];
|
2010-12-07 01:56:32 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
eul_to_quat(quat, eul);
|
2010-12-07 01:56:32 +00:00
|
|
|
|
|
|
|
|
/* restore original quat size */
|
|
|
|
|
mul_qt_fl(quat, qlen);
|
2018-05-13 06:44:03 +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
|
|
|
/* quaternions flip w sign to accumulate rotations correctly */
|
2012-06-10 22:13:17 +00:00
|
|
|
if ((nquat[0] < 0.0f && quat[0] > 0.0f) ||
|
|
|
|
|
(nquat[0] > 0.0f && quat[0] < 0.0f))
|
|
|
|
|
{
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_fl(quat, -1.0f);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ******************* TRANSFORM LIMITS ********************** */
|
|
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
static void constraintTransLim(TransInfo *t, TransData *td)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
if (td->con) {
|
2015-03-30 21:17:07 +11:00
|
|
|
const bConstraintTypeInfo *ctiLoc = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_LOCLIMIT);
|
|
|
|
|
const bConstraintTypeInfo *ctiDist = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_DISTLIMIT);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
bConstraintOb cob = {NULL};
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bConstraint *con;
|
2011-05-24 12:12:12 +00:00
|
|
|
float ctime = (float)(t->scene->r.cfra);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Make a temporary bConstraintOb for using these limit constraints
|
2018-11-14 12:53:15 +11:00
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
|
* - current space should be local
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(cob.matrix);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(cob.matrix[3], td->loc);
|
2018-05-13 06:44:03 +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
|
|
|
/* Evaluate valid constraints */
|
2012-06-10 19:59:02 +00:00
|
|
|
for (con = td->con; con; con = con->next) {
|
2015-03-30 21:17:07 +11:00
|
|
|
const bConstraintTypeInfo *cti = NULL;
|
2011-05-24 12:12:12 +00:00
|
|
|
ListBase targets = {NULL, NULL};
|
2018-05-13 06:44:03 +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
|
|
|
/* only consider constraint if enabled */
|
2013-01-28 23:57:02 +00:00
|
|
|
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (con->enforce == 0.0f) continue;
|
2018-05-13 06:44:03 +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
|
|
|
/* only use it if it's tagged for this purpose (and the right type) */
|
|
|
|
|
if (con->type == CONSTRAINT_TYPE_LOCLIMIT) {
|
2012-06-10 19:59:02 +00:00
|
|
|
bLocLimitConstraint *data = con->data;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM) == 0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
2011-05-24 12:12:12 +00:00
|
|
|
cti = ctiLoc;
|
|
|
|
|
}
|
|
|
|
|
else if (con->type == CONSTRAINT_TYPE_DISTLIMIT) {
|
2012-06-10 19:59:02 +00:00
|
|
|
bDistLimitConstraint *data = con->data;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((data->flag & LIMITDIST_TRANSFORM) == 0)
|
2011-05-24 12:12:12 +00:00
|
|
|
continue;
|
|
|
|
|
cti = ctiDist;
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
if (cti) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* do space conversions */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2012-09-16 15:25:28 +00:00
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
|
2018-09-27 15:35:22 +02:00
|
|
|
/* skip... incompatible spacetype */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
/* get constraint targets if needed */
|
2018-04-06 12:07:27 +02:00
|
|
|
BKE_constraint_targets_for_solving_get(t->depsgraph, con, &cob, &targets, ctime);
|
2018-05-13 06:44:03 +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
|
|
|
/* do constraint */
|
2011-05-24 12:12:12 +00:00
|
|
|
cti->evaluate_constraint(con, &cob, &targets);
|
2018-05-13 06:44:03 +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
|
|
|
/* convert spaces again */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
2012-09-16 15:25:28 +00:00
|
|
|
/* just multiply by td->smtx (this should be ok) */
|
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2011-05-24 12:12:12 +00:00
|
|
|
/* free targets list */
|
|
|
|
|
BLI_freelistN(&targets);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* copy results from cob->matrix */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->loc, cob.matrix[3]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-19 09:38:36 +00:00
|
|
|
static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
|
|
|
|
|
{
|
|
|
|
|
/* Make a temporary bConstraintOb for use by limit constraints
|
2018-11-14 12:53:15 +11:00
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
|
* - current space should be local
|
2010-04-19 09:38:36 +00:00
|
|
|
*/
|
|
|
|
|
memset(cob, 0, sizeof(bConstraintOb));
|
2012-04-28 06:31:57 +00:00
|
|
|
if (td->ext) {
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
|
|
|
|
/* quats */
|
2010-04-19 09:38:36 +00:00
|
|
|
/* objects and bones do normalization first too, otherwise
|
2012-06-30 22:49:33 +00:00
|
|
|
* we don't necessarily end up with a rotation matrix, and
|
|
|
|
|
* then conversion back to quat gives a different result */
|
2010-04-19 09:38:36 +00:00
|
|
|
float quat[4];
|
2010-12-07 01:56:32 +00:00
|
|
|
normalize_qt_qt(quat, td->ext->quat);
|
2010-04-19 09:38:36 +00:00
|
|
|
quat_to_mat4(cob->matrix, quat);
|
|
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
|
|
|
|
/* axis angle */
|
2015-11-11 04:46:55 +11:00
|
|
|
axis_angle_to_mat4(cob->matrix, td->ext->rotAxis, *td->ext->rotAngle);
|
2010-11-14 19:19:58 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* eulers */
|
|
|
|
|
eulO_to_mat4(cob->matrix, td->ext->rot, td->ext->rotOrder);
|
|
|
|
|
}
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
static void constraintRotLim(TransInfo *UNUSED(t), TransData *td)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
if (td->con) {
|
2015-03-30 21:17:07 +11:00
|
|
|
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_ROTLIMIT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bConstraintOb cob;
|
|
|
|
|
bConstraint *con;
|
2014-04-11 11:25:41 +10:00
|
|
|
bool do_limit = false;
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* Evaluate valid constraints */
|
2012-06-10 19:59:02 +00:00
|
|
|
for (con = td->con; con; con = con->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only consider constraint if enabled */
|
2013-01-28 23:57:02 +00:00
|
|
|
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (con->enforce == 0.0f) continue;
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* we're only interested in Limit-Rotation constraints */
|
|
|
|
|
if (con->type == CONSTRAINT_TYPE_ROTLIMIT) {
|
2012-06-10 19:59:02 +00:00
|
|
|
bRotLimitConstraint *data = con->data;
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only use it if it's tagged for this purpose */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM) == 0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
2010-04-19 09:38:36 +00:00
|
|
|
|
2018-09-27 15:35:22 +02:00
|
|
|
/* skip incompatible spacetypes */
|
2010-04-19 09:38:36 +00:00
|
|
|
if (!ELEM(con->ownspace, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* only do conversion if necessary, to preserve quats and eulers */
|
2014-04-01 11:34:00 +11:00
|
|
|
if (do_limit == false) {
|
2010-04-19 09:38:36 +00:00
|
|
|
constraintob_from_transdata(&cob, td);
|
2014-04-01 11:34:00 +11:00
|
|
|
do_limit = true;
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* do space conversions */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2012-09-16 15:25:28 +00:00
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* do constraint */
|
|
|
|
|
cti->evaluate_constraint(con, &cob, NULL);
|
2018-05-13 06:44:03 +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
|
|
|
/* convert spaces again */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
2012-09-16 15:25:28 +00:00
|
|
|
/* just multiply by td->smtx (this should be ok) */
|
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-19 13:28:19 +00:00
|
|
|
if (do_limit) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* copy results from cob->matrix */
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* quats */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_quat(td->ext->quat, cob.matrix);
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2010-04-19 09:38:36 +00:00
|
|
|
/* axis angle */
|
2015-11-11 04:46:55 +11:00
|
|
|
mat4_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, cob.matrix);
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* eulers */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_eulO(td->ext->rot, td->ext->rotOrder, cob.matrix);
|
2010-04-19 09:38:36 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void constraintSizeLim(TransInfo *t, TransData *td)
|
|
|
|
|
{
|
|
|
|
|
if (td->con && td->ext) {
|
2015-03-30 21:17:07 +11:00
|
|
|
const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(CONSTRAINT_TYPE_SIZELIMIT);
|
2012-06-10 19:59:02 +00:00
|
|
|
bConstraintOb cob = {NULL};
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
bConstraint *con;
|
2012-11-27 16:02:03 +00:00
|
|
|
float size_sign[3], size_abs[3];
|
|
|
|
|
int i;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* Make a temporary bConstraintOb for using these limit constraints
|
2018-11-14 12:53:15 +11:00
|
|
|
* - they only care that cob->matrix is correctly set ;-)
|
|
|
|
|
* - current space should be local
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2009-10-22 23:22:05 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* scale val and reset size */
|
|
|
|
|
return; // TODO: fix this case
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
|
|
|
|
return;
|
2012-11-27 16:02:03 +00:00
|
|
|
|
|
|
|
|
/* separate out sign to apply back later */
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
size_sign[i] = signf(td->ext->size[i]);
|
|
|
|
|
size_abs[i] = fabsf(td->ext->size[i]);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-11-27 16:02:03 +00:00
|
|
|
size_to_mat4(cob.matrix, size_abs);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-05-13 06:44:03 +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
|
|
|
/* Evaluate valid constraints */
|
2012-06-10 19:59:02 +00:00
|
|
|
for (con = td->con; con; con = con->next) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* only consider constraint if enabled */
|
2013-01-28 23:57:02 +00:00
|
|
|
if (con->flag & (CONSTRAINT_DISABLE | CONSTRAINT_OFF)) continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (con->enforce == 0.0f) continue;
|
2018-05-13 06:44:03 +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
|
|
|
/* we're only interested in Limit-Scale constraints */
|
|
|
|
|
if (con->type == CONSTRAINT_TYPE_SIZELIMIT) {
|
2012-06-10 19:59:02 +00:00
|
|
|
bSizeLimitConstraint *data = con->data;
|
2018-05-13 06:44:03 +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
|
|
|
/* only use it if it's tagged for this purpose */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((data->flag2 & LIMIT_TRANSFORM) == 0)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
2018-05-13 06:44:03 +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
|
|
|
/* do space conversions */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
|
|
|
|
/* just multiply by td->mtx (this should be ok) */
|
2012-09-16 15:25:28 +00:00
|
|
|
mul_m4_m3m4(cob.matrix, td->mtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else if (con->ownspace != CONSTRAINT_SPACE_LOCAL) {
|
2012-09-16 15:25:28 +00:00
|
|
|
/* skip... incompatible spacetype */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
continue;
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* do constraint */
|
|
|
|
|
cti->evaluate_constraint(con, &cob, NULL);
|
2018-05-13 06:44:03 +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
|
|
|
/* convert spaces again */
|
|
|
|
|
if (con->ownspace == CONSTRAINT_SPACE_WORLD) {
|
2012-09-16 15:25:28 +00:00
|
|
|
/* just multiply by td->smtx (this should be ok) */
|
|
|
|
|
mul_m4_m3m4(cob.matrix, td->smtx, cob.matrix);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* copy results from cob->matrix */
|
2009-10-22 23:22:05 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* scale val and reset size */
|
|
|
|
|
return; // TODO: fix this case
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
|
|
|
|
return;
|
2012-09-16 15:25:28 +00:00
|
|
|
|
2012-11-27 16:02:03 +00:00
|
|
|
/* extrace scale from matrix and apply back sign */
|
2012-04-29 15:47:02 +00:00
|
|
|
mat4_to_size(td->ext->size, cob.matrix);
|
2012-11-27 16:02:03 +00:00
|
|
|
mul_v3_v3(td->ext->size, size_sign);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2013-11-20 12:14:10 +11:00
|
|
|
/* Transform (Bend) */
|
2013-10-23 03:57:42 +00:00
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
/** \name Transform Bend
|
2013-10-23 03:57: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
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
struct BendCustomData {
|
2018-04-16 16:27:55 +02:00
|
|
|
/* All values are in global space. */
|
2013-10-13 01:09:23 +00:00
|
|
|
float warp_sta[3];
|
|
|
|
|
float warp_end[3];
|
2010-03-09 01:19:32 +00:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
float warp_nor[3];
|
|
|
|
|
float warp_tan[3];
|
|
|
|
|
|
|
|
|
|
/* for applying the mouse distance */
|
|
|
|
|
float warp_init_dist;
|
|
|
|
|
};
|
2010-03-09 01:19:32 +00:00
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
static void initBend(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
|
|
|
{
|
2013-10-13 01:09:23 +00:00
|
|
|
const float mval_fl[2] = {UNPACK2(t->mval)};
|
|
|
|
|
const float *curs;
|
|
|
|
|
float tvec[3];
|
2013-11-20 12:14:10 +11:00
|
|
|
struct BendCustomData *data;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
t->mode = TFM_BEND;
|
|
|
|
|
t->transform = Bend;
|
|
|
|
|
t->handleEvent = handleEventBend;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
setInputPostFct(&t->mouse, postInputRotation);
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE_SPRING);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
t->idx_max = 1;
|
|
|
|
|
t->num.idx_max = 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->snap[0] = 0.0f;
|
2018-10-03 16:23:32 -03:00
|
|
|
t->snap[1] = SNAP_INCREMENTAL_ANGLE;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.2;
|
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
|
|
|
|
|
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_LENGTH;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2013-10-26 04:07:18 +00:00
|
|
|
//copy_v3_v3(t->center, ED_view3d_cursor3d_get(t->scene, t->view));
|
2017-08-28 16:00:28 +10:00
|
|
|
if ((t->flag & T_OVERRIDE_CENTER) == 0) {
|
2018-04-16 16:27:55 +02:00
|
|
|
calculateCenterCursor(t, t->center_global);
|
2017-08-28 16:00:28 +10:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
calculateCenterLocal(t, t->center_global);
|
2013-10-13 01:09:23 +00:00
|
|
|
|
|
|
|
|
t->val = 0.0f;
|
|
|
|
|
|
|
|
|
|
data = MEM_callocN(sizeof(*data), __func__);
|
|
|
|
|
|
2018-11-26 13:49:17 +11:00
|
|
|
curs = t->scene->cursor.location;
|
2013-10-13 01:09:23 +00:00
|
|
|
copy_v3_v3(data->warp_sta, curs);
|
2016-12-08 12:41:27 +01:00
|
|
|
ED_view3d_win_to_3d(t->sa->spacedata.first, t->ar, curs, mval_fl, data->warp_end);
|
2013-10-13 01:09:23 +00:00
|
|
|
|
|
|
|
|
copy_v3_v3(data->warp_nor, t->viewinv[2]);
|
|
|
|
|
normalize_v3(data->warp_nor);
|
|
|
|
|
|
|
|
|
|
/* tangent */
|
|
|
|
|
sub_v3_v3v3(tvec, data->warp_end, data->warp_sta);
|
|
|
|
|
cross_v3_v3v3(data->warp_tan, tvec, data->warp_nor);
|
|
|
|
|
normalize_v3(data->warp_tan);
|
2010-07-31 10:58:10 +00:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
data->warp_init_dist = len_v3v3(data->warp_end, data->warp_sta);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
t->custom.mode.data = data;
|
|
|
|
|
t->custom.mode.use_free = 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
|
|
|
}
|
|
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
static eRedrawFlag handleEventBend(TransInfo *UNUSED(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
|
|
|
{
|
2013-10-23 06:48:36 +00:00
|
|
|
eRedrawFlag status = TREDRAW_NOTHING;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
|
2013-10-23 03:57:42 +00:00
|
|
|
status = TREDRAW_HARD;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
static void Bend(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2013-10-13 01:09:23 +00:00
|
|
|
float vec[3];
|
2018-04-16 16:27:55 +02:00
|
|
|
float pivot_global[3];
|
|
|
|
|
float warp_end_radius_global[3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2016-02-01 15:15:10 +11:00
|
|
|
const struct BendCustomData *data = t->custom.mode.data;
|
2013-10-13 01:09:23 +00:00
|
|
|
const bool is_clamp = (t->flag & T_ALT_TRANSFORM) == 0;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
struct { float angle, scale; };
|
|
|
|
|
float vector[2];
|
|
|
|
|
} values;
|
|
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
/* amount of radians for bend */
|
2013-10-13 01:09:23 +00:00
|
|
|
copy_v2_v2(values.vector, t->values);
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
snapGrid(t, angle_rad);
|
|
|
|
|
#else
|
|
|
|
|
/* hrmf, snapping radius is using 'angle' steps, need to convert to something else
|
|
|
|
|
* this isnt essential but nicer to give reasonable snapping values for radius */
|
2018-05-22 08:58:56 -03:00
|
|
|
if (t->tsnap.mode & SCE_SNAP_MODE_INCREMENT) {
|
2013-10-13 01:09:23 +00:00
|
|
|
const float radius_snap = 0.1f;
|
|
|
|
|
const float snap_hack = (t->snap[1] * data->warp_init_dist) / radius_snap;
|
|
|
|
|
values.scale *= snap_hack;
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, values.vector);
|
2013-10-13 01:09:23 +00:00
|
|
|
values.scale /= snap_hack;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2014-03-22 23:20:14 +01:00
|
|
|
|
|
|
|
|
if (applyNumInput(&t->num, values.vector)) {
|
|
|
|
|
values.scale = values.scale / data->warp_init_dist;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v2_v2(t->values, values.vector);
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2013-10-13 01:09:23 +00:00
|
|
|
char c[NUM_STR_REP_LEN * 2];
|
|
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bend Angle: %s Radius: %s Alt, Clamp %s"),
|
2013-10-13 01:09:23 +00:00
|
|
|
&c[0], &c[NUM_STR_REP_LEN],
|
|
|
|
|
WM_bool_as_string(is_clamp));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bend Angle: %.3f Radius: %.4f, Alt, Clamp %s"),
|
2013-10-13 01:09:23 +00:00
|
|
|
RAD2DEGF(values.angle), values.scale * data->warp_init_dist,
|
|
|
|
|
WM_bool_as_string(is_clamp));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-05-13 06:44:03 +02:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
values.angle *= -1.0f;
|
|
|
|
|
values.scale *= data->warp_init_dist;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-10-13 01:09:23 +00:00
|
|
|
/* calc 'data->warp_end' from 'data->warp_end_init' */
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(warp_end_radius_global, data->warp_end);
|
|
|
|
|
dist_ensure_v3_v3fl(warp_end_radius_global, data->warp_sta, values.scale);
|
2013-10-13 01:09:23 +00:00
|
|
|
/* done */
|
|
|
|
|
|
|
|
|
|
/* calculate pivot */
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(pivot_global, data->warp_sta);
|
2013-10-13 01:09:23 +00:00
|
|
|
if (values.angle > 0.0f) {
|
2018-04-16 16:27:55 +02:00
|
|
|
madd_v3_v3fl(pivot_global, data->warp_tan, -values.scale * shell_angle_to_dist((float)M_PI_2 - values.angle));
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
madd_v3_v3fl(pivot_global, data->warp_tan, +values.scale * shell_angle_to_dist((float)M_PI_2 + values.angle));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* TODO(campbell): xform, compensate object center. */
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
float warp_sta_local[3];
|
|
|
|
|
float warp_end_local[3];
|
|
|
|
|
float warp_end_radius_local[3];
|
|
|
|
|
float pivot_local[3];
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-05-04 14:41:51 +02:00
|
|
|
if (tc->use_local_mat) {
|
|
|
|
|
sub_v3_v3v3(warp_sta_local, data->warp_sta, tc->mat[3]);
|
|
|
|
|
sub_v3_v3v3(warp_end_local, data->warp_end, tc->mat[3]);
|
|
|
|
|
sub_v3_v3v3(warp_end_radius_local, warp_end_radius_global, tc->mat[3]);
|
|
|
|
|
sub_v3_v3v3(pivot_local, pivot_global, tc->mat[3]);
|
2018-04-16 17:54:33 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v3_v3(warp_sta_local, data->warp_sta);
|
|
|
|
|
copy_v3_v3(warp_end_local, data->warp_end);
|
|
|
|
|
copy_v3_v3(warp_end_radius_local, warp_end_radius_global);
|
|
|
|
|
copy_v3_v3(pivot_local, pivot_global);
|
|
|
|
|
}
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
float mat[3][3];
|
|
|
|
|
float delta[3];
|
|
|
|
|
float fac, fac_scaled;
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (UNLIKELY(values.angle == 0.0f)) {
|
|
|
|
|
copy_v3_v3(td->loc, td->iloc);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
copy_v3_v3(vec, td->iloc);
|
|
|
|
|
mul_m3_v3(td->mtx, vec);
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
fac = line_point_factor_v3(vec, warp_sta_local, warp_end_radius_local);
|
|
|
|
|
if (is_clamp) {
|
|
|
|
|
CLAMP(fac, 0.0f, 1.0f);
|
|
|
|
|
}
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2019-01-16 11:25:12 +01:00
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
|
/* grease pencil multiframe falloff */
|
|
|
|
|
bGPDstroke *gps = (bGPDstroke *)td->extra;
|
|
|
|
|
if (gps != NULL) {
|
|
|
|
|
fac_scaled = fac * td->factor * gps->runtime.multi_frame_falloff;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
fac_scaled = fac * td->factor;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
fac_scaled = fac * td->factor;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
axis_angle_normalized_to_mat3(mat, data->warp_nor, values.angle * fac_scaled);
|
|
|
|
|
interp_v3_v3v3(delta, warp_sta_local, warp_end_radius_local, fac_scaled);
|
|
|
|
|
sub_v3_v3(delta, warp_sta_local);
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* delta is subtracted, rotation adds back this offset */
|
|
|
|
|
sub_v3_v3(vec, delta);
|
2013-10-13 01:09:23 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
sub_v3_v3(vec, pivot_local);
|
|
|
|
|
mul_m3_v3(mat, vec);
|
|
|
|
|
add_v3_v3(vec, pivot_local);
|
2015-05-25 10:35:54 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
mul_m3_v3(td->smtx, vec);
|
2015-05-25 10:35:54 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* rotation */
|
|
|
|
|
if ((t->flag & T_POINTS) == 0) {
|
|
|
|
|
ElementRotation(t, tc, td, mat, V3D_AROUND_LOCAL_ORIGINS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* location */
|
|
|
|
|
copy_v3_v3(td->loc, vec);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Shear) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Shear
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-17 16:30:15 +11:00
|
|
|
static void initShear_mouseInputMode(TransInfo *t)
|
|
|
|
|
{
|
|
|
|
|
float dir[3];
|
|
|
|
|
|
|
|
|
|
if (t->custom.mode.data == NULL) {
|
2019-02-26 20:22:54 +11:00
|
|
|
copy_v3_v3(dir, t->orient_matrix[t->orient_axis_ortho]);
|
2018-10-17 16:30:15 +11:00
|
|
|
}
|
|
|
|
|
else {
|
2019-02-26 20:22:54 +11:00
|
|
|
cross_v3_v3v3(dir, t->orient_matrix[t->orient_axis_ortho], t->orient_matrix[t->orient_axis]);
|
2018-10-17 16:30:15 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mul_mat3_m4_v3(t->viewmat, dir);
|
|
|
|
|
if (normalize_v2(dir) == 0.0f) {
|
|
|
|
|
dir[0] = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
setCustomPointsFromDirection(t, &t->mouse, dir);
|
|
|
|
|
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initShear(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_SHEAR;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyShear;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->handleEvent = handleEventShear;
|
2017-06-02 20:40:41 +10:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
t->orient_axis = 2;
|
|
|
|
|
t->orient_axis_ortho = 1;
|
|
|
|
|
|
|
|
|
|
if (t->orient_matrix_is_set == false) {
|
|
|
|
|
float *axis = t->orient_matrix[t->orient_axis];
|
|
|
|
|
float *axis_ortho = t->orient_matrix[t->orient_axis_ortho];
|
|
|
|
|
if (is_zero_v3(axis)) {
|
|
|
|
|
negate_v3_v3(axis, t->viewinv[2]);
|
|
|
|
|
normalize_v3(axis);
|
|
|
|
|
}
|
|
|
|
|
if (is_zero_v3(axis_ortho)) {
|
|
|
|
|
copy_v3_v3(axis_ortho, t->viewinv[0]);
|
|
|
|
|
normalize_v3(axis_ortho);
|
|
|
|
|
}
|
2018-10-17 16:30:15 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initShear_mouseInputMode(t);
|
2018-05-13 06:44:03 +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->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
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
|
|
|
|
|
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE; /* Don't think we have any unit here? */
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventShear(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
|
|
|
{
|
2013-10-23 06:48:36 +00:00
|
|
|
eRedrawFlag status = TREDRAW_NOTHING;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event->type == MIDDLEMOUSE && event->val == KM_PRESS) {
|
2016-02-01 15:15:10 +11:00
|
|
|
/* Use custom.mode.data pointer to signal Shear direction */
|
|
|
|
|
if (t->custom.mode.data == NULL) {
|
|
|
|
|
t->custom.mode.data = (void *)1;
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2016-02-01 15:15:10 +11:00
|
|
|
t->custom.mode.data = NULL;
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2018-10-17 16:30:15 +11:00
|
|
|
initShear_mouseInputMode(t);
|
2012-03-15 00:57:14 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
status = TREDRAW_HARD;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-12-31 12:26:14 +00:00
|
|
|
else if (event->type == XKEY && event->val == KM_PRESS) {
|
2016-02-01 15:15:10 +11:00
|
|
|
t->custom.mode.data = NULL;
|
2018-10-17 16:30:15 +11:00
|
|
|
initShear_mouseInputMode(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
status = TREDRAW_HARD;
|
2012-12-31 12:26:14 +00:00
|
|
|
}
|
|
|
|
|
else if (event->type == YKEY && event->val == KM_PRESS) {
|
2016-02-01 15:15:10 +11:00
|
|
|
t->custom.mode.data = (void *)1;
|
2018-10-17 16:30:15 +11:00
|
|
|
initShear_mouseInputMode(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
status = TREDRAW_HARD;
|
2012-12-31 12:26:14 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float vec[3];
|
2018-10-16 21:52:30 +11:00
|
|
|
float smat[3][3], tmat[3][3], totmat[3][3], axismat[3][3], axismat_inv[3][3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float value;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2015-10-12 12:02:22 +11:00
|
|
|
const bool is_local_center = transdata_check_local_center(t, t->around);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
value = t->values[0];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &value);
|
2018-05-13 06:44:03 +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
|
|
|
applyNumInput(&t->num, &value);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = value;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shear: %s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shear: %.3f %s (Press X or Y to set shear axis)"), value, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(smat);
|
2018-05-13 06:44:03 +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
|
|
|
// Custom data signals shear direction
|
2016-02-01 15:15:10 +11:00
|
|
|
if (t->custom.mode.data == NULL)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
smat[1][0] = value;
|
|
|
|
|
else
|
|
|
|
|
smat[0][1] = value;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
copy_v3_v3(axismat_inv[0], t->orient_matrix[t->orient_axis_ortho]);
|
|
|
|
|
copy_v3_v3(axismat_inv[2], t->orient_matrix[t->orient_axis]);
|
2018-10-16 21:52:30 +11:00
|
|
|
cross_v3_v3v3(axismat_inv[1], axismat_inv[0], axismat_inv[2]);
|
|
|
|
|
invert_m3_m3(axismat, axismat_inv);
|
|
|
|
|
|
2018-10-18 11:45:21 +11:00
|
|
|
mul_m3_series(totmat, axismat_inv, smat, axismat);
|
2015-10-12 12:02:22 +11:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
const float *center, *co;
|
2015-10-12 12:02:22 +11:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2015-10-12 12:02:22 +11:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (t->flag & T_EDIT) {
|
2018-10-18 11:45:21 +11:00
|
|
|
mul_m3_series(tmat, td->smtx, totmat, td->mtx);
|
2018-04-16 17:54:33 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_m3_m3(tmat, totmat);
|
|
|
|
|
}
|
2015-10-12 12:02:22 +11:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (is_local_center) {
|
|
|
|
|
center = td->center;
|
|
|
|
|
co = td->loc;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
center = tc->center_local;
|
|
|
|
|
co = td->center;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sub_v3_v3v3(vec, co, center);
|
|
|
|
|
|
|
|
|
|
mul_m3_v3(tmat, vec);
|
|
|
|
|
|
|
|
|
|
add_v3_v3(vec, center);
|
|
|
|
|
sub_v3_v3(vec, co);
|
|
|
|
|
|
2019-01-16 11:30:06 +01:00
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
|
/* grease pencil multiframe falloff */
|
|
|
|
|
bGPDstroke *gps = (bGPDstroke *)td->extra;
|
|
|
|
|
if (gps != NULL) {
|
|
|
|
|
mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mul_v3_fl(vec, td->factor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mul_v3_fl(vec, td->factor);
|
|
|
|
|
}
|
2018-04-16 17:54:33 +02:00
|
|
|
|
|
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Resize) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Resize
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initResize(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_RESIZE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyResize;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2018-05-13 06:44:03 +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->flag |= T_NULL_ONE;
|
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->num.val_flag[0] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[1] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[2] |= NUM_NULL_ONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->num.flag |= NUM_AFFECT_ALL;
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->flag & T_EDIT) == 0) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_ZERO;
|
2014-07-22 01:24:43 +10:00
|
|
|
#ifdef USE_NUM_NO_ZERO
|
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->num.val_flag[0] |= NUM_NO_ZERO;
|
|
|
|
|
t->num.val_flag[1] |= NUM_NO_ZERO;
|
|
|
|
|
t->num.val_flag[2] |= NUM_NO_ZERO;
|
2014-07-21 17:13:48 +02:00
|
|
|
#endif
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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->idx_max = 2;
|
|
|
|
|
t->num.idx_max = 2;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[2] = B_UNIT_NONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerResize(TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-07-14 14:03:36 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", vec[1]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", vec[2]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->num.idx_max) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case 0:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Scale: %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], t->con.text, t->proptext);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case 1:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Scale: %s : %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], t->con.text, t->proptext);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Scale: %s : %s : %s%s %s"), &tvec[0],
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-08-30 13:18:33 +00:00
|
|
|
if (t->flag & T_2D_EDIT) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Scale X: %s Y: %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], t->con.text, t->proptext);
|
2012-08-30 13:18:33 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Scale X: %s Y: %s Z: %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
|
2012-08-30 13:18:33 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2013-06-20 13:24:07 +00:00
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
|
2011-02-12 14:25:54 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-30 10:15:43 +01:00
|
|
|
/**
|
|
|
|
|
* \a smat is reference matrix only.
|
|
|
|
|
*
|
|
|
|
|
* \note this is a tricky area, before making changes see: T29633, T42444
|
|
|
|
|
*/
|
2012-12-11 14:29:01 +00:00
|
|
|
static void TransMat3ToSize(float mat[3][3], float smat[3][3], float size[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2014-10-30 10:15:43 +01:00
|
|
|
float rmat[3][3];
|
|
|
|
|
|
|
|
|
|
mat3_to_rot_size(rmat, size, mat);
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* first tried with dotproduct... but the sign flip is crucial */
|
2014-10-30 10:15:43 +01:00
|
|
|
if (dot_v3v3(rmat[0], smat[0]) < 0.0f) size[0] = -size[0];
|
|
|
|
|
if (dot_v3v3(rmat[1], smat[1]) < 0.0f) size[1] = -size[1];
|
|
|
|
|
if (dot_v3v3(rmat[2], smat[2]) < 0.0f) size[2] = -size[2];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float tmat[3][3], smat[3][3], center[3];
|
|
|
|
|
float vec[3];
|
2018-05-13 06:44:03 +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 (t->flag & T_EDIT) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(smat, mat, td->mtx);
|
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, smat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m3(tmat, mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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 (t->con.applySize) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, tc, td, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* local constraint shouldn't alter center */
|
2013-12-12 14:35:37 +06:00
|
|
|
if (transdata_check_local_center(t, t->around)) {
|
2011-10-03 16:20:05 +00:00
|
|
|
copy_v3_v3(center, td->center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
Planar tracking support for motion tracking
===========================================
Major list of changes done in tomato branch:
- Add a planar tracking implementation to libmv
This adds a new planar tracking implementation to libmv. The
tracker is based on Ceres[1], the new nonlinear minimizer that
myself and Sameer released from Google as open source. Since
the motion model is more involved, the interface is
different than the RegionTracker interface used previously
in Blender.
The start of a C API in libmv-capi.{cpp,h} is also included.
- Migrate from pat_{min,max} for markers to 4 corners representation
Convert markers in the movie clip editor / 2D tracker from using
pat_min and pat_max notation to using the a more general, 4-corner
representation.
There is still considerable porting work to do; in particular
sliding from preview widget does not work correct for rotated
markers.
All other areas should be ported to new representation:
* Added support of sliding individual corners. LMB slide + Ctrl
would scale the whole pattern
* S would scale the whole marker, S-S would scale pattern only
* Added support of marker's rotation which is currently rotates
only patterns around their centers or all markers around median,
Rotation or other non-translation/scaling transformation of search
area doesn't make sense.
* Track Preview widget would display transformed pattern which
libmv actually operates with.
- "Efficient Second-order Minimization" for the planar tracker
This implements the "Efficient Second-order Minimization"
scheme, as supported by the existing translation tracker.
This increases the amount of per-iteration work, but
decreases the number of iterations required to converge and
also increases the size of the basin of attraction for the
optimization.
- Remove the use of the legacy RegionTracker API from Blender,
and replaces it with the new TrackRegion API. This also
adds several features to the planar tracker in libmv:
* Do a brute-force initialization of tracking similar to "Hybrid"
mode in the stable release, but using all floats. This is slower
but more accurate. It is still necessary to evaluate if the
performance loss is worth it. In particular, this change is
necessary to support high bit depth imagery.
* Add support for masks over the search window. This is a step
towards supporting user-defined tracker masks. The tracker masks
will make it easy for users to make a mask for e.g. a ball.
Not exposed into interface yet/
* Add Pearson product moment correlation coefficient checking (aka
"Correlation" in the UI. This causes tracking failure if the
tracked patch is not linearly related to the template.
* Add support for warping a few points in addition to the supplied
points. This is useful because the tracking code deliberately
does not expose the underlying warp representation. Instead,
warps are specified in an aparametric way via the correspondences.
- Replace the old style tracker configuration panel with the
new planar tracking panel. From a users perspective, this means:
* The old "tracking algorithm" picker is gone. There is only 1
algorithm now. We may revisit this later, but I would much
prefer to have only 1 algorithm. So far no optimization work
has been done so the speed is not there yet.
* There is now a dropdown to select the motion model. Choices:
* Translation
* Translation, rotation
* Translation, scale
* Translation, rotation, scale
* Affine
* Perspective
* The old "Hybrid" mode is gone; instead there is a toggle to
enable or disable translation-only tracker initialization. This
is the equivalent of the hyrbid mode before, but rewritten to work
with the new planar tracking modes.
* The pyramid levels setting is gone. At a future date, the planar
tracker will decide to use pyramids or not automatically. The
pyramid setting was ultimately a mistake; with the brute force
initialization it is unnecessary.
- Add light-normalized tracking
Added the ability to normalize patterns by their average value while
tracking, to make them invariant to global illumination changes.
Additional details could be found at wiki page [2]
[1] http://code.google.com/p/ceres-solver
[2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker
2012-06-10 15:28:19 +00:00
|
|
|
else if (t->options & CTX_MOVIECLIP) {
|
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
|
|
|
if (td->flag & TD_INDIVIDUAL_SCALE) {
|
|
|
|
|
copy_v3_v3(center, td->center);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(center, tc->center_local);
|
Merge plane track feature from tomato branch
This commit includes all the changes made for plane tracker
in tomato branch.
Movie clip editor changes:
- Artist might create a plane track out of multiple point
tracks which belongs to the same track (minimum amount of
point tracks is 4, maximum is not actually limited).
When new plane track is added, it's getting "tracked"
across all point tracks, which makes it stick to the same
plane point tracks belong to.
- After plane track was added, it need to be manually adjusted
in a way it covers feature one might to mask/replace.
General transform tools (G, R, S) or sliding corners with
a mouse could be sued for this. Plane corner which
corresponds to left bottom image corner has got X/Y axis
on it (red is for X axis, green for Y).
- Re-adjusting plane corners makes plane to be "re-tracked"
for the frames sequence between current frame and next
and previous keyframes.
- Kayframes might be removed from the plane, using Shit-X
(Marker Delete) operator. However, currently manual
re-adjustment or "re-track" trigger is needed.
Compositor changes:
- Added new node called Plane Track Deform.
- User selects which plane track to use (for this he need
to select movie clip datablock, object and track names).
- Node gets an image input, which need to be warped into
the plane.
- Node outputs:
* Input image warped into the plane.
* Plane, rasterized to a mask.
Masking changes:
- Mask points might be parented to a plane track, which
makes this point deforming in a way as if it belongs
to the tracked plane.
Some video tutorials are available:
- Coder video: http://www.youtube.com/watch?v=vISEwqNHqe4
- Artist video: https://vimeo.com/71727578
This is mine and Keir's holiday code project :)
2013-08-16 09:46:30 +00:00
|
|
|
}
|
Planar tracking support for motion tracking
===========================================
Major list of changes done in tomato branch:
- Add a planar tracking implementation to libmv
This adds a new planar tracking implementation to libmv. The
tracker is based on Ceres[1], the new nonlinear minimizer that
myself and Sameer released from Google as open source. Since
the motion model is more involved, the interface is
different than the RegionTracker interface used previously
in Blender.
The start of a C API in libmv-capi.{cpp,h} is also included.
- Migrate from pat_{min,max} for markers to 4 corners representation
Convert markers in the movie clip editor / 2D tracker from using
pat_min and pat_max notation to using the a more general, 4-corner
representation.
There is still considerable porting work to do; in particular
sliding from preview widget does not work correct for rotated
markers.
All other areas should be ported to new representation:
* Added support of sliding individual corners. LMB slide + Ctrl
would scale the whole pattern
* S would scale the whole marker, S-S would scale pattern only
* Added support of marker's rotation which is currently rotates
only patterns around their centers or all markers around median,
Rotation or other non-translation/scaling transformation of search
area doesn't make sense.
* Track Preview widget would display transformed pattern which
libmv actually operates with.
- "Efficient Second-order Minimization" for the planar tracker
This implements the "Efficient Second-order Minimization"
scheme, as supported by the existing translation tracker.
This increases the amount of per-iteration work, but
decreases the number of iterations required to converge and
also increases the size of the basin of attraction for the
optimization.
- Remove the use of the legacy RegionTracker API from Blender,
and replaces it with the new TrackRegion API. This also
adds several features to the planar tracker in libmv:
* Do a brute-force initialization of tracking similar to "Hybrid"
mode in the stable release, but using all floats. This is slower
but more accurate. It is still necessary to evaluate if the
performance loss is worth it. In particular, this change is
necessary to support high bit depth imagery.
* Add support for masks over the search window. This is a step
towards supporting user-defined tracker masks. The tracker masks
will make it easy for users to make a mask for e.g. a ball.
Not exposed into interface yet/
* Add Pearson product moment correlation coefficient checking (aka
"Correlation" in the UI. This causes tracking failure if the
tracked patch is not linearly related to the template.
* Add support for warping a few points in addition to the supplied
points. This is useful because the tracking code deliberately
does not expose the underlying warp representation. Instead,
warps are specified in an aparametric way via the correspondences.
- Replace the old style tracker configuration panel with the
new planar tracking panel. From a users perspective, this means:
* The old "tracking algorithm" picker is gone. There is only 1
algorithm now. We may revisit this later, but I would much
prefer to have only 1 algorithm. So far no optimization work
has been done so the speed is not there yet.
* There is now a dropdown to select the motion model. Choices:
* Translation
* Translation, rotation
* Translation, scale
* Translation, rotation, scale
* Affine
* Perspective
* The old "Hybrid" mode is gone; instead there is a toggle to
enable or disable translation-only tracker initialization. This
is the equivalent of the hyrbid mode before, but rewritten to work
with the new planar tracking modes.
* The pyramid levels setting is gone. At a future date, the planar
tracker will decide to use pyramids or not automatically. The
pyramid setting was ultimately a mistake; with the brute force
initialization it is unnecessary.
- Add light-normalized tracking
Added the ability to normalize patterns by their average value while
tracking, to make them invariant to global illumination changes.
Additional details could be found at wiki page [2]
[1] http://code.google.com/p/ceres-solver
[2] http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.64/Motion_Tracker
2012-06-10 15:28:19 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(center, tc->center_local);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2011-10-03 16:20:05 +00:00
|
|
|
|
2018-10-31 11:50:49 +11:00
|
|
|
/* Size checked needed since the 3D cursor only uses rotation fields. */
|
|
|
|
|
if (td->ext && td->ext->size) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float fsize[3];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->flag & (T_OBJECT | T_TEXTURE | T_POSE)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float obsizemat[3][3];
|
2012-09-16 15:25:28 +00:00
|
|
|
/* Reorient the size mat to fit the oriented object. */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(obsizemat, tmat, td->axismtx);
|
2012-09-16 15:25:28 +00:00
|
|
|
/* print_m3("obsizemat", obsizemat); */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
TransMat3ToSize(obsizemat, td->axismtx, fsize);
|
2012-09-16 15:25:28 +00:00
|
|
|
/* print_v3("fsize", fsize); */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_size(fsize, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
protectedSizeBits(td->protectflag, fsize);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-09-16 15:25:28 +00:00
|
|
|
if ((t->flag & T_V3D_ALIGN) == 0) { /* align mode doesn't resize objects itself */
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((td->flag & TD_SINGLESIZE) && !(t->con.mode & CON_APPLY)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* scale val and reset size */
|
2012-06-10 19:59:02 +00:00
|
|
|
*td->val = td->ival * (1 + (fsize[0] - 1) * td->factor);
|
2018-05-13 06:44:03 +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
|
|
|
td->ext->size[0] = td->ext->isize[0];
|
|
|
|
|
td->ext->size[1] = td->ext->isize[1];
|
|
|
|
|
td->ext->size[2] = td->ext->isize[2];
|
2012-06-10 19:59:02 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
|
|
|
|
/* Reset val if SINGLESIZE but using a constraint */
|
|
|
|
|
if (td->flag & TD_SINGLESIZE)
|
2012-06-10 19:59:02 +00:00
|
|
|
*td->val = td->ival;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-31 02:54:27 +00:00
|
|
|
td->ext->size[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor);
|
|
|
|
|
td->ext->size[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor);
|
|
|
|
|
td->ext->size[2] = td->ext->isize[2] * (1 + (fsize[2] - 1) * td->factor);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
constraintSizeLim(t, td);
|
|
|
|
|
}
|
2012-05-22 15:30:14 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* For individual element center, Editmode need to use iloc */
|
|
|
|
|
if (t->flag & T_POINTS)
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(tmat, vec);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->flag & T_POINTS)
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->iloc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->center);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* grease pencil falloff */
|
|
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
|
bGPDstroke *gps = (bGPDstroke *)td->extra;
|
|
|
|
|
mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
|
|
|
|
|
|
|
|
|
|
/* scale stroke thickness */
|
|
|
|
|
if (td->val) {
|
|
|
|
|
snapGridIncrement(t, t->values);
|
|
|
|
|
applyNumInput(&t->num, t->values);
|
|
|
|
|
|
|
|
|
|
float ratio = t->values[0];
|
|
|
|
|
*td->val = td->ival * ratio * gps->runtime.multi_frame_falloff;
|
|
|
|
|
CLAMP_MIN(*td->val, 0.001f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mul_v3_fl(vec, td->factor);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->flag & (T_OBJECT | T_POSE)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2016-11-15 15:27:22 +01:00
|
|
|
if (td->loc) {
|
|
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
constraintTransLim(t, td);
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-07 00:35:57 +10:00
|
|
|
static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2015-11-24 16:50:21 +11:00
|
|
|
float mat[3][3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2012-06-10 22:13:17 +00:00
|
|
|
|
2015-11-24 16:50:21 +11:00
|
|
|
if (t->flag & T_AUTOVALUES) {
|
|
|
|
|
copy_v3_v3(t->values, t->auto_values);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2017-04-07 00:35:57 +10:00
|
|
|
float ratio = t->values[0];
|
2015-11-24 16:50:21 +11:00
|
|
|
|
|
|
|
|
copy_v3_fl(t->values, ratio);
|
|
|
|
|
|
|
|
|
|
snapGridIncrement(t, t->values);
|
|
|
|
|
|
|
|
|
|
if (applyNumInput(&t->num, t->values)) {
|
|
|
|
|
constraintNumInput(t, t->values);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
applySnapping(t, t->values);
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-11-24 16:50:21 +11:00
|
|
|
size_to_mat3(mat, t->values);
|
2019-02-22 08:42:08 +11:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, NULL, NULL, mat);
|
2019-02-22 08:42:08 +11:00
|
|
|
|
|
|
|
|
/* Only so we have re-usable value with redo. */
|
2019-02-26 03:18:07 +11:00
|
|
|
float pvec[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
|
int j = 0;
|
2019-02-22 08:42:08 +11:00
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
if (!(t->con.mode & (CON_AXIS0 << i))) {
|
|
|
|
|
t->values[i] = 1.0f;
|
|
|
|
|
}
|
2019-02-26 03:18:07 +11:00
|
|
|
else {
|
|
|
|
|
pvec[j++] = t->values[i];
|
|
|
|
|
}
|
2019-02-22 08:42:08 +11:00
|
|
|
}
|
2019-02-26 03:18:07 +11:00
|
|
|
headerResize(t, pvec, str);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
headerResize(t, t->values, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
copy_m3_m3(t->mat, mat); // used in gizmo
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
ElementResize(t, tc, td, mat);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
/* evil hack - redo resize if cliping needed */
|
2015-11-24 16:50:21 +11:00
|
|
|
if (t->flag & T_CLIP_UV && clipUVTransform(t, t->values, 1)) {
|
|
|
|
|
size_to_mat3(mat, t->values);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2019-02-22 08:42:08 +11:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, NULL, NULL, mat);
|
2019-02-22 08:42:08 +11:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++)
|
|
|
|
|
ElementResize(t, tc, td, mat);
|
2012-08-06 13:40:29 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* In proportional edit it can happen that */
|
|
|
|
|
/* vertices in the radius of the brush end */
|
|
|
|
|
/* outside the clipping area */
|
|
|
|
|
/* XXX HACK - dg */
|
|
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
|
|
|
|
clipUVData(t);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Skin) */
|
2012-05-22 15:30:14 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Skin
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initSkinResize(TransInfo *t)
|
2012-05-22 15:30:14 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_SKIN_RESIZE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applySkinResize;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
t->flag |= T_NULL_ONE;
|
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->num.val_flag[0] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[1] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[2] |= NUM_NULL_ONE;
|
2012-05-22 15:30:14 +00:00
|
|
|
t->num.flag |= NUM_AFFECT_ALL;
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->flag & T_EDIT) == 0) {
|
2012-05-22 15:30:14 +00:00
|
|
|
t->flag |= T_NO_ZERO;
|
2014-07-22 01:24:43 +10:00
|
|
|
#ifdef USE_NUM_NO_ZERO
|
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->num.val_flag[0] |= NUM_NO_ZERO;
|
|
|
|
|
t->num.val_flag[1] |= NUM_NO_ZERO;
|
|
|
|
|
t->num.val_flag[2] |= NUM_NO_ZERO;
|
2014-07-21 17:13:48 +02:00
|
|
|
#endif
|
2012-05-22 15:30:14 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
t->idx_max = 2;
|
|
|
|
|
t->num.idx_max = 2;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[2] = B_UNIT_NONE;
|
2012-05-22 15:30:14 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
|
2012-05-22 15:30:14 +00:00
|
|
|
{
|
|
|
|
|
float size[3], mat[3][3];
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v3_fl(size, t->values[0]);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, size);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
if (applyNumInput(&t->num, size)) {
|
2012-05-22 15:30:14 +00:00
|
|
|
constraintNumInput(t, size);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
applySnapping(t, size);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
if (t->flag & T_AUTOVALUES) {
|
|
|
|
|
copy_v3_v3(size, t->auto_values);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
copy_v3_v3(t->values, size);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
size_to_mat3(mat, size);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
headerResize(t, size, str);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
float tmat[3][3], smat[3][3];
|
|
|
|
|
float fsize[3];
|
2012-05-22 15:30:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2012-05-22 15:30:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (t->flag & T_EDIT) {
|
|
|
|
|
mul_m3_m3m3(smat, mat, td->mtx);
|
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, smat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_m3_m3(tmat, mat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t->con.applySize) {
|
|
|
|
|
t->con.applySize(t, NULL, NULL, tmat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mat3_to_size(fsize, tmat);
|
|
|
|
|
td->val[0] = td->ext->isize[0] * (1 + (fsize[0] - 1) * td->factor);
|
|
|
|
|
td->val[1] = td->ext->isize[1] * (1 + (fsize[1] - 1) * td->factor);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
|
|
|
|
|
2012-05-22 15:30:14 +00:00
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2012-05-22 15:30:14 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (ToSphere) */
|
2012-05-22 15:30:14 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform ToSphere
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
static void initToSphere(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
2018-05-13 06:44:03 +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 = TFM_TOSPHERE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyToSphere;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_HORIZONTAL_RATIO);
|
2018-05-13 06:44:03 +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->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2018-05-13 06:44:03 +02: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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +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
|
|
|
t->num.val_flag[0] |= NUM_NULL_ONE | NUM_NO_NEGATIVE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2018-04-16 16:27:55 +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
|
|
|
// Calculate average radius
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
t->val += len_v3v3(tc->center_local, td->iloc);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t->val /= (float)t->data_len_all;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float vec[3];
|
|
|
|
|
float ratio, radius;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &ratio);
|
2018-05-13 06:44:03 +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
|
|
|
applyNumInput(&t->num, &ratio);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
CLAMP(ratio, 0.0f, 1.0f);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("To Sphere: %s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("To Sphere: %.4f %s"), ratio, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
float tratio;
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
sub_v3_v3v3(vec, td->iloc, tc->center_local);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
radius = normalize_v3(vec);
|
|
|
|
|
|
|
|
|
|
tratio = ratio * td->factor;
|
|
|
|
|
|
|
|
|
|
mul_v3_fl(vec, radius * (1.0f - tratio) + t->val * tratio);
|
|
|
|
|
|
|
|
|
|
add_v3_v3v3(td->loc, tc->center_local, vec);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Rotation) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Rotation
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-14 17:55:27 +00:00
|
|
|
static void postInputRotation(TransInfo *t, float values[3])
|
2010-03-09 01:19:32 +00:00
|
|
|
{
|
2019-02-26 20:22:54 +11:00
|
|
|
float axis_final[3];
|
|
|
|
|
copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
|
2010-03-09 01:19:32 +00:00
|
|
|
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
2019-02-26 20:22:54 +11:00
|
|
|
t->con.applyRot(t, NULL, NULL, axis_final, values);
|
2010-03-09 01:19:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initRotation(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_ROTATION;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyRotation;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-03-09 01:19:32 +00:00
|
|
|
setInputPostFct(&t->mouse, postInputRotation);
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
2018-05-13 06:44:03 +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->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
2013-10-12 22:31:02 +00:00
|
|
|
t->snap[1] = DEG2RAD(5.0);
|
|
|
|
|
t->snap[2] = DEG2RAD(1.0);
|
2018-05-13 06:44:03 +02: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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[2]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->flag & T_2D_EDIT)
|
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2010-01-04 20:49:42 +00:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
if (t->orient_matrix_is_set == false) {
|
|
|
|
|
if ((t->options & CTX_PAINT_CURVE) == 0) {
|
|
|
|
|
t->orientation.unset = V3D_ORIENT_VIEW;
|
|
|
|
|
copy_m3_m4(t->orient_matrix, t->viewinv);
|
|
|
|
|
normalize_m3(t->orient_matrix);
|
|
|
|
|
negate_m3(t->orient_matrix);
|
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
}
|
2010-11-03 04:38:07 +00:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
t->orient_axis = 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
|
|
|
}
|
|
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
/* Used by Transform Rotation and Transform Normal Rotation */
|
|
|
|
|
static void headerRotation(TransInfo *t, char str[UI_MAX_DRAW_STR], float final)
|
|
|
|
|
{
|
|
|
|
|
size_t ofs = 0;
|
|
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
|
char c[NUM_STR_REP_LEN];
|
|
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
|
|
|
|
|
|
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Rot: %s %s %s"), &c[0], t->con.text, t->proptext);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Rot: %.2f%s %s"),
|
|
|
|
|
RAD2DEGF(final), t->con.text, t->proptext);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
|
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-03 02:27:57 -03:00
|
|
|
/**
|
|
|
|
|
* Applies values of rotation to `td->loc` and `td->ext->quat`
|
|
|
|
|
* based on a rotation matrix (mat) and a pivot (center).
|
|
|
|
|
*
|
|
|
|
|
* Protected axis and other transform settings are taken into account.
|
|
|
|
|
*/
|
2018-04-16 16:27:55 +02:00
|
|
|
static void ElementRotation_ex(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const float *center)
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float vec[3], totmat[3][3], smat[3][3];
|
|
|
|
|
float eul[3], fmat[3][3], quat[4];
|
2011-10-02 12:21:24 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->flag & T_POINTS) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->mtx);
|
|
|
|
|
mul_m3_m3m3(smat, td->smtx, totmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/* apply gpencil falloff */
|
|
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
|
bGPDstroke *gps = (bGPDstroke *)td->extra;
|
|
|
|
|
float sx = smat[0][0];
|
|
|
|
|
float sy = smat[1][1];
|
|
|
|
|
float sz = smat[2][2];
|
|
|
|
|
|
|
|
|
|
mul_m3_fl(smat, gps->runtime.multi_frame_falloff);
|
|
|
|
|
/* fix scale */
|
|
|
|
|
smat[0][0] = sx;
|
|
|
|
|
smat[1][1] = sy;
|
|
|
|
|
smat[2][2] = sz;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->iloc, center);
|
|
|
|
|
mul_m3_v3(smat, vec);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, vec, center);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
sub_v3_v3v3(vec, td->loc, td->iloc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
protectedTransBits(td->protectflag, vec);
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->flag & TD_USEQUAT) {
|
2014-07-21 18:55:12 +10:00
|
|
|
mul_m3_series(fmat, td->smtx, mat, td->mtx);
|
2012-06-10 19:59:02 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->ext->quat) {
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
2018-05-13 06:44:03 +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
|
|
|
/* is there a reason not to have this here? -jahka */
|
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* HACK WARNING
|
2009-07-12 02:01:13 +00:00
|
|
|
*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* This is some VERY ugly special case to deal with pose mode.
|
2009-07-12 02:01:13 +00:00
|
|
|
*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* The problem is that mtx and smtx include each bone orientation.
|
2009-07-12 02:01:13 +00:00
|
|
|
*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* That is needed to rotate each bone properly, HOWEVER, to calculate
|
|
|
|
|
* the translation component, we only need the actual armature object's
|
|
|
|
|
* matrix (and inverse). That is not all though. Once the proper translation
|
|
|
|
|
* has been computed, it has to be converted back into the bone's space.
|
|
|
|
|
*/
|
|
|
|
|
else if (t->flag & T_POSE) {
|
2009-07-12 02:01:13 +00:00
|
|
|
// Extract and invert armature object matrix
|
2018-05-04 14:41:51 +02:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((td->flag & TD_NO_LOC) == 0) {
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_v3(tc->mat3, vec); // To Global space
|
2012-06-10 19:59:02 +00:00
|
|
|
mul_m3_v3(mat, vec); // Applying rotation
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_v3(tc->imat3, vec); // To Local space
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* vec now is the location where the object has to be */
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, vec, td->center); // Translation needed from the initial location
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-10-24 06:16:44 +00:00
|
|
|
/* special exception, see TD_PBONE_LOCAL_MTX definition comments */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->flag & TD_PBONE_LOCAL_MTX_P) {
|
2010-10-24 06:16:44 +00:00
|
|
|
/* do nothing */
|
|
|
|
|
}
|
|
|
|
|
else if (td->flag & TD_PBONE_LOCAL_MTX_C) {
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_v3(tc->mat3, vec); // To Global space
|
2012-06-10 19:59:02 +00:00
|
|
|
mul_m3_v3(td->ext->l_smtx, vec); // To Pose space (Local Location)
|
2010-10-24 06:16:44 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_v3(tc->mat3, vec); // To Global space
|
2012-06-10 19:59:02 +00:00
|
|
|
mul_m3_v3(td->smtx, vec); // To Pose space
|
2010-10-24 06:16:44 +00:00
|
|
|
}
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
protectedTransBits(td->protectflag, vec);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2018-05-13 06:44:03 +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
|
|
|
constraintTransLim(t, td);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* rotation */
|
2012-05-13 16:01:59 +00:00
|
|
|
/* MORE HACK: as in some cases the matrix to apply location and rot/scale is not the same,
|
|
|
|
|
* and ElementRotation() might be called in Translation context (with align snapping),
|
|
|
|
|
* we need to be sure to actually use the *rotation* matrix here...
|
|
|
|
|
* So no other way than storing it in some dedicated members of td->ext! */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((t->flag & T_V3D_ALIGN) == 0) { /* align mode doesn't rotate objects itself */
|
2009-09-16 17:43:09 +00:00
|
|
|
/* euler or quaternion/axis-angle? */
|
2010-11-14 19:19:58 +00:00
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
2014-07-21 18:55:12 +10:00
|
|
|
mul_m3_series(fmat, td->ext->r_smtx, mat, td->ext->r_mtx);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
mat3_to_quat(quat, fmat); /* Actual transform */
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
2009-03-02 01:22:02 +00:00
|
|
|
/* this function works on end result */
|
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-09-16 17:43:09 +00:00
|
|
|
/* calculate effect based on quats */
|
2009-11-01 00:06:53 +00:00
|
|
|
float iquat[4], tquat[4];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-07-21 18:55:12 +10:00
|
|
|
mul_m3_series(fmat, td->ext->r_smtx, mat, td->ext->r_mtx);
|
2012-05-13 16:01:59 +00:00
|
|
|
mat3_to_quat(quat, fmat); /* Actual transform */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-09-16 17:43:09 +00:00
|
|
|
/* this function works on end result */
|
2013-03-12 13:18:39 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis,
|
|
|
|
|
td->ext->irotAngle);
|
2009-09-16 17:43:09 +00:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
else {
|
2009-03-02 01:22:02 +00:00
|
|
|
float eulmat[3][3];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-05-13 16:01:59 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->ext->r_mtx);
|
|
|
|
|
mul_m3_m3m3(smat, td->ext->r_smtx, totmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* calculate the total rotatation in eulers */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(eul, td->ext->irot);
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_mat3(eulmat, eul, td->ext->rotOrder);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* mat = transform, obmat = bone rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(fmat, smat, eulmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-03-02 01:22:02 +00:00
|
|
|
/* and apply (to end result only) */
|
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rot, eul);
|
2009-03-02 01:22:02 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
constraintRotLim(t, td);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-04-28 06:31:57 +00:00
|
|
|
if ((td->flag & TD_NO_LOC) == 0) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* translation */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, td->center, center);
|
|
|
|
|
mul_m3_v3(mat, vec);
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(vec, center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* vec now is the location where the object has to be */
|
2010-04-23 23:57:00 +00:00
|
|
|
sub_v3_v3(vec, td->center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(td->smtx, vec);
|
2018-05-13 06:44:03 +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
|
|
|
protectedTransBits(td->protectflag, vec);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
constraintTransLim(t, td);
|
2018-05-13 06:44:03 +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
|
|
|
/* rotation */
|
2012-06-10 19:59:02 +00:00
|
|
|
if ((t->flag & T_V3D_ALIGN) == 0) { // align mode doesn't rotate objects itself
|
2009-03-02 01:22:02 +00:00
|
|
|
/* euler or quaternion? */
|
2012-05-20 19:49:27 +00:00
|
|
|
if ((td->ext->rotOrder == ROT_MODE_QUAT) || (td->flag & TD_USEQUAT)) {
|
2013-03-13 15:11:45 +00:00
|
|
|
/* can be called for texture space translate for example, then opt out */
|
|
|
|
|
if (td->ext->quat) {
|
2014-07-21 18:55:12 +10:00
|
|
|
mul_m3_series(fmat, td->smtx, mat, td->mtx);
|
2013-03-13 15:11:45 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-03-13 15:11:45 +00:00
|
|
|
mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat);
|
|
|
|
|
/* this function works on end result */
|
|
|
|
|
protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2010-11-14 19:19:58 +00:00
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
2009-10-22 23:22:05 +00:00
|
|
|
/* calculate effect based on quats */
|
2009-11-01 00:06:53 +00:00
|
|
|
float iquat[4], tquat[4];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
axis_angle_to_quat(iquat, td->ext->irotAxis, td->ext->irotAngle);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-07-21 18:55:12 +10:00
|
|
|
mul_m3_series(fmat, td->smtx, mat, td->mtx);
|
2012-06-10 19:59:02 +00:00
|
|
|
mat3_to_quat(quat, fmat); // Actual transform
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_qt_qtqt(tquat, quat, iquat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
quat_to_axis_angle(td->ext->rotAxis, td->ext->rotAngle, tquat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* this function works on end result */
|
2013-03-12 13:18:39 +00:00
|
|
|
protectedAxisAngleBits(td->protectflag, td->ext->rotAxis, td->ext->rotAngle, td->ext->irotAxis,
|
|
|
|
|
td->ext->irotAngle);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else {
|
|
|
|
|
float obmat[3][3];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(totmat, mat, td->mtx);
|
|
|
|
|
mul_m3_m3m3(smat, td->smtx, totmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* calculate the total rotatation in eulers */
|
2019-01-15 23:24:20 +11:00
|
|
|
add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta rot */
|
2012-04-29 15:47:02 +00:00
|
|
|
eulO_to_mat3(obmat, eul, td->ext->rotOrder);
|
2009-10-22 23:22:05 +00:00
|
|
|
/* mat = transform, obmat = object rotation */
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* correct back for delta rot */
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(eul, eul, td->ext->drot);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* and apply */
|
|
|
|
|
protectedRotateBits(td->protectflag, eul, td->ext->irot);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rot, eul);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
constraintRotLim(t, td);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void ElementRotation(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const short around)
|
2016-07-28 18:11:43 +10:00
|
|
|
{
|
|
|
|
|
const float *center;
|
|
|
|
|
|
|
|
|
|
/* local constraint shouldn't alter center */
|
|
|
|
|
if (transdata_check_local_center(t, around)) {
|
|
|
|
|
center = td->center;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
center = tc->center_local;
|
2016-07-28 18:11:43 +10:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
ElementRotation_ex(t, tc, td, mat, center);
|
2016-07-28 18:11:43 +10:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyRotationValue(TransInfo *t, float angle, float axis[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float mat[3][3];
|
|
|
|
|
int i;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-06-22 23:58:52 +00:00
|
|
|
axis_angle_normalized_to_mat3(mat, axis, angle);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (t->con.applyRot) {
|
|
|
|
|
t->con.applyRot(t, tc, td, axis, NULL);
|
|
|
|
|
axis_angle_normalized_to_mat3(mat, axis, angle * td->factor);
|
|
|
|
|
}
|
|
|
|
|
else if (t->flag & T_PROP_EDIT) {
|
|
|
|
|
axis_angle_normalized_to_mat3(mat, axis, angle * td->factor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ElementRotation(t, tc, td, mat, t->around);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyRotation(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float final;
|
2010-11-30 05:15:58 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &final);
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
float axis_final[3];
|
|
|
|
|
copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
|
|
|
|
|
|
2010-02-21 14:13:20 +00:00
|
|
|
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
2019-02-26 20:22:54 +11:00
|
|
|
t->con.applyRot(t, NULL, NULL, axis_final, NULL);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applySnapping(t, &final);
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2016-08-02 12:41:43 +02:00
|
|
|
/* Used to clamp final result in [-PI, PI[ range, no idea why, inheritance from 2.4x area, see T48998. */
|
|
|
|
|
applyNumInput(&t->num, &final);
|
2014-03-22 23:20:14 +01:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = final;
|
|
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
headerRotation(t, str, final);
|
2011-04-29 06:59:18 +00:00
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
applyRotationValue(t, final, axis_final);
|
2018-05-13 06:44:03 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Rotation - 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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Rotation - 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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initTrackball(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_TRACKBALL;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTrackball;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 1;
|
|
|
|
|
t->num.idx_max = 1;
|
|
|
|
|
t->snap[0] = 0.0f;
|
2013-10-12 22:31:02 +00:00
|
|
|
t->snap[1] = DEG2RAD(5.0);
|
|
|
|
|
t->snap[2] = DEG2RAD(1.0);
|
2009-07-12 02:01:13 +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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[2]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_ROTATION;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTrackballValue(TransInfo *t, const float axis1[3], const float axis2[3], float angles[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
|
|
|
{
|
2017-06-30 10:33:42 +10:00
|
|
|
float mat[3][3];
|
|
|
|
|
float axis[3];
|
|
|
|
|
float angle;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int i;
|
|
|
|
|
|
2017-06-30 10:33:42 +10:00
|
|
|
mul_v3_v3fl(axis, axis1, angles[0]);
|
|
|
|
|
madd_v3_v3fl(axis, axis2, angles[1]);
|
|
|
|
|
angle = normalize_v3(axis);
|
|
|
|
|
axis_angle_normalized_to_mat3(mat, axis, angle);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (t->flag & T_PROP_EDIT) {
|
|
|
|
|
axis_angle_normalized_to_mat3(mat, axis, td->factor * angle);
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
ElementRotation(t, tc, td, mat, t->around);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTrackball(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float axis1[3], axis2[3];
|
2015-06-16 21:15:01 +02:00
|
|
|
#if 0 /* UNUSED */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float mat[3][3], totmat[3][3], smat[3][3];
|
2015-06-16 21:15:01 +02:00
|
|
|
#endif
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float phi[2];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(axis1, t->persinv[0]);
|
|
|
|
|
copy_v3_v3(axis2, t->persinv[1]);
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(axis1);
|
|
|
|
|
normalize_v3(axis2);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v2_v2(phi, t->values);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, phi);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
applyNumInput(&t->num, phi);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v2_v2(t->values, phi);
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN * 2];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Trackball: %s %s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&c[0], &c[NUM_STR_REP_LEN], t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Trackball: %.2f %.2f %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
RAD2DEGF(phi[0]), RAD2DEGF(phi[1]), t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-06-20 13:24:07 +00:00
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
#if 0 /* UNUSED */
|
2013-06-22 23:58:52 +00:00
|
|
|
axis_angle_normalized_to_mat3(smat, axis1, phi[0]);
|
|
|
|
|
axis_angle_normalized_to_mat3(totmat, axis2, phi[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(mat, smat, totmat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
// TRANSFORM_FIX_ME
|
2018-07-14 23:49:00 +02:00
|
|
|
//copy_m3_m3(t->mat, mat); // used in gizmo
|
2015-06-16 21:15:01 +02:00
|
|
|
#endif
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
applyTrackballValue(t, axis1, axis2, phi);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Normal Rotation) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Normal Rotation
|
2019-02-11 10:51:25 +11:00
|
|
|
* \{ */
|
2018-05-25 22:24:24 +05:30
|
|
|
|
|
|
|
|
static void storeCustomLNorValue(TransDataContainer *tc, BMesh *bm)
|
|
|
|
|
{
|
|
|
|
|
BMLoopNorEditDataArray *lnors_ed_arr = BM_loop_normal_editdata_array_init(bm);
|
2018-08-10 08:10:07 +10:00
|
|
|
// BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata;
|
2018-05-25 22:24:24 +05:30
|
|
|
|
|
|
|
|
tc->custom.mode.data = lnors_ed_arr;
|
|
|
|
|
tc->custom.mode.free_cb = freeCustomNormalArray;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data)
|
|
|
|
|
{
|
|
|
|
|
BMLoopNorEditDataArray *lnors_ed_arr = custom_data->data;
|
|
|
|
|
|
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
|
BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata;
|
|
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
|
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Restore custom loop normal on cancel */
|
|
|
|
|
for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) {
|
2018-05-25 22:24:24 +05:30
|
|
|
BKE_lnor_space_custom_normal_to_data(
|
|
|
|
|
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->niloc, lnor_ed->clnors_data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BM_loop_normal_editdata_array_free(lnors_ed_arr);
|
|
|
|
|
|
|
|
|
|
tc->custom.mode.data = NULL;
|
|
|
|
|
tc->custom.mode.free_cb = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void initNormalRotation(TransInfo *t)
|
|
|
|
|
{
|
|
|
|
|
t->mode = TFM_NORMAL_ROTATION;
|
|
|
|
|
t->transform = applyNormalRotation;
|
|
|
|
|
|
|
|
|
|
setInputPostFct(&t->mouse, postInputRotation);
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
|
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = DEG2RAD(5.0);
|
|
|
|
|
t->snap[2] = DEG2RAD(1.0);
|
|
|
|
|
|
|
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[2]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
|
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
|
|
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
|
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
|
|
|
|
|
BKE_editmesh_lnorspace_update(em);
|
|
|
|
|
|
|
|
|
|
storeCustomLNorValue(tc, bm);
|
|
|
|
|
}
|
|
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
if (t->orient_matrix_is_set == false) {
|
|
|
|
|
t->orientation.unset = V3D_ORIENT_VIEW;
|
|
|
|
|
copy_m3_m4(t->orient_matrix, t->viewinv);
|
|
|
|
|
normalize_m3(t->orient_matrix);
|
|
|
|
|
negate_m3(t->orient_matrix);
|
|
|
|
|
}
|
2018-05-25 22:24:24 +05:30
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
t->orient_axis = 2;
|
2018-05-25 22:24:24 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Works by getting custom normal from clnor_data, transform, then store */
|
|
|
|
|
static void applyNormalRotation(TransInfo *t, const int UNUSED(mval[2]))
|
|
|
|
|
{
|
|
|
|
|
char str[UI_MAX_DRAW_STR];
|
|
|
|
|
|
2019-02-26 20:22:54 +11:00
|
|
|
float axis_final[3];
|
|
|
|
|
copy_v3_v3(axis_final, t->orient_matrix[t->orient_axis]);
|
|
|
|
|
|
2018-05-25 22:24:24 +05:30
|
|
|
if ((t->con.mode & CON_APPLY) && t->con.applyRot) {
|
2019-02-26 20:22:54 +11:00
|
|
|
t->con.applyRot(t, NULL, NULL, axis_final, NULL);
|
2018-05-25 22:24:24 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER(t, tc) {
|
|
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
|
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
|
|
|
|
|
BMLoopNorEditDataArray *lnors_ed_arr = tc->custom.mode.data;
|
|
|
|
|
BMLoopNorEditData *lnor_ed = lnors_ed_arr->lnor_editdata;
|
|
|
|
|
|
|
|
|
|
float axis[3];
|
|
|
|
|
float mat[3][3];
|
|
|
|
|
float angle = t->values[0];
|
2019-02-26 20:22:54 +11:00
|
|
|
copy_v3_v3(axis, axis_final);
|
2018-05-25 22:24:24 +05:30
|
|
|
|
|
|
|
|
snapGridIncrement(t, &angle);
|
|
|
|
|
|
|
|
|
|
applySnapping(t, &angle);
|
|
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &angle);
|
|
|
|
|
|
|
|
|
|
headerRotation(t, str, angle);
|
|
|
|
|
|
|
|
|
|
axis_angle_normalized_to_mat3(mat, axis, angle);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < lnors_ed_arr->totloop; i++, lnor_ed++) {
|
|
|
|
|
mul_v3_m3v3(lnor_ed->nloc, mat, lnor_ed->niloc);
|
|
|
|
|
|
|
|
|
|
BKE_lnor_space_custom_normal_to_data(
|
|
|
|
|
bm->lnor_spacearr->lspacearr[lnor_ed->loop_index], lnor_ed->nloc, lnor_ed->clnors_data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-07-03 19:01:20 +05:30
|
|
|
ED_area_status_text(t->sa, str);
|
2018-05-25 22:24:24 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Translation) */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-06-30 18:57:17 +10:00
|
|
|
static void initSnapSpatial(TransInfo *t, float r_snap[3])
|
|
|
|
|
{
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
RegionView3D *rv3d = t->ar->regiondata;
|
|
|
|
|
|
|
|
|
|
if (rv3d) {
|
2018-08-24 18:04:36 -03:00
|
|
|
View3D *v3d = t->sa->spacedata.first;
|
2015-06-30 18:57:17 +10:00
|
|
|
r_snap[0] = 0.0f;
|
2018-10-30 14:21:50 -03:00
|
|
|
r_snap[1] = ED_view3d_grid_view_scale(t->scene, v3d, rv3d, NULL) * 1.0f;
|
2015-06-30 18:57:17 +10:00
|
|
|
r_snap[2] = r_snap[1] * 0.1f;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-06-13 18:34:46 +02:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
|
r_snap[0] = 0.0f;
|
|
|
|
|
r_snap[1] = 0.0625f;
|
|
|
|
|
r_snap[2] = 0.03125f;
|
|
|
|
|
}
|
|
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2015-06-30 18:57:17 +10:00
|
|
|
r_snap[0] = 0.0f;
|
|
|
|
|
r_snap[1] = 0.125f;
|
|
|
|
|
r_snap[2] = 0.0625f;
|
|
|
|
|
}
|
|
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
|
|
|
|
r_snap[0] = 0.0f;
|
|
|
|
|
r_snap[1] = ED_node_grid_size();
|
|
|
|
|
r_snap[2] = ED_node_grid_size();
|
|
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2015-06-30 18:57:17 +10:00
|
|
|
r_snap[0] = 0.0f;
|
|
|
|
|
r_snap[1] = 1.0;
|
|
|
|
|
r_snap[2] = 0.1f;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
r_snap[0] = 0.0f;
|
|
|
|
|
r_snap[1] = r_snap[2] = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Translation
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initTranslation(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2011-09-22 14:29:15 +00:00
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
|
|
|
|
/* this space uses time translate */
|
2018-05-13 06:44:03 +02:00
|
|
|
BKE_report(t->reports, RPT_ERROR,
|
2014-09-28 16:48:22 +13:00
|
|
|
"Use 'Time_Translate' transform mode instead of 'Translation' mode "
|
2014-10-03 08:09:00 +02:00
|
|
|
"for translating keyframes in Dope Sheet Editor");
|
2011-09-22 14:29:15 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = TFM_TRANSLATION;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTranslation;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->idx_max = (t->flag & T_2D_EDIT) ? 1 : 2;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->num.flag = 0;
|
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-06-30 18:57:17 +10:00
|
|
|
copy_v3_v3(t->snap, t->snap_spatial);
|
2010-02-22 23:25:34 +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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
2014-02-28 09:51:05 +01:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
/* Handling units makes only sense in 3Dview... See T38877. */
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_LENGTH;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_LENGTH;
|
|
|
|
|
t->num.unit_type[2] = B_UNIT_LENGTH;
|
|
|
|
|
}
|
|
|
|
|
else {
|
2019-02-16 16:42:11 +11:00
|
|
|
/* SPACE_GRAPH, SPACE_ACTION, etc. could use some time units, when we have them... */
|
2014-02-28 09:51:05 +01:00
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[2] = B_UNIT_NONE;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
|
|
|
|
char distvec[NUM_STR_REP_LEN];
|
|
|
|
|
char autoik[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float dist;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3(t->num.val);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2009-01-20 20:44:36 +00:00
|
|
|
float dvec[3];
|
|
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(dvec, vec);
|
2009-01-20 20:44:36 +00:00
|
|
|
applyAspectRatio(t, dvec);
|
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
dist = len_v3(vec);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
|
2014-04-11 11:25:41 +10:00
|
|
|
int i;
|
2009-08-12 17:02:03 +00:00
|
|
|
|
2012-08-30 13:18:33 +00:00
|
|
|
for (i = 0; i < 3; i++) {
|
2018-10-03 10:20:16 +02:00
|
|
|
bUnit_AsString2(
|
|
|
|
|
&tvec[NUM_STR_REP_LEN * i], NUM_STR_REP_LEN, dvec[i] * t->scene->unit.scale_length,
|
|
|
|
|
4, B_UNIT_LENGTH, &t->scene->unit, true);
|
2012-08-30 13:18:33 +00:00
|
|
|
}
|
2009-08-12 17:02:03 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", dvec[0]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", dvec[1]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", dvec[2]);
|
2009-08-12 17:02:03 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-11 11:25:41 +10:00
|
|
|
if (!(t->flag & T_2D_EDIT) && t->scene->unit.system) {
|
2018-10-03 10:20:16 +02:00
|
|
|
bUnit_AsString2(
|
|
|
|
|
distvec, sizeof(distvec), dist * t->scene->unit.scale_length,
|
|
|
|
|
4, B_UNIT_LENGTH, &t->scene->unit, false);
|
2014-04-11 11:25:41 +10:00
|
|
|
}
|
2017-06-02 15:38:04 +10:00
|
|
|
else if (dist > 1e10f || dist < -1e10f) {
|
2014-04-11 11:25:41 +10:00
|
|
|
/* prevent string buffer overflow */
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist);
|
2014-04-11 11:25:41 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist);
|
2014-04-11 11:25:41 +10:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_AUTOIK) {
|
2012-06-10 19:59:02 +00:00
|
|
|
short chainlen = t->settings->autoik_chainlen;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (chainlen)
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(autoik, NUM_STR_REP_LEN, IFACE_("AutoIK-Len: %d"), chainlen);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
autoik[0] = '\0';
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
autoik[0] = '\0';
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->num.idx_max) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case 0:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, "D: %s (%s)%s %s %s",
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], distvec, t->con.text, t->proptext, autoik);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case 1:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, "D: %s D: %s (%s)%s %s %s",
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], distvec, t->con.text, t->proptext, autoik);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
|
case 2:
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, "D: %s D: %s D: %s (%s)%s %s %s",
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], distvec,
|
|
|
|
|
t->con.text, t->proptext, autoik);
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-08-30 13:18:33 +00:00
|
|
|
if (t->flag & T_2D_EDIT) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, "Dx: %s Dy: %s (%s)%s %s",
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], distvec, t->con.text, t->proptext);
|
2012-08-30 13:18:33 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, "Dx: %s Dy: %s Dz: %s (%s)%s %s %s",
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], distvec, t->con.text,
|
|
|
|
|
t->proptext, autoik);
|
2012-08-30 13:18:33 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-03-12 13:18:39 +00:00
|
|
|
|
2013-06-20 13:24:07 +00:00
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
|
2011-04-29 06:59:18 +00:00
|
|
|
}
|
2015-08-01 17:39:48 +02:00
|
|
|
|
|
|
|
|
if (t->spacetype == SPACE_NODE) {
|
|
|
|
|
SpaceNode *snode = (SpaceNode *)t->sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
if ((snode->flag & SNODE_SKIP_INSOFFSET) == 0) {
|
|
|
|
|
const char *str_old = BLI_strdup(str);
|
2016-01-29 15:05:51 +01:00
|
|
|
const char *str_dir = (snode->insert_ofs_dir == SNODE_INSERTOFS_DIR_RIGHT) ? IFACE_("right") : IFACE_("left");
|
2016-05-14 10:00:52 +02:00
|
|
|
char str_km[64];
|
2015-08-01 17:39:48 +02:00
|
|
|
|
2017-11-06 00:04:46 +11:00
|
|
|
WM_modalkeymap_items_to_string(t->keymap, TFM_MODAL_INSERTOFS_TOGGLE_DIR, true, str_km, sizeof(str_km));
|
2015-08-01 17:39:48 +02:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("Auto-offset set to %s - press %s to toggle direction | %s"),
|
2015-08-01 17:39:48 +02:00
|
|
|
str_dir, str_km, str_old);
|
|
|
|
|
|
|
|
|
|
MEM_freeN((void *)str_old);
|
|
|
|
|
}
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-20 22:41:30 +11:00
|
|
|
static void applyTranslationValue(TransInfo *t, const float vec[3])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
const bool apply_snap_align_rotation = usingSnappingNormal(t);// && (t->tsnap.status & POINT_INIT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float tvec[3];
|
|
|
|
|
|
2017-02-03 12:57:02 -03:00
|
|
|
/* The ideal would be "apply_snap_align_rotation" only when a snap point is found
|
2017-02-03 02:27:57 -03:00
|
|
|
* so, maybe inside this function is not the best place to apply this rotation.
|
|
|
|
|
* but you need "handle snapping rotation before doing the translation" (really?) */
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
float pivot[3];
|
|
|
|
|
if (apply_snap_align_rotation) {
|
|
|
|
|
copy_v3_v3(pivot, t->tsnap.snapTarget);
|
|
|
|
|
/* The pivot has to be in local-space (see T49494) */
|
2018-05-04 14:41:51 +02:00
|
|
|
if (tc->use_local_mat) {
|
|
|
|
|
mul_m4_v3(tc->imat, pivot);
|
2018-04-16 17:54:33 +02:00
|
|
|
}
|
2017-02-03 02:27:57 -03:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (int i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2014-10-30 12:54:05 +01:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
float rotate_offset[3] = {0};
|
|
|
|
|
bool use_rotate_offset = false;
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* handle snapping rotation before doing the translation */
|
|
|
|
|
if (apply_snap_align_rotation) {
|
|
|
|
|
float mat[3][3];
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (validSnappingNormal(t)) {
|
|
|
|
|
const float *original_normal;
|
|
|
|
|
|
|
|
|
|
/* In pose mode, we want to align normals with Y axis of bones... */
|
|
|
|
|
if (t->flag & T_POSE)
|
|
|
|
|
original_normal = td->axismtx[1];
|
|
|
|
|
else
|
|
|
|
|
original_normal = td->axismtx[2];
|
2014-10-30 12:54:05 +01:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
rotation_between_vecs_to_mat3(mat, original_normal, t->tsnap.snapNormal);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
unit_m3(mat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ElementRotation_ex(t, tc, td, mat, pivot);
|
|
|
|
|
|
|
|
|
|
if (td->loc) {
|
|
|
|
|
use_rotate_offset = true;
|
|
|
|
|
sub_v3_v3v3(rotate_offset, td->loc, td->iloc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t->con.applyVec) {
|
|
|
|
|
float pvec[3];
|
|
|
|
|
t->con.applyVec(t, tc, td, vec, tvec, pvec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-06 18:40:15 +00:00
|
|
|
else {
|
2018-04-16 17:54:33 +02:00
|
|
|
copy_v3_v3(tvec, vec);
|
2016-07-28 18:11:43 +10:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (use_rotate_offset) {
|
|
|
|
|
add_v3_v3(tvec, rotate_offset);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
mul_m3_v3(td->smtx, tvec);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
|
/* grease pencil multiframe falloff */
|
|
|
|
|
bGPDstroke *gps = (bGPDstroke *)td->extra;
|
2018-08-01 10:17:05 +02:00
|
|
|
if (gps != NULL) {
|
|
|
|
|
mul_v3_fl(tvec, td->factor * gps->runtime.multi_frame_falloff);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mul_v3_fl(tvec, td->factor);
|
|
|
|
|
}
|
2018-07-31 10:22:19 +02:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* proportional editing falloff */
|
|
|
|
|
mul_v3_fl(tvec, td->factor);
|
|
|
|
|
}
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
protectedTransBits(td->protectflag, tvec);
|
2016-07-28 18:11:43 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->loc)
|
|
|
|
|
add_v3_v3v3(td->loc, td->iloc, tvec);
|
|
|
|
|
|
|
|
|
|
constraintTransLim(t, td);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTranslation(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2015-11-24 16:50:21 +11:00
|
|
|
float value_final[3];
|
|
|
|
|
|
|
|
|
|
if (t->flag & T_AUTOVALUES) {
|
|
|
|
|
copy_v3_v3(t->values, t->auto_values);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ((t->con.mode & CON_APPLY) == 0) {
|
|
|
|
|
snapGridIncrement(t, t->values);
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
if (applyNumInput(&t->num, t->values)) {
|
2010-11-16 17:37:26 +00:00
|
|
|
removeAspectRatio(t, t->values);
|
|
|
|
|
}
|
2015-11-24 16:50:21 +11:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
applySnapping(t, t->values);
|
2015-11-24 16:50:21 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
float pvec[3] = {0.0f, 0.0f, 0.0f};
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applyVec(t, NULL, NULL, t->values, value_final, pvec);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
headerTranslation(t, pvec, str);
|
2015-11-24 16:50:21 +11:00
|
|
|
|
|
|
|
|
/* only so we have re-usable value with redo, see T46741. */
|
|
|
|
|
mul_v3_m3v3(t->values, t->con.imtx, value_final);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2008-12-29 20:37:54 +00:00
|
|
|
headerTranslation(t, t->values, str);
|
2015-11-24 17:57:47 +11:00
|
|
|
copy_v3_v3(value_final, t->values);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-11-24 16:50:21 +11:00
|
|
|
/* don't use 't->values' now on */
|
|
|
|
|
|
|
|
|
|
applyTranslationValue(t, value_final);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-01-04 01:08:01 +00:00
|
|
|
/* evil hack - redo translation if clipping needed */
|
2015-11-24 16:50:21 +11:00
|
|
|
if (t->flag & T_CLIP_UV && clipUVTransform(t, value_final, 0)) {
|
|
|
|
|
applyTranslationValue(t, value_final);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-08-06 13:40:29 +00:00
|
|
|
/* In proportional edit it can happen that */
|
|
|
|
|
/* vertices in the radius of the brush end */
|
|
|
|
|
/* outside the clipping area */
|
|
|
|
|
/* XXX HACK - dg */
|
2013-06-20 13:24:07 +00:00
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
2012-08-06 13:40:29 +00:00
|
|
|
clipUVData(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
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Shrink-Fatten) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Shrink-Fatten
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initShrinkFatten(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
// If not in mesh edit mode, fallback to Resize
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->flag & T_EDIT) == 0 || (t->obedit_type != OB_MESH)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
initResize(t);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
t->mode = TFM_SHRINKFATTEN;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyShrinkFatten;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_LENGTH;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float distance;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
distance = -t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &distance);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &distance);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = -distance;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Shrink/Fatten:"), sizeof(str) - ofs);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %s", c);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %.4f", distance);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-02-14 14:50:16 +00:00
|
|
|
if (t->proptext[0]) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %s", t->proptext);
|
2013-02-14 14:50:16 +00:00
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, ", (");
|
2013-02-14 14:50:16 +00:00
|
|
|
|
2013-04-22 21:27:44 +00:00
|
|
|
if (t->keymap) {
|
2013-02-14 14:01:02 +00:00
|
|
|
wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_RESIZE);
|
|
|
|
|
if (kmi) {
|
2017-11-06 00:04:46 +11:00
|
|
|
ofs += WM_keymap_item_to_string(kmi, false, str + ofs, sizeof(str) - ofs);
|
2013-02-14 14:01:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_(" or Alt) Even Thickness %s"),
|
2019-01-03 15:13:46 +11:00
|
|
|
WM_bool_as_string((t->flag & T_ALT_TRANSFORM) != 0));
|
2013-02-14 14:01:02 +00:00
|
|
|
/* done with header string */
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
float tdistance; /* temp dist */
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-04-16 17:54:33 +02:00
|
|
|
/* get the final offset */
|
|
|
|
|
tdistance = distance * td->factor;
|
2019-01-03 15:13:46 +11:00
|
|
|
if (td->ext && (t->flag & T_ALT_TRANSFORM) != 0) {
|
2018-04-16 17:54:33 +02:00
|
|
|
tdistance *= td->ext->isize[0]; /* shell factor */
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
madd_v3_v3v3fl(td->loc, td->iloc, td->axismtx[2], tdistance);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Tilt) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Tilt
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initTilt(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_TILT;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTilt;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
2013-10-12 22:31:02 +00:00
|
|
|
t->snap[1] = DEG2RAD(5.0);
|
|
|
|
|
t->snap[2] = DEG2RAD(1.0);
|
2009-07-12 02:01:13 +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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[2]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTilt(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
float final;
|
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &final);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = final;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Tilt: %s° %s"), &c[0], t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-10-08 20:01:36 +00:00
|
|
|
/* XXX For some reason, this seems needed for this op, else RNA prop is not updated... :/ */
|
|
|
|
|
t->values[0] = final;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Tilt: %.2f° %s"), RAD2DEGF(final), t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival + final * td->factor;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Curve Shrink/Fatten) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Curve Shrink/Fatten
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initCurveShrinkFatten(TransInfo *t)
|
2008-12-29 20:37:54 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_CURVE_SHRINKFATTEN;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyCurveShrinkFatten;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2010-02-16 01:42:34 +00:00
|
|
|
t->flag |= T_NO_ZERO;
|
2014-07-22 01:24:43 +10:00
|
|
|
#ifdef USE_NUM_NO_ZERO
|
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->num.val_flag[0] |= NUM_NO_ZERO;
|
2014-07-21 17:13:48 +02:00
|
|
|
#endif
|
2010-02-16 01:42:34 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyCurveShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float ratio;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &ratio);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applyNumInput(&t->num, &ratio);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shrink/Fatten: %s"), c);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shrink/Fatten: %3f"), ratio);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival * ratio;
|
|
|
|
|
/* apply PET */
|
|
|
|
|
*td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival);
|
|
|
|
|
if (*td->val <= 0.0f) *td->val = 0.001f;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Mask Shrink/Fatten) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Mask Shrink/Fatten
|
|
|
|
|
* \{ */
|
2012-06-05 14:13:14 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initMaskShrinkFatten(TransInfo *t)
|
2012-06-05 14:13:14 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_MASK_SHRINKFATTEN;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyMaskShrinkFatten;
|
2012-06-05 14:13:14 +00:00
|
|
|
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
|
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2012-06-05 14:13:14 +00:00
|
|
|
|
|
|
|
|
t->flag |= T_NO_ZERO;
|
2014-07-22 01:24:43 +10:00
|
|
|
#ifdef USE_NUM_NO_ZERO
|
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->num.val_flag[0] |= NUM_NO_ZERO;
|
2014-07-21 17:13:48 +02:00
|
|
|
#endif
|
2012-06-05 14:13:14 +00:00
|
|
|
|
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyMaskShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
2012-06-05 14:13:14 +00:00
|
|
|
{
|
|
|
|
|
float ratio;
|
2014-04-11 11:25:41 +10:00
|
|
|
int i;
|
|
|
|
|
bool initial_feather = false;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2012-06-05 14:13:14 +00:00
|
|
|
|
|
|
|
|
ratio = t->values[0];
|
|
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &ratio);
|
2012-06-05 14:13:14 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &ratio);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
|
2012-06-05 14:13:14 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2012-06-05 14:13:14 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Feather Shrink/Fatten: %s"), c);
|
2012-06-05 14:13:14 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Feather Shrink/Fatten: %3f"), ratio);
|
2012-06-05 14:13:14 +00:00
|
|
|
}
|
|
|
|
|
|
2012-09-21 12:18:14 +00:00
|
|
|
/* detect if no points have feather yet */
|
|
|
|
|
if (ratio > 1.0f) {
|
2014-04-01 11:34:00 +11:00
|
|
|
initial_feather = true;
|
2012-09-21 12:18:14 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2012-09-21 12:18:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2012-09-21 12:18:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->ival >= 0.001f)
|
|
|
|
|
initial_feather = false;
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2012-09-21 12:18:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* apply shrink/fatten */
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (td = tc->data, i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2012-06-05 14:13:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2012-06-05 14:13:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
if (initial_feather)
|
|
|
|
|
*td->val = td->ival + (ratio - 1.0f) * 0.01f;
|
|
|
|
|
else
|
|
|
|
|
*td->val = td->ival * ratio;
|
2012-09-21 12:18:14 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* apply PET */
|
|
|
|
|
*td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival);
|
|
|
|
|
if (*td->val <= 0.0f) *td->val = 0.001f;
|
|
|
|
|
}
|
2012-06-05 14:13:14 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2012-06-05 14:13:14 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
2012-06-05 14:13:14 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2015-02-13 02:46:14 +13:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (GPencil Shrink/Fatten) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform GPencil Strokes Shrink/Fatten
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initGPShrinkFatten(TransInfo *t)
|
|
|
|
|
{
|
|
|
|
|
t->mode = TFM_GPENCIL_SHRINKFATTEN;
|
|
|
|
|
t->transform = applyGPShrinkFatten;
|
|
|
|
|
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
|
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
|
|
|
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
|
|
|
|
|
t->flag |= T_NO_ZERO;
|
|
|
|
|
#ifdef USE_NUM_NO_ZERO
|
|
|
|
|
t->num.val_flag[0] |= NUM_NO_ZERO;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void applyGPShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
|
|
|
|
|
{
|
|
|
|
|
float ratio;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2015-02-13 02:46:14 +13:00
|
|
|
|
|
|
|
|
ratio = t->values[0];
|
|
|
|
|
|
|
|
|
|
snapGridIncrement(t, &ratio);
|
|
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &ratio);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
|
2015-02-13 02:46:14 +13:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
|
char c[NUM_STR_REP_LEN];
|
|
|
|
|
|
|
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shrink/Fatten: %s"), c);
|
2015-02-13 02:46:14 +13:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Shrink/Fatten: %3f"), ratio);
|
2015-02-13 02:46:14 +13:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2015-02-13 02:46:14 +13:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2015-02-13 02:46:14 +13:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival * ratio;
|
|
|
|
|
/* apply PET */
|
|
|
|
|
*td->val = (*td->val * td->factor) + ((1.0f - td->factor) * td->ival);
|
|
|
|
|
if (*td->val <= 0.0f) *td->val = 0.001f;
|
|
|
|
|
}
|
2015-02-13 02:46:14 +13:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2015-02-13 02:46:14 +13:00
|
|
|
}
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Push/Pull) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Push/Pull
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initPushPull(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_PUSHPULL;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyPushPull;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VERTICAL_ABSOLUTE);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_LENGTH;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2017-05-22 21:10:18 +10:00
|
|
|
float vec[3], axis_global[3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float distance;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
distance = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &distance);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &distance);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = distance;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Push/Pull: %s%s %s"), c, t->con.text, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Push/Pull: %.4f%s %s"), distance, t->con.text, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->con.applyRot && t->con.mode & CON_APPLY) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applyRot(t, NULL, NULL, axis_global, NULL);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2017-05-22 21:10:18 +10:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
sub_v3_v3v3(vec, tc->center_local, td->center);
|
|
|
|
|
if (t->con.applyRot && t->con.mode & CON_APPLY) {
|
|
|
|
|
float axis[3];
|
|
|
|
|
copy_v3_v3(axis, axis_global);
|
|
|
|
|
t->con.applyRot(t, tc, td, axis, NULL);
|
|
|
|
|
|
|
|
|
|
mul_m3_v3(td->smtx, axis);
|
|
|
|
|
if (isLockConstraint(t)) {
|
|
|
|
|
float dvec[3];
|
|
|
|
|
project_v3_v3v3(dvec, vec, axis);
|
|
|
|
|
sub_v3_v3(vec, dvec);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
project_v3_v3v3(vec, vec, axis);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 17:54:33 +02:00
|
|
|
normalize_v3_length(vec, distance * td->factor);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
add_v3_v3v3(td->loc, td->iloc, vec);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Bevel Weight) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Bevel Weight
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initBevelWeight(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_BWEIGHT;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyBevelWeight;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-06-03 22:02:02 +06:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_DELTA);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float weight;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
weight = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
CLAMP_MAX(weight, 1.0f);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &weight);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &weight);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = weight;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (weight >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bevel Weight: +%s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bevel Weight: %s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
|
|
|
|
if (weight >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bevel Weight: +%.3f %s"), weight, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Bevel Weight: %.3f %s"), weight, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival + weight * td->factor;
|
|
|
|
|
if (*td->val < 0.0f) *td->val = 0.0f;
|
|
|
|
|
if (*td->val > 1.0f) *td->val = 1.0f;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Crease) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Crease
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initCrease(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_CREASE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyCrease;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2014-06-03 22:02:02 +06:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_DELTA);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float crease;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
crease = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
CLAMP_MAX(crease, 1.0f);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &crease);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &crease);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = crease;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (crease >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Crease: +%s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Crease: %s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
|
|
|
|
if (crease >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Crease: +%.3f %s"), crease, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Crease: %.3f %s"), crease, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival + crease * td->factor;
|
|
|
|
|
if (*td->val < 0.0f) *td->val = 0.0f;
|
|
|
|
|
if (*td->val > 1.0f) *td->val = 1.0f;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (EditBone (B-bone) width scaling) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform B-bone width scaling
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initBoneSize(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_BONESIZE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyBoneSize;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 2;
|
|
|
|
|
t->num.idx_max = 2;
|
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->num.val_flag[0] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[1] |= NUM_NULL_ONE;
|
|
|
|
|
t->num.val_flag[2] |= NUM_NULL_ONE;
|
2011-04-21 12:48:07 +00:00
|
|
|
t->num.flag |= NUM_AFFECT_ALL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[2] = B_UNIT_NONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerBoneSize(TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", vec[0]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", vec[1]);
|
|
|
|
|
BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", vec[2]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* hmm... perhaps the y-axis values don't need to be shown? */
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
if (t->num.idx_max == 0)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("ScaleB: %s%s %s"), &tvec[0], t->con.text, t->proptext);
|
2009-07-12 02:01:13 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("ScaleB: %s : %s : %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("ScaleB X: %s Y: %s Z: %s%s %s"),
|
2013-03-12 13:18:39 +00:00
|
|
|
&tvec[0], &tvec[NUM_STR_REP_LEN], &tvec[NUM_STR_REP_LEN * 2], t->con.text, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void ElementBoneSize(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float tmat[3][3], smat[3][3], oldy;
|
|
|
|
|
float sizemat[3][3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(smat, mat, td->mtx);
|
|
|
|
|
mul_m3_m3m3(tmat, td->smtx, smat);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->con.applySize) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, tc, td, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* we've tucked the scale in loc */
|
2012-06-10 19:59:02 +00:00
|
|
|
oldy = td->iloc[1];
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(sizemat, td->iloc);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(tmat, tmat, sizemat);
|
2012-04-29 15:47:02 +00:00
|
|
|
mat3_to_size(td->loc, tmat);
|
2012-06-10 19:59:02 +00:00
|
|
|
td->loc[1] = oldy;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2017-04-07 00:35:57 +10:00
|
|
|
static void applyBoneSize(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float size[3], mat[3][3];
|
2017-04-07 00:35:57 +10:00
|
|
|
float ratio = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2017-04-07 00:35:57 +10:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v3_fl(size, ratio);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, size);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
if (applyNumInput(&t->num, size)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
constraintNumInput(t, size);
|
|
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
copy_v3_v3(t->values, size);
|
|
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2018-05-13 06:44:03 +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 (t->con.applySize) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, NULL, NULL, mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-07-14 23:49:00 +02:00
|
|
|
copy_m3_m3(t->mat, mat); // used in gizmo
|
2018-05-13 06:44:03 +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
|
|
|
headerBoneSize(t, size, str);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
ElementBoneSize(t, tc, td, mat);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Bone Envelope) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Bone Envelope
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initBoneEnvelope(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_BONE_ENVELOPE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyBoneEnvelope;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING);
|
2018-05-13 06:44:03 +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->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2018-05-13 06:44:03 +02: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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyBoneEnvelope(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float ratio;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
ratio = t->values[0];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &ratio);
|
2018-05-13 06:44:03 +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
|
|
|
applyNumInput(&t->num, &ratio);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = ratio;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Envelope: %s"), c);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Envelope: %3f"), ratio);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (td->val) {
|
|
|
|
|
/* if the old/original value was 0.0f, then just use ratio */
|
|
|
|
|
if (td->ival)
|
|
|
|
|
*td->val = td->ival * ratio;
|
|
|
|
|
else
|
|
|
|
|
*td->val = ratio;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-04-16 16:27:55 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
recalcData(t);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Original Data Store */
|
|
|
|
|
|
|
|
|
|
/** \name Orig-Data Store Utility Functions
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void slide_origdata_init_flag(
|
2018-04-16 16:27:55 +02:00
|
|
|
TransInfo *t, TransDataContainer *tc, SlideOrigData *sod)
|
2015-01-12 02:18:20 +11:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2015-01-12 02:18:20 +11:00
|
|
|
BMesh *bm = em->bm;
|
2015-11-03 19:08:14 +11:00
|
|
|
const bool has_layer_math = CustomData_has_math(&bm->ldata);
|
|
|
|
|
const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
|
2015-01-12 02:18:20 +11:00
|
|
|
|
|
|
|
|
if ((t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) &&
|
|
|
|
|
/* don't do this at all for non-basis shape keys, too easy to
|
|
|
|
|
* accidentally break uv maps or vertex colors then */
|
2015-02-11 19:40:54 +11:00
|
|
|
(bm->shapenr <= 1) &&
|
2015-11-03 19:08:14 +11:00
|
|
|
(has_layer_math || (cd_loop_mdisp_offset != -1)))
|
2015-01-12 02:18:20 +11:00
|
|
|
{
|
|
|
|
|
sod->use_origfaces = true;
|
2015-11-03 19:08:14 +11:00
|
|
|
sod->cd_loop_mdisp_offset = cd_loop_mdisp_offset;
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sod->use_origfaces = false;
|
2015-11-03 19:08:14 +11:00
|
|
|
sod->cd_loop_mdisp_offset = -1;
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void slide_origdata_init_data(
|
2018-04-16 16:27:55 +02:00
|
|
|
TransDataContainer *tc, SlideOrigData *sod)
|
2015-01-12 02:18:20 +11:00
|
|
|
{
|
|
|
|
|
if (sod->use_origfaces) {
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2015-01-12 02:18:20 +11:00
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
|
|
|
|
|
sod->origfaces = BLI_ghash_ptr_new(__func__);
|
2016-07-01 19:07:11 +10:00
|
|
|
sod->bm_origfaces = BM_mesh_create(
|
|
|
|
|
&bm_mesh_allocsize_default,
|
|
|
|
|
&((struct BMeshCreateParams){.use_toolflags = false,}));
|
2015-01-12 02:18:20 +11:00
|
|
|
/* we need to have matching customdata */
|
|
|
|
|
BM_mesh_copy_init_customdata(sod->bm_origfaces, bm, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-23 15:44:28 +11:00
|
|
|
static void slide_origdata_create_data_vert(
|
|
|
|
|
BMesh *bm, SlideOrigData *sod,
|
|
|
|
|
TransDataGenericSlideVert *sv)
|
|
|
|
|
{
|
|
|
|
|
BMIter liter;
|
|
|
|
|
int j, l_num;
|
|
|
|
|
float *loop_weights;
|
|
|
|
|
|
|
|
|
|
/* copy face data */
|
|
|
|
|
// BM_ITER_ELEM (l, &liter, sv->v, BM_LOOPS_OF_VERT) {
|
|
|
|
|
BM_iter_init(&liter, bm, BM_LOOPS_OF_VERT, sv->v);
|
|
|
|
|
l_num = liter.count;
|
|
|
|
|
loop_weights = BLI_array_alloca(loop_weights, l_num);
|
|
|
|
|
for (j = 0; j < l_num; j++) {
|
|
|
|
|
BMLoop *l = BM_iter_step(&liter);
|
2015-06-24 09:54:23 +10:00
|
|
|
BMLoop *l_prev, *l_next;
|
2015-04-06 20:03:49 +10:00
|
|
|
void **val_p;
|
|
|
|
|
if (!BLI_ghash_ensure_p(sod->origfaces, l->f, &val_p)) {
|
2015-02-23 15:44:28 +11:00
|
|
|
BMFace *f_copy = BM_face_copy(sod->bm_origfaces, bm, l->f, true, true);
|
2015-04-06 20:03:49 +10:00
|
|
|
*val_p = f_copy;
|
2015-02-23 15:44:28 +11:00
|
|
|
}
|
2015-06-24 09:54:23 +10:00
|
|
|
|
|
|
|
|
if ((l_prev = BM_loop_find_prev_nodouble(l, l->next, FLT_EPSILON)) &&
|
|
|
|
|
(l_next = BM_loop_find_next_nodouble(l, l_prev, FLT_EPSILON)))
|
|
|
|
|
{
|
|
|
|
|
loop_weights[j] = angle_v3v3v3(l_prev->v->co, l->v->co, l_next->v->co);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
loop_weights[j] = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-23 15:44:28 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* store cd_loop_groups */
|
2015-11-03 19:08:14 +11:00
|
|
|
if (sod->layer_math_map_num && (l_num != 0)) {
|
2015-02-23 15:44:28 +11:00
|
|
|
sv->cd_loop_groups = BLI_memarena_alloc(sod->arena, sod->layer_math_map_num * sizeof(void *));
|
|
|
|
|
for (j = 0; j < sod->layer_math_map_num; j++) {
|
|
|
|
|
const int layer_nr = sod->layer_math_map[j];
|
|
|
|
|
sv->cd_loop_groups[j] = BM_vert_loop_groups_data_layer_create(bm, sv->v, layer_nr, loop_weights, sod->arena);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sv->cd_loop_groups = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_ghash_insert(sod->origverts, sv->v, sv);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 19:40:54 +11:00
|
|
|
static void slide_origdata_create_data(
|
2019-01-14 14:59:18 +11:00
|
|
|
TransDataContainer *tc, SlideOrigData *sod,
|
2015-07-21 14:15:31 +10:00
|
|
|
TransDataGenericSlideVert *sv_array, unsigned int v_stride, unsigned int v_num)
|
2015-01-12 02:18:20 +11:00
|
|
|
{
|
|
|
|
|
if (sod->use_origfaces) {
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2015-01-12 02:18:20 +11:00
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
unsigned int i;
|
2015-07-21 14:15:31 +10:00
|
|
|
TransDataGenericSlideVert *sv;
|
2015-02-11 19:40:54 +11:00
|
|
|
|
|
|
|
|
int layer_index_dst;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
layer_index_dst = 0;
|
2015-11-03 19:08:14 +11:00
|
|
|
|
|
|
|
|
if (CustomData_has_math(&bm->ldata)) {
|
|
|
|
|
/* over alloc, only 'math' layers are indexed */
|
|
|
|
|
sod->layer_math_map = MEM_mallocN(bm->ldata.totlayer * sizeof(int), __func__);
|
|
|
|
|
for (j = 0; j < bm->ldata.totlayer; j++) {
|
|
|
|
|
if (CustomData_layer_has_math(&bm->ldata, j)) {
|
|
|
|
|
sod->layer_math_map[layer_index_dst++] = j;
|
|
|
|
|
}
|
2015-02-11 19:40:54 +11:00
|
|
|
}
|
2015-11-03 19:08:14 +11:00
|
|
|
BLI_assert(layer_index_dst != 0);
|
2015-02-11 19:40:54 +11:00
|
|
|
}
|
2015-11-03 19:08:14 +11:00
|
|
|
|
2015-02-11 19:40:54 +11:00
|
|
|
sod->layer_math_map_num = layer_index_dst;
|
|
|
|
|
|
|
|
|
|
sod->arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
|
|
|
|
|
|
2015-02-16 18:49:18 +11:00
|
|
|
sod->origverts = BLI_ghash_ptr_new_ex(__func__, v_num);
|
|
|
|
|
|
2015-07-21 14:15:31 +10:00
|
|
|
for (i = 0, sv = sv_array; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) {
|
2015-02-23 15:44:28 +11:00
|
|
|
slide_origdata_create_data_vert(bm, sod, sv);
|
2015-02-16 18:49:18 +11:00
|
|
|
}
|
2015-07-21 14:15:31 +10:00
|
|
|
|
2019-01-14 14:59:18 +11:00
|
|
|
if (tc->mirror.axis_flag) {
|
2018-04-16 16:27:55 +02:00
|
|
|
TransData *td = tc->data;
|
2015-07-21 14:15:31 +10:00
|
|
|
TransDataGenericSlideVert *sv_mirror;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
sod->sv_mirror = MEM_callocN(sizeof(*sv_mirror) * tc->data_len, __func__);
|
|
|
|
|
sod->totsv_mirror = tc->data_len;
|
2015-07-21 14:15:31 +10:00
|
|
|
|
|
|
|
|
sv_mirror = sod->sv_mirror;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
2015-07-21 14:15:31 +10:00
|
|
|
BMVert *eve = td->extra;
|
|
|
|
|
if (eve) {
|
|
|
|
|
sv_mirror->v = eve;
|
|
|
|
|
copy_v3_v3(sv_mirror->co_orig_3d, eve->co);
|
|
|
|
|
|
|
|
|
|
slide_origdata_create_data_vert(bm, sod, sv_mirror);
|
|
|
|
|
sv_mirror++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sod->totsv_mirror--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sod->totsv_mirror == 0) {
|
|
|
|
|
MEM_freeN(sod->sv_mirror);
|
|
|
|
|
sod->sv_mirror = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-02-16 18:49:18 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If we're sliding the vert, return its original location, if not, the current location is good.
|
|
|
|
|
*/
|
|
|
|
|
static const float *slide_origdata_orig_vert_co(SlideOrigData *sod, BMVert *v)
|
|
|
|
|
{
|
|
|
|
|
TransDataGenericSlideVert *sv = BLI_ghash_lookup(sod->origverts, v);
|
|
|
|
|
return sv ? sv->co_orig_3d : v->co;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void slide_origdata_interp_data_vert(
|
|
|
|
|
SlideOrigData *sod, BMesh *bm, bool is_final,
|
|
|
|
|
TransDataGenericSlideVert *sv)
|
|
|
|
|
{
|
|
|
|
|
BMIter liter;
|
2015-02-23 13:43:09 +11:00
|
|
|
int j, l_num;
|
2015-02-16 18:49:18 +11:00
|
|
|
float *loop_weights;
|
2015-11-03 19:08:14 +11:00
|
|
|
const bool is_moved = (len_squared_v3v3(sv->v->co, sv->co_orig_3d) > FLT_EPSILON);
|
|
|
|
|
const bool do_loop_weight = sod->layer_math_map_num && is_moved;
|
2015-11-03 20:30:54 +11:00
|
|
|
const bool do_loop_mdisps = is_final && is_moved && (sod->cd_loop_mdisp_offset != -1);
|
2015-06-24 10:59:45 +10:00
|
|
|
const float *v_proj_axis = sv->v->no;
|
|
|
|
|
/* original (l->prev, l, l->next) projections for each loop ('l' remains unchanged) */
|
|
|
|
|
float v_proj[3][3];
|
|
|
|
|
|
2015-11-03 20:30:54 +11:00
|
|
|
if (do_loop_weight || do_loop_mdisps) {
|
2017-06-16 01:25:08 +10:00
|
|
|
project_plane_normalized_v3_v3v3(v_proj[1], sv->co_orig_3d, v_proj_axis);
|
2015-06-24 10:59:45 +10:00
|
|
|
}
|
2015-02-16 18:49:18 +11:00
|
|
|
|
2018-04-16 17:08:27 +02:00
|
|
|
// BM_ITER_ELEM (l, &liter, sv->v, BM_LOOPS_OF_VERT)
|
2015-02-23 13:43:09 +11:00
|
|
|
BM_iter_init(&liter, bm, BM_LOOPS_OF_VERT, sv->v);
|
|
|
|
|
l_num = liter.count;
|
|
|
|
|
loop_weights = do_loop_weight ? BLI_array_alloca(loop_weights, l_num) : NULL;
|
|
|
|
|
for (j = 0; j < l_num; j++) {
|
2015-02-16 18:49:18 +11:00
|
|
|
BMFace *f_copy; /* the copy of 'f' */
|
2015-02-23 13:43:09 +11:00
|
|
|
BMLoop *l = BM_iter_step(&liter);
|
2015-02-16 18:49:18 +11:00
|
|
|
|
|
|
|
|
f_copy = BLI_ghash_lookup(sod->origfaces, l->f);
|
|
|
|
|
|
|
|
|
|
/* only loop data, no vertex data since that contains shape keys,
|
|
|
|
|
* and we do not want to mess up other shape keys */
|
2015-11-03 19:08:14 +11:00
|
|
|
BM_loop_interp_from_face(bm, l, f_copy, false, false);
|
2015-02-16 18:49:18 +11:00
|
|
|
|
|
|
|
|
/* make sure face-attributes are correct (e.g. MTexPoly) */
|
2018-11-27 11:39:51 +11:00
|
|
|
BM_elem_attrs_copy_ex(sod->bm_origfaces, bm, f_copy, l->f, 0x0, CD_MASK_NORMAL);
|
2015-02-16 18:49:18 +11:00
|
|
|
|
|
|
|
|
/* weight the loop */
|
|
|
|
|
if (do_loop_weight) {
|
2015-06-24 11:09:53 +10:00
|
|
|
const float eps = 1.0e-8f;
|
2015-06-17 05:48:55 +10:00
|
|
|
const BMLoop *l_prev = l->prev;
|
|
|
|
|
const BMLoop *l_next = l->next;
|
|
|
|
|
const float *co_prev = slide_origdata_orig_vert_co(sod, l_prev->v);
|
|
|
|
|
const float *co_next = slide_origdata_orig_vert_co(sod, l_next->v);
|
|
|
|
|
bool co_prev_ok;
|
|
|
|
|
bool co_next_ok;
|
|
|
|
|
|
2015-06-24 10:59:45 +10:00
|
|
|
|
2019-01-15 23:24:20 +11:00
|
|
|
/* In the unlikely case that we're next to a zero length edge -
|
|
|
|
|
* walk around the to the next.
|
|
|
|
|
*
|
2015-06-17 05:48:55 +10:00
|
|
|
* Since we only need to check if the vertex is in this corner,
|
2019-01-15 23:24:20 +11:00
|
|
|
* its not important _which_ loop - as long as its not overlapping
|
|
|
|
|
* 'sv->co_orig_3d', see: T45096. */
|
2017-06-16 01:25:08 +10:00
|
|
|
project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis);
|
2015-06-24 10:59:45 +10:00
|
|
|
while (UNLIKELY(((co_prev_ok = (len_squared_v3v3(v_proj[1], v_proj[0]) > eps)) == false) &&
|
2015-06-17 05:48:55 +10:00
|
|
|
((l_prev = l_prev->prev) != l->next)))
|
|
|
|
|
{
|
|
|
|
|
co_prev = slide_origdata_orig_vert_co(sod, l_prev->v);
|
2017-06-16 01:25:08 +10:00
|
|
|
project_plane_normalized_v3_v3v3(v_proj[0], co_prev, v_proj_axis);
|
2015-06-17 05:48:55 +10:00
|
|
|
}
|
2017-06-16 01:25:08 +10:00
|
|
|
project_plane_normalized_v3_v3v3(v_proj[2], co_next, v_proj_axis);
|
2015-06-24 10:59:45 +10:00
|
|
|
while (UNLIKELY(((co_next_ok = (len_squared_v3v3(v_proj[1], v_proj[2]) > eps)) == false) &&
|
2015-06-17 05:48:55 +10:00
|
|
|
((l_next = l_next->next) != l->prev)))
|
|
|
|
|
{
|
|
|
|
|
co_next = slide_origdata_orig_vert_co(sod, l_next->v);
|
2017-06-16 01:25:08 +10:00
|
|
|
project_plane_normalized_v3_v3v3(v_proj[2], co_next, v_proj_axis);
|
2015-06-17 05:48:55 +10:00
|
|
|
}
|
|
|
|
|
|
2015-06-24 10:59:45 +10:00
|
|
|
if (co_prev_ok && co_next_ok) {
|
|
|
|
|
const float dist = dist_signed_squared_to_corner_v3v3v3(sv->v->co, UNPACK3(v_proj), v_proj_axis);
|
|
|
|
|
|
2015-06-17 05:48:55 +10:00
|
|
|
loop_weights[j] = (dist >= 0.0f) ? 1.0f : ((dist <= -eps) ? 0.0f : (1.0f + (dist / eps)));
|
2015-06-24 10:59:45 +10:00
|
|
|
if (UNLIKELY(!isfinite(loop_weights[j]))) {
|
|
|
|
|
loop_weights[j] = 0.0f;
|
|
|
|
|
}
|
2015-06-17 05:48:55 +10:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
loop_weights[j] = 0.0f;
|
|
|
|
|
}
|
2015-02-16 18:49:18 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-03 19:08:14 +11:00
|
|
|
if (sod->layer_math_map_num) {
|
|
|
|
|
if (do_loop_weight) {
|
|
|
|
|
for (j = 0; j < sod->layer_math_map_num; j++) {
|
2018-01-16 11:40:43 +11:00
|
|
|
BM_vert_loop_groups_data_layer_merge_weights(bm, sv->cd_loop_groups[j], sod->layer_math_map[j], loop_weights);
|
2015-11-03 19:08:14 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
for (j = 0; j < sod->layer_math_map_num; j++) {
|
2018-01-16 11:40:43 +11:00
|
|
|
BM_vert_loop_groups_data_layer_merge(bm, sv->cd_loop_groups[j], sod->layer_math_map[j]);
|
2015-11-03 19:08:14 +11:00
|
|
|
}
|
2015-02-16 18:49:18 +11:00
|
|
|
}
|
|
|
|
|
}
|
2015-11-03 19:08:14 +11:00
|
|
|
|
|
|
|
|
/* Special handling for multires
|
|
|
|
|
*
|
|
|
|
|
* Interpolate from every other loop (not ideal)
|
|
|
|
|
* However values will only be taken from loops which overlap other mdisps.
|
|
|
|
|
* */
|
2015-11-03 20:30:54 +11:00
|
|
|
if (do_loop_mdisps) {
|
2015-11-03 19:08:14 +11:00
|
|
|
float (*faces_center)[3] = BLI_array_alloca(faces_center, l_num);
|
|
|
|
|
BMLoop *l;
|
|
|
|
|
|
2015-11-06 05:09:14 +11:00
|
|
|
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
|
2018-12-14 10:54:11 +11:00
|
|
|
BM_face_calc_center_median(l->f, faces_center[j]);
|
2015-11-03 19:08:14 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
|
|
|
|
|
BMFace *f_copy = BLI_ghash_lookup(sod->origfaces, l->f);
|
|
|
|
|
float f_copy_center[3];
|
|
|
|
|
BMIter liter_other;
|
|
|
|
|
BMLoop *l_other;
|
|
|
|
|
int j_other;
|
|
|
|
|
|
2018-12-14 10:54:11 +11:00
|
|
|
BM_face_calc_center_median(f_copy, f_copy_center);
|
2015-11-03 19:08:14 +11:00
|
|
|
|
|
|
|
|
BM_ITER_ELEM_INDEX (l_other, &liter_other, sv->v, BM_LOOPS_OF_VERT, j_other) {
|
2015-11-03 20:30:54 +11:00
|
|
|
BM_face_interp_multires_ex(
|
|
|
|
|
bm, l_other->f, f_copy,
|
2015-11-03 19:08:14 +11:00
|
|
|
faces_center[j_other], f_copy_center, sod->cd_loop_mdisp_offset);
|
|
|
|
|
}
|
2015-02-11 19:40:54 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void slide_origdata_interp_data(
|
2018-04-16 16:27:55 +02:00
|
|
|
Object *obedit, SlideOrigData *sod,
|
2015-02-11 19:40:54 +11:00
|
|
|
TransDataGenericSlideVert *sv, unsigned int v_stride, unsigned int v_num,
|
|
|
|
|
bool is_final)
|
|
|
|
|
{
|
|
|
|
|
if (sod->use_origfaces) {
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(obedit);
|
2015-02-16 18:49:18 +11:00
|
|
|
BMesh *bm = em->bm;
|
2015-02-11 19:40:54 +11:00
|
|
|
unsigned int i;
|
2015-11-03 19:08:14 +11:00
|
|
|
const bool has_mdisps = (sod->cd_loop_mdisp_offset != -1);
|
2015-02-11 19:40:54 +11:00
|
|
|
|
2015-02-23 15:44:28 +11:00
|
|
|
for (i = 0; i < v_num; i++, sv = POINTER_OFFSET(sv, v_stride)) {
|
2015-02-11 19:40:54 +11:00
|
|
|
|
2015-11-03 19:08:14 +11:00
|
|
|
if (sv->cd_loop_groups || has_mdisps) {
|
2015-02-16 18:49:18 +11:00
|
|
|
slide_origdata_interp_data_vert(sod, bm, is_final, sv);
|
2015-02-11 19:40:54 +11:00
|
|
|
}
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
2015-07-21 14:15:31 +10:00
|
|
|
|
|
|
|
|
if (sod->sv_mirror) {
|
|
|
|
|
sv = sod->sv_mirror;
|
|
|
|
|
for (i = 0; i < v_num; i++, sv++) {
|
2015-11-03 19:08:14 +11:00
|
|
|
if (sv->cd_loop_groups || has_mdisps) {
|
2015-07-21 14:15:31 +10:00
|
|
|
slide_origdata_interp_data_vert(sod, bm, is_final, sv);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void slide_origdata_free_date(
|
|
|
|
|
SlideOrigData *sod)
|
|
|
|
|
{
|
|
|
|
|
if (sod->use_origfaces) {
|
|
|
|
|
if (sod->bm_origfaces) {
|
|
|
|
|
BM_mesh_free(sod->bm_origfaces);
|
|
|
|
|
sod->bm_origfaces = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sod->origfaces) {
|
|
|
|
|
BLI_ghash_free(sod->origfaces, NULL, NULL);
|
|
|
|
|
sod->origfaces = NULL;
|
|
|
|
|
}
|
2015-02-11 19:40:54 +11:00
|
|
|
|
2015-02-16 18:49:18 +11:00
|
|
|
if (sod->origverts) {
|
|
|
|
|
BLI_ghash_free(sod->origverts, NULL, NULL);
|
|
|
|
|
sod->origverts = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 19:40:54 +11:00
|
|
|
if (sod->arena) {
|
|
|
|
|
BLI_memarena_free(sod->arena);
|
|
|
|
|
sod->arena = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_SAFE_FREE(sod->layer_math_map);
|
2015-07-21 14:15:31 +10:00
|
|
|
|
|
|
|
|
MEM_SAFE_FREE(sod->sv_mirror);
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** \} */
|
2013-10-23 03:57:42 +00:00
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Edge Slide) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Edge Slide
|
|
|
|
|
* \{ */
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2015-05-07 21:28:03 +10:00
|
|
|
static void calcEdgeSlideCustomPoints(struct TransInfo *t)
|
|
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
EdgeSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2015-05-07 21:28:03 +10:00
|
|
|
|
|
|
|
|
setCustomPoints(t, &t->mouse, sld->mval_end, sld->mval_start);
|
|
|
|
|
|
|
|
|
|
/* setCustomPoints isn't normally changing as the mouse moves,
|
2018-09-27 15:35:22 +02:00
|
|
|
* in this case apply mouse input immediately so we don't refresh
|
2015-05-07 21:28:03 +10:00
|
|
|
* with the value from the previous points */
|
|
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
static BMEdge *get_other_edge(BMVert *v, BMEdge *e)
|
2009-11-29 00:53:23 +00:00
|
|
|
{
|
|
|
|
|
BMIter iter;
|
2013-01-29 01:02:45 +00:00
|
|
|
BMEdge *e_iter;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2013-01-29 01:02:45 +00:00
|
|
|
BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
if (BM_elem_flag_test(e_iter, BM_ELEM_SELECT) && e_iter != e) {
|
|
|
|
|
return e_iter;
|
|
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-04 05:53:02 +00:00
|
|
|
/* interpoaltes along a line made up of 2 segments (used for edge slide) */
|
2015-05-07 19:50:46 +10:00
|
|
|
static void interp_line_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], float t)
|
2013-10-04 05:53:02 +00:00
|
|
|
{
|
|
|
|
|
float t_mid, t_delta;
|
|
|
|
|
|
|
|
|
|
/* could be pre-calculated */
|
|
|
|
|
t_mid = line_point_factor_v3(v2, v1, v3);
|
|
|
|
|
|
|
|
|
|
t_delta = t - t_mid;
|
2015-05-07 19:50:46 +10:00
|
|
|
if (t_delta < 0.0f) {
|
|
|
|
|
if (UNLIKELY(fabsf(t_mid) < FLT_EPSILON)) {
|
|
|
|
|
copy_v3_v3(p, v2);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
interp_v3_v3v3(p, v1, v2, t / t_mid);
|
|
|
|
|
}
|
2013-10-04 05:53:02 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-05-07 19:50:46 +10:00
|
|
|
t = t - t_mid;
|
|
|
|
|
t_mid = 1.0f - t_mid;
|
|
|
|
|
|
|
|
|
|
if (UNLIKELY(fabsf(t_mid) < FLT_EPSILON)) {
|
|
|
|
|
copy_v3_v3(p, v3);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
interp_v3_v3v3(p, v2, v3, t / t_mid);
|
|
|
|
|
}
|
2013-10-04 05:53:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-03 07:26:58 +00:00
|
|
|
/**
|
|
|
|
|
* Find the closest point on the ngon on the opposite side.
|
|
|
|
|
* used to set the edge slide distance for ngons.
|
|
|
|
|
*/
|
|
|
|
|
static bool bm_loop_calc_opposite_co(BMLoop *l_tmp,
|
|
|
|
|
const float plane_no[3],
|
|
|
|
|
float r_co[3])
|
|
|
|
|
{
|
|
|
|
|
/* skip adjacent edges */
|
|
|
|
|
BMLoop *l_first = l_tmp->next;
|
|
|
|
|
BMLoop *l_last = l_tmp->prev;
|
|
|
|
|
BMLoop *l_iter;
|
|
|
|
|
float dist = FLT_MAX;
|
2018-05-02 10:32:01 +02:00
|
|
|
bool found = false;
|
2013-02-03 07:26:58 +00:00
|
|
|
|
|
|
|
|
l_iter = l_first;
|
|
|
|
|
do {
|
|
|
|
|
float tvec[3];
|
|
|
|
|
if (isect_line_plane_v3(tvec,
|
|
|
|
|
l_iter->v->co, l_iter->next->v->co,
|
2013-08-31 02:06:23 +00:00
|
|
|
l_tmp->v->co, plane_no))
|
2013-02-03 07:26:58 +00:00
|
|
|
{
|
|
|
|
|
const float fac = line_point_factor_v3(tvec, l_iter->v->co, l_iter->next->v->co);
|
|
|
|
|
/* allow some overlap to avoid missing the intersection because of float precision */
|
|
|
|
|
if ((fac > -FLT_EPSILON) && (fac < 1.0f + FLT_EPSILON)) {
|
2014-01-17 17:35:03 +11:00
|
|
|
/* likelihood of multiple intersections per ngon is quite low,
|
2013-02-03 07:26:58 +00:00
|
|
|
* it would have to loop back on its self, but better support it
|
|
|
|
|
* so check for the closest opposite edge */
|
|
|
|
|
const float tdist = len_v3v3(l_tmp->v->co, tvec);
|
|
|
|
|
if (tdist < dist) {
|
|
|
|
|
copy_v3_v3(r_co, tvec);
|
|
|
|
|
dist = tdist;
|
2018-05-02 10:32:01 +02:00
|
|
|
found = true;
|
2013-02-03 07:26:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while ((l_iter = l_iter->next) != l_last);
|
|
|
|
|
|
2018-05-02 10:32:01 +02:00
|
|
|
return found;
|
2013-02-03 07:26:58 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-29 01:31:42 +00:00
|
|
|
/**
|
|
|
|
|
* Given 2 edges and a loop, step over the loops
|
|
|
|
|
* and calculate a direction to slide along.
|
2013-01-29 02:17:19 +00:00
|
|
|
*
|
2018-12-12 12:50:58 +11:00
|
|
|
* \param r_slide_vec: the direction to slide,
|
2013-01-29 02:17:19 +00:00
|
|
|
* the length of the vector defines the slide distance.
|
2013-01-29 01:31:42 +00:00
|
|
|
*/
|
2012-04-19 14:38:09 +00:00
|
|
|
static BMLoop *get_next_loop(BMVert *v, BMLoop *l,
|
2013-01-29 02:17:19 +00:00
|
|
|
BMEdge *e_prev, BMEdge *e_next, float r_slide_vec[3])
|
2009-11-29 00:53:23 +00:00
|
|
|
{
|
2013-01-29 01:37:04 +00:00
|
|
|
BMLoop *l_first;
|
2013-01-29 01:31:42 +00:00
|
|
|
float vec_accum[3] = {0.0f, 0.0f, 0.0f};
|
2013-01-29 02:17:19 +00:00
|
|
|
float vec_accum_len = 0.0f;
|
2012-06-10 19:59:02 +00:00
|
|
|
int i = 0;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2013-01-29 01:31:42 +00:00
|
|
|
BLI_assert(BM_edge_share_vert(e_prev, e_next) == v);
|
2013-04-19 08:42:11 +00:00
|
|
|
BLI_assert(BM_vert_in_edge(l->e, v));
|
2013-01-29 01:31:42 +00:00
|
|
|
|
2013-01-29 01:37:04 +00:00
|
|
|
l_first = l;
|
2009-11-29 00:53:23 +00:00
|
|
|
do {
|
2013-04-19 01:02:58 +00:00
|
|
|
l = BM_loop_other_edge_loop(l, v);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-01-29 01:02:45 +00:00
|
|
|
if (l->e == e_next) {
|
2009-12-26 08:47:38 +00:00
|
|
|
if (i) {
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_length(vec_accum, vec_accum_len / (float)i);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-01-29 05:30:39 +00:00
|
|
|
/* When there is no edge to slide along,
|
|
|
|
|
* we must slide along the vector defined by the face we're attach to */
|
2013-01-29 05:18:30 +00:00
|
|
|
BMLoop *l_tmp = BM_face_vert_share_loop(l_first->f, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2013-01-29 05:30:39 +00:00
|
|
|
BLI_assert(ELEM(l_tmp->e, e_prev, e_next) && ELEM(l_tmp->prev->e, e_prev, e_next));
|
|
|
|
|
|
|
|
|
|
if (l_tmp->f->len == 4) {
|
|
|
|
|
/* we could use code below, but in this case
|
|
|
|
|
* sliding diagonally across the quad works well */
|
|
|
|
|
sub_v3_v3v3(vec_accum, l_tmp->next->next->v->co, v->co);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2013-02-03 06:09:29 +00:00
|
|
|
float tdir[3];
|
|
|
|
|
BM_loop_calc_face_direction(l_tmp, tdir);
|
|
|
|
|
cross_v3_v3v3(vec_accum, l_tmp->f->no, tdir);
|
2013-02-03 07:26:58 +00:00
|
|
|
#if 0
|
|
|
|
|
/* rough guess, we can do better! */
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_length(vec_accum, (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f);
|
2013-02-03 07:26:58 +00:00
|
|
|
#else
|
|
|
|
|
/* be clever, check the opposite ngon edge to slide into.
|
|
|
|
|
* this gives best results */
|
|
|
|
|
{
|
|
|
|
|
float tvec[3];
|
|
|
|
|
float dist;
|
|
|
|
|
|
|
|
|
|
if (bm_loop_calc_opposite_co(l_tmp, tdir, tvec)) {
|
|
|
|
|
dist = len_v3v3(l_tmp->v->co, tvec);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
dist = (BM_edge_calc_length(e_prev) + BM_edge_calc_length(e_next)) / 2.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_length(vec_accum, dist);
|
2013-02-03 07:26:58 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
2013-01-29 05:18:30 +00:00
|
|
|
}
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
2013-01-29 01:02:45 +00:00
|
|
|
|
2013-01-29 02:17:19 +00:00
|
|
|
copy_v3_v3(r_slide_vec, vec_accum);
|
2009-11-29 00:53:23 +00:00
|
|
|
return l;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-01-29 01:37:04 +00:00
|
|
|
/* accumulate the normalized edge vector,
|
|
|
|
|
* normalize so some edges don't skew the result */
|
2013-01-29 01:31:42 +00:00
|
|
|
float tvec[3];
|
|
|
|
|
sub_v3_v3v3(tvec, BM_edge_other_vert(l->e, v)->co, v->co);
|
2013-01-29 02:17:19 +00:00
|
|
|
vec_accum_len += normalize_v3(tvec);
|
|
|
|
|
add_v3_v3(vec_accum, tvec);
|
2009-12-26 08:47:38 +00:00
|
|
|
i += 1;
|
|
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2013-04-19 01:02:58 +00:00
|
|
|
if (BM_loop_other_edge_loop(l, v)->e == e_next) {
|
2013-01-29 01:02:45 +00:00
|
|
|
if (i) {
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_length(vec_accum, vec_accum_len / (float)i);
|
2013-01-29 01:02:45 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-29 02:17:19 +00:00
|
|
|
copy_v3_v3(r_slide_vec, vec_accum);
|
2013-04-19 01:02:58 +00:00
|
|
|
return BM_loop_other_edge_loop(l, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
2013-04-19 08:42:11 +00:00
|
|
|
|
|
|
|
|
} while ((l != l->radial_next) &&
|
|
|
|
|
((l = l->radial_next) != l_first));
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2013-01-29 01:31:42 +00:00
|
|
|
if (i) {
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_length(vec_accum, vec_accum_len / (float)i);
|
2013-01-29 01:31:42 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-01-29 02:17:19 +00:00
|
|
|
copy_v3_v3(r_slide_vec, vec_accum);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2015-06-15 04:52:35 +10:00
|
|
|
/**
|
|
|
|
|
* Calculate screenspace `mval_start` / `mval_end`, optionally slide direction.
|
|
|
|
|
*/
|
|
|
|
|
static void calcEdgeSlide_mval_range(
|
2018-04-16 16:27:55 +02:00
|
|
|
TransInfo *t, TransDataContainer *tc, EdgeSlideData *sld, const int *sv_table, const int loop_nr,
|
2016-07-31 12:02:33 +10:00
|
|
|
const float mval[2], const bool use_occlude_geometry, const bool use_calc_direction)
|
2015-06-15 04:52:35 +10:00
|
|
|
{
|
|
|
|
|
TransDataEdgeSlideVert *sv_array = sld->sv;
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2015-06-15 04:52:35 +10:00
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
ARegion *ar = t->ar;
|
|
|
|
|
View3D *v3d = NULL;
|
|
|
|
|
RegionView3D *rv3d = NULL;
|
|
|
|
|
float projectMat[4][4];
|
2016-07-31 12:02:33 +10:00
|
|
|
BMBVHTree *bmbvh;
|
2015-06-15 04:52:35 +10:00
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
/* only for use_calc_direction */
|
|
|
|
|
float (*loop_dir)[3] = NULL, *loop_maxdist = NULL;
|
|
|
|
|
|
2015-06-15 04:52:35 +10:00
|
|
|
float mval_start[2], mval_end[2];
|
2015-06-15 10:58:07 +10:00
|
|
|
float mval_dir[3], dist_best_sq;
|
2015-06-15 04:52:35 +10:00
|
|
|
BMIter iter;
|
|
|
|
|
BMEdge *e;
|
|
|
|
|
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
/* background mode support */
|
|
|
|
|
v3d = t->sa ? t->sa->spacedata.first : NULL;
|
|
|
|
|
rv3d = t->ar ? t->ar->regiondata : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!rv3d) {
|
|
|
|
|
/* ok, let's try to survive this */
|
|
|
|
|
unit_m4(projectMat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, projectMat);
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
|
2016-07-31 12:02:33 +10:00
|
|
|
if (use_occlude_geometry) {
|
|
|
|
|
bmbvh = BKE_bmbvh_new_from_editmesh(em, BMBVH_RESPECT_HIDDEN, NULL, false);
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2016-07-31 12:02:33 +10:00
|
|
|
bmbvh = NULL;
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* find mouse vectors, the global one, and one per loop in case we have
|
|
|
|
|
* multiple loops selected, in case they are oriented different */
|
|
|
|
|
zero_v3(mval_dir);
|
|
|
|
|
dist_best_sq = -1.0f;
|
|
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
if (use_calc_direction) {
|
|
|
|
|
loop_dir = MEM_callocN(sizeof(float[3]) * loop_nr, "sv loop_dir");
|
|
|
|
|
loop_maxdist = MEM_mallocN(sizeof(float) * loop_nr, "sv loop_maxdist");
|
|
|
|
|
copy_vn_fl(loop_maxdist, loop_nr, -1.0f);
|
|
|
|
|
}
|
2015-06-15 04:52:35 +10:00
|
|
|
|
|
|
|
|
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
|
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
/* search cross edges for visible edge to the mouse cursor,
|
|
|
|
|
* then use the shared vertex to calculate screen vector*/
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
|
BMIter iter_other;
|
|
|
|
|
BMEdge *e_other;
|
|
|
|
|
|
|
|
|
|
BMVert *v = i ? e->v1 : e->v2;
|
|
|
|
|
BM_ITER_ELEM (e_other, &iter_other, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
/* screen-space coords */
|
|
|
|
|
float sco_a[3], sco_b[3];
|
|
|
|
|
float dist_sq;
|
|
|
|
|
int j, l_nr;
|
|
|
|
|
|
|
|
|
|
if (BM_elem_flag_test(e_other, BM_ELEM_SELECT))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* This test is only relevant if object is not wire-drawn! See [#32068]. */
|
2018-01-18 15:58:02 +01:00
|
|
|
if (use_occlude_geometry &&
|
2018-04-16 16:27:55 +02:00
|
|
|
!BMBVH_EdgeVisible(bmbvh, e_other, t->depsgraph, ar, v3d, tc->obedit))
|
2018-01-18 15:58:02 +01:00
|
|
|
{
|
2015-06-15 04:52:35 +10:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BLI_assert(sv_table[BM_elem_index_get(v)] != -1);
|
|
|
|
|
j = sv_table[BM_elem_index_get(v)];
|
|
|
|
|
|
|
|
|
|
if (sv_array[j].v_side[1]) {
|
|
|
|
|
ED_view3d_project_float_v3_m4(ar, sv_array[j].v_side[1]->co, sco_b, projectMat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
add_v3_v3v3(sco_b, v->co, sv_array[j].dir_side[1]);
|
|
|
|
|
ED_view3d_project_float_v3_m4(ar, sco_b, sco_b, projectMat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sv_array[j].v_side[0]) {
|
|
|
|
|
ED_view3d_project_float_v3_m4(ar, sv_array[j].v_side[0]->co, sco_a, projectMat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
add_v3_v3v3(sco_a, v->co, sv_array[j].dir_side[0]);
|
|
|
|
|
ED_view3d_project_float_v3_m4(ar, sco_a, sco_a, projectMat);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* global direction */
|
|
|
|
|
dist_sq = dist_squared_to_line_segment_v2(mval, sco_b, sco_a);
|
|
|
|
|
if ((dist_best_sq == -1.0f) ||
|
|
|
|
|
/* intentionally use 2d size on 3d vector */
|
|
|
|
|
(dist_sq < dist_best_sq && (len_squared_v2v2(sco_b, sco_a) > 0.1f)))
|
|
|
|
|
{
|
|
|
|
|
dist_best_sq = dist_sq;
|
|
|
|
|
sub_v3_v3v3(mval_dir, sco_b, sco_a);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
if (use_calc_direction) {
|
|
|
|
|
/* per loop direction */
|
|
|
|
|
l_nr = sv_array[j].loop_nr;
|
|
|
|
|
if (loop_maxdist[l_nr] == -1.0f || dist_sq < loop_maxdist[l_nr]) {
|
|
|
|
|
loop_maxdist[l_nr] = dist_sq;
|
|
|
|
|
sub_v3_v3v3(loop_dir[l_nr], sco_b, sco_a);
|
|
|
|
|
}
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (use_calc_direction) {
|
|
|
|
|
int i;
|
|
|
|
|
sv_array = sld->sv;
|
|
|
|
|
for (i = 0; i < sld->totsv; i++, sv_array++) {
|
|
|
|
|
/* switch a/b if loop direction is different from global direction */
|
|
|
|
|
int l_nr = sv_array->loop_nr;
|
|
|
|
|
if (dot_v3v3(loop_dir[l_nr], mval_dir) < 0.0f) {
|
|
|
|
|
swap_v3_v3(sv_array->dir_side[0], sv_array->dir_side[1]);
|
|
|
|
|
SWAP(BMVert *, sv_array->v_side[0], sv_array->v_side[1]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
MEM_freeN(loop_dir);
|
|
|
|
|
MEM_freeN(loop_maxdist);
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* possible all of the edge loops are pointing directly at the view */
|
|
|
|
|
if (UNLIKELY(len_squared_v2(mval_dir) < 0.1f)) {
|
|
|
|
|
mval_dir[0] = 0.0f;
|
|
|
|
|
mval_dir[1] = 100.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* zero out start */
|
|
|
|
|
zero_v2(mval_start);
|
|
|
|
|
|
|
|
|
|
/* dir holds a vector along edge loop */
|
|
|
|
|
copy_v2_v2(mval_end, mval_dir);
|
|
|
|
|
mul_v2_fl(mval_end, 0.5f);
|
|
|
|
|
|
|
|
|
|
sld->mval_start[0] = t->mval[0] + mval_start[0];
|
|
|
|
|
sld->mval_start[1] = t->mval[1] + mval_start[1];
|
|
|
|
|
|
|
|
|
|
sld->mval_end[0] = t->mval[0] + mval_end[0];
|
|
|
|
|
sld->mval_end[1] = t->mval[1] + mval_end[1];
|
|
|
|
|
|
2016-07-31 12:02:33 +10:00
|
|
|
if (bmbvh) {
|
|
|
|
|
BKE_bmbvh_free(bmbvh);
|
2015-06-15 04:52:35 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-12 16:44:07 +02:00
|
|
|
static void calcEdgeSlide_even(
|
2018-04-16 16:27:55 +02:00
|
|
|
TransInfo *t, TransDataContainer *tc, EdgeSlideData *sld, const float mval[2])
|
2012-05-23 09:46:32 +00:00
|
|
|
{
|
2013-01-13 05:19:47 +00:00
|
|
|
TransDataEdgeSlideVert *sv = sld->sv;
|
2012-05-23 09:46:32 +00:00
|
|
|
|
|
|
|
|
if (sld->totsv > 0) {
|
2013-01-13 14:49:04 +00:00
|
|
|
ARegion *ar = t->ar;
|
|
|
|
|
RegionView3D *rv3d = NULL;
|
|
|
|
|
float projectMat[4][4];
|
|
|
|
|
|
2012-05-23 09:46:32 +00:00
|
|
|
int i = 0;
|
|
|
|
|
|
2013-01-13 14:49:04 +00:00
|
|
|
float v_proj[2];
|
2014-02-03 02:46:45 +11:00
|
|
|
float dist_sq = 0;
|
|
|
|
|
float dist_min_sq = FLT_MAX;
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2013-01-13 14:49:04 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
/* background mode support */
|
|
|
|
|
rv3d = t->ar ? t->ar->regiondata : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!rv3d) {
|
|
|
|
|
/* ok, let's try to survive this */
|
|
|
|
|
unit_m4(projectMat);
|
|
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, projectMat);
|
2013-01-13 14:49:04 +00:00
|
|
|
}
|
|
|
|
|
|
2012-05-23 09:46:32 +00:00
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
/* Set length */
|
2015-05-07 19:57:54 +10:00
|
|
|
sv->edge_len = len_v3v3(sv->dir_side[0], sv->dir_side[1]);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2013-01-13 14:49:04 +00:00
|
|
|
ED_view3d_project_float_v2_m4(ar, sv->v->co, v_proj, projectMat);
|
2014-02-03 02:46:45 +11:00
|
|
|
dist_sq = len_squared_v2v2(mval, v_proj);
|
|
|
|
|
if (dist_sq < dist_min_sq) {
|
|
|
|
|
dist_min_sq = dist_sq;
|
2013-01-13 14:49:04 +00:00
|
|
|
sld->curr_sv_index = i;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
2012-05-23 09:55:48 +00:00
|
|
|
sld->curr_sv_index = 0;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static bool createEdgeSlideVerts_double_side(TransInfo *t, TransDataContainer *tc)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2009-12-26 08:47:38 +00:00
|
|
|
BMesh *bm = em->bm;
|
2012-10-12 14:35:10 +00:00
|
|
|
BMIter iter;
|
2013-04-19 02:47:31 +00:00
|
|
|
BMEdge *e;
|
|
|
|
|
BMVert *v;
|
2013-01-13 05:19:47 +00:00
|
|
|
TransDataEdgeSlideVert *sv_array;
|
2013-01-29 08:19:23 +00:00
|
|
|
int sv_tot;
|
2013-07-11 04:24:36 +00:00
|
|
|
int *sv_table; /* BMVert -> sv_array index */
|
2013-01-13 05:19:47 +00:00
|
|
|
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
2015-06-15 04:52:35 +10:00
|
|
|
float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
|
2016-07-28 21:48:07 +10:00
|
|
|
int numsel, i, loop_nr;
|
2016-07-31 12:02:33 +10:00
|
|
|
bool use_occlude_geometry = false;
|
2012-05-31 19:06:52 +00:00
|
|
|
View3D *v3d = NULL;
|
|
|
|
|
RegionView3D *rv3d = NULL;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_flag(t, tc, &sld->orig_data);
|
2013-07-10 12:37:15 +00:00
|
|
|
|
2012-05-23 09:46:32 +00:00
|
|
|
sld->curr_sv_index = 0;
|
|
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
/*ensure valid selection*/
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
2012-10-12 14:35:10 +00:00
|
|
|
BMIter iter2;
|
2009-11-29 00:53:23 +00:00
|
|
|
numsel = 0;
|
2012-04-19 13:47:58 +00:00
|
|
|
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
2012-03-03 16:31:46 +00:00
|
|
|
/* BMESH_TODO: this is probably very evil,
|
|
|
|
|
* set v->e to a selected edge*/
|
2010-07-14 22:06:10 +00:00
|
|
|
v->e = e;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
|
numsel++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-20 01:47:08 +00:00
|
|
|
if (numsel == 0 || numsel > 2) {
|
2012-04-03 02:52:34 +00:00
|
|
|
MEM_freeN(sld);
|
2013-04-19 15:53:24 +00:00
|
|
|
return false; /* invalid edge selection */
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
2013-04-19 08:42:11 +00:00
|
|
|
/* note, any edge with loops can work, but we won't get predictable results, so bail out */
|
|
|
|
|
if (!BM_edge_is_manifold(e) && !BM_edge_is_boundary(e)) {
|
|
|
|
|
/* can edges with at least once face user */
|
2012-04-03 02:52:34 +00:00
|
|
|
MEM_freeN(sld);
|
2013-04-19 08:42:11 +00:00
|
|
|
return false;
|
2012-04-03 02:52:34 +00:00
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-11 04:24:36 +00:00
|
|
|
sv_table = MEM_mallocN(sizeof(*sv_table) * bm->totvert, __func__);
|
|
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
#define INDEX_UNSET -1
|
|
|
|
|
#define INDEX_INVALID -2
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
int j = 0;
|
|
|
|
|
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
|
|
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
|
|
|
|
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
|
|
|
|
sv_table[i] = INDEX_UNSET;
|
|
|
|
|
j += 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
|
|
|
|
sv_table[i] = INDEX_INVALID;
|
|
|
|
|
}
|
|
|
|
|
BM_elem_index_set(v, i); /* set_inline */
|
2011-11-01 12:51:38 +00:00
|
|
|
}
|
2016-07-28 21:48:07 +10:00
|
|
|
bm->elem_index_dirty &= ~BM_VERT;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
if (!j) {
|
|
|
|
|
MEM_freeN(sld);
|
|
|
|
|
MEM_freeN(sv_table);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
sv_tot = j;
|
2012-04-03 02:52:34 +00:00
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2013-01-29 08:19:23 +00:00
|
|
|
sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * sv_tot, "sv_array");
|
2012-08-31 12:08:04 +00:00
|
|
|
loop_nr = 0;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
STACK_DECLARE(sv_array);
|
|
|
|
|
STACK_INIT(sv_array, sv_tot);
|
|
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
while (1) {
|
2013-04-19 10:23:48 +00:00
|
|
|
float vec_a[3], vec_b[3];
|
2013-04-19 08:42:11 +00:00
|
|
|
BMLoop *l_a, *l_b;
|
2014-05-31 13:56:54 +10:00
|
|
|
BMLoop *l_a_prev, *l_b_prev;
|
2013-01-29 00:20:04 +00:00
|
|
|
BMVert *v_first;
|
2014-05-30 01:49:36 +10:00
|
|
|
/* If this succeeds call get_next_loop()
|
|
|
|
|
* which calculates the direction to slide based on clever checks.
|
|
|
|
|
*
|
|
|
|
|
* otherwise we simply use 'e_dir' as an edge-rail.
|
|
|
|
|
* (which is better when the attached edge is a boundary, see: T40422)
|
|
|
|
|
*/
|
|
|
|
|
#define EDGESLIDE_VERT_IS_INNER(v, e_dir) \
|
|
|
|
|
((BM_edge_is_boundary(e_dir) == false) && \
|
|
|
|
|
(BM_vert_edge_count_nonwire(v) == 2))
|
|
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
v = NULL;
|
2012-04-19 14:38:09 +00:00
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2012-02-12 10:51:45 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_TAG))
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!v)
|
|
|
|
|
break;
|
|
|
|
|
|
2010-07-14 22:06:10 +00:00
|
|
|
if (!v->e)
|
2009-12-26 08:47:38 +00:00
|
|
|
continue;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2013-01-29 00:20:04 +00:00
|
|
|
v_first = v;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
|
/*walk along the edge loop*/
|
2010-07-14 22:06:10 +00:00
|
|
|
e = v->e;
|
2009-11-29 00:53:23 +00:00
|
|
|
|
|
|
|
|
/*first, rewind*/
|
|
|
|
|
do {
|
2012-04-19 14:38:09 +00:00
|
|
|
e = get_other_edge(v, e);
|
2009-11-29 00:53:23 +00:00
|
|
|
if (!e) {
|
2010-07-14 22:06:10 +00:00
|
|
|
e = v->e;
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
if (!BM_elem_flag_test(BM_edge_other_vert(e, v), BM_ELEM_TAG))
|
2009-12-26 08:47:38 +00:00
|
|
|
break;
|
|
|
|
|
|
2012-02-12 10:51:45 +00:00
|
|
|
v = BM_edge_other_vert(e, v);
|
2013-01-29 00:20:04 +00:00
|
|
|
} while (e != v_first->e);
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
2010-03-10 11:16:26 +00:00
|
|
|
|
2013-04-19 02:22:23 +00:00
|
|
|
l_a = e->l;
|
|
|
|
|
l_b = e->l->radial_next;
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2013-04-19 10:04:23 +00:00
|
|
|
/* regarding e_next, use get_next_loop()'s improved interpolation where possible */
|
2013-04-19 08:42:11 +00:00
|
|
|
{
|
2013-04-19 10:04:23 +00:00
|
|
|
BMEdge *e_next = get_other_edge(v, e);
|
|
|
|
|
if (e_next) {
|
|
|
|
|
get_next_loop(v, l_a, e, e_next, vec_a);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
|
2014-05-30 01:49:36 +10:00
|
|
|
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
|
2013-04-19 10:04:23 +00:00
|
|
|
get_next_loop(v, l_a, e, l_tmp->e, vec_a);
|
2014-05-30 01:49:36 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-04-19 10:04:23 +00:00
|
|
|
sub_v3_v3v3(vec_a, BM_edge_other_vert(l_tmp->e, v)->co, v->co);
|
2014-05-30 01:49:36 +10:00
|
|
|
}
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
2013-04-19 08:42:11 +00:00
|
|
|
}
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2013-04-19 08:42:11 +00:00
|
|
|
/* !BM_edge_is_boundary(e); */
|
2013-04-19 02:22:23 +00:00
|
|
|
if (l_b != l_a) {
|
2013-04-19 10:04:23 +00:00
|
|
|
BMEdge *e_next = get_other_edge(v, e);
|
|
|
|
|
if (e_next) {
|
|
|
|
|
get_next_loop(v, l_b, e, e_next, vec_b);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
|
2014-05-30 01:49:36 +10:00
|
|
|
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
|
2013-04-19 10:04:23 +00:00
|
|
|
get_next_loop(v, l_b, e, l_tmp->e, vec_b);
|
2014-05-30 01:49:36 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2013-04-19 10:04:23 +00:00
|
|
|
sub_v3_v3v3(vec_b, BM_edge_other_vert(l_tmp->e, v)->co, v->co);
|
2014-05-30 01:49:36 +10:00
|
|
|
}
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-04-19 02:22:23 +00:00
|
|
|
l_b = NULL;
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2014-05-31 13:56:54 +10:00
|
|
|
l_a_prev = NULL;
|
|
|
|
|
l_b_prev = NULL;
|
|
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
#define SV_FROM_VERT(v) ( \
|
|
|
|
|
(sv_table[BM_elem_index_get(v)] == INDEX_UNSET) ? \
|
|
|
|
|
((void)(sv_table[BM_elem_index_get(v)] = STACK_SIZE(sv_array)), STACK_PUSH_RET_PTR(sv_array)) : \
|
|
|
|
|
(&sv_array[sv_table[BM_elem_index_get(v)]]))
|
|
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
/*iterate over the loop*/
|
2013-01-29 00:20:04 +00:00
|
|
|
v_first = v;
|
2009-11-29 00:53:23 +00:00
|
|
|
do {
|
2013-04-19 08:42:11 +00:00
|
|
|
bool l_a_ok_prev;
|
|
|
|
|
bool l_b_ok_prev;
|
2013-01-29 08:19:23 +00:00
|
|
|
TransDataEdgeSlideVert *sv;
|
2013-04-19 02:47:31 +00:00
|
|
|
BMVert *v_prev;
|
|
|
|
|
BMEdge *e_prev;
|
2013-01-29 00:20:04 +00:00
|
|
|
|
2013-01-29 08:19:23 +00:00
|
|
|
/* XXX, 'sv' will initialize multiple times, this is suspicious. see [#34024] */
|
2013-04-19 08:42:11 +00:00
|
|
|
BLI_assert(v != NULL);
|
2016-07-28 21:48:07 +10:00
|
|
|
BLI_assert(sv_table[BM_elem_index_get(v)] != INDEX_INVALID);
|
|
|
|
|
sv = SV_FROM_VERT(v);
|
2009-11-29 00:53:23 +00:00
|
|
|
sv->v = v;
|
2013-04-19 02:22:23 +00:00
|
|
|
copy_v3_v3(sv->v_co_orig, v->co);
|
2012-08-31 12:08:04 +00:00
|
|
|
sv->loop_nr = loop_nr;
|
|
|
|
|
|
2014-05-31 13:56:54 +10:00
|
|
|
if (l_a || l_a_prev) {
|
|
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_a ? l_a : l_a_prev, v);
|
2015-05-07 19:57:54 +10:00
|
|
|
sv->v_side[0] = BM_edge_other_vert(l_tmp->e, v);
|
|
|
|
|
copy_v3_v3(sv->dir_side[0], vec_a);
|
2013-04-19 02:36:52 +00:00
|
|
|
}
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2014-05-31 13:56:54 +10:00
|
|
|
if (l_b || l_b_prev) {
|
|
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_b ? l_b : l_b_prev, v);
|
2015-05-07 19:57:54 +10:00
|
|
|
sv->v_side[1] = BM_edge_other_vert(l_tmp->e, v);
|
|
|
|
|
copy_v3_v3(sv->dir_side[1], vec_b);
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
2013-04-19 02:47:31 +00:00
|
|
|
v_prev = v;
|
|
|
|
|
v = BM_edge_other_vert(e, v);
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2013-04-19 02:47:31 +00:00
|
|
|
e_prev = e;
|
2012-04-19 14:38:09 +00:00
|
|
|
e = get_other_edge(v, e);
|
2013-04-19 02:47:31 +00:00
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
if (!e) {
|
2013-04-19 08:42:11 +00:00
|
|
|
BLI_assert(v != NULL);
|
2016-07-28 21:48:07 +10:00
|
|
|
|
|
|
|
|
BLI_assert(sv_table[BM_elem_index_get(v)] != INDEX_INVALID);
|
|
|
|
|
sv = SV_FROM_VERT(v);
|
|
|
|
|
|
2009-12-26 08:47:38 +00:00
|
|
|
sv->v = v;
|
2013-04-19 02:22:23 +00:00
|
|
|
copy_v3_v3(sv->v_co_orig, v->co);
|
2012-08-31 12:08:04 +00:00
|
|
|
sv->loop_nr = loop_nr;
|
2013-04-19 02:36:52 +00:00
|
|
|
|
|
|
|
|
if (l_a) {
|
2013-04-19 08:42:11 +00:00
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_a, v);
|
2015-05-07 19:57:54 +10:00
|
|
|
sv->v_side[0] = BM_edge_other_vert(l_tmp->e, v);
|
2014-05-30 01:49:36 +10:00
|
|
|
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
|
2015-05-07 19:57:54 +10:00
|
|
|
get_next_loop(v, l_a, e_prev, l_tmp->e, sv->dir_side[0]);
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-06-13 02:06:38 +10:00
|
|
|
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
2013-04-19 02:36:52 +00:00
|
|
|
}
|
2013-04-19 02:22:23 +00:00
|
|
|
|
|
|
|
|
if (l_b) {
|
2013-04-19 08:42:11 +00:00
|
|
|
BMLoop *l_tmp = BM_loop_other_edge_loop(l_b, v);
|
2015-05-07 19:57:54 +10:00
|
|
|
sv->v_side[1] = BM_edge_other_vert(l_tmp->e, v);
|
2014-05-30 01:49:36 +10:00
|
|
|
if (EDGESLIDE_VERT_IS_INNER(v, l_tmp->e)) {
|
2015-05-07 19:57:54 +10:00
|
|
|
get_next_loop(v, l_b, e_prev, l_tmp->e, sv->dir_side[1]);
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-06-13 02:06:38 +10:00
|
|
|
sub_v3_v3v3(sv->dir_side[1], sv->v_side[1]->co, v->co);
|
2013-04-19 10:04:23 +00:00
|
|
|
}
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
2013-04-19 02:47:31 +00:00
|
|
|
BM_elem_flag_disable(v_prev, BM_ELEM_TAG);
|
2013-01-29 08:19:23 +00:00
|
|
|
|
2009-11-29 00:53:23 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2013-04-19 08:42:11 +00:00
|
|
|
l_a_ok_prev = (l_a != NULL);
|
|
|
|
|
l_b_ok_prev = (l_b != NULL);
|
2009-11-29 00:53:23 +00:00
|
|
|
|
2014-05-31 13:56:54 +10:00
|
|
|
l_a_prev = l_a;
|
|
|
|
|
l_b_prev = l_b;
|
|
|
|
|
|
|
|
|
|
if (l_a) {
|
|
|
|
|
l_a = get_next_loop(v, l_a, e_prev, e, vec_a);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
zero_v3(vec_a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (l_b) {
|
|
|
|
|
l_b = get_next_loop(v, l_b, e_prev, e, vec_b);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
zero_v3(vec_b);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (l_a && l_b) {
|
|
|
|
|
/* pass */
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (l_a || l_b) {
|
|
|
|
|
/* find the opposite loop if it was missing previously */
|
|
|
|
|
if (l_a == NULL && l_b && (l_b->radial_next != l_b)) l_a = l_b->radial_next;
|
|
|
|
|
else if (l_b == NULL && l_a && (l_a->radial_next != l_a)) l_b = l_a->radial_next;
|
2013-04-19 08:42:11 +00:00
|
|
|
}
|
2014-05-31 13:56:54 +10:00
|
|
|
else if (e->l != NULL) {
|
2019-01-15 23:24:20 +11:00
|
|
|
/* if there are non-contiguous faces, we can still recover
|
|
|
|
|
* the loops of the new edges faces */
|
|
|
|
|
|
2014-05-31 13:56:54 +10:00
|
|
|
/* note!, the behavior in this case means edges may move in opposite directions,
|
|
|
|
|
* this could be made to work more usefully. */
|
|
|
|
|
|
|
|
|
|
if (l_a_ok_prev) {
|
|
|
|
|
l_a = e->l;
|
|
|
|
|
l_b = (l_a->radial_next != l_a) ? l_a->radial_next : NULL;
|
|
|
|
|
}
|
|
|
|
|
else if (l_b_ok_prev) {
|
|
|
|
|
l_b = e->l;
|
|
|
|
|
l_a = (l_b->radial_next != l_b) ? l_b->radial_next : NULL;
|
2013-04-19 08:42:11 +00:00
|
|
|
}
|
|
|
|
|
}
|
2014-05-31 13:56:54 +10:00
|
|
|
|
|
|
|
|
if (!l_a_ok_prev && l_a) {
|
|
|
|
|
get_next_loop(v, l_a, e, e_prev, vec_a);
|
|
|
|
|
}
|
|
|
|
|
if (!l_b_ok_prev && l_b) {
|
|
|
|
|
get_next_loop(v, l_b, e, e_prev, vec_b);
|
|
|
|
|
}
|
2013-04-19 08:42:11 +00:00
|
|
|
}
|
|
|
|
|
|
2012-02-12 18:43:59 +00:00
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
2013-04-19 02:47:31 +00:00
|
|
|
BM_elem_flag_disable(v_prev, BM_ELEM_TAG);
|
2013-04-19 02:36:52 +00:00
|
|
|
} while ((e != v_first->e) && (l_a || l_b));
|
2012-08-31 12:08:04 +00:00
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
#undef SV_FROM_VERT
|
|
|
|
|
#undef INDEX_UNSET
|
|
|
|
|
#undef INDEX_INVALID
|
|
|
|
|
|
2012-08-31 12:08:04 +00:00
|
|
|
loop_nr++;
|
2014-05-30 01:49:36 +10:00
|
|
|
|
|
|
|
|
#undef EDGESLIDE_VERT_IS_INNER
|
2009-11-29 00:53:23 +00:00
|
|
|
}
|
|
|
|
|
|
2012-07-18 12:23:18 +00:00
|
|
|
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2016-07-28 21:48:07 +10:00
|
|
|
BLI_assert(STACK_SIZE(sv_array) == sv_tot);
|
|
|
|
|
|
2012-04-25 01:24:55 +00:00
|
|
|
sld->sv = sv_array;
|
2013-01-29 08:19:23 +00:00
|
|
|
sld->totsv = sv_tot;
|
2012-08-31 12:08:04 +00:00
|
|
|
|
2015-06-15 04:52:35 +10:00
|
|
|
/* use for visibility checks */
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
v3d = t->sa ? t->sa->spacedata.first : NULL;
|
|
|
|
|
rv3d = t->ar ? t->ar->regiondata : NULL;
|
2018-07-11 14:20:39 +02:00
|
|
|
use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && v3d->shading.type > OB_WIRE);
|
2010-07-22 22:17:20 +00:00
|
|
|
}
|
2012-03-11 19:58:56 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, true);
|
2013-04-19 10:23:48 +00:00
|
|
|
|
2015-06-15 04:52:35 +10:00
|
|
|
/* create copies of faces for customdata projection */
|
2013-04-14 06:22:34 +00:00
|
|
|
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_data(tc, &sld->orig_data);
|
2019-01-14 14:59:18 +11:00
|
|
|
slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
|
2013-07-11 04:24:36 +00:00
|
|
|
|
2015-06-15 04:52:35 +10:00
|
|
|
if (rv3d) {
|
2018-04-16 16:27:55 +02:00
|
|
|
calcEdgeSlide_even(t, tc, sld, mval);
|
2011-04-13 21:48:16 +00:00
|
|
|
}
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
sld->em = em;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
|
|
|
|
tc->custom.mode.data = sld;
|
|
|
|
|
|
2013-07-11 04:24:36 +00:00
|
|
|
MEM_freeN(sv_table);
|
2012-12-12 16:32:05 +00:00
|
|
|
|
2013-04-19 15:53:24 +00:00
|
|
|
return true;
|
2011-04-13 21:48:16 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
/**
|
2015-07-31 22:59:02 +10:00
|
|
|
* A simple version of #createEdgeSlideVerts_double_side
|
2015-06-15 10:58:07 +10:00
|
|
|
* Which assumes the longest unselected.
|
|
|
|
|
*/
|
2018-04-16 16:27:55 +02:00
|
|
|
static bool createEdgeSlideVerts_single_side(TransInfo *t, TransDataContainer *tc)
|
2015-06-15 10:58:07 +10:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2015-06-15 10:58:07 +10:00
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
BMIter iter;
|
|
|
|
|
BMEdge *e;
|
|
|
|
|
TransDataEdgeSlideVert *sv_array;
|
|
|
|
|
int sv_tot;
|
|
|
|
|
int *sv_table; /* BMVert -> sv_array index */
|
|
|
|
|
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
|
|
|
|
float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
|
2015-11-23 15:44:15 +11:00
|
|
|
int loop_nr;
|
2016-07-31 12:02:33 +10:00
|
|
|
bool use_occlude_geometry = false;
|
2015-06-15 10:58:07 +10:00
|
|
|
View3D *v3d = NULL;
|
|
|
|
|
RegionView3D *rv3d = NULL;
|
|
|
|
|
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
/* background mode support */
|
|
|
|
|
v3d = t->sa ? t->sa->spacedata.first : NULL;
|
|
|
|
|
rv3d = t->ar ? t->ar->regiondata : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_flag(t, tc, &sld->orig_data);
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
sld->curr_sv_index = 0;
|
|
|
|
|
/* ensure valid selection */
|
2015-11-23 15:44:15 +11:00
|
|
|
{
|
|
|
|
|
int i = 0, j = 0;
|
|
|
|
|
BMVert *v;
|
|
|
|
|
|
|
|
|
|
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
|
|
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
|
|
|
|
|
float len_sq_max = -1.0f;
|
|
|
|
|
BMIter iter2;
|
|
|
|
|
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) {
|
|
|
|
|
float len_sq = BM_edge_calc_length_squared(e);
|
|
|
|
|
if (len_sq > len_sq_max) {
|
|
|
|
|
len_sq_max = len_sq;
|
|
|
|
|
v->e = e;
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
if (len_sq_max != -1.0f) {
|
|
|
|
|
j++;
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
2015-11-23 15:44:15 +11:00
|
|
|
BM_elem_index_set(v, i); /* set_inline */
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
2015-11-23 15:44:15 +11:00
|
|
|
bm->elem_index_dirty &= ~BM_VERT;
|
2015-06-15 10:58:07 +10:00
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
if (!j) {
|
2016-07-29 09:50:55 +10:00
|
|
|
MEM_freeN(sld);
|
2015-11-23 15:44:15 +11:00
|
|
|
return false;
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
sv_tot = j;
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
BLI_assert(sv_tot != 0);
|
|
|
|
|
/* over alloc */
|
|
|
|
|
sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * bm->totvertsel, "sv_array");
|
|
|
|
|
|
|
|
|
|
/* same loop for all loops, weak but we dont connect loops in this case */
|
|
|
|
|
loop_nr = 1;
|
|
|
|
|
|
|
|
|
|
sv_table = MEM_mallocN(sizeof(*sv_table) * bm->totvert, __func__);
|
|
|
|
|
|
2015-11-23 15:44:15 +11:00
|
|
|
{
|
|
|
|
|
int i = 0, j = 0;
|
|
|
|
|
BMVert *v;
|
|
|
|
|
|
|
|
|
|
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
|
|
|
|
|
sv_table[i] = -1;
|
|
|
|
|
if ((v->e != NULL) && (BM_elem_flag_test(v, BM_ELEM_SELECT))) {
|
|
|
|
|
if (BM_elem_flag_test(v->e, BM_ELEM_SELECT) == 0) {
|
|
|
|
|
TransDataEdgeSlideVert *sv;
|
|
|
|
|
sv = &sv_array[j];
|
|
|
|
|
sv->v = v;
|
|
|
|
|
copy_v3_v3(sv->v_co_orig, v->co);
|
|
|
|
|
sv->v_side[0] = BM_edge_other_vert(v->e, v);
|
|
|
|
|
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
|
|
|
|
|
sv->loop_nr = 0;
|
|
|
|
|
sv_table[i] = j;
|
|
|
|
|
j += 1;
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check for wire vertices,
|
|
|
|
|
* interpolate the directions of wire verts between non-wire verts */
|
|
|
|
|
if (sv_tot != bm->totvert) {
|
|
|
|
|
const int sv_tot_nowire = sv_tot;
|
|
|
|
|
TransDataEdgeSlideVert *sv_iter = sv_array;
|
2015-11-23 15:44:15 +11:00
|
|
|
|
|
|
|
|
for (int i = 0; i < sv_tot_nowire; i++, sv_iter++) {
|
2015-06-15 10:58:07 +10:00
|
|
|
BMIter eiter;
|
|
|
|
|
BM_ITER_ELEM (e, &eiter, sv_iter->v, BM_EDGES_OF_VERT) {
|
|
|
|
|
/* walk over wire */
|
|
|
|
|
TransDataEdgeSlideVert *sv_end = NULL;
|
|
|
|
|
BMEdge *e_step = e;
|
|
|
|
|
BMVert *v = sv_iter->v;
|
2015-11-23 15:44:15 +11:00
|
|
|
int j;
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
j = sv_tot;
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
BMVert *v_other = BM_edge_other_vert(e_step, v);
|
|
|
|
|
int endpoint = (
|
|
|
|
|
(sv_table[BM_elem_index_get(v_other)] != -1) +
|
|
|
|
|
(BM_vert_is_edge_pair(v_other) == false));
|
|
|
|
|
|
|
|
|
|
if ((BM_elem_flag_test(e_step, BM_ELEM_SELECT) &&
|
|
|
|
|
BM_elem_flag_test(v_other, BM_ELEM_SELECT)) &&
|
|
|
|
|
(endpoint == 0))
|
|
|
|
|
{
|
|
|
|
|
/* scan down the list */
|
|
|
|
|
TransDataEdgeSlideVert *sv;
|
|
|
|
|
BLI_assert(sv_table[BM_elem_index_get(v_other)] == -1);
|
|
|
|
|
sv_table[BM_elem_index_get(v_other)] = j;
|
|
|
|
|
sv = &sv_array[j];
|
|
|
|
|
sv->v = v_other;
|
|
|
|
|
copy_v3_v3(sv->v_co_orig, v_other->co);
|
|
|
|
|
copy_v3_v3(sv->dir_side[0], sv_iter->dir_side[0]);
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
|
|
/* advance! */
|
|
|
|
|
v = v_other;
|
|
|
|
|
e_step = BM_DISK_EDGE_NEXT(e_step, v_other);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ((endpoint == 2) && (sv_tot != j)) {
|
|
|
|
|
BLI_assert(BM_elem_index_get(v_other) != -1);
|
|
|
|
|
sv_end = &sv_array[sv_table[BM_elem_index_get(v_other)]];
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sv_end) {
|
|
|
|
|
int sv_tot_prev = sv_tot;
|
|
|
|
|
const float *co_src = sv_iter->v->co;
|
|
|
|
|
const float *co_dst = sv_end->v->co;
|
|
|
|
|
const float *dir_src = sv_iter->dir_side[0];
|
|
|
|
|
const float *dir_dst = sv_end->dir_side[0];
|
|
|
|
|
sv_tot = j;
|
|
|
|
|
|
|
|
|
|
while (j-- != sv_tot_prev) {
|
|
|
|
|
float factor;
|
|
|
|
|
factor = line_point_factor_v3(sv_array[j].v->co, co_src, co_dst);
|
|
|
|
|
interp_v3_v3v3(sv_array[j].dir_side[0], dir_src, dir_dst, factor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* EDBM_flag_disable_all(em, BM_ELEM_SELECT); */
|
|
|
|
|
|
|
|
|
|
sld->sv = sv_array;
|
|
|
|
|
sld->totsv = sv_tot;
|
|
|
|
|
|
|
|
|
|
/* use for visibility checks */
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
v3d = t->sa ? t->sa->spacedata.first : NULL;
|
|
|
|
|
rv3d = t->ar ? t->ar->regiondata : NULL;
|
2018-07-11 14:20:39 +02:00
|
|
|
use_occlude_geometry = (v3d && TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->dt > OB_WIRE && v3d->shading.type > OB_WIRE);
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
calcEdgeSlide_mval_range(t, tc, sld, sv_table, loop_nr, mval, use_occlude_geometry, false);
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
/* create copies of faces for customdata projection */
|
|
|
|
|
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_data(tc, &sld->orig_data);
|
2019-01-14 14:59:18 +11:00
|
|
|
slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
if (rv3d) {
|
2018-04-16 16:27:55 +02:00
|
|
|
calcEdgeSlide_even(t, tc, sld, mval);
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sld->em = em;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
tc->custom.mode.data = sld;
|
2015-06-15 10:58:07 +10:00
|
|
|
|
|
|
|
|
MEM_freeN(sv_table);
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-13 05:19:47 +00:00
|
|
|
void projectEdgeSlideData(TransInfo *t, bool is_final)
|
2011-04-13 21:48:16 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
EdgeSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
SlideOrigData *sod = &sld->orig_data;
|
2012-04-17 14:24:04 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (sod->use_origfaces == false) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2012-04-17 14:24:04 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
slide_origdata_interp_data(tc->obedit, sod, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv, is_final);
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-13 05:19:47 +00:00
|
|
|
void freeEdgeSlideTempFaces(EdgeSlideData *sld)
|
2012-04-24 22:50:49 +00:00
|
|
|
{
|
2015-01-12 02:18:20 +11:00
|
|
|
slide_origdata_free_date(&sld->orig_data);
|
2012-02-27 16:45:48 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
void freeEdgeSlideVerts(TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), TransCustomData *custom_data)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2016-02-01 15:15:10 +11:00
|
|
|
EdgeSlideData *sld = custom_data->data;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
if (!sld)
|
|
|
|
|
return;
|
2015-01-12 02:18:20 +11:00
|
|
|
|
2013-01-13 05:19:47 +00:00
|
|
|
freeEdgeSlideTempFaces(sld);
|
2012-02-27 16:45:48 +00:00
|
|
|
|
2013-04-14 06:22:34 +00:00
|
|
|
bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2011-04-13 21:48:16 +00:00
|
|
|
MEM_freeN(sld->sv);
|
2009-10-22 23:22:05 +00:00
|
|
|
MEM_freeN(sld);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
custom_data->data = NULL;
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-15 01:46:28 +02:00
|
|
|
static void initEdgeSlide_ex(TransInfo *t, bool use_double_side, bool use_even, bool flipped, bool use_clamp)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2013-01-13 05:19:47 +00:00
|
|
|
EdgeSlideData *sld;
|
2018-04-16 16:27:55 +02:00
|
|
|
bool ok = false;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
|
t->mode = TFM_EDGE_SLIDE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyEdgeSlide;
|
2012-05-23 09:46:32 +00:00
|
|
|
t->handleEvent = handleEventEdgeSlide;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
{
|
|
|
|
|
EdgeSlideParams *slp = MEM_callocN(sizeof(*slp), __func__);
|
|
|
|
|
slp->use_even = use_even;
|
|
|
|
|
slp->flipped = flipped;
|
|
|
|
|
/* happens to be best for single-sided */
|
|
|
|
|
if (use_double_side == false) {
|
|
|
|
|
slp->flipped = !flipped;
|
|
|
|
|
}
|
|
|
|
|
slp->perc = 0.0f;
|
|
|
|
|
|
|
|
|
|
if (!use_clamp) {
|
|
|
|
|
t->flag |= T_ALT_TRANSFORM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t->custom.mode.data = slp;
|
|
|
|
|
t->custom.mode.use_free = true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
if (use_double_side) {
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
ok |= createEdgeSlideVerts_double_side(t, tc);
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
ok |= createEdgeSlideVerts_single_side(t, tc);
|
|
|
|
|
}
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!ok) {
|
2012-06-10 19:59:02 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
2010-11-20 18:46:36 +00:00
|
|
|
return;
|
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
sld = tc->custom.mode.data;
|
|
|
|
|
if (!sld) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
tc->custom.mode.free_cb = freeEdgeSlideVerts;
|
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-18 17:14:56 +00:00
|
|
|
/* set custom point first if you want value to be initialized by init */
|
2015-05-07 21:28:03 +10:00
|
|
|
calcEdgeSlideCustomPoints(t);
|
2013-01-31 22:18:37 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO_FLIP);
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
2011-06-07 09:35:20 +00:00
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
2015-06-15 10:58:07 +10:00
|
|
|
static void initEdgeSlide(TransInfo *t)
|
|
|
|
|
{
|
2015-10-15 01:46:28 +02:00
|
|
|
initEdgeSlide_ex(t, true, false, false, true);
|
2015-06-15 10:58:07 +10:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventEdgeSlide(struct TransInfo *t, const struct wmEvent *event)
|
2012-05-23 09:46:32 +00:00
|
|
|
{
|
2012-06-07 07:39:37 +00:00
|
|
|
if (t->mode == TFM_EDGE_SLIDE) {
|
2018-04-16 16:27:55 +02:00
|
|
|
EdgeSlideParams *slp = t->custom.mode.data;
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (slp) {
|
2012-05-23 09:46:32 +00:00
|
|
|
switch (event->type) {
|
|
|
|
|
case EKEY:
|
|
|
|
|
if (event->val == KM_PRESS) {
|
2018-04-16 16:27:55 +02:00
|
|
|
slp->use_even = !slp->use_even;
|
2015-05-07 21:28:03 +10:00
|
|
|
calcEdgeSlideCustomPoints(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_HARD;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2012-09-08 08:59:47 +00:00
|
|
|
case FKEY:
|
2012-05-23 09:46:32 +00:00
|
|
|
if (event->val == KM_PRESS) {
|
2018-04-16 16:27:55 +02:00
|
|
|
slp->flipped = !slp->flipped;
|
2015-05-07 21:28:03 +10:00
|
|
|
calcEdgeSlideCustomPoints(t);
|
|
|
|
|
return TREDRAW_HARD;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CKEY:
|
|
|
|
|
/* use like a modifier key */
|
|
|
|
|
if (event->val == KM_PRESS) {
|
|
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
|
|
|
|
calcEdgeSlideCustomPoints(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_HARD;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2012-09-08 08:59:47 +00:00
|
|
|
case EVT_MODAL_MAP:
|
2018-04-16 16:27:55 +02:00
|
|
|
#if 0
|
2012-05-23 09:46:32 +00:00
|
|
|
switch (event->val) {
|
2012-09-08 08:59:47 +00:00
|
|
|
case TFM_MODAL_EDGESLIDE_DOWN:
|
2012-05-23 09:55:48 +00:00
|
|
|
sld->curr_sv_index = ((sld->curr_sv_index - 1) + sld->totsv) % sld->totsv;
|
2015-05-08 10:29:59 +02:00
|
|
|
return TREDRAW_HARD;
|
2012-09-08 08:59:47 +00:00
|
|
|
case TFM_MODAL_EDGESLIDE_UP:
|
2012-05-23 09:55:48 +00:00
|
|
|
sld->curr_sv_index = (sld->curr_sv_index + 1) % sld->totsv;
|
2015-05-08 10:29:59 +02:00
|
|
|
return TREDRAW_HARD;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
#endif
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2015-05-07 21:28:03 +10:00
|
|
|
case MOUSEMOVE:
|
|
|
|
|
calcEdgeSlideCustomPoints(t);
|
|
|
|
|
break;
|
2012-05-23 09:46:32 +00:00
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_NOTHING;
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-07 20:10:05 +10:00
|
|
|
static void drawEdgeSlide(TransInfo *t)
|
2012-05-23 09:46:32 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->mode == TFM_EDGE_SLIDE) && TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data) {
|
2018-04-26 10:08:41 +02:00
|
|
|
const EdgeSlideParams *slp = t->custom.mode.data;
|
2018-04-16 16:27:55 +02:00
|
|
|
EdgeSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2015-05-07 21:28:03 +10:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
2015-05-07 20:10:05 +10:00
|
|
|
|
2015-10-12 16:44:07 +02:00
|
|
|
/* Even mode */
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((slp->use_even == true) || (is_clamp == false)) {
|
2012-05-23 09:46:32 +00:00
|
|
|
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
|
|
|
|
|
|
2018-07-03 19:22:00 +02:00
|
|
|
GPU_depth_test(false);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
|
|
|
|
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
|
|
|
|
GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (slp->use_even == true) {
|
2015-05-07 21:28:03 +10:00
|
|
|
float co_a[3], co_b[3], co_mark[3];
|
|
|
|
|
TransDataEdgeSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
|
2018-04-16 16:27:55 +02:00
|
|
|
const float fac = (slp->perc + 1.0f) / 2.0f;
|
2015-05-07 21:28:03 +10:00
|
|
|
const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
|
|
|
|
|
const float guide_size = ctrl_size - 0.5f;
|
|
|
|
|
const int alpha_shade = -30;
|
|
|
|
|
|
|
|
|
|
add_v3_v3v3(co_a, curr_sv->v_co_orig, curr_sv->dir_side[0]);
|
|
|
|
|
add_v3_v3v3(co_b, curr_sv->v_co_orig, curr_sv->dir_side[1]);
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(line_size);
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBeginAtMost(GPU_PRIM_LINES, 4);
|
2015-05-07 21:28:03 +10:00
|
|
|
if (curr_sv->v_side[0]) {
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex3fv(pos, curr_sv->v_side[0]->co);
|
|
|
|
|
immVertex3fv(pos, curr_sv->v_co_orig);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
|
|
|
|
if (curr_sv->v_side[1]) {
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex3fv(pos, curr_sv->v_side[1]->co);
|
|
|
|
|
immVertex3fv(pos, curr_sv->v_co_orig);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColorShadeAlpha(TH_SELECT, -30, alpha_shade);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(ctrl_size);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_POINTS, 1);
|
2018-04-16 16:27:55 +02:00
|
|
|
if (slp->flipped) {
|
2017-01-19 00:46:01 -05:00
|
|
|
if (curr_sv->v_side[1]) immVertex3fv(pos, curr_sv->v_side[1]->co);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2017-01-19 00:46:01 -05:00
|
|
|
if (curr_sv->v_side[0]) immVertex3fv(pos, curr_sv->v_side[0]->co);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColorShadeAlpha(TH_SELECT, 255, alpha_shade);
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(guide_size);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_POINTS, 1);
|
2015-05-07 21:28:03 +10:00
|
|
|
interp_line_v3_v3v3v3(co_mark, co_b, curr_sv->v_co_orig, co_a, fac);
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex3fv(pos, co_mark);
|
|
|
|
|
immEnd();
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2015-05-07 21:28:03 +10:00
|
|
|
if (is_clamp == false) {
|
|
|
|
|
const int side_index = sld->curr_side_unclamp;
|
|
|
|
|
TransDataEdgeSlideVert *sv;
|
|
|
|
|
int i;
|
|
|
|
|
const int alpha_shade = -160;
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(line_size);
|
2017-01-19 00:46:01 -05:00
|
|
|
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, sld->totsv * 2);
|
2015-05-07 21:28:03 +10:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/* TODO(campbell): Loop over all verts */
|
2015-05-07 21:28:03 +10:00
|
|
|
sv = sld->sv;
|
|
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
float a[3], b[3];
|
|
|
|
|
|
|
|
|
|
if (!is_zero_v3(sv->dir_side[side_index])) {
|
|
|
|
|
copy_v3_v3(a, sv->dir_side[side_index]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v3_v3(a, sv->dir_side[!side_index]);
|
|
|
|
|
}
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2015-05-07 21:28:03 +10:00
|
|
|
mul_v3_fl(a, 100.0f);
|
|
|
|
|
negate_v3_v3(b, a);
|
|
|
|
|
add_v3_v3(a, sv->v_co_orig);
|
|
|
|
|
add_v3_v3(b, sv->v_co_orig);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immVertex3fv(pos, a);
|
|
|
|
|
immVertex3fv(pos, b);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BLI_assert(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immUnbindProgram();
|
|
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(false);
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-07-03 19:22:00 +02:00
|
|
|
GPU_depth_test(true);
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
static void doEdgeSlide(TransInfo *t, float perc)
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
EdgeSlideParams *slp = t->custom.mode.data;
|
|
|
|
|
EdgeSlideData *sld_active = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2009-12-26 08:47:38 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
slp->perc = perc;
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (slp->use_even == false) {
|
2015-05-07 21:28:03 +10:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
|
|
|
|
if (is_clamp) {
|
|
|
|
|
const int side_index = (perc < 0.0f);
|
|
|
|
|
const float perc_final = fabsf(perc);
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
EdgeSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
TransDataEdgeSlideVert *sv = sld->sv;
|
|
|
|
|
for (int i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
madd_v3_v3v3fl(sv->v->co, sv->v_co_orig, sv->dir_side[side_index], perc_final);
|
|
|
|
|
}
|
|
|
|
|
sld->curr_side_unclamp = side_index;
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 16:27:55 +02:00
|
|
|
const float perc_init = fabsf(perc) * ((sld_active->curr_side_unclamp == (perc < 0.0f)) ? 1 : -1);
|
|
|
|
|
const int side_index = sld_active->curr_side_unclamp;
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
EdgeSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
TransDataEdgeSlideVert *sv = sld->sv;
|
|
|
|
|
for (int i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
float dir_flip[3];
|
|
|
|
|
float perc_final = perc_init;
|
|
|
|
|
if (!is_zero_v3(sv->dir_side[side_index])) {
|
|
|
|
|
copy_v3_v3(dir_flip, sv->dir_side[side_index]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
copy_v3_v3(dir_flip, sv->dir_side[!side_index]);
|
|
|
|
|
perc_final *= -1;
|
|
|
|
|
}
|
|
|
|
|
madd_v3_v3v3fl(sv->v->co, sv->v_co_orig, dir_flip, perc_final);
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2012-05-23 09:46:32 +00:00
|
|
|
}
|
2012-10-01 10:43:52 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/**
|
2015-10-12 16:44:07 +02:00
|
|
|
* Implementation note, even mode ignores the starting positions and uses only the
|
2013-04-19 02:22:23 +00:00
|
|
|
* a/b verts, this could be changed/improved so the distance is still met but the verts are moved along
|
2012-10-01 10:43:52 +00:00
|
|
|
* their original path (which may not be straight), however how it works now is OK and matches 2.4x - Campbell
|
2012-11-07 11:19:54 +00:00
|
|
|
*
|
2015-05-07 19:57:54 +10:00
|
|
|
* \note len_v3v3(curr_sv->dir_side[0], curr_sv->dir_side[1])
|
2012-11-07 11:19:54 +00:00
|
|
|
* is the same as the distance between the original vert locations, same goes for the lines below.
|
2012-10-01 10:43:52 +00:00
|
|
|
*/
|
2018-04-16 16:27:55 +02:00
|
|
|
TransDataEdgeSlideVert *curr_sv = &sld_active->sv[sld_active->curr_sv_index];
|
|
|
|
|
const float curr_length_perc = curr_sv->edge_len * (((slp->flipped ? perc : -perc) + 1.0f) / 2.0f);
|
2012-11-07 11:19:54 +00:00
|
|
|
|
2013-04-19 02:22:23 +00:00
|
|
|
float co_a[3];
|
|
|
|
|
float co_b[3];
|
2012-05-23 09:46:32 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
EdgeSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
TransDataEdgeSlideVert *sv = sld->sv;
|
|
|
|
|
for (int i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
if (sv->edge_len > FLT_EPSILON) {
|
|
|
|
|
const float fac = min_ff(sv->edge_len, curr_length_perc) / sv->edge_len;
|
2012-10-01 10:43:52 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
add_v3_v3v3(co_a, sv->v_co_orig, sv->dir_side[0]);
|
|
|
|
|
add_v3_v3v3(co_b, sv->v_co_orig, sv->dir_side[1]);
|
2012-11-07 11:19:54 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (slp->flipped) {
|
|
|
|
|
interp_line_v3_v3v3v3(sv->v->co, co_b, sv->v_co_orig, co_a, fac);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
interp_line_v3_v3v3v3(sv->v->co, co_a, sv->v_co_orig, co_b, fac);
|
|
|
|
|
}
|
2012-11-07 11:19:54 +00:00
|
|
|
}
|
2012-10-01 10:43:52 +00:00
|
|
|
}
|
2009-12-26 08:47:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyEdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
|
2009-10-22 23:22:05 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2015-05-07 21:28:03 +10:00
|
|
|
size_t ofs = 0;
|
2009-10-22 23:22:05 +00:00
|
|
|
float final;
|
2018-04-16 16:27:55 +02:00
|
|
|
EdgeSlideParams *slp = t->custom.mode.data;
|
|
|
|
|
bool flipped = slp->flipped;
|
|
|
|
|
bool use_even = slp->use_even;
|
2015-05-07 21:28:03 +10:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
|
|
|
|
const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num));
|
2009-10-22 23:22:05 +00:00
|
|
|
|
|
|
|
|
final = t->values[0];
|
|
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &final);
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-06-07 09:35:20 +00:00
|
|
|
/* only do this so out of range values are not displayed */
|
2015-05-07 21:28:03 +10:00
|
|
|
if (is_constrained) {
|
|
|
|
|
CLAMP(final, -1.0f, 1.0f);
|
|
|
|
|
}
|
2011-06-07 09:35:20 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = final;
|
|
|
|
|
|
2015-05-07 21:28:03 +10:00
|
|
|
/* header string */
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Edge Slide: "), sizeof(str) - ofs);
|
2009-10-22 23:22:05 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, &c[0], sizeof(str) - ofs);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%.4f ", final);
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("(E)ven: %s, "), WM_bool_as_string(use_even));
|
2015-10-12 16:44:07 +02:00
|
|
|
if (use_even) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("(F)lipped: %s, "), WM_bool_as_string(flipped));
|
2015-05-07 21:28:03 +10:00
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Alt or (C)lamp: %s"), WM_bool_as_string(is_clamp));
|
2015-05-07 21:28:03 +10:00
|
|
|
/* done with header string */
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2013-08-03 22:03:15 +00:00
|
|
|
/* do stuff here */
|
|
|
|
|
doEdgeSlide(t, final);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Vert Slide) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Vert Slide
|
|
|
|
|
* \{ */
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
static void calcVertSlideCustomPoints(struct TransInfo *t)
|
|
|
|
|
{
|
2018-04-26 10:08:41 +02:00
|
|
|
VertSlideParams *slp = t->custom.mode.data;
|
2018-04-16 16:27:55 +02:00
|
|
|
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2013-01-13 14:08:53 +00:00
|
|
|
TransDataVertSlideVert *sv = &sld->sv[sld->curr_sv_index];
|
2015-04-08 22:58:31 +10:00
|
|
|
|
|
|
|
|
const float *co_orig_3d = sv->co_orig_3d;
|
|
|
|
|
const float *co_curr_3d = sv->co_link_orig_3d[sv->co_link_curr];
|
|
|
|
|
|
|
|
|
|
float co_curr_2d[2], co_orig_2d[2];
|
|
|
|
|
|
|
|
|
|
int mval_ofs[2], mval_start[2], mval_end[2];
|
|
|
|
|
|
|
|
|
|
ED_view3d_project_float_v2_m4(t->ar, co_orig_3d, co_orig_2d, sld->proj_mat);
|
|
|
|
|
ED_view3d_project_float_v2_m4(t->ar, co_curr_3d, co_curr_2d, sld->proj_mat);
|
|
|
|
|
|
2015-10-28 22:56:09 +11:00
|
|
|
ARRAY_SET_ITEMS(mval_ofs, t->mouse.imval[0] - co_orig_2d[0], t->mouse.imval[1] - co_orig_2d[1]);
|
2015-04-08 22:58:31 +10:00
|
|
|
ARRAY_SET_ITEMS(mval_start, co_orig_2d[0] + mval_ofs[0], co_orig_2d[1] + mval_ofs[1]);
|
|
|
|
|
ARRAY_SET_ITEMS(mval_end, co_curr_2d[0] + mval_ofs[0], co_curr_2d[1] + mval_ofs[1]);
|
2013-01-15 03:35:31 +00:00
|
|
|
|
2018-04-26 10:08:41 +02:00
|
|
|
if (slp->flipped && slp->use_even) {
|
2013-04-19 02:22:23 +00:00
|
|
|
setCustomPoints(t, &t->mouse, mval_start, mval_end);
|
2013-01-31 22:18:37 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-04-19 02:22:23 +00:00
|
|
|
setCustomPoints(t, &t->mouse, mval_end, mval_start);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2015-04-08 22:58:31 +10:00
|
|
|
|
|
|
|
|
/* setCustomPoints isn't normally changing as the mouse moves,
|
2018-09-27 15:35:22 +02:00
|
|
|
* in this case apply mouse input immediately so we don't refresh
|
2015-04-08 22:58:31 +10:00
|
|
|
* with the value from the previous points */
|
|
|
|
|
applyMouseInput(t, &t->mouse, t->mval, t->values);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2013-01-16 02:23:34 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Run once when initializing vert slide to find the reference edge
|
|
|
|
|
*/
|
|
|
|
|
static void calcVertSlideMouseActiveVert(struct TransInfo *t, const int mval[2])
|
|
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
/* Active object may have no selected vertices. */
|
|
|
|
|
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2013-01-16 02:23:34 +00:00
|
|
|
float mval_fl[2] = {UNPACK2(mval)};
|
|
|
|
|
TransDataVertSlideVert *sv;
|
|
|
|
|
|
|
|
|
|
/* set the vertex to use as a reference for the mouse direction 'curr_sv_index' */
|
2014-02-03 02:46:45 +11:00
|
|
|
float dist_sq = 0.0f;
|
|
|
|
|
float dist_min_sq = FLT_MAX;
|
2013-01-16 02:23:34 +00:00
|
|
|
int i;
|
|
|
|
|
|
2013-01-17 06:21:20 +00:00
|
|
|
for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
|
2015-04-08 22:58:31 +10:00
|
|
|
float co_2d[2];
|
|
|
|
|
|
|
|
|
|
ED_view3d_project_float_v2_m4(t->ar, sv->co_orig_3d, co_2d, sld->proj_mat);
|
|
|
|
|
|
|
|
|
|
dist_sq = len_squared_v2v2(mval_fl, co_2d);
|
2014-02-03 02:46:45 +11:00
|
|
|
if (dist_sq < dist_min_sq) {
|
|
|
|
|
dist_min_sq = dist_sq;
|
2013-01-16 02:23:34 +00:00
|
|
|
sld->curr_sv_index = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-08 22:58:31 +10:00
|
|
|
|
2013-01-16 02:23:34 +00:00
|
|
|
/**
|
|
|
|
|
* Run while moving the mouse to slide along the edge matching the mouse direction
|
|
|
|
|
*/
|
|
|
|
|
static void calcVertSlideMouseActiveEdges(struct TransInfo *t, const int mval[2])
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2015-10-28 22:56:09 +11:00
|
|
|
float imval_fl[2] = {UNPACK2(t->mouse.imval)};
|
2015-04-08 22:58:31 +10:00
|
|
|
float mval_fl[2] = {UNPACK2(mval)};
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2015-04-08 22:58:31 +10:00
|
|
|
float dir[3];
|
2013-01-13 14:08:53 +00:00
|
|
|
TransDataVertSlideVert *sv;
|
|
|
|
|
int i;
|
|
|
|
|
|
2015-07-03 10:49:57 +10:00
|
|
|
/* note: we could save a matrix-multiply for each vertex
|
|
|
|
|
* by finding the closest edge in local-space.
|
|
|
|
|
* However this skews the outcome with non-uniform-scale. */
|
|
|
|
|
|
2015-04-08 22:58:31 +10:00
|
|
|
/* first get the direction of the original mouse position */
|
|
|
|
|
sub_v2_v2v2(dir, imval_fl, mval_fl);
|
|
|
|
|
ED_view3d_win_to_delta(t->ar, dir, dir, t->zfac);
|
|
|
|
|
normalize_v3(dir);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2013-01-17 06:21:20 +00:00
|
|
|
for (i = 0, sv = sld->sv; i < sld->totsv; i++, sv++) {
|
2013-01-13 14:08:53 +00:00
|
|
|
if (sv->co_link_tot > 1) {
|
|
|
|
|
float dir_dot_best = -FLT_MAX;
|
|
|
|
|
int co_link_curr_best = -1;
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < sv->co_link_tot; j++) {
|
2015-04-08 22:58:31 +10:00
|
|
|
float tdir[3];
|
2013-01-13 14:08:53 +00:00
|
|
|
float dir_dot;
|
2015-04-08 22:58:31 +10:00
|
|
|
|
|
|
|
|
sub_v3_v3v3(tdir, sv->co_orig_3d, sv->co_link_orig_3d[j]);
|
2018-04-16 16:27:55 +02:00
|
|
|
mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, tdir);
|
2015-04-08 22:58:31 +10:00
|
|
|
project_plane_v3_v3v3(tdir, tdir, t->viewinv[2]);
|
|
|
|
|
|
|
|
|
|
normalize_v3(tdir);
|
|
|
|
|
dir_dot = dot_v3v3(dir, tdir);
|
2013-01-13 14:08:53 +00:00
|
|
|
if (dir_dot > dir_dot_best) {
|
|
|
|
|
dir_dot_best = dir_dot;
|
|
|
|
|
co_link_curr_best = j;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (co_link_curr_best != -1) {
|
|
|
|
|
sv->co_link_curr = co_link_curr_best;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static bool createVertSlideVerts(TransInfo *t, TransDataContainer *tc)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(tc->obedit);
|
2013-01-13 14:08:53 +00:00
|
|
|
BMesh *bm = em->bm;
|
|
|
|
|
BMIter iter;
|
|
|
|
|
BMIter eiter;
|
|
|
|
|
BMEdge *e;
|
|
|
|
|
BMVert *v;
|
|
|
|
|
TransDataVertSlideVert *sv_array;
|
|
|
|
|
VertSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
|
|
|
|
|
int j;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_flag(t, tc, &sld->orig_data);
|
2015-01-12 02:18:20 +11:00
|
|
|
|
2013-01-13 14:08:53 +00:00
|
|
|
sld->curr_sv_index = 0;
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
|
|
|
|
bool ok = false;
|
|
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_SELECT) && v->e) {
|
|
|
|
|
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
|
|
|
|
|
ok = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (ok) {
|
|
|
|
|
BM_elem_flag_enable(v, BM_ELEM_TAG);
|
|
|
|
|
j += 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
BM_elem_flag_disable(v, BM_ELEM_TAG);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!j) {
|
|
|
|
|
MEM_freeN(sld);
|
2013-04-19 15:53:24 +00:00
|
|
|
return false;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sv_array = MEM_callocN(sizeof(TransDataVertSlideVert) * j, "sv_array");
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
|
2013-01-21 03:00:10 +00:00
|
|
|
if (BM_elem_flag_test(v, BM_ELEM_TAG)) {
|
2013-01-13 14:08:53 +00:00
|
|
|
int k;
|
|
|
|
|
sv_array[j].v = v;
|
|
|
|
|
copy_v3_v3(sv_array[j].co_orig_3d, v->co);
|
|
|
|
|
|
|
|
|
|
k = 0;
|
|
|
|
|
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
|
|
|
|
|
k++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sv_array[j].co_link_orig_3d = MEM_mallocN(sizeof(*sv_array[j].co_link_orig_3d) * k, __func__);
|
|
|
|
|
sv_array[j].co_link_tot = k;
|
|
|
|
|
|
|
|
|
|
k = 0;
|
|
|
|
|
BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
|
|
|
|
|
if (!BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
|
|
|
|
|
BMVert *v_other = BM_edge_other_vert(e, v);
|
|
|
|
|
copy_v3_v3(sv_array[j].co_link_orig_3d[k], v_other->co);
|
|
|
|
|
k++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sld->sv = sv_array;
|
|
|
|
|
sld->totsv = j;
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
bmesh_edit_begin(bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
|
2018-04-16 16:27:55 +02:00
|
|
|
slide_origdata_init_data(tc, &sld->orig_data);
|
2019-01-14 14:59:18 +11:00
|
|
|
slide_origdata_create_data(tc, &sld->orig_data, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv);
|
2015-01-12 02:18:20 +11:00
|
|
|
|
2013-01-13 14:08:53 +00:00
|
|
|
sld->em = em;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
tc->custom.mode.data = sld;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2015-04-08 22:58:31 +10:00
|
|
|
/* most likely will be set below */
|
|
|
|
|
unit_m4(sld->proj_mat);
|
|
|
|
|
|
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
/* view vars */
|
|
|
|
|
RegionView3D *rv3d = NULL;
|
|
|
|
|
ARegion *ar = t->ar;
|
|
|
|
|
|
|
|
|
|
rv3d = ar ? ar->regiondata : NULL;
|
|
|
|
|
if (rv3d) {
|
2018-04-16 16:27:55 +02:00
|
|
|
ED_view3d_ob_project_mat_get(rv3d, tc->obedit, sld->proj_mat);
|
2015-04-08 22:58:31 +10:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2015-04-08 22:58:31 +10:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
/* XXX, calc vert slide across all objects */
|
|
|
|
|
if (tc == t->data_container) {
|
2013-01-16 02:23:34 +00:00
|
|
|
calcVertSlideMouseActiveVert(t, t->mval);
|
|
|
|
|
calcVertSlideMouseActiveEdges(t, t->mval);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2013-04-19 15:53:24 +00:00
|
|
|
return true;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
void projectVertSlideData(TransInfo *t, bool is_final)
|
|
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
VertSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
SlideOrigData *sod = &sld->orig_data;
|
|
|
|
|
if (sod->use_origfaces == true) {
|
|
|
|
|
slide_origdata_interp_data(tc->obedit, sod, (TransDataGenericSlideVert *)sld->sv, sizeof(*sld->sv), sld->totsv, is_final);
|
|
|
|
|
}
|
2015-01-12 02:18:20 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void freeVertSlideTempFaces(VertSlideData *sld)
|
|
|
|
|
{
|
|
|
|
|
slide_origdata_free_date(&sld->orig_data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
void freeVertSlideVerts(TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), TransCustomData *custom_data)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2016-02-01 15:15:10 +11:00
|
|
|
VertSlideData *sld = custom_data->data;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
if (!sld)
|
|
|
|
|
return;
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
freeVertSlideTempFaces(sld);
|
|
|
|
|
|
|
|
|
|
bmesh_edit_end(sld->em->bm, BMO_OPTYPE_FLAG_UNTAN_MULTIRES);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
if (sld->totsv > 0) {
|
|
|
|
|
TransDataVertSlideVert *sv = sld->sv;
|
|
|
|
|
int i = 0;
|
|
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
MEM_freeN(sv->co_link_orig_3d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MEM_freeN(sld->sv);
|
|
|
|
|
MEM_freeN(sld);
|
|
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
custom_data->data = NULL;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-15 01:46:28 +02:00
|
|
|
static void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
t->mode = TFM_VERT_SLIDE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyVertSlide;
|
2013-01-13 14:08:53 +00:00
|
|
|
t->handleEvent = handleEventVertSlide;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
{
|
|
|
|
|
VertSlideParams *slp = MEM_callocN(sizeof(*slp), __func__);
|
|
|
|
|
slp->use_even = use_even;
|
|
|
|
|
slp->flipped = flipped;
|
|
|
|
|
slp->perc = 0.0f;
|
|
|
|
|
|
|
|
|
|
if (!use_clamp) {
|
|
|
|
|
t->flag |= T_ALT_TRANSFORM;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t->custom.mode.data = slp;
|
|
|
|
|
t->custom.mode.use_free = true;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
bool ok = false;
|
|
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
|
|
|
|
ok |= createVertSlideVerts(t, tc);
|
|
|
|
|
VertSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
if (sld) {
|
|
|
|
|
tc->custom.mode.free_cb = freeVertSlideVerts;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (ok == false) {
|
|
|
|
|
t->state = TRANS_CANCEL;
|
2013-01-13 14:08:53 +00:00
|
|
|
return;
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
/* set custom point first if you want value to be initialized by init */
|
|
|
|
|
calcVertSlideCustomPoints(t);
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
|
|
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 0.1f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
|
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-12 16:44:07 +02:00
|
|
|
static void initVertSlide(TransInfo *t)
|
|
|
|
|
{
|
2015-10-15 01:46:28 +02:00
|
|
|
initVertSlide_ex(t, false, false, true);
|
2015-10-12 16:44:07 +02:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
static eRedrawFlag handleEventVertSlide(struct TransInfo *t, const struct wmEvent *event)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
|
|
|
|
if (t->mode == TFM_VERT_SLIDE) {
|
2018-04-16 16:27:55 +02:00
|
|
|
VertSlideParams *slp = t->custom.mode.data;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
if (slp) {
|
2013-01-13 14:08:53 +00:00
|
|
|
switch (event->type) {
|
|
|
|
|
case EKEY:
|
|
|
|
|
if (event->val == KM_PRESS) {
|
2018-04-16 16:27:55 +02:00
|
|
|
slp->use_even = !slp->use_even;
|
|
|
|
|
if (slp->flipped) {
|
2013-01-31 22:18:37 +00:00
|
|
|
calcVertSlideCustomPoints(t);
|
|
|
|
|
}
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_HARD;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case FKEY:
|
|
|
|
|
if (event->val == KM_PRESS) {
|
2018-04-16 16:27:55 +02:00
|
|
|
slp->flipped = !slp->flipped;
|
2013-01-31 22:18:37 +00:00
|
|
|
calcVertSlideCustomPoints(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_HARD;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2013-02-11 01:55:58 +00:00
|
|
|
case CKEY:
|
|
|
|
|
/* use like a modifier key */
|
|
|
|
|
if (event->val == KM_PRESS) {
|
2013-02-17 05:39:55 +00:00
|
|
|
t->flag ^= T_ALT_TRANSFORM;
|
2013-02-11 01:55:58 +00:00
|
|
|
calcVertSlideCustomPoints(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_HARD;
|
2013-02-11 01:55:58 +00:00
|
|
|
}
|
|
|
|
|
break;
|
2013-01-13 14:08:53 +00:00
|
|
|
#if 0
|
|
|
|
|
case EVT_MODAL_MAP:
|
|
|
|
|
switch (event->val) {
|
|
|
|
|
case TFM_MODAL_EDGESLIDE_DOWN:
|
|
|
|
|
sld->curr_sv_index = ((sld->curr_sv_index - 1) + sld->totsv) % sld->totsv;
|
|
|
|
|
break;
|
|
|
|
|
case TFM_MODAL_EDGESLIDE_UP:
|
|
|
|
|
sld->curr_sv_index = (sld->curr_sv_index + 1) % sld->totsv;
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-05-08 10:38:53 +02:00
|
|
|
break;
|
2013-01-13 14:08:53 +00:00
|
|
|
#endif
|
|
|
|
|
case MOUSEMOVE:
|
|
|
|
|
{
|
2015-02-26 14:11:39 -05:00
|
|
|
/* don't recalculate the best edge */
|
2013-02-17 05:39:55 +00:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
|
|
|
|
if (is_clamp) {
|
2013-01-16 02:23:34 +00:00
|
|
|
calcVertSlideMouseActiveEdges(t, event->mval);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
calcVertSlideCustomPoints(t);
|
2013-07-21 08:16:37 +00:00
|
|
|
break;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-10-23 06:48:36 +00:00
|
|
|
return TREDRAW_NOTHING;
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
|
2015-05-07 20:10:05 +10:00
|
|
|
static void drawVertSlide(TransInfo *t)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->mode == TFM_VERT_SLIDE) && TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data) {
|
2018-04-26 10:08:41 +02:00
|
|
|
const VertSlideParams *slp = t->custom.mode.data;
|
2018-04-16 16:27:55 +02:00
|
|
|
VertSlideData *sld = TRANS_DATA_CONTAINER_FIRST_OK(t)->custom.mode.data;
|
2015-05-07 21:28:03 +10:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
2015-05-07 20:10:05 +10:00
|
|
|
|
2013-01-13 14:08:53 +00:00
|
|
|
/* Non-Prop mode */
|
2015-05-07 20:10:05 +10:00
|
|
|
{
|
2013-01-13 14:08:53 +00:00
|
|
|
TransDataVertSlideVert *curr_sv = &sld->sv[sld->curr_sv_index];
|
|
|
|
|
TransDataVertSlideVert *sv;
|
|
|
|
|
const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f;
|
|
|
|
|
const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f;
|
2013-04-22 15:13:47 +00:00
|
|
|
const int alpha_shade = -160;
|
2013-01-13 14:08:53 +00:00
|
|
|
int i;
|
|
|
|
|
|
2018-07-03 19:22:00 +02:00
|
|
|
GPU_depth_test(false);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_blend(true);
|
|
|
|
|
GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
|
|
|
|
GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(line_size);
|
2017-01-19 00:46:01 -05:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2017-01-19 00:46:01 -05:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
|
|
|
|
immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade);
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, sld->totsv * 2);
|
2013-02-17 05:39:55 +00:00
|
|
|
if (is_clamp) {
|
2013-01-18 23:20:17 +00:00
|
|
|
sv = sld->sv;
|
|
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immVertex3fv(shdr_pos, sv->co_orig_3d);
|
|
|
|
|
immVertex3fv(shdr_pos, sv->co_link_orig_3d[sv->co_link_curr]);
|
2013-01-18 23:20:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sv = sld->sv;
|
|
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
float a[3], b[3];
|
|
|
|
|
sub_v3_v3v3(a, sv->co_link_orig_3d[sv->co_link_curr], sv->co_orig_3d);
|
|
|
|
|
mul_v3_fl(a, 100.0f);
|
|
|
|
|
negate_v3_v3(b, a);
|
|
|
|
|
add_v3_v3(a, sv->co_orig_3d);
|
|
|
|
|
add_v3_v3(b, sv->co_orig_3d);
|
|
|
|
|
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immVertex3fv(shdr_pos, a);
|
|
|
|
|
immVertex3fv(shdr_pos, b);
|
2013-01-18 23:20:17 +00:00
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_point_size(ctrl_size);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_POINTS, 1);
|
2018-04-26 10:08:41 +02:00
|
|
|
immVertex3fv(shdr_pos, (slp->flipped && slp->use_even) ?
|
2016-01-04 03:30:18 -05:00
|
|
|
curr_sv->co_link_orig_3d[curr_sv->co_link_curr] :
|
|
|
|
|
curr_sv->co_orig_3d);
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2017-04-27 15:27:00 +02:00
|
|
|
immUnbindProgram();
|
2015-04-08 22:58:31 +10:00
|
|
|
|
|
|
|
|
/* direction from active vertex! */
|
2015-10-28 22:56:09 +11:00
|
|
|
if ((t->mval[0] != t->mouse.imval[0]) ||
|
|
|
|
|
(t->mval[1] != t->mouse.imval[1]))
|
2015-04-08 22:58:31 +10:00
|
|
|
{
|
2015-07-05 22:33:44 +10:00
|
|
|
float zfac;
|
2015-04-08 22:58:31 +10:00
|
|
|
float mval_ofs[2];
|
2015-07-05 22:33:44 +10:00
|
|
|
float co_orig_3d[3];
|
2015-04-08 22:58:31 +10:00
|
|
|
float co_dest_3d[3];
|
|
|
|
|
|
2015-10-28 22:56:09 +11:00
|
|
|
mval_ofs[0] = t->mval[0] - t->mouse.imval[0];
|
|
|
|
|
mval_ofs[1] = t->mval[1] - t->mouse.imval[1];
|
2015-04-08 22:58:31 +10:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
mul_v3_m4v3(co_orig_3d, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat, curr_sv->co_orig_3d);
|
2015-07-05 22:33:44 +10:00
|
|
|
zfac = ED_view3d_calc_zfac(t->ar->regiondata, co_orig_3d, NULL);
|
|
|
|
|
|
2015-04-08 22:58:31 +10:00
|
|
|
ED_view3d_win_to_delta(t->ar, mval_ofs, co_dest_3d, zfac);
|
2015-06-01 11:25:55 +10:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
invert_m4_m4(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat, TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat);
|
|
|
|
|
mul_mat3_m4_v3(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->imat, co_dest_3d);
|
2015-06-01 11:25:55 +10:00
|
|
|
|
2015-04-08 22:58:31 +10:00
|
|
|
add_v3_v3(co_dest_3d, curr_sv->co_orig_3d);
|
|
|
|
|
|
2018-06-27 19:07:23 -06:00
|
|
|
GPU_line_width(1.0f);
|
2015-04-08 22:58:31 +10:00
|
|
|
|
2017-07-13 16:44:02 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
2017-04-27 15:27:00 +02:00
|
|
|
|
|
|
|
|
float viewport_size[4];
|
2018-07-02 18:27:05 +02:00
|
|
|
GPU_viewport_size_get_f(viewport_size);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
|
|
|
|
|
2018-07-01 08:42:16 +02:00
|
|
|
immUniform1i("colors_len", 0); /* "simple" mode */
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform1f("dash_width", 6.0f);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniform1f("dash_factor", 0.5f);
|
2015-04-08 22:58:31 +10:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immVertex3fv(shdr_pos, curr_sv->co_orig_3d);
|
|
|
|
|
immVertex3fv(shdr_pos, co_dest_3d);
|
2017-01-19 00:46:01 -05:00
|
|
|
immEnd();
|
2017-04-27 15:27:00 +02:00
|
|
|
|
|
|
|
|
immUnbindProgram();
|
2015-04-08 22:58:31 +10:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-07-03 19:22:00 +02:00
|
|
|
GPU_depth_test(true);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-12 02:18:20 +11:00
|
|
|
static void doVertSlide(TransInfo *t, float perc)
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2018-04-26 10:08:41 +02:00
|
|
|
VertSlideParams *slp = t->custom.mode.data;
|
|
|
|
|
|
|
|
|
|
slp->perc = perc;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
VertSlideData *sld = tc->custom.mode.data;
|
|
|
|
|
TransDataVertSlideVert *svlist = sld->sv, *sv;
|
|
|
|
|
int i;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
sv = svlist;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-26 10:08:41 +02:00
|
|
|
if (slp->use_even == false) {
|
2018-04-16 17:54:33 +02:00
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
interp_v3_v3v3(sv->v->co, sv->co_orig_3d, sv->co_link_orig_3d[sv->co_link_curr], perc);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2018-04-16 17:54:33 +02:00
|
|
|
else {
|
|
|
|
|
TransDataVertSlideVert *sv_curr = &sld->sv[sld->curr_sv_index];
|
|
|
|
|
const float edge_len_curr = len_v3v3(sv_curr->co_orig_3d, sv_curr->co_link_orig_3d[sv_curr->co_link_curr]);
|
|
|
|
|
const float tperc = perc * edge_len_curr;
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
for (i = 0; i < sld->totsv; i++, sv++) {
|
|
|
|
|
float edge_len;
|
|
|
|
|
float dir[3];
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
sub_v3_v3v3(dir, sv->co_link_orig_3d[sv->co_link_curr], sv->co_orig_3d);
|
|
|
|
|
edge_len = normalize_v3(dir);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (edge_len > FLT_EPSILON) {
|
2018-04-26 10:08:41 +02:00
|
|
|
if (slp->flipped) {
|
2018-04-16 17:54:33 +02:00
|
|
|
madd_v3_v3v3fl(sv->v->co, sv->co_link_orig_3d[sv->co_link_curr], dir, -tperc);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
madd_v3_v3v3fl(sv->v->co, sv->co_orig_3d, dir, tperc);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2018-04-16 17:54:33 +02:00
|
|
|
copy_v3_v3(sv->v->co, sv->co_orig_3d);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
static void applyVertSlide(TransInfo *t, const int UNUSED(mval[2]))
|
2013-01-13 14:08:53 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2013-01-13 14:08:53 +00:00
|
|
|
float final;
|
2018-04-26 10:08:41 +02:00
|
|
|
VertSlideParams *slp = t->custom.mode.data;
|
2018-04-16 16:27:55 +02:00
|
|
|
const bool flipped = slp->flipped;
|
|
|
|
|
const bool use_even = slp->use_even;
|
2013-02-17 05:39:55 +00:00
|
|
|
const bool is_clamp = !(t->flag & T_ALT_TRANSFORM);
|
|
|
|
|
const bool is_constrained = !(is_clamp == false || hasNumInput(&t->num));
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
final = t->values[0];
|
|
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &final);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
/* only do this so out of range values are not displayed */
|
2013-01-19 06:12:25 +00:00
|
|
|
if (is_constrained) {
|
2013-01-18 23:20:17 +00:00
|
|
|
CLAMP(final, 0.0f, 1.0f);
|
|
|
|
|
}
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = final;
|
|
|
|
|
|
2013-02-11 01:55:58 +00:00
|
|
|
/* header string */
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, IFACE_("Vert Slide: "), sizeof(str) - ofs);
|
2013-01-13 14:08:53 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
|
|
|
|
char c[NUM_STR_REP_LEN];
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_strncpy_rlen(str + ofs, &c[0], sizeof(str) - ofs);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%.4f ", final);
|
2013-02-11 01:55:58 +00:00
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("(E)ven: %s, "), WM_bool_as_string(use_even));
|
2015-10-12 16:44:07 +02:00
|
|
|
if (use_even) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("(F)lipped: %s, "), WM_bool_as_string(flipped));
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, IFACE_("Alt or (C)lamp: %s"), WM_bool_as_string(is_clamp));
|
2013-02-11 01:55:58 +00:00
|
|
|
/* done with header string */
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2013-08-03 22:03:15 +00:00
|
|
|
/* do stuff here */
|
|
|
|
|
doVertSlide(t, final);
|
2013-01-13 14:08:53 +00:00
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2013-01-13 14:08:53 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (EditBone Roll) */
|
2013-01-13 14:08:53 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \name Transform EditBone Roll
|
|
|
|
|
* \{ */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
static void initBoneRoll(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->mode = TFM_BONE_ROLL;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyBoneRoll;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_ANGLE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
2013-10-12 22:31:02 +00:00
|
|
|
t->snap[1] = DEG2RAD(5.0);
|
|
|
|
|
t->snap[2] = DEG2RAD(1.0);
|
2009-07-12 02:01:13 +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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_use_radians = (t->scene->unit.system_rotation == USER_UNIT_ROT_RADIANS);
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_ROTATION;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyBoneRoll(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
float final;
|
|
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
final = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &final);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-03-22 23:20:14 +01:00
|
|
|
applyNumInput(&t->num, &final);
|
|
|
|
|
|
2015-06-16 21:15:01 +02:00
|
|
|
t->values[0] = final;
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Roll: %s"), &c[0]);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Roll: %.2f"), RAD2DEGF(final));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* set roll values */
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
*(td->val) = td->ival - final;
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Bake-Time) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Bake-Time
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initBakeTime(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyBakeTime;
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.idx_max = 0;
|
|
|
|
|
t->snap[0] = 0.0f;
|
|
|
|
|
t->snap[1] = 1.0f;
|
|
|
|
|
t->snap[2] = t->snap[1] * 0.1f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE; /* Don't think this uses units? */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
static void applyBakeTime(TransInfo *t, const int mval[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float time;
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
float fac = 0.1f;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-11-07 17:31:28 +11:00
|
|
|
/* XXX, disable precision for now,
|
2015-10-30 17:31:07 +11:00
|
|
|
* this isn't even accessible by the user */
|
|
|
|
|
#if 0
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->mouse.precision) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
|
2012-06-10 19:59:02 +00:00
|
|
|
time = (float)(t->center2d[0] - t->mouse.precision_mval[0]) * fac;
|
|
|
|
|
time += 0.1f * ((float)(t->center2d[0] * fac - mval[0]) - time);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2015-10-30 17:31:07 +11:00
|
|
|
else
|
|
|
|
|
#endif
|
|
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
time = (float)(t->center2d[0] - mval[0]) * fac;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-11-06 17:46:32 +00:00
|
|
|
snapGridIncrement(t, &time);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
applyNumInput(&t->num, &time);
|
|
|
|
|
|
|
|
|
|
/* header print for NumInput */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2012-07-14 14:03:36 +00:00
|
|
|
char c[NUM_STR_REP_LEN];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), c, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (time >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Time: +%s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Time: %s %s"), c, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
/* default header print */
|
|
|
|
|
if (time >= 0.0f)
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Time: +%.3f %s"), time, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Time: %.3f %s"), time, t->proptext);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-04-16 17:54:33 +02:00
|
|
|
if (td->val) {
|
|
|
|
|
*td->val = td->ival + time * td->factor;
|
|
|
|
|
if (td->ext->size && *td->val < *td->ext->size) *td->val = *td->ext->size;
|
|
|
|
|
if (td->ext->quat && *td->val > *td->ext->quat) *td->val = *td->ext->quat;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Mirror) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Mirror
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initMirror(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyMirror;
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NULL_ONE;
|
2018-04-16 16:27:55 +02:00
|
|
|
if ((t->flag & T_EDIT) == 0) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag |= T_NO_ZERO;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyMirror(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float size[3], mat[3][3];
|
|
|
|
|
int i;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
/*
|
2012-03-04 04:35:12 +00:00
|
|
|
* OPTIMIZATION:
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* This still recalcs transformation on mouse move
|
|
|
|
|
* while it should only recalc on constraint change
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
|
|
/* if an axis has been selected */
|
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
size[0] = size[1] = size[2] = -1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->con.applySize) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applySize(t, NULL, NULL, mat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, sizeof(str), IFACE_("Mirror%s"), t->con.text);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
ElementResize(t, tc, td, mat);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
size[0] = size[1] = size[2] = 1;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-29 15:47:02 +00:00
|
|
|
size_to_mat3(mat, size);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
ElementResize(t, tc, td, mat);
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->flag & T_2D_EDIT)
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y)"));
|
2009-09-16 17:43:09 +00:00
|
|
|
else
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, IFACE_("Select a mirror axis (X, Y, Z)"));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Align) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Align
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initAlign(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
t->flag |= T_NO_CONSTRAINT;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyAlign;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyAlign(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
float center[3];
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
/* saving original center */
|
|
|
|
|
copy_v3_v3(center, tc->center_local);
|
|
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
float mat[3][3], invmat[3][3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
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
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* around local centers */
|
|
|
|
|
if (t->flag & (T_OBJECT | T_POSE)) {
|
2018-04-16 16:27:55 +02:00
|
|
|
copy_v3_v3(tc->center_local, td->center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 17:54:33 +02:00
|
|
|
else {
|
|
|
|
|
if (t->settings->selectmode & SCE_SELECT_FACE) {
|
|
|
|
|
copy_v3_v3(tc->center_local, td->center);
|
|
|
|
|
}
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
invert_m3_m3(invmat, td->axismtx);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
mul_m3_m3m3(mat, t->spacemtx, invmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
ElementRotation(t, tc, td, mat, t->around);
|
|
|
|
|
}
|
|
|
|
|
/* restoring original center */
|
|
|
|
|
copy_v3_v3(tc->center_local, center);
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, IFACE_("Align"));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Sequencer Slide) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Sequencer Slide
|
|
|
|
|
* \{ */
|
2009-12-21 17:23:44 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void initSeqSlide(TransInfo *t)
|
2009-12-21 17:23:44 +00:00
|
|
|
{
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applySeqSlide;
|
2009-12-21 17:23:44 +00:00
|
|
|
|
|
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
|
|
|
|
|
|
|
|
|
|
t->idx_max = 1;
|
|
|
|
|
t->num.flag = 0;
|
|
|
|
|
t->num.idx_max = t->idx_max;
|
|
|
|
|
|
|
|
|
|
t->snap[0] = 0.0f;
|
2015-06-16 21:22:53 +02:00
|
|
|
t->snap[1] = floorf(t->scene->r.frs_sec / t->scene->r.frs_sec_base);
|
2009-12-21 17:23:44 +00:00
|
|
|
t->snap[2] = 10.0f;
|
2010-02-22 23:25:34 +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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
2019-01-15 23:24:20 +11:00
|
|
|
/* Would be nice to have a time handling in units as well
|
|
|
|
|
* (supporting frames in addition to "natural" time...). */
|
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->num.unit_type[0] = B_UNIT_NONE;
|
|
|
|
|
t->num.unit_type[1] = B_UNIT_NONE;
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerSeqSlide(TransInfo *t, const float val[2], char str[UI_MAX_DRAW_STR])
|
2009-12-21 17:23:44 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2013-03-12 13:18:39 +00:00
|
|
|
size_t ofs = 0;
|
2009-12-21 17:23:44 +00:00
|
|
|
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.0f, %.0f", val[0], val[1]);
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_("Sequence Slide: %s%s, ("), &tvec[0], t->con.text);
|
2013-02-14 14:50:16 +00:00
|
|
|
|
2013-04-22 21:27:44 +00:00
|
|
|
if (t->keymap) {
|
2013-02-14 14:50:16 +00:00
|
|
|
wmKeyMapItem *kmi = WM_modalkeymap_find_propvalue(t->keymap, TFM_MODAL_TRANSLATE);
|
|
|
|
|
if (kmi) {
|
2017-11-06 00:04:46 +11:00
|
|
|
ofs += WM_keymap_item_to_string(kmi, false, str + ofs, UI_MAX_DRAW_STR - ofs);
|
2013-02-14 14:50:16 +00:00
|
|
|
}
|
|
|
|
|
}
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_(" or Alt) Expand to fit %s"),
|
2013-11-03 05:19:55 +00:00
|
|
|
WM_bool_as_string((t->flag & T_ALT_TRANSFORM) != 0));
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
2015-03-19 20:47:38 +01:00
|
|
|
static void applySeqSlideValue(TransInfo *t, const float val[2])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2009-12-21 17:23:44 +00:00
|
|
|
int i;
|
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
|
break;
|
2009-12-21 17:23:44 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
|
continue;
|
2009-12-21 17:23:44 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
madd_v2_v2v2fl(td->loc, td->iloc, val, td->factor);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
2014-11-24 18:18:35 +01:00
|
|
|
static void applySeqSlide(TransInfo *t, const int mval[2])
|
2009-12-21 17:23:44 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2015-03-19 20:47:38 +01:00
|
|
|
|
|
|
|
|
snapSequenceBounds(t, mval);
|
|
|
|
|
|
2009-12-21 17:23:44 +00:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
|
float pvec[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
|
float tvec[3];
|
2018-04-16 16:27:55 +02:00
|
|
|
t->con.applyVec(t, NULL, NULL, t->values, tvec, pvec);
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->values, tvec);
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2014-11-24 18:18:35 +01:00
|
|
|
// snapGridIncrement(t, t->values);
|
2009-12-21 17:23:44 +00:00
|
|
|
applyNumInput(&t->num, t->values);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 21:22:53 +02:00
|
|
|
t->values[0] = floorf(t->values[0] + 0.5f);
|
|
|
|
|
t->values[1] = floorf(t->values[1] + 0.5f);
|
2009-12-21 17:23:44 +00:00
|
|
|
|
2013-03-12 13:18:39 +00:00
|
|
|
headerSeqSlide(t, t->values, str);
|
2015-03-19 20:47:38 +01:00
|
|
|
applySeqSlideValue(t, t->values);
|
2009-12-21 17:23:44 +00:00
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2009-12-21 17:23:44 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
2009-12-21 17:23:44 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Animation Editors - Transform Utils
|
|
|
|
|
*
|
|
|
|
|
* Special Helpers for Various Settings
|
|
|
|
|
*/
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Animation Editor Utils
|
|
|
|
|
* \{ */
|
2009-01-03 22:15:59 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* This function returns the snapping 'mode' for Animation Editors only
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* We cannot use the standard snapping due to NLA-strip scaling complexities.
|
|
|
|
|
*/
|
2008-12-29 06:06:59 +00:00
|
|
|
// XXX these modifier checks should be keymappable
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
static short getAnimEdit_SnapMode(TransInfo *t)
|
|
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
short autosnap = SACTSNAP_OFF;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2008-12-29 06:06:59 +00:00
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (saction)
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = saction->autosnap;
|
2009-01-01 00:18:23 +00:00
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (t->spacetype == SPACE_GRAPH) {
|
2019-02-16 10:16:16 +11:00
|
|
|
SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (sipo)
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = sipo->autosnap;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2008-12-29 06:06:59 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first;
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2009-01-01 00:18:23 +00:00
|
|
|
if (snla)
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = snla->autosnap;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = SACTSNAP_OFF;
|
2010-01-27 09:42:17 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
|
|
|
|
/* toggle autosnap on/off
|
2018-11-14 12:53:15 +11:00
|
|
|
* - when toggling on, prefer nearest frame over 1.0 frame increments
|
2010-01-27 09:42:17 +00:00
|
|
|
*/
|
|
|
|
|
if (t->modifiers & MOD_SNAP_INVERT) {
|
|
|
|
|
if (autosnap)
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = SACTSNAP_OFF;
|
2010-01-27 09:42:17 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
autosnap = SACTSNAP_FRAME;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return autosnap;
|
|
|
|
|
}
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* This function is used by Animation Editor specific transform functions to do
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* the Snap Keyframe to Nearest Frame/Marker
|
|
|
|
|
*/
|
2010-05-06 19:54:43 +00:00
|
|
|
static void doAnimEdit_SnapFrame(TransInfo *t, TransData *td, TransData2D *td2d, AnimData *adt, short autosnap)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2014-04-25 00:40:51 +12:00
|
|
|
/* snap key to nearest frame or second? */
|
|
|
|
|
if (ELEM(autosnap, SACTSNAP_FRAME, SACTSNAP_SECOND)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
const Scene *scene = t->scene;
|
|
|
|
|
const double secf = FPS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
double val;
|
2018-05-13 06:44:03 +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
|
|
|
/* convert frame to nla-action time (if needed) */
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2012-06-10 19:59:02 +00:00
|
|
|
val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
val = *(td->val);
|
2018-05-13 06:44:03 +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
|
|
|
/* do the snapping to nearest frame/second */
|
2014-04-25 00:40:51 +12:00
|
|
|
if (autosnap == SACTSNAP_FRAME) {
|
|
|
|
|
val = floorf(val + 0.5);
|
2011-09-12 00:00:21 +00:00
|
|
|
}
|
2014-04-25 00:40:51 +12:00
|
|
|
else if (autosnap == SACTSNAP_SECOND) {
|
2014-04-25 03:18:19 +10:00
|
|
|
val = (float)(floor((val / secf) + 0.5) * secf);
|
2011-09-12 00:00:21 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +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
|
|
|
/* convert frame out of nla-action time */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2012-06-10 19:59:02 +00:00
|
|
|
*(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
*(td->val) = val;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
/* snap key to nearest marker? */
|
|
|
|
|
else if (autosnap == SACTSNAP_MARKER) {
|
|
|
|
|
float val;
|
2018-05-13 06:44:03 +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
|
|
|
/* convert frame to nla-action time (if needed) */
|
2009-07-12 02:01:13 +00:00
|
|
|
if (adt)
|
2012-06-10 19:59:02 +00:00
|
|
|
val = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_MAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
val = *(td->val);
|
2018-05-13 06:44:03 +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
|
|
|
/* snap to nearest marker */
|
2009-05-09 02:37:12 +00:00
|
|
|
// TODO: need some more careful checks for where data comes from
|
2012-06-10 19:59:02 +00:00
|
|
|
val = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, val);
|
2018-05-13 06:44:03 +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
|
|
|
/* convert frame out of nla-action time */
|
2009-06-23 13:25:31 +00:00
|
|
|
if (adt)
|
2012-06-10 19:59:02 +00:00
|
|
|
*(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
*(td->val) = val;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
|
|
|
|
/* if the handles are to be moved too (as side-effect of keyframes moving, to keep the general effect)
|
|
|
|
|
* offset them by the same amount so that the general angles are maintained (i.e. won't change while
|
2010-05-07 10:59:48 +00:00
|
|
|
* handles are free-to-roam and keyframes are snap-locked)
|
|
|
|
|
*/
|
2010-05-06 19:54:43 +00:00
|
|
|
if ((td->flag & TD_MOVEHANDLE1) && td2d->h1) {
|
|
|
|
|
td2d->h1[0] = td2d->ih1[0] + *td->val - td->ival;
|
|
|
|
|
}
|
|
|
|
|
if ((td->flag & TD_MOVEHANDLE2) && td2d->h2) {
|
|
|
|
|
td2d->h2[0] = td2d->ih2[0] + *td->val - td->ival;
|
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Animation Translation) */
|
|
|
|
|
|
|
|
|
|
/** \name Transform Animation Translation
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initTimeTranslate(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2011-03-27 22:15:37 +00:00
|
|
|
/* this tool is only really available in the Action Editor... */
|
2011-07-05 09:47:09 +00:00
|
|
|
if (!ELEM(t->spacetype, SPACE_ACTION, SPACE_SEQ)) {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = TFM_TIME_TRANSLATE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTimeTranslate;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.flag = 0;
|
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 0.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
/* No time unit supporting frames currently... */
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerTimeTranslate(TransInfo *t, char str[UI_MAX_DRAW_STR])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2015-04-07 16:45:29 +02:00
|
|
|
int ofs = 0;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* if numeric input is active, use results from that, otherwise apply snapping to result */
|
|
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2008-12-29 06:06:59 +00:00
|
|
|
const Scene *scene = t->scene;
|
2012-06-10 19:59:02 +00:00
|
|
|
const short autosnap = getAnimEdit_SnapMode(t);
|
|
|
|
|
const double secf = FPS;
|
2008-12-29 20:37:54 +00:00
|
|
|
float val = t->values[0];
|
2018-05-13 06:44:03 +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
|
|
|
/* apply snapping + frame->seconds conversions */
|
|
|
|
|
if (autosnap == SACTSNAP_STEP) {
|
2014-04-25 00:40:51 +12:00
|
|
|
/* frame step */
|
|
|
|
|
val = floorf(val + 0.5f);
|
|
|
|
|
}
|
|
|
|
|
else if (autosnap == SACTSNAP_TSTEP) {
|
|
|
|
|
/* second step */
|
|
|
|
|
val = floorf((double)val / secf + 0.5);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-06-16 21:44:08 +12:00
|
|
|
else if (autosnap == SACTSNAP_SECOND) {
|
|
|
|
|
/* nearest second */
|
2014-04-25 00:40:51 +12:00
|
|
|
val = (float)((double)val / secf);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-05-13 06:44:03 +02:00
|
|
|
|
2010-01-27 09:42:17 +00:00
|
|
|
if (autosnap == SACTSNAP_FRAME)
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%d.00 (%.4f)", (int)val, val);
|
2014-06-16 21:44:08 +12:00
|
|
|
else if (autosnap == SACTSNAP_SECOND)
|
|
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%d.00 sec (%.4f)", (int)val, val);
|
|
|
|
|
else if (autosnap == SACTSNAP_TSTEP)
|
|
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f sec", val);
|
2010-01-27 09:42:17 +00:00
|
|
|
else
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", val);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("DeltaX: %s"), &tvec[0]);
|
2015-04-07 16:45:29 +02:00
|
|
|
|
|
|
|
|
if (t->flag & T_PROP_EDIT_ALL) {
|
2016-05-14 10:00:52 +02:00
|
|
|
ofs += BLI_snprintf(str + ofs, UI_MAX_DRAW_STR - ofs, IFACE_(" Proportional size: %.2f"), t->prop_size);
|
2015-04-07 16:45:29 +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
|
|
|
}
|
|
|
|
|
|
2015-04-13 23:58:50 +02:00
|
|
|
static void applyTimeTranslateValue(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
|
int i;
|
2018-04-16 16:27:55 +02:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
const short autosnap = getAnimEdit_SnapMode(t);
|
2014-04-25 00:40:51 +12:00
|
|
|
const double secf = FPS;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-09-20 08:48:48 +00:00
|
|
|
float deltax, val /* , valprev */;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
TransData2D *td2d = tc->data_2d;
|
|
|
|
|
/* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++, td2d++) {
|
|
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
|
|
|
|
* whose active action is where this keyframe comes from
|
|
|
|
|
* (this is only valid when not in NLA)
|
|
|
|
|
*/
|
|
|
|
|
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* valprev = *td->val; */ /* UNUSED */
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* check if any need to apply nla-mapping */
|
|
|
|
|
if (adt && (t->spacetype != SPACE_SEQ)) {
|
|
|
|
|
deltax = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (autosnap == SACTSNAP_TSTEP) {
|
|
|
|
|
deltax = (float)(floor(((double)deltax / secf) + 0.5) * secf);
|
|
|
|
|
}
|
|
|
|
|
else if (autosnap == SACTSNAP_STEP) {
|
|
|
|
|
deltax = floorf(deltax + 0.5f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
val = BKE_nla_tweakedit_remap(adt, td->ival, NLATIME_CONVERT_MAP);
|
|
|
|
|
val += deltax * td->factor;
|
|
|
|
|
*(td->val) = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_UNMAP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 17:54:33 +02:00
|
|
|
else {
|
|
|
|
|
deltax = val = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (autosnap == SACTSNAP_TSTEP) {
|
|
|
|
|
val = (float)(floor(((double)deltax / secf) + 0.5) * secf);
|
|
|
|
|
}
|
|
|
|
|
else if (autosnap == SACTSNAP_STEP) {
|
|
|
|
|
val = floorf(val + 0.5f);
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
*(td->val) = td->ival + val;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* apply nearest snapping */
|
|
|
|
|
doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTimeTranslate(TransInfo *t, const int mval[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2008-12-29 06:22:45 +00:00
|
|
|
View2D *v2d = (View2D *)t->view;
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* calculate translation amount from mouse movement - in 'time-grid space' */
|
2015-04-13 23:58:50 +02:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
|
float cval[2], sval[2];
|
|
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[0], &cval[0], &cval[1]);
|
2015-10-28 22:56:09 +11:00
|
|
|
UI_view2d_region_to_view(v2d, t->mouse.imval[0], t->mouse.imval[0], &sval[0], &sval[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-04-13 23:58:50 +02:00
|
|
|
/* we only need to calculate effect for time (applyTimeTranslate only needs that) */
|
|
|
|
|
t->values[0] = cval[0] - sval[0];
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* handle numeric-input stuff */
|
2008-12-29 20:37:54 +00:00
|
|
|
t->vec[0] = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = t->vec[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
headerTimeTranslate(t, str);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2015-04-13 23:58:50 +02:00
|
|
|
applyTimeTranslateValue(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
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Animation Time Slide) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Animation Time Slide
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initTimeSlide(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
/* this tool is only really available in the Action Editor... */
|
|
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 06:22:45 +00:00
|
|
|
/* set flag for drawing stuff */
|
|
|
|
|
saction->flag |= SACTION_MOVING;
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2011-03-27 22:15:37 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = TFM_TIME_SLIDE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTimeSlide;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_NONE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
{
|
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
|
float *range;
|
|
|
|
|
t->custom.mode.data = range = MEM_mallocN(sizeof(float[2]), "TimeSlide Min/Max");
|
|
|
|
|
t->custom.mode.use_free = true;
|
|
|
|
|
|
|
|
|
|
float min = 999999999.0f, max = -999999999.0f;
|
|
|
|
|
int i;
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
|
|
|
|
float val = *(td->val);
|
|
|
|
|
|
|
|
|
|
/* strip/action time to global (mapped) time */
|
|
|
|
|
if (adt)
|
|
|
|
|
val = BKE_nla_tweakedit_remap(adt, val, NLATIME_CONVERT_MAP);
|
|
|
|
|
|
|
|
|
|
if (min > val) min = val;
|
|
|
|
|
if (max < val) max = val;
|
|
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2016-02-01 15:15:10 +11:00
|
|
|
|
|
|
|
|
if (min == max) {
|
|
|
|
|
/* just use the current frame ranges */
|
|
|
|
|
min = (float)PSFRA;
|
|
|
|
|
max = (float)PEFRA;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
range[0] = min;
|
|
|
|
|
range[1] = max;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.flag = 0;
|
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 0.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
/* No time unit supporting frames currently... */
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerTimeSlide(TransInfo *t, const float sval, char str[UI_MAX_DRAW_STR])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num)) {
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
2016-02-01 15:15:10 +11:00
|
|
|
const float *range = t->custom.mode.data;
|
|
|
|
|
float minx = range[0];
|
|
|
|
|
float maxx = range[1];
|
2012-06-10 19:59:02 +00:00
|
|
|
float cval = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float val;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
val = 2.0f * (cval - sval) / (maxx - minx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
CLAMP(val, -1.0f, 1.0f);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", val);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("TimeSlide: %s"), &tvec[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
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTimeSlideValue(TransInfo *t, float sval)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
|
int i;
|
2016-02-01 15:15:10 +11:00
|
|
|
const float *range = t->custom.mode.data;
|
|
|
|
|
float minx = range[0];
|
|
|
|
|
float maxx = range[1];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* set value for drawing black line */
|
|
|
|
|
if (t->spacetype == SPACE_ACTION) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
|
2008-12-29 20:37:54 +00:00
|
|
|
float cvalf = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
saction->timeslide = cvalf;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* it doesn't matter whether we apply to t->data or t->data2d, but t->data2d is more convenient */
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++) {
|
|
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
|
|
|
|
* whose active action is where this keyframe comes from
|
|
|
|
|
* (this is only valid when not in NLA)
|
2017-09-03 03:35:27 +12:00
|
|
|
*/
|
2018-04-16 17:54:33 +02:00
|
|
|
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
|
|
|
|
float cval = t->values[0];
|
|
|
|
|
|
|
|
|
|
/* only apply to data if in range */
|
|
|
|
|
if ((sval > minx) && (sval < maxx)) {
|
|
|
|
|
float cvalc = CLAMPIS(cval, minx, maxx);
|
|
|
|
|
float ival = td->ival;
|
|
|
|
|
float timefac;
|
|
|
|
|
|
|
|
|
|
/* NLA mapping magic here works as follows:
|
|
|
|
|
* - "ival" goes from strip time to global time
|
|
|
|
|
* - calculation is performed into td->val in global time
|
|
|
|
|
* (since sval and min/max are all in global time)
|
|
|
|
|
* - "td->val" then gets put back into strip time
|
|
|
|
|
*/
|
|
|
|
|
if (adt) {
|
|
|
|
|
/* strip to global */
|
|
|
|
|
ival = BKE_nla_tweakedit_remap(adt, ival, NLATIME_CONVERT_MAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* left half? */
|
|
|
|
|
if (ival < sval) {
|
|
|
|
|
timefac = (sval - ival) / (sval - minx);
|
|
|
|
|
*(td->val) = cvalc - timefac * (cvalc - minx);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
timefac = (ival - sval) / (maxx - sval);
|
|
|
|
|
*(td->val) = cvalc + timefac * (maxx - cvalc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (adt) {
|
|
|
|
|
/* global to strip */
|
|
|
|
|
*(td->val) = BKE_nla_tweakedit_remap(adt, *(td->val), NLATIME_CONVERT_UNMAP);
|
|
|
|
|
}
|
2017-09-03 03:35:27 +12:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
static void applyTimeSlide(TransInfo *t, const int mval[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2008-12-29 06:22:45 +00:00
|
|
|
View2D *v2d = (View2D *)t->view;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float cval[2], sval[2];
|
2016-02-01 15:15:10 +11:00
|
|
|
const float *range = t->custom.mode.data;
|
|
|
|
|
float minx = range[0];
|
|
|
|
|
float maxx = range[1];
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* calculate mouse co-ordinates */
|
2011-06-02 11:51:38 +00:00
|
|
|
UI_view2d_region_to_view(v2d, mval[0], mval[1], &cval[0], &cval[1]);
|
2015-10-28 22:56:09 +11:00
|
|
|
UI_view2d_region_to_view(v2d, t->mouse.imval[0], t->mouse.imval[1], &sval[0], &sval[1]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
/* t->values[0] stores cval[0], which is the current mouse-pointer location (in frames) */
|
2010-03-09 01:19:32 +00:00
|
|
|
// XXX Need to be able to repeat this
|
2015-06-16 21:15:01 +02:00
|
|
|
/* t->values[0] = cval[0]; */ /* UNUSED (reset again later). */
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* handle numeric-input stuff */
|
2012-06-10 19:59:02 +00:00
|
|
|
t->vec[0] = 2.0f * (cval[0] - sval[0]) / (maxx - minx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2012-06-10 19:59:02 +00:00
|
|
|
t->values[0] = (maxx - minx) * t->vec[0] / 2.0f + sval[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
headerTimeSlide(t, sval[0], str);
|
2013-10-23 03:57:42 +00:00
|
|
|
applyTimeSlideValue(t, sval[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
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57: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
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/* Transform (Animation Time Scale) */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-10-23 03:57:42 +00:00
|
|
|
/** \name Transform Animation Time Scale
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
static void initTimeScale(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2013-10-12 03:42:06 +00:00
|
|
|
float center[2];
|
2010-01-18 22:21:32 +00:00
|
|
|
|
2011-04-05 11:04:00 +00:00
|
|
|
/* this tool is only really available in the Action Editor
|
|
|
|
|
* AND NLA Editor (for strip scaling)
|
|
|
|
|
*/
|
|
|
|
|
if (ELEM(t->spacetype, SPACE_ACTION, SPACE_NLA) == 0) {
|
2011-03-27 22:15:37 +00:00
|
|
|
t->state = TRANS_CANCEL;
|
|
|
|
|
}
|
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mode = TFM_TIME_SCALE;
|
2013-10-23 03:57:42 +00:00
|
|
|
t->transform = applyTimeScale;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2010-01-18 22:21:32 +00:00
|
|
|
/* recalculate center2d to use CFRA and mouse Y, since that's
|
|
|
|
|
* what is used in time scale */
|
2017-08-28 16:00:28 +10:00
|
|
|
if ((t->flag & T_OVERRIDE_CENTER) == 0) {
|
2018-04-16 16:27:55 +02:00
|
|
|
t->center_global[0] = t->scene->r.cfra;
|
|
|
|
|
projectFloatView(t, t->center_global, center);
|
2017-08-28 16:00:28 +10:00
|
|
|
center[1] = t->mouse.imval[1];
|
|
|
|
|
}
|
2010-01-18 22:21:32 +00:00
|
|
|
|
|
|
|
|
/* force a reinit with the center2d used here */
|
2016-12-15 11:12:43 +01:00
|
|
|
initMouseInput(t, &t->mouse, center, t->mouse.imval, false);
|
2010-01-18 22:21:32 +00:00
|
|
|
|
2010-01-18 00:45:33 +00:00
|
|
|
initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
|
t->flag |= T_NULL_ONE;
|
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->num.val_flag[0] |= NUM_NULL_ONE;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* num-input has max of (n-1) */
|
|
|
|
|
t->idx_max = 0;
|
|
|
|
|
t->num.flag = 0;
|
|
|
|
|
t->num.idx_max = t->idx_max;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize snap like for everything else */
|
2009-07-12 02:01:13 +00:00
|
|
|
t->snap[0] = 0.0f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->snap[1] = t->snap[2] = 1.0f;
|
2010-02-22 23:25:34 +00:00
|
|
|
|
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
|
|
|
copy_v3_fl(t->num.val_inc, t->snap[1]);
|
|
|
|
|
t->num.unit_sys = t->scene->unit.system;
|
|
|
|
|
t->num.unit_type[0] = B_UNIT_NONE;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
static void headerTimeScale(TransInfo *t, char str[UI_MAX_DRAW_STR])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2012-07-14 14:03:36 +00:00
|
|
|
char tvec[NUM_STR_REP_LEN * 3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (hasNumInput(&t->num))
|
2014-08-26 12:04:24 +02:00
|
|
|
outputNumInput(&(t->num), tvec, &t->scene->unit);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
2013-03-12 13:18:39 +00:00
|
|
|
BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", t->values[0]);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2016-05-14 10:00:52 +02:00
|
|
|
BLI_snprintf(str, UI_MAX_DRAW_STR, IFACE_("ScaleX: %s"), &tvec[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
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTimeScaleValue(TransInfo *t)
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
Scene *scene = t->scene;
|
|
|
|
|
int i;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
const short autosnap = getAnimEdit_SnapMode(t);
|
|
|
|
|
const double secf = FPS;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
|
|
|
|
TransData2D *td2d = tc->data_2d;
|
|
|
|
|
for (i = 0; i < tc->data_len; i++, td++, td2d++) {
|
|
|
|
|
/* it is assumed that td->extra is a pointer to the AnimData,
|
|
|
|
|
* whose active action is where this keyframe comes from
|
|
|
|
|
* (this is only valid when not in NLA)
|
|
|
|
|
*/
|
|
|
|
|
AnimData *adt = (t->spacetype != SPACE_NLA) ? td->extra : NULL;
|
|
|
|
|
float startx = CFRA;
|
|
|
|
|
float fac = t->values[0];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (autosnap == SACTSNAP_TSTEP) {
|
|
|
|
|
fac = (float)(floor((double)fac / secf + 0.5) * secf);
|
|
|
|
|
}
|
|
|
|
|
else if (autosnap == SACTSNAP_STEP) {
|
|
|
|
|
fac = floorf(fac + 0.5f);
|
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2019-01-10 14:03:52 +01:00
|
|
|
/* take proportional editing into account */
|
|
|
|
|
fac = ((fac - 1.0f) * td->factor) + 1;
|
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* check if any need to apply nla-mapping */
|
|
|
|
|
if (adt)
|
|
|
|
|
startx = BKE_nla_tweakedit_remap(adt, startx, NLATIME_CONVERT_UNMAP);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* now, calculate the new value */
|
|
|
|
|
*(td->val) = ((td->ival - startx) * fac) + startx;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
/* apply nearest snapping */
|
|
|
|
|
doAnimEdit_SnapFrame(t, td, td2d, adt, autosnap);
|
|
|
|
|
}
|
2018-04-16 16:27:55 +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
|
|
|
}
|
|
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
static void applyTimeScale(TransInfo *t, const int UNUSED(mval[2]))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2016-05-14 10:00:52 +02:00
|
|
|
char str[UI_MAX_DRAW_STR];
|
2018-05-13 06:44:03 +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
|
|
|
/* handle numeric-input stuff */
|
2008-12-29 20:37:54 +00:00
|
|
|
t->vec[0] = t->values[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
applyNumInput(&t->num, &t->vec[0]);
|
2008-12-29 20:37:54 +00:00
|
|
|
t->values[0] = t->vec[0];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
headerTimeScale(t, str);
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2013-10-23 03:57:42 +00:00
|
|
|
applyTimeScaleValue(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
|
|
|
|
|
|
|
|
recalcData(t);
|
|
|
|
|
|
2018-06-28 12:06:00 +02:00
|
|
|
ED_area_status_text(t->sa, str);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-10-23 03:57:42 +00:00
|
|
|
/** \} */
|
2013-02-18 16:35:13 +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)))
|
2015-12-01 18:52:24 +11:00
|
|
|
{
|
2013-05-01 05:26:10 +00:00
|
|
|
/* not all editmode supports axis-matrix */
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|