2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
2011-02-27 20:29:51 +00:00
|
|
|
/** \file blender/editors/transform/transform_generics.c
|
|
|
|
* \ingroup edtransform
|
|
|
|
*/
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
2013-05-28 19:35:26 +00:00
|
|
|
#include "BLI_sys_types.h" /* for intptr_t support */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-01-28 02:56:58 +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"
|
2014-07-21 12:02:05 +02:00
|
|
|
#include "DNA_brush_types.h"
|
2015-12-13 21:03:13 +13:00
|
|
|
#include "DNA_gpencil_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_lattice_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
2012-09-13 10:51:13 +00:00
|
|
|
#include "DNA_sequence_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_space_types.h"
|
2010-08-10 05:41:51 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
2012-02-19 22:17:30 +00:00
|
|
|
#include "DNA_mesh_types.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "DNA_view3d_types.h"
|
2010-08-10 05:41:51 +00:00
|
|
|
#include "DNA_modifier_types.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "DNA_movieclip_types.h"
|
2012-06-04 16:42:58 +00:00
|
|
|
#include "DNA_mask_types.h"
|
2014-05-09 16:52:09 +10:00
|
|
|
#include "DNA_meta_types.h"
|
2009-03-06 15:50:15 +00:00
|
|
|
|
2012-03-24 01:24:58 +00:00
|
|
|
#include "BLI_math.h"
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_rand.h"
|
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-02-19 15:45:56 +00:00
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
#include "RNA_access.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2017-01-26 12:13:50 -02:00
|
|
|
#include "GPU_immediate.h"
|
2017-03-21 17:49:21 -04:00
|
|
|
#include "GPU_matrix.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-12-29 19:43:08 +00:00
|
|
|
#include "BIK_api.h"
|
|
|
|
|
2009-07-16 04:45:52 +00:00
|
|
|
#include "BKE_animsys.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_action.h"
|
|
|
|
#include "BKE_armature.h"
|
|
|
|
#include "BKE_curve.h"
|
2009-01-28 02:56:58 +00:00
|
|
|
#include "BKE_fcurve.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_lattice.h"
|
2015-11-09 19:47:10 +01:00
|
|
|
#include "BKE_library.h"
|
2009-07-07 02:12:50 +00:00
|
|
|
#include "BKE_nla.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BKE_context.h"
|
2014-07-21 12:02:05 +02:00
|
|
|
#include "BKE_paint.h"
|
2012-08-21 10:42:21 +00:00
|
|
|
#include "BKE_sequencer.h"
|
2013-04-13 20:31:52 +00:00
|
|
|
#include "BKE_editmesh.h"
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "BKE_tracking.h"
|
2012-07-26 10:52:59 +00:00
|
|
|
#include "BKE_mask.h"
|
2015-05-25 15:45:56 +10:00
|
|
|
#include "BKE_utildefines.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-06-08 10:14:53 +02:00
|
|
|
#include "DEG_depsgraph.h"
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
#include "ED_anim_api.h"
|
2009-01-05 15:19:31 +00:00
|
|
|
#include "ED_armature.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_image.h"
|
2009-02-16 03:01:56 +00:00
|
|
|
#include "ED_keyframing.h"
|
2009-07-07 06:16:06 +00:00
|
|
|
#include "ED_markers.h"
|
2009-01-03 22:15:59 +00:00
|
|
|
#include "ED_mesh.h"
|
2015-02-23 23:05:54 +11:00
|
|
|
#include "ED_object.h"
|
2016-12-28 17:30:58 +01:00
|
|
|
#include "ED_particle.h"
|
2009-07-31 07:43:47 +00:00
|
|
|
#include "ED_screen_types.h"
|
2009-01-10 18:33:16 +00:00
|
|
|
#include "ED_space_api.h"
|
2009-01-28 21:43:43 +00:00
|
|
|
#include "ED_uvedit.h"
|
|
|
|
#include "ED_view3d.h"
|
2011-09-14 00:37:27 +00:00
|
|
|
#include "ED_curve.h" /* for curve_editnurbs */
|
2011-11-07 12:55:18 +00:00
|
|
|
#include "ED_clip.h"
|
2012-05-25 12:37:11 +00:00
|
|
|
#include "ED_screen.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
#include "WM_types.h"
|
2009-12-07 18:10:11 +00:00
|
|
|
#include "WM_api.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
#include "UI_resources.h"
|
2014-07-21 12:02:05 +02:00
|
|
|
#include "UI_view2d.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 "transform.h"
|
|
|
|
|
|
|
|
/* ************************** Functions *************************** */
|
|
|
|
|
|
|
|
void getViewVector(TransInfo *t, float coord[3], float vec[3])
|
|
|
|
{
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->persp != RV3D_ORTHO) {
|
2014-11-17 14:38:19 +01:00
|
|
|
sub_v3_v3v3(vec, coord, t->viewinv[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
|
|
|
}
|
|
|
|
else {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, t->viewinv[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-11-10 20:43:45 +00:00
|
|
|
normalize_v3(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
|
|
|
}
|
|
|
|
|
|
|
|
/* ************************** GENERICS **************************** */
|
|
|
|
|
2013-02-18 16:35:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 clipMirrorModifier(TransInfo *t, Object *ob)
|
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
ModifierData *md = ob->modifiers.first;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float tolerance[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
int axis = 0;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (; md; md = md->next) {
|
|
|
|
if ((md->type == eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) {
|
|
|
|
MirrorModifierData *mmd = (MirrorModifierData *) md;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (mmd->flag & MOD_MIR_CLIPPING) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
axis = 0;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (mmd->flag & MOD_MIR_AXIS_X) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
axis |= 1;
|
|
|
|
tolerance[0] = mmd->tolerance;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (mmd->flag & MOD_MIR_AXIS_Y) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
axis |= 2;
|
|
|
|
tolerance[1] = mmd->tolerance;
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (mmd->flag & MOD_MIR_AXIS_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
|
|
|
axis |= 4;
|
|
|
|
tolerance[2] = mmd->tolerance;
|
|
|
|
}
|
|
|
|
if (axis) {
|
|
|
|
float mtx[4][4], imtx[4][4];
|
|
|
|
int i;
|
|
|
|
TransData *td = t->data;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (mmd->mirror_ob) {
|
|
|
|
float obinv[4][4];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(obinv, mmd->mirror_ob->obmat);
|
2013-05-26 18:36:25 +00:00
|
|
|
mul_m4_m4m4(mtx, obinv, ob->obmat);
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(imtx, mtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int clip;
|
|
|
|
float loc[3], iloc[3];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
if (td->loc == 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
|
|
|
break;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(loc, td->loc);
|
|
|
|
copy_v3_v3(iloc, td->iloc);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (mmd->mirror_ob) {
|
2010-04-12 00:36:50 +00:00
|
|
|
mul_m4_v3(mtx, loc);
|
|
|
|
mul_m4_v3(mtx, 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
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
clip = 0;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (axis & 1) {
|
2012-06-10 19:59:02 +00:00
|
|
|
if (fabsf(iloc[0]) <= tolerance[0] ||
|
|
|
|
loc[0] * iloc[0] < 0.0f)
|
2011-11-11 12:00:08 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
loc[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
|
|
|
clip = 1;
|
|
|
|
}
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (axis & 2) {
|
2012-05-03 21:35:04 +00:00
|
|
|
if (fabsf(iloc[1]) <= tolerance[1] ||
|
2012-06-10 19:59:02 +00:00
|
|
|
loc[1] * iloc[1] < 0.0f)
|
2011-11-11 12:00:08 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
loc[1] = 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
|
|
|
clip = 1;
|
|
|
|
}
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (axis & 4) {
|
2012-05-03 21:35:04 +00:00
|
|
|
if (fabsf(iloc[2]) <= tolerance[2] ||
|
2012-06-10 19:59:02 +00:00
|
|
|
loc[2] * iloc[2] < 0.0f)
|
2011-11-11 12:00:08 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
loc[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
|
|
|
clip = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (clip) {
|
|
|
|
if (mmd->mirror_ob) {
|
2010-04-12 00:36:50 +00:00
|
|
|
mul_m4_v3(imtx, loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(td->loc, loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-02 19:10:35 +00:00
|
|
|
/* assumes obedit set to mesh object */
|
2009-05-16 16:18:08 +00:00
|
|
|
static void editbmesh_apply_to_mirror(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
2009-05-16 16:18:08 +00:00
|
|
|
BMVert *eve;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
if (td->loc == 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
|
|
|
break;
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
eve = td->extra;
|
2009-11-01 00:06:53 +00:00
|
|
|
if (eve) {
|
2012-06-10 19:59:02 +00:00
|
|
|
eve->co[0] = -td->loc[0];
|
|
|
|
eve->co[1] = td->loc[1];
|
|
|
|
eve->co[2] = td->loc[2];
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (td->flag & TD_MIRROR_EDGE) {
|
2009-10-22 23:22:05 +00:00
|
|
|
td->loc[0] = 0;
|
2009-11-01 00:06:53 +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
|
|
|
}
|
|
|
|
|
2009-07-31 07:43:47 +00:00
|
|
|
/* for the realtime animation recording feature, handle overlapping data */
|
2012-06-10 19:59:02 +00:00
|
|
|
static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer)
|
2009-07-31 07:43:47 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
ScreenAnimData *sad = (animtimer) ? animtimer->customdata : NULL;
|
2009-08-02 03:15:24 +00:00
|
|
|
|
|
|
|
/* sanity checks */
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(NULL, scene, id, sad))
|
2009-08-02 03:15:24 +00:00
|
|
|
return;
|
2009-07-31 07:43:47 +00:00
|
|
|
|
2009-08-01 05:10:57 +00:00
|
|
|
/* check if we need a new strip if:
|
2012-06-10 19:59:02 +00:00
|
|
|
* - if animtimer is running
|
2009-08-01 05:10:57 +00:00
|
|
|
* - we're not only keying for available channels
|
|
|
|
* - the option to add new actions for each round is not enabled
|
2009-07-31 07:43:47 +00:00
|
|
|
*/
|
2012-06-10 19:59:02 +00:00
|
|
|
if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL) == 0 && (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) {
|
2009-07-31 07:43:47 +00:00
|
|
|
/* if playback has just looped around, we need to add a new NLA track+strip to allow a clean pass to occur */
|
2009-08-02 03:15:24 +00:00
|
|
|
if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
AnimData *adt = BKE_animdata_from_id(id);
|
2009-07-31 07:43:47 +00:00
|
|
|
|
|
|
|
/* perform push-down manually with some differences
|
|
|
|
* NOTE: BKE_nla_action_pushdown() sync warning...
|
|
|
|
*/
|
|
|
|
if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) {
|
2009-08-01 05:10:57 +00:00
|
|
|
float astart, aend;
|
2009-07-31 07:43:47 +00:00
|
|
|
|
2009-08-01 05:10:57 +00:00
|
|
|
/* only push down if action is more than 1-2 frames long */
|
|
|
|
calc_action_range(adt->action, &astart, &aend, 1);
|
2012-06-10 19:59:02 +00:00
|
|
|
if (aend > astart + 2.0f) {
|
|
|
|
NlaStrip *strip = add_nlastrip_to_stack(adt, adt->action);
|
2009-08-01 05:10:57 +00:00
|
|
|
|
|
|
|
/* clear reference to action now that we've pushed it onto the stack */
|
2015-11-09 19:47:10 +01:00
|
|
|
id_us_min(&adt->action->id);
|
2012-06-10 19:59:02 +00:00
|
|
|
adt->action = NULL;
|
2009-08-01 05:10:57 +00:00
|
|
|
|
|
|
|
/* adjust blending + extend so that they will behave correctly */
|
2012-06-10 19:59:02 +00:00
|
|
|
strip->extendmode = NLASTRIP_EXTEND_NOTHING;
|
|
|
|
strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | NLASTRIP_FLAG_ACTIVE);
|
2009-08-01 05:10:57 +00:00
|
|
|
|
|
|
|
/* also, adjust the AnimData's action extend mode to be on
|
|
|
|
* 'nothing' so that previous result still play
|
|
|
|
*/
|
2012-06-10 19:59:02 +00:00
|
|
|
adt->act_extendmode = NLASTRIP_EXTEND_NOTHING;
|
2009-08-01 05:10:57 +00:00
|
|
|
}
|
2009-07-31 07:43: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
|
|
|
}
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
}
|
|
|
|
|
2014-02-05 22:36:15 +11:00
|
|
|
static bool fcu_test_selected(FCurve *fcu)
|
2010-02-10 18:22:55 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
BezTriple *bezt = fcu->bezt;
|
2010-09-20 13:19:37 +00:00
|
|
|
unsigned int i;
|
2010-02-10 18:22:55 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (bezt == NULL) /* ignore baked */
|
2010-03-03 13:20:18 +00:00
|
|
|
return 0;
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (i = 0; i < fcu->totvert; i++, bezt++) {
|
2015-07-09 14:31:27 +10:00
|
|
|
if (BEZT_ISSEL_ANY(bezt)) return 1;
|
2010-02-10 18:22:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* helper for recalcData() - for Action Editor transforms */
|
|
|
|
static void recalcData_actedit(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
|
|
|
{
|
2017-04-11 16:09:30 +02:00
|
|
|
SceneLayer *sl= t->scene_layer;
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
bAnimContext ac = {NULL};
|
2011-07-22 07:25:52 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize relevant anim-context 'context' data from TransInfo data */
|
2012-06-10 19:59:02 +00:00
|
|
|
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
|
|
|
|
ac.scene = t->scene;
|
2017-04-11 16:09:30 +02:00
|
|
|
ac.scene_layer = t->scene_layer;
|
2017-08-15 15:59:38 +02:00
|
|
|
ac.obact = OBACT_NEW(sl);
|
2012-06-10 19:59:02 +00:00
|
|
|
ac.sa = t->sa;
|
|
|
|
ac.ar = t->ar;
|
|
|
|
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
|
|
|
|
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
|
|
|
|
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
ANIM_animdata_context_getdata(&ac);
|
|
|
|
|
|
|
|
/* perform flush */
|
2012-06-08 14:31:38 +00:00
|
|
|
if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* flush transform values back to actual coordinates */
|
2012-06-08 14:31:38 +00:00
|
|
|
flushTransIntFrameActionData(t);
|
2009-01-21 07:01:20 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else {
|
|
|
|
/* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
|
2012-06-10 19:59:02 +00:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA);
|
2011-07-22 07:25:52 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* just tag these animdata-blocks to recalc, assuming that some data there changed
|
|
|
|
* BUT only do this if realtime updates are enabled
|
|
|
|
*/
|
|
|
|
if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) {
|
2012-06-10 19:59:02 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* set refresh tags for objects using this animation */
|
|
|
|
ANIM_list_elem_update(t->scene, ale);
|
2010-01-20 11:20:20 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
}
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* now free temp channels */
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2009-07-12 03:42:39 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
/* helper for recalcData() - for Graph Editor transforms */
|
|
|
|
static void recalcData_graphedit(TransInfo *t)
|
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
2017-04-11 16:09:30 +02:00
|
|
|
SceneLayer *sl = t->scene_layer;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
ListBase anim_data = {NULL, NULL};
|
2012-06-10 19:59:02 +00:00
|
|
|
bAnimContext ac = {NULL};
|
2011-07-22 07:25:52 +00:00
|
|
|
int filter;
|
|
|
|
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int dosort = 0;
|
2013-02-19 02:30:02 +00:00
|
|
|
|
2012-03-02 16:05:54 +00:00
|
|
|
/* initialize relevant anim-context 'context' data from TransInfo data */
|
2012-06-10 19:59:02 +00:00
|
|
|
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
|
2017-02-09 16:34:26 +01:00
|
|
|
ac.scene = t->scene;
|
2017-04-11 16:09:30 +02:00
|
|
|
ac.scene_layer = t->scene_layer;
|
2017-08-15 15:59:38 +02:00
|
|
|
ac.obact = OBACT_NEW(sl);
|
2012-06-10 19:59:02 +00:00
|
|
|
ac.sa = t->sa;
|
|
|
|
ac.ar = t->ar;
|
|
|
|
ac.sl = (t->sa) ? t->sa->spacedata.first : NULL;
|
|
|
|
ac.spacetype = (t->sa) ? t->sa->spacetype : 0;
|
|
|
|
ac.regiontype = (t->ar) ? t->ar->regiontype : 0;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
ANIM_animdata_context_getdata(&ac);
|
|
|
|
|
|
|
|
/* do the flush first */
|
|
|
|
flushTransGraphData(t);
|
|
|
|
|
|
|
|
/* get curves to check if a re-sort is needed */
|
2012-06-10 19:59:02 +00:00
|
|
|
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE);
|
2011-07-22 07:25:52 +00:00
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
/* now test if there is a need to re-sort */
|
2012-06-10 19:59:02 +00:00
|
|
|
for (ale = anim_data.first; ale; ale = ale->next) {
|
|
|
|
FCurve *fcu = (FCurve *)ale->key_data;
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2014-04-25 13:19:21 +12:00
|
|
|
/* ignore FC-Curves without any selected verts */
|
2011-07-22 07:25:52 +00:00
|
|
|
if (!fcu_test_selected(fcu))
|
|
|
|
continue;
|
2013-02-19 02:30:02 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* watch it: if the time is wrong: do not correct handles yet */
|
|
|
|
if (test_time_fcurve(fcu))
|
|
|
|
dosort++;
|
|
|
|
else
|
|
|
|
calchandles_fcurve(fcu);
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* set refresh tags for objects using this animation,
|
|
|
|
* BUT only if realtime updates are enabled
|
|
|
|
*/
|
|
|
|
if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0)
|
|
|
|
ANIM_list_elem_update(t->scene, ale);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do resort and other updates? */
|
|
|
|
if (dosort) remake_graph_transdata(t, &anim_data);
|
|
|
|
|
|
|
|
/* now free temp channels */
|
2014-05-19 00:24:45 +10:00
|
|
|
ANIM_animdata_freelist(&anim_data);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* helper for recalcData() - for NLA Editor transforms */
|
|
|
|
static void recalcData_nla(TransInfo *t)
|
|
|
|
{
|
2016-02-01 15:15:10 +11:00
|
|
|
TransDataNla *tdn = t->custom.type.data;
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first;
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
double secf = FPS;
|
2011-07-22 07:25:52 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
/* for each strip we've got, perform some additional validation of the values that got set before
|
|
|
|
* using RNA to set the value (which does some special operations when setting these values to make
|
|
|
|
* sure that everything works ok)
|
|
|
|
*/
|
|
|
|
for (i = 0; i < t->total; i++, tdn++) {
|
2012-06-10 19:59:02 +00:00
|
|
|
NlaStrip *strip = tdn->strip;
|
2011-07-22 07:25:52 +00:00
|
|
|
PointerRNA strip_ptr;
|
|
|
|
short pExceeded, nExceeded, iter;
|
|
|
|
int delta_y1, delta_y2;
|
2009-02-15 23:48:05 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* if this tdn has no handles, that means it is just a dummy that should be skipped */
|
|
|
|
if (tdn->handle == 0)
|
|
|
|
continue;
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* set refresh tags for objects using this animation,
|
|
|
|
* BUT only if realtime updates are enabled
|
|
|
|
*/
|
|
|
|
if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0)
|
|
|
|
ANIM_id_update(t->scene, tdn->id);
|
2009-01-28 02:56:58 +00:00
|
|
|
|
2012-03-08 04:12:11 +00:00
|
|
|
/* if canceling transform, just write the values without validating, then move on */
|
2011-07-22 07:25:52 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
/* clear the values by directly overwriting the originals, but also need to restore
|
|
|
|
* endpoints of neighboring transition-strips
|
|
|
|
*/
|
2010-03-09 08:31:41 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* start */
|
2012-06-10 19:59:02 +00:00
|
|
|
strip->start = tdn->h1[0];
|
2010-03-09 08:31:41 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
|
2012-06-10 19:59:02 +00:00
|
|
|
strip->prev->end = tdn->h1[0];
|
2010-01-26 05:58:03 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* end */
|
2012-06-10 19:59:02 +00:00
|
|
|
strip->end = tdn->h2[0];
|
2009-01-28 09:55:36 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
|
2012-06-10 19:59:02 +00:00
|
|
|
strip->next->start = tdn->h2[0];
|
2010-01-26 05:58:03 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* flush transforms to child strips (since this should be a meta) */
|
|
|
|
BKE_nlameta_flush_transforms(strip);
|
|
|
|
|
|
|
|
/* restore to original track (if needed) */
|
|
|
|
if (tdn->oldTrack != tdn->nlt) {
|
|
|
|
/* just append to end of list for now, since strips get sorted in special_aftertrans_update() */
|
|
|
|
BLI_remlink(&tdn->nlt->strips, strip);
|
|
|
|
BLI_addtail(&tdn->oldTrack->strips, strip);
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
|
|
|
|
2012-03-01 12:20:18 +00:00
|
|
|
/* firstly, check if the proposed transform locations would overlap with any neighboring strips
|
2011-07-22 07:25:52 +00:00
|
|
|
* (barring transitions) which are absolute barriers since they are not being moved
|
|
|
|
*
|
|
|
|
* this is done as a iterative procedure (done 5 times max for now)
|
2009-06-09 11:26:45 +00:00
|
|
|
*/
|
2012-06-10 19:59:02 +00:00
|
|
|
for (iter = 0; iter < 5; iter++) {
|
|
|
|
pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h1[0] < strip->prev->end));
|
|
|
|
nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && (tdn->h2[0] > strip->next->start));
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2014-01-16 19:15:53 +11:00
|
|
|
if ((pExceeded && nExceeded) || (iter == 4)) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
|
|
|
|
* - simply crop strip to fit within the bounds of the strips bounding it
|
2012-03-09 00:41:09 +00:00
|
|
|
* - if there were no neighbors, clear the transforms (make it default to the strip's current values)
|
2009-06-09 11:26:45 +00:00
|
|
|
*/
|
2011-07-22 07:25:52 +00:00
|
|
|
if (strip->prev && strip->next) {
|
2012-06-10 19:59:02 +00:00
|
|
|
tdn->h1[0] = strip->prev->end;
|
|
|
|
tdn->h2[0] = strip->next->start;
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
else {
|
2012-06-10 19:59:02 +00:00
|
|
|
tdn->h1[0] = strip->start;
|
|
|
|
tdn->h2[0] = strip->end;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else if (nExceeded) {
|
|
|
|
/* move backwards */
|
2012-06-10 19:59:02 +00:00
|
|
|
float offset = tdn->h2[0] - strip->next->start;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
tdn->h1[0] -= offset;
|
|
|
|
tdn->h2[0] -= offset;
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else if (pExceeded) {
|
|
|
|
/* more forwards */
|
2012-06-10 19:59:02 +00:00
|
|
|
float offset = strip->prev->end - tdn->h1[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
tdn->h1[0] += offset;
|
|
|
|
tdn->h2[0] += offset;
|
2009-07-07 06:16:06 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else /* all is fine and well */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-04-25 13:32:27 +12:00
|
|
|
/* handle auto-snapping
|
|
|
|
* NOTE: only do this when transform is still running, or we can't restore
|
|
|
|
*/
|
|
|
|
if (t->state != TRANS_CANCEL) {
|
|
|
|
switch (snla->autosnap) {
|
|
|
|
case SACTSNAP_FRAME: /* snap to nearest frame */
|
|
|
|
case SACTSNAP_STEP: /* frame step - this is basically the same, since we don't have any remapping going on */
|
|
|
|
{
|
|
|
|
tdn->h1[0] = floorf(tdn->h1[0] + 0.5f);
|
|
|
|
tdn->h2[0] = floorf(tdn->h2[0] + 0.5f);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-25 02:52:27 +12:00
|
|
|
|
2014-04-25 13:32:27 +12:00
|
|
|
case SACTSNAP_SECOND: /* snap to nearest second */
|
|
|
|
case SACTSNAP_TSTEP: /* second step - this is basically the same, since we don't have any remapping going on */
|
|
|
|
{
|
|
|
|
/* This case behaves differently from the rest, since lengths of strips
|
|
|
|
* may not be multiples of a second. If we just naively resize adjust
|
|
|
|
* the handles, things may not work correctly. Instead, we only snap
|
|
|
|
* the first handle, and move the other to fit.
|
|
|
|
*
|
|
|
|
* FIXME: we do run into problems here when user attempts to negatively
|
|
|
|
* scale the strip, as it then just compresses down and refuses
|
|
|
|
* to expand out the other end.
|
|
|
|
*/
|
|
|
|
float h1_new = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf);
|
|
|
|
float delta = h1_new - tdn->h1[0];
|
|
|
|
|
|
|
|
tdn->h1[0] = h1_new;
|
|
|
|
tdn->h2[0] += delta;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case SACTSNAP_MARKER: /* snap to nearest marker */
|
|
|
|
{
|
|
|
|
tdn->h1[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]);
|
|
|
|
tdn->h2[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]);
|
|
|
|
break;
|
|
|
|
}
|
2014-04-25 02:52:27 +12:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
|
2013-01-21 06:31:17 +00:00
|
|
|
/* Use RNA to write the values to ensure that constraints on these are obeyed
|
2016-07-08 00:48:03 +10:00
|
|
|
* (e.g. for transition strips, the values are taken from the neighbors)
|
2013-01-21 06:31:17 +00:00
|
|
|
*
|
|
|
|
* NOTE: we write these twice to avoid truncation errors which can arise when
|
|
|
|
* moving the strips a large distance using numeric input [#33852]
|
|
|
|
*/
|
2011-07-22 07:25:52 +00:00
|
|
|
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
|
|
|
|
|
|
|
|
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
|
|
|
|
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
|
|
|
|
|
2013-01-21 06:31:17 +00:00
|
|
|
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
|
|
|
|
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
|
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* flush transforms to child strips (since this should be a meta) */
|
|
|
|
BKE_nlameta_flush_transforms(strip);
|
|
|
|
|
|
|
|
|
|
|
|
/* now, check if we need to try and move track
|
|
|
|
* - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
|
|
|
|
*/
|
2012-06-10 19:59:02 +00:00
|
|
|
delta_y1 = ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
|
|
|
|
delta_y2 = ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex);
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
if (delta_y1 || delta_y2) {
|
|
|
|
NlaTrack *track;
|
|
|
|
int delta = (delta_y2) ? delta_y2 : delta_y1;
|
|
|
|
int n;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* move in the requested direction, checking at each layer if there's space for strip to pass through,
|
|
|
|
* stopping on the last track available or that we're able to fit in
|
2009-07-07 05:41:59 +00:00
|
|
|
*/
|
2011-07-22 07:25:52 +00:00
|
|
|
if (delta > 0) {
|
2012-06-10 19:59:02 +00:00
|
|
|
for (track = tdn->nlt->next, n = 0; (track) && (n < delta); track = track->next, n++) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* check if space in this track for the strip */
|
|
|
|
if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
|
|
|
|
/* move strip to this track */
|
|
|
|
BLI_remlink(&tdn->nlt->strips, strip);
|
|
|
|
BKE_nlatrack_add_strip(track, strip);
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
tdn->nlt = track;
|
2011-07-22 07:25:52 +00:00
|
|
|
tdn->trackIndex++;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else /* can't move any further */
|
|
|
|
break;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* make delta 'positive' before using it, since we now know to go backwards */
|
2012-06-10 19:59:02 +00:00
|
|
|
delta = -delta;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* check if space in this track for the strip */
|
|
|
|
if (BKE_nlatrack_has_space(track, strip->start, strip->end)) {
|
|
|
|
/* move strip to this track */
|
|
|
|
BLI_remlink(&tdn->nlt->strips, strip);
|
|
|
|
BKE_nlatrack_add_strip(track, strip);
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
tdn->nlt = track;
|
2011-07-22 07:25:52 +00:00
|
|
|
tdn->trackIndex--;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else /* can't move any further */
|
|
|
|
break;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
2009-07-07 02:12:50 +00:00
|
|
|
}
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
|
2012-07-25 19:36:59 +00:00
|
|
|
static void recalcData_mask_common(TransInfo *t)
|
|
|
|
{
|
|
|
|
Mask *mask = CTX_data_edit_mask(t->context);
|
|
|
|
|
|
|
|
flushTransMasking(t);
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&mask->id, 0);
|
2012-07-25 19:36:59 +00:00
|
|
|
}
|
|
|
|
|
2011-11-08 06:09:16 +00:00
|
|
|
/* helper for recalcData() - for Image Editor transforms */
|
|
|
|
static void recalcData_image(TransInfo *t)
|
|
|
|
{
|
2012-08-03 20:12:49 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
recalcData_mask_common(t);
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
flushTransPaintCurve(t);
|
|
|
|
}
|
2012-08-03 20:12:49 +00:00
|
|
|
else if (t->obedit && t->obedit->type == OB_MESH) {
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
2011-11-08 06:09:16 +00:00
|
|
|
|
|
|
|
flushTransUVs(t);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sima->flag & SI_LIVE_UNWRAP)
|
2011-11-08 06:09:16 +00:00
|
|
|
ED_uvedit_live_unwrap_re_solve();
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(t->obedit->data, 0);
|
2011-11-08 06:09:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* helper for recalcData() - for Movie Clip transforms */
|
2012-04-29 12:32:26 +00:00
|
|
|
static void recalcData_spaceclip(TransInfo *t)
|
2011-11-08 06:09:16 +00:00
|
|
|
{
|
2012-03-25 23:19:21 +00:00
|
|
|
SpaceClip *sc = t->sa->spacedata.first;
|
2012-04-29 12:32:26 +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-15 11:03:23 +00:00
|
|
|
ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
|
2012-06-04 16:42:58 +00:00
|
|
|
MovieTrackingTrack *track;
|
2012-06-20 10:42:41 +00:00
|
|
|
int framenr = ED_space_clip_get_clip_frame_number(sc);
|
2012-04-29 12:32:26 +00:00
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
flushTransTracking(t);
|
2012-04-29 12:32:26 +00:00
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
track = tracksbase->first;
|
|
|
|
while (track) {
|
2012-06-10 19:59:02 +00:00
|
|
|
if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {
|
2012-06-15 11:03:23 +00:00
|
|
|
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
|
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
|
|
|
|
2012-06-04 16:42:58 +00:00
|
|
|
if (t->mode == TFM_TRANSLATION) {
|
|
|
|
if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_marker_clamp(marker, CLAMP_PAT_POS);
|
2012-06-04 16:42:58 +00:00
|
|
|
if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_POS);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
|
|
|
else if (t->mode == TFM_RESIZE) {
|
|
|
|
if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM);
|
2012-06-04 16:42:58 +00:00
|
|
|
if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM);
|
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->mode == TFM_ROTATION) {
|
|
|
|
if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
|
2012-06-15 11:03:23 +00:00
|
|
|
BKE_tracking_marker_clamp(marker, CLAMP_PAT_POS);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
2011-11-08 06:09:16 +00:00
|
|
|
}
|
2012-06-04 16:42:58 +00:00
|
|
|
|
|
|
|
track = track->next;
|
2011-11-08 06:09:16 +00:00
|
|
|
}
|
2012-04-29 12:32:26 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&clip->id, 0);
|
2011-11-08 06:09:16 +00:00
|
|
|
}
|
2012-07-25 19:36:59 +00:00
|
|
|
else if (t->options & CTX_MASK) {
|
|
|
|
recalcData_mask_common(t);
|
2012-06-04 16:42:58 +00:00
|
|
|
}
|
2011-11-08 06:09:16 +00:00
|
|
|
}
|
|
|
|
|
2014-02-12 17:00:46 +01:00
|
|
|
/* helper for recalcData() - for object transforms, typically in the 3D view */
|
|
|
|
static void recalcData_objects(TransInfo *t)
|
2011-07-22 07:25:52 +00:00
|
|
|
{
|
2017-04-11 16:09:30 +02:00
|
|
|
Base *base = t->scene_layer->basact;
|
2017-07-21 11:53:13 +02:00
|
|
|
EvaluationContext eval_ctx;
|
|
|
|
|
|
|
|
CTX_data_eval_ctx(t->context, &eval_ctx);
|
2016-12-28 17:30:58 +01:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
if (t->obedit) {
|
2012-03-25 22:35:18 +00:00
|
|
|
if (ELEM(t->obedit->type, OB_CURVE, OB_SURF)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
Curve *cu = t->obedit->data;
|
|
|
|
ListBase *nurbs = BKE_curve_editNurbs_get(cu);
|
|
|
|
Nurb *nu = nurbs->first;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
clipMirrorModifier(t, t->obedit);
|
|
|
|
applyProject(t);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
2012-03-24 06:38:07 +00:00
|
|
|
while (nu) {
|
2012-04-28 16:49:00 +00:00
|
|
|
BKE_nurb_handles_calc(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
|
2012-06-10 19:59:02 +00:00
|
|
|
nu = nu->next;
|
2010-03-29 09:29:50 +00:00
|
|
|
}
|
2012-10-21 05:46:41 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else {
|
|
|
|
/* Normal updating */
|
2012-03-24 06:38:07 +00:00
|
|
|
while (nu) {
|
2012-04-28 16:49:00 +00:00
|
|
|
BKE_nurb_test2D(nu);
|
|
|
|
BKE_nurb_handles_calc(nu);
|
2012-06-10 19:59:02 +00:00
|
|
|
nu = nu->next;
|
2009-02-11 23:02:21 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->obedit->type == OB_LATTICE) {
|
|
|
|
Lattice *la = t->obedit->data;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
applyProject(t);
|
2009-02-11 23:02:21 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
else if (t->obedit->type == OB_MESH) {
|
2013-04-16 05:59:48 +00:00
|
|
|
BMEditMesh *em = BKE_editmesh_from_object(t->obedit);
|
2011-07-22 07:25:52 +00:00
|
|
|
/* mirror modifier clipping? */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* apply clipping after so we never project past the clip plane [#25423] */
|
|
|
|
applyProject(t);
|
|
|
|
clipMirrorModifier(t, t->obedit);
|
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if ((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
|
2011-09-01 00:35:30 +00:00
|
|
|
editbmesh_apply_to_mirror(t);
|
2015-07-21 14:15:31 +10:00
|
|
|
|
|
|
|
if (t->mode == TFM_EDGE_SLIDE) {
|
|
|
|
projectEdgeSlideData(t, false);
|
|
|
|
}
|
|
|
|
else if (t->mode == TFM_VERT_SLIDE) {
|
|
|
|
projectVertSlideData(t, false);
|
|
|
|
}
|
|
|
|
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2012-03-27 04:46:52 +00:00
|
|
|
EDBM_mesh_normals_update(em);
|
2013-04-16 05:59:48 +00:00
|
|
|
BKE_editmesh_tessface_calc(em);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->obedit->type == OB_ARMATURE) { /* no recalc flag, does pose */
|
|
|
|
bArmature *arm = t->obedit->data;
|
2011-07-22 07:25:52 +00:00
|
|
|
ListBase *edbo = arm->edbo;
|
2014-10-22 11:11:52 +02:00
|
|
|
EditBone *ebo, *ebo_parent;
|
2011-07-22 07:25:52 +00:00
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
applyProject(t);
|
2009-01-08 17:12:50 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
/* Ensure all bones are correctly adjusted */
|
2012-02-23 02:23:42 +00:00
|
|
|
for (ebo = edbo->first; ebo; ebo = ebo->next) {
|
2014-10-22 11:11:52 +02:00
|
|
|
ebo_parent = (ebo->flag & BONE_CONNECTED) ? ebo->parent : NULL;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2014-10-22 11:11:52 +02:00
|
|
|
if (ebo_parent) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* If this bone has a parent tip that has been moved */
|
2014-10-22 11:11:52 +02:00
|
|
|
if (ebo_parent->flag & BONE_TIPSEL) {
|
|
|
|
copy_v3_v3(ebo->head, ebo_parent->tail);
|
|
|
|
if (t->mode == TFM_BONE_ENVELOPE) ebo->rad_head = ebo_parent->rad_tail;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-07-22 07:25:52 +00:00
|
|
|
/* If this bone has a parent tip that has NOT been moved */
|
2012-03-24 06:38:07 +00:00
|
|
|
else {
|
2014-10-22 11:11:52 +02:00
|
|
|
copy_v3_v3(ebo_parent->tail, ebo->head);
|
|
|
|
if (t->mode == TFM_BONE_ENVELOPE) ebo_parent->rad_tail = ebo->rad_head;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
|
2012-06-10 19:59:02 +00:00
|
|
|
ebo->length = len_v3v3(ebo->head, ebo->tail);
|
|
|
|
if (ebo->oldlength == 0.0f) {
|
|
|
|
ebo->rad_head = 0.25f * ebo->length;
|
|
|
|
ebo->rad_tail = 0.10f * ebo->length;
|
|
|
|
ebo->dist = 0.25f * ebo->length;
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ebo->parent) {
|
|
|
|
if (ebo->rad_head > ebo->parent->rad_tail)
|
2012-06-10 19:59:02 +00:00
|
|
|
ebo->rad_head = ebo->parent->rad_tail;
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->mode != TFM_BONE_ENVELOPE) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* if bones change length, lets do that for the deform distance as well */
|
2012-06-10 19:59:02 +00:00
|
|
|
ebo->dist *= ebo->length / ebo->oldlength;
|
|
|
|
ebo->rad_head *= ebo->length / ebo->oldlength;
|
|
|
|
ebo->rad_tail *= ebo->length / ebo->oldlength;
|
|
|
|
ebo->oldlength = ebo->length;
|
2015-04-01 17:07:04 +11:00
|
|
|
|
|
|
|
if (ebo_parent) {
|
|
|
|
ebo_parent->rad_tail = ebo->rad_head;
|
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 12:30:30 +02:00
|
|
|
if (!ELEM(t->mode, TFM_BONE_ROLL, TFM_BONE_ENVELOPE, TFM_BONE_ENVELOPE_DIST, TFM_BONESIZE)) {
|
2011-07-22 07:25:52 +00:00
|
|
|
/* fix roll */
|
2012-04-28 06:31:57 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
|
|
|
if (td->extra) {
|
2014-02-28 10:35:11 +01:00
|
|
|
float vec[3], up_axis[3];
|
|
|
|
float qrot[4];
|
|
|
|
float roll;
|
|
|
|
|
2014-02-22 11:12:44 +01:00
|
|
|
ebo = td->extra;
|
2014-02-26 21:28:11 +01:00
|
|
|
|
2014-02-28 10:35:11 +01:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
/* restore roll */
|
2014-02-27 09:47:37 +11:00
|
|
|
ebo->roll = td->ival;
|
2014-02-26 21:28:11 +01:00
|
|
|
}
|
|
|
|
else {
|
2014-02-28 10:35:11 +01:00
|
|
|
copy_v3_v3(up_axis, td->axismtx[2]);
|
2014-02-28 10:47:28 +01:00
|
|
|
|
|
|
|
sub_v3_v3v3(vec, ebo->tail, ebo->head);
|
|
|
|
normalize_v3(vec);
|
|
|
|
rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
|
|
|
|
mul_qt_v3(qrot, up_axis);
|
|
|
|
|
2014-02-28 10:35:11 +01:00
|
|
|
/* roll has a tendency to flip in certain orientations - [#34283], [#33974] */
|
|
|
|
roll = ED_rollBoneToVector(ebo, up_axis, false);
|
|
|
|
ebo->roll = angle_compat_rad(roll, td->ival);
|
2014-02-26 21:28:11 +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
|
|
|
}
|
|
|
|
}
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
|
2014-07-09 19:58:48 +03:00
|
|
|
if (arm->flag & ARM_MIRROR_EDIT) {
|
|
|
|
if (t->state != TRANS_CANCEL)
|
|
|
|
transform_armature_mirror_update(t->obedit);
|
|
|
|
else
|
|
|
|
restoreBones(t);
|
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
applyProject(t);
|
2010-11-14 16:31:06 +00:00
|
|
|
}
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
2012-06-10 22:13:17 +00:00
|
|
|
else if ((t->flag & T_POSE) && t->poseobj) {
|
2012-06-10 19:59:02 +00:00
|
|
|
Object *ob = t->poseobj;
|
|
|
|
bArmature *arm = ob->data;
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
/* if animtimer is running, and the object already has animation data,
|
|
|
|
* check if the auto-record feature means that we should record 'samples'
|
|
|
|
* (i.e. uneditable animation values)
|
|
|
|
*
|
|
|
|
* context is needed for keying set poll() functions.
|
|
|
|
*/
|
|
|
|
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
|
|
|
if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
|
2012-06-10 19:59:02 +00:00
|
|
|
int targetless_ik = (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
|
2011-07-22 07:25:52 +00:00
|
|
|
|
|
|
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
|
|
|
autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* old optimize trick... this enforces to bypass the depgraph */
|
|
|
|
if (!(arm->flag & ARM_DELAYDEFORM)) {
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
|
2012-12-29 19:43:08 +00:00
|
|
|
/* transformation of pose may affect IK tree, make sure it is rebuilt */
|
|
|
|
BIK_clear_data(ob->pose);
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else
|
2017-07-21 11:53:13 +02:00
|
|
|
BKE_pose_where_is(&eval_ctx, t->scene, ob);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2017-04-11 16:09:30 +02:00
|
|
|
else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, t->scene_layer, base->object)) {
|
2016-12-28 17:30:58 +01:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
|
|
|
flushTransParticles(t);
|
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
else {
|
|
|
|
int i;
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->state != TRANS_CANCEL) {
|
2011-07-22 07:25:52 +00:00
|
|
|
applyProject(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < t->total; i++) {
|
|
|
|
TransData *td = t->data + i;
|
|
|
|
Object *ob = td->ob;
|
|
|
|
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2009-11-01 00:06:53 +00:00
|
|
|
/* if animtimer is running, and the object already has animation data,
|
|
|
|
* check if the auto-record feature means that we should record 'samples'
|
|
|
|
* (i.e. uneditable animation values)
|
|
|
|
*/
|
|
|
|
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
2011-07-22 07:25:52 +00:00
|
|
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
2009-11-01 00:06:53 +00:00
|
|
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
2017-04-11 16:09:30 +02:00
|
|
|
autokeyframe_ob_cb_func(t->context, t->scene, t->scene_layer, (View3D *)t->view, ob, t->mode);
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
2009-07-31 07:43:47 +00:00
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* sets recalc flags fully, instead of flushing existing ones
|
|
|
|
* otherwise proxies don't function correctly
|
|
|
|
*/
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&ob->id, OB_RECALC_OB);
|
2013-06-10 13:01:41 +00:00
|
|
|
|
2013-06-13 11:59:28 +00:00
|
|
|
if (t->flag & T_TEXTURE)
|
2017-06-08 10:14:53 +02:00
|
|
|
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
2009-01-24 10:03:19 +00:00
|
|
|
}
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
}
|
2010-11-14 16:31:06 +00:00
|
|
|
|
2012-08-21 10:42:21 +00:00
|
|
|
/* helper for recalcData() - for sequencer transforms */
|
|
|
|
static void recalcData_sequencer(TransInfo *t)
|
|
|
|
{
|
2012-10-04 18:30:28 +00:00
|
|
|
TransData *td;
|
|
|
|
int a;
|
|
|
|
Sequence *seq_prev = NULL;
|
2012-09-13 10:51:13 +00:00
|
|
|
|
2012-10-04 18:30:28 +00:00
|
|
|
for (a = 0, td = t->data; a < t->total; a++, td++) {
|
|
|
|
TransDataSeq *tdsq = (TransDataSeq *) td->extra;
|
|
|
|
Sequence *seq = tdsq->seq;
|
|
|
|
|
|
|
|
if (seq != seq_prev) {
|
2015-11-20 17:33:53 +01:00
|
|
|
if (BKE_sequence_tx_fullupdate_test(seq)) {
|
|
|
|
/* A few effect strip types need a complete recache on transform. */
|
|
|
|
BKE_sequence_invalidate_cache(t->scene, seq);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
BKE_sequence_invalidate_dependent(t->scene, seq);
|
|
|
|
}
|
2012-09-13 10:51:18 +00:00
|
|
|
}
|
2012-10-04 18:30:28 +00:00
|
|
|
|
|
|
|
seq_prev = seq;
|
2012-09-13 10:51:13 +00:00
|
|
|
}
|
|
|
|
|
2012-08-21 10:42:21 +00:00
|
|
|
BKE_sequencer_preprocessed_cache_cleanup();
|
|
|
|
|
|
|
|
flushTransSeq(t);
|
|
|
|
}
|
|
|
|
|
2016-04-29 01:10:33 +12:00
|
|
|
/* force recalculation of triangles during transformation */
|
|
|
|
static void recalcData_gpencil_strokes(TransInfo *t)
|
2017-06-12 13:35:00 +10:00
|
|
|
{
|
2016-04-29 01:10:33 +12:00
|
|
|
TransData *td = t->data;
|
|
|
|
for (int i = 0; i < t->total; i++, td++) {
|
|
|
|
bGPDstroke *gps = td->extra;
|
2016-08-03 23:31:48 +02:00
|
|
|
if (gps != NULL) {
|
|
|
|
gps->flag |= GP_STROKE_RECALC_CACHES;
|
|
|
|
}
|
2016-04-29 01:10:33 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-22 07:25:52 +00:00
|
|
|
/* called for updating while transform acts, once per redraw */
|
|
|
|
void recalcData(TransInfo *t)
|
|
|
|
{
|
2014-02-12 17:00:46 +01:00
|
|
|
/* if tests must match createTransData for correct updates */
|
|
|
|
if (t->options & CTX_TEXTURE) {
|
|
|
|
recalcData_objects(t);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2014-02-12 17:00:46 +01:00
|
|
|
else if (t->options & CTX_EDGE) {
|
|
|
|
recalcData_objects(t);
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
flushTransPaintCurve(t);
|
|
|
|
}
|
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
|
|
|
else if (t->options & CTX_GPENCIL_STROKES) {
|
2016-04-29 01:10:33 +12:00
|
|
|
/* set recalc triangle cache flag */
|
|
|
|
recalcData_gpencil_strokes(t);
|
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
|
|
|
}
|
2014-02-12 17:00:46 +01:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
recalcData_image(t);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
|
|
|
recalcData_actedit(t);
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
|
|
|
recalcData_nla(t);
|
|
|
|
}
|
2014-02-12 17:00:46 +01:00
|
|
|
else if (t->spacetype == SPACE_SEQ) {
|
|
|
|
recalcData_sequencer(t);
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
2014-02-12 17:00:46 +01:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
recalcData_graphedit(t);
|
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
|
|
|
flushTransNodes(t);
|
2011-07-22 07:25:52 +00:00
|
|
|
}
|
2011-11-07 12:55:18 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2012-04-29 12:32:26 +00:00
|
|
|
recalcData_spaceclip(t);
|
2011-11-07 12:55:18 +00:00
|
|
|
}
|
2014-02-12 17:00:46 +01:00
|
|
|
else {
|
|
|
|
recalcData_objects(t);
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2012-08-05 20:40:26 +00:00
|
|
|
void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 v1[3], v2[3], v3[3];
|
2010-12-20 03:59:22 +00:00
|
|
|
unsigned char col[3], col2[3];
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2009-01-10 18:33:16 +00:00
|
|
|
View3D *v3d = t->view;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2017-03-21 17:49:21 -04:00
|
|
|
gpuPushMatrix();
|
|
|
|
|
2017-04-15 01:29:25 -04:00
|
|
|
// if (t->obedit) gpuLoadMatrix(t->obedit->obmat); // sets opengl viewing
|
2017-03-21 17:49:21 -04:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(v3, dir);
|
|
|
|
mul_v3_fl(v3, v3d->far);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(v2, center, v3);
|
|
|
|
add_v3_v3v3(v1, center, v3);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
if (options & DRAWLIGHT) {
|
|
|
|
col[0] = col[1] = col[2] = 220;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
UI_GetThemeColor3ubv(TH_GRID, col);
|
|
|
|
}
|
2009-05-23 03:24:15 +00:00
|
|
|
UI_make_axis_color(col, col2, axis);
|
2017-01-26 12:13:50 -02:00
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
|
2017-01-26 12:13:50 -02:00
|
|
|
|
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
|
|
|
immUniformColor3ubv(col2);
|
|
|
|
|
2017-06-19 20:18:04 +10:00
|
|
|
immBegin(GWN_PRIM_LINES, 2);
|
2017-01-26 12:13:50 -02:00
|
|
|
immVertex3fv(pos, v1);
|
|
|
|
immVertex3fv(pos, v2);
|
|
|
|
immEnd();
|
|
|
|
|
|
|
|
immUnbindProgram();
|
|
|
|
|
2017-03-21 17:49:21 -04:00
|
|
|
gpuPopMatrix();
|
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
|
|
|
}
|
|
|
|
|
2013-04-24 15:15:01 +00:00
|
|
|
/**
|
|
|
|
* Free data before switching to another mode.
|
|
|
|
*/
|
|
|
|
void resetTransModal(TransInfo *t)
|
|
|
|
{
|
|
|
|
if (t->mode == TFM_EDGE_SLIDE) {
|
2016-02-01 15:15:10 +11:00
|
|
|
freeEdgeSlideVerts(t, &t->custom.mode);
|
2013-04-24 15:15:01 +00:00
|
|
|
}
|
|
|
|
else if (t->mode == TFM_VERT_SLIDE) {
|
2016-02-01 15:15:10 +11:00
|
|
|
freeVertSlideVerts(t, &t->custom.mode);
|
2013-04-24 15:15:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 resetTransRestrictions(TransInfo *t)
|
|
|
|
{
|
|
|
|
t->flag &= ~T_ALL_RESTRICTIONS;
|
|
|
|
}
|
|
|
|
|
2013-06-20 13:24:07 +00:00
|
|
|
static int initTransInfo_edit_pet_to_flag(const int proportional)
|
|
|
|
{
|
|
|
|
switch (proportional) {
|
|
|
|
case PROP_EDIT_ON:
|
|
|
|
return T_PROP_EDIT;
|
|
|
|
case PROP_EDIT_CONNECTED:
|
|
|
|
return T_PROP_EDIT | T_PROP_CONNECTED;
|
|
|
|
case PROP_EDIT_PROJECTED:
|
|
|
|
return T_PROP_EDIT | T_PROP_PROJECTED;
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-25 07:49:49 +11:00
|
|
|
/**
|
|
|
|
* Setup internal data, mouse, vectors
|
|
|
|
*
|
|
|
|
* \note \a op and \a event can be NULL
|
2015-05-25 15:45:56 +10:00
|
|
|
*
|
|
|
|
* \see #saveTransform does the reverse.
|
2013-11-25 07:49:49 +11:00
|
|
|
*/
|
|
|
|
void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, 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
|
|
|
{
|
|
|
|
Scene *sce = CTX_data_scene(C);
|
2017-02-08 12:26:41 +01:00
|
|
|
SceneLayer *sl = CTX_data_scene_layer(C);
|
2009-06-23 00:41:55 +00:00
|
|
|
ToolSettings *ts = CTX_data_tool_settings(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
|
|
|
ARegion *ar = CTX_wm_region(C);
|
|
|
|
ScrArea *sa = CTX_wm_area(C);
|
2008-12-31 17:11:42 +00:00
|
|
|
Object *obedit = CTX_data_edit_object(C);
|
2014-07-21 12:02:05 +02:00
|
|
|
Object *ob = CTX_data_active_object(C);
|
2015-12-13 21:03:13 +13:00
|
|
|
bGPdata *gpd = CTX_data_gpencil_data(C);
|
2013-06-16 04:37:39 +00:00
|
|
|
PropertyRNA *prop;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->scene = sce;
|
2017-04-11 16:09:30 +02:00
|
|
|
t->scene_layer = sl;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->sa = sa;
|
|
|
|
t->ar = ar;
|
2008-12-31 22:43:29 +00:00
|
|
|
t->obedit = obedit;
|
2009-06-23 00:41:55 +00:00
|
|
|
t->settings = ts;
|
2013-08-20 06:04:46 +00:00
|
|
|
t->reports = op ? op->reports : NULL;
|
2013-04-12 02:16:44 +00:00
|
|
|
|
|
|
|
if (obedit) {
|
|
|
|
copy_m3_m4(t->obedit_mat, obedit->obmat);
|
|
|
|
normalize_m3(t->obedit_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
|
|
|
t->data = NULL;
|
|
|
|
t->ext = NULL;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-05-23 03:24:15 +00:00
|
|
|
t->helpline = HLP_NONE;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag = 0;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2013-10-23 06:48:36 +00:00
|
|
|
t->redraw = TREDRAW_HARD; /* redraw first time */
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (event) {
|
2015-10-30 00:09:25 +11:00
|
|
|
t->mouse.imval[0] = event->mval[0];
|
|
|
|
t->mouse.imval[1] = event->mval[1];
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2015-10-28 22:56:09 +11:00
|
|
|
t->mouse.imval[0] = 0;
|
|
|
|
t->mouse.imval[1] = 0;
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2015-10-28 22:56:09 +11:00
|
|
|
t->con.imval[0] = t->mouse.imval[0];
|
|
|
|
t->con.imval[1] = t->mouse.imval[1];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2015-10-28 22:56:09 +11:00
|
|
|
t->mval[0] = t->mouse.imval[0];
|
|
|
|
t->mval[1] = t->mouse.imval[1];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->transform = NULL;
|
|
|
|
t->handleEvent = NULL;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
t->total = 0;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->val = 0.0f;
|
2012-06-10 19:59:02 +00:00
|
|
|
|
2012-08-05 20:40:26 +00:00
|
|
|
zero_v3(t->vec);
|
|
|
|
zero_v3(t->center);
|
2015-06-26 16:19:39 +10:00
|
|
|
zero_v3(t->center_global);
|
2012-08-05 20:40:26 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->mat);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-11-27 16:15:34 +00:00
|
|
|
/* if there's an event, we're modal */
|
|
|
|
if (event) {
|
|
|
|
t->flag |= T_MODAL;
|
|
|
|
}
|
|
|
|
|
2010-01-09 20:42:35 +00:00
|
|
|
/* Crease needs edge flag */
|
2012-05-12 23:07:52 +00:00
|
|
|
if (ELEM(t->mode, TFM_CREASE, TFM_BWEIGHT)) {
|
2010-01-09 20:42:35 +00:00
|
|
|
t->options |= CTX_EDGE;
|
|
|
|
}
|
|
|
|
|
2013-09-17 13:07:48 +00:00
|
|
|
t->remove_on_cancel = false;
|
2013-09-17 16:12:05 +00:00
|
|
|
|
|
|
|
if (op && (prop = RNA_struct_find_property(op->ptr, "remove_on_cancel")) && RNA_property_is_set(op->ptr, prop)) {
|
2013-09-17 13:07:48 +00:00
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
|
|
|
t->remove_on_cancel = true;
|
|
|
|
}
|
|
|
|
}
|
2015-12-13 21:03:13 +13:00
|
|
|
|
|
|
|
/* GPencil editing context */
|
|
|
|
if ((gpd) && (gpd->flag & GP_DATA_STROKE_EDITMODE)) {
|
|
|
|
t->options |= CTX_GPENCIL_STROKES;
|
|
|
|
}
|
2011-04-19 04:19:09 +00:00
|
|
|
|
|
|
|
/* Assign the space type, some exceptions for running in different mode */
|
2012-03-24 06:38:07 +00:00
|
|
|
if (sa == NULL) {
|
2011-04-19 04:19:09 +00:00
|
|
|
/* background mode */
|
2012-06-10 19:59:02 +00:00
|
|
|
t->spacetype = SPACE_EMPTY;
|
2011-04-19 04:19:09 +00:00
|
|
|
}
|
|
|
|
else if ((ar == NULL) && (sa->spacetype == SPACE_VIEW3D)) {
|
|
|
|
/* running in the text editor */
|
2012-06-10 19:59:02 +00:00
|
|
|
t->spacetype = SPACE_EMPTY;
|
2011-04-19 04:19:09 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* normal operation */
|
2012-06-10 19:59:02 +00:00
|
|
|
t->spacetype = sa->spacetype;
|
2011-04-19 04:19:09 +00:00
|
|
|
}
|
|
|
|
|
2015-05-25 15:45:56 +10:00
|
|
|
/* handle T_ALT_TRANSFORM initialization, we may use for different operators */
|
|
|
|
if (op) {
|
|
|
|
const char *prop_id = NULL;
|
|
|
|
if (t->mode == TFM_SHRINKFATTEN) {
|
|
|
|
prop_id = "use_even_offset";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id)) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop))
|
|
|
|
{
|
|
|
|
BKE_BIT_TEST_SET(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM);
|
|
|
|
}
|
|
|
|
}
|
2011-04-19 04:19:09 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
View3D *v3d = sa->spacedata.first;
|
2012-05-25 12:56:29 +00:00
|
|
|
bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C));
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->view = v3d;
|
2012-06-10 19:59:02 +00:00
|
|
|
t->animtimer = (animscreen) ? animscreen->animtimer : NULL;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-12-17 17:50:55 +00:00
|
|
|
/* turn manipulator off during transform */
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
t->twtype = v3d->twtype;
|
|
|
|
v3d->twtype = 0;
|
|
|
|
}
|
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (v3d->flag & V3D_ALIGN) t->flag |= T_V3D_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
|
|
|
t->around = v3d->around;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2013-11-20 12:14:10 +11:00
|
|
|
/* bend always uses the cursor */
|
|
|
|
if (t->mode == TFM_BEND) {
|
2015-12-01 18:52:24 +11:00
|
|
|
t->around = V3D_AROUND_CURSOR;
|
2013-10-13 01:09:23 +00:00
|
|
|
}
|
|
|
|
|
2015-09-09 02:05:10 +10:00
|
|
|
t->current_orientation = v3d->twmode;
|
2017-06-01 20:41:18 +02:00
|
|
|
t->custom_orientation = BKE_workspace_transform_orientation_find(
|
|
|
|
CTX_wm_workspace(C), v3d->custom_orientation_index);
|
2011-01-10 06:00:56 +00:00
|
|
|
|
|
|
|
/* exceptional case */
|
2015-12-01 18:52:24 +11:00
|
|
|
if (t->around == V3D_AROUND_LOCAL_ORIGINS) {
|
2014-07-20 01:30:29 +10:00
|
|
|
if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
|
2014-11-27 21:37:42 +01:00
|
|
|
const bool use_island = transdata_check_local_islands(t, t->around);
|
|
|
|
|
2015-02-25 13:39:01 +11:00
|
|
|
if (obedit && !use_island) {
|
2014-11-27 21:37:42 +01:00
|
|
|
t->options |= CTX_NO_PET;
|
|
|
|
}
|
2011-01-10 06:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
2011-08-03 08:02:32 +00:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
if (ob && ob->mode & OB_MODE_ALL_PAINT) {
|
|
|
|
Paint *p = BKE_paint_get_active_from_context(C);
|
|
|
|
if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
|
|
|
|
t->options |= CTX_PAINT_CURVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-03 08:02:32 +00:00
|
|
|
/* initialize UV transform from */
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "correct_uv")))) {
|
|
|
|
if (RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
2011-08-03 08:02:32 +00:00
|
|
|
t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->settings->uvcalc_flag &= ~UVCALC_TRANSFORM_CORRECT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2015-02-19 12:33:14 +11:00
|
|
|
RNA_property_boolean_set(op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) != 0);
|
2011-08-03 08:02:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2009-06-23 00:45:41 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2011-05-02 05:24:59 +00:00
|
|
|
// XXX for now, get View2D from the active region
|
|
|
|
t->view = &ar->v2d;
|
|
|
|
t->around = sima->around;
|
2012-07-25 16:03:08 +00:00
|
|
|
|
2012-08-03 20:12:49 +00:00
|
|
|
if (ED_space_image_show_uvedit(sima, t->obedit)) {
|
2012-07-25 16:03:08 +00:00
|
|
|
/* UV transform */
|
|
|
|
}
|
|
|
|
else if (sima->mode == SI_MODE_MASK) {
|
|
|
|
t->options |= CTX_MASK;
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (sima->mode == SI_MODE_PAINT) {
|
|
|
|
Paint *p = &sce->toolsettings->imapaint.paint;
|
|
|
|
if (p->brush && (p->brush->flag & BRUSH_CURVE)) {
|
|
|
|
t->options |= CTX_PAINT_CURVE;
|
|
|
|
}
|
2012-07-25 16:03:08 +00:00
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
/* image not in uv edit, nor in mask mode, can happen for some tools */
|
2011-05-02 05:24:59 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_NODE) {
|
2011-05-02 05:24:59 +00:00
|
|
|
// XXX for now, get View2D from the active region
|
2009-01-28 21:43:43 +00:00
|
|
|
t->view = &ar->v2d;
|
2015-12-01 18:52:24 +11:00
|
|
|
t->around = V3D_AROUND_CENTER_BOUNDS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
SpaceIpo *sipo = sa->spacedata.first;
|
2009-11-01 00:06:53 +00:00
|
|
|
t->view = &ar->v2d;
|
|
|
|
t->around = sipo->around;
|
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
2012-05-30 07:38:33 +00:00
|
|
|
SpaceClip *sclip = sa->spacedata.first;
|
2012-06-01 11:03:44 +00:00
|
|
|
t->view = &ar->v2d;
|
2012-06-04 16:42:58 +00:00
|
|
|
t->around = sclip->around;
|
2012-05-30 07:38:33 +00:00
|
|
|
|
2012-06-19 14:26:29 +00:00
|
|
|
if (ED_space_clip_check_show_trackedit(sclip))
|
2012-05-30 07:38:33 +00:00
|
|
|
t->options |= CTX_MOVIECLIP;
|
2012-06-19 14:26:29 +00:00
|
|
|
else if (ED_space_clip_check_show_maskedit(sclip))
|
2012-06-04 16:42:58 +00:00
|
|
|
t->options |= CTX_MASK;
|
2012-05-30 07:38:33 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2012-03-24 06:38:07 +00:00
|
|
|
if (ar) {
|
2011-05-18 09:58:17 +00:00
|
|
|
// XXX for now, get View2D from the active region
|
|
|
|
t->view = &ar->v2d;
|
|
|
|
// XXX for now, the center point is the midpoint of the data
|
|
|
|
}
|
|
|
|
else {
|
2012-06-10 19:59:02 +00:00
|
|
|
t->view = NULL;
|
2011-05-18 09:58:17 +00:00
|
|
|
}
|
2015-12-01 18:52:24 +11:00
|
|
|
t->around = V3D_AROUND_CENTER_BOUNDS;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2015-09-09 02:05:10 +10:00
|
|
|
|
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)))
|
|
|
|
{
|
2017-06-01 20:41:18 +02:00
|
|
|
short orientation = RNA_property_enum_get(op->ptr, prop);
|
|
|
|
TransformOrientation *custom_orientation = NULL;
|
2015-09-09 02:05:10 +10:00
|
|
|
|
2017-06-01 20:41:18 +02:00
|
|
|
if (orientation >= V3D_MANIP_CUSTOM) {
|
|
|
|
if (orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C)) {
|
|
|
|
orientation = V3D_MANIP_GLOBAL;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
custom_orientation = BKE_workspace_transform_orientation_find(
|
|
|
|
CTX_wm_workspace(C), orientation - V3D_MANIP_CUSTOM);
|
|
|
|
orientation = V3D_MANIP_CUSTOM;
|
|
|
|
}
|
2015-09-09 02:05:10 +10:00
|
|
|
}
|
2017-06-01 20:41:18 +02:00
|
|
|
|
|
|
|
t->current_orientation = orientation;
|
|
|
|
t->custom_orientation = custom_orientation;
|
2015-09-09 02:05:10 +10:00
|
|
|
}
|
2017-06-01 20:41:18 +02:00
|
|
|
|
2017-08-28 16:00:28 +10:00
|
|
|
if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) && RNA_property_is_set(op->ptr, prop)) {
|
|
|
|
RNA_property_float_get_array(op->ptr, prop, t->center);
|
|
|
|
t->flag |= T_OVERRIDE_CENTER;
|
|
|
|
}
|
|
|
|
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "release_confirm")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)))
|
|
|
|
{
|
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->flag |= T_RELEASE_CONFIRM;
|
|
|
|
}
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
|
|
|
if (U.flag & USER_RELEASECONFIRM) {
|
2010-04-02 19:40:51 +00:00
|
|
|
t->flag |= T_RELEASE_CONFIRM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "mirror")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2013-06-16 04:37:39 +00:00
|
|
|
if (RNA_property_boolean_get(op->ptr, prop)) {
|
2009-03-06 15:50:15 +00:00
|
|
|
t->flag |= T_MIRROR;
|
2009-10-22 23:22:05 +00:00
|
|
|
t->mirror = 1;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Need stuff to take it from edit mesh or whatnot here
|
2012-03-07 04:53:43 +00:00
|
|
|
else if (t->spacetype == SPACE_VIEW3D) {
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X)) {
|
2009-03-06 15:50:15 +00:00
|
|
|
t->flag |= T_MIRROR;
|
2009-10-22 23:22:05 +00:00
|
|
|
t->mirror = 1;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
|
|
|
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && (prop = RNA_struct_find_property(op->ptr, "proportional"))) {
|
|
|
|
if (RNA_property_is_set(op->ptr, prop)) {
|
2013-06-20 13:24:07 +00:00
|
|
|
t->flag |= initTransInfo_edit_pet_to_flag(RNA_property_enum_get(op->ptr, prop));
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2009-11-27 16:15:34 +00:00
|
|
|
/* use settings from scene only if modal */
|
2012-03-06 18:40:15 +00:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
if ((t->options & CTX_NO_PET) == 0) {
|
2015-04-09 18:29:58 +02:00
|
|
|
if (t->spacetype == SPACE_IPO) {
|
2015-04-10 13:41:57 +10:00
|
|
|
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_fcurve);
|
2015-04-09 18:29:58 +02:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
|
|
|
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_action);
|
2015-04-01 11:24:26 +02:00
|
|
|
}
|
|
|
|
else if (t->obedit) {
|
2013-06-20 13:24:07 +00:00
|
|
|
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional);
|
2010-07-31 19:26:21 +00: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
|
|
|
else if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional);
|
|
|
|
}
|
2012-06-04 16:42:58 +00:00
|
|
|
else if (t->options & CTX_MASK) {
|
|
|
|
if (ts->proportional_mask) {
|
|
|
|
t->flag |= T_PROP_EDIT;
|
|
|
|
|
|
|
|
if (ts->proportional == PROP_EDIT_CONNECTED) {
|
|
|
|
t->flag |= T_PROP_CONNECTED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else if (t->obedit == NULL && ts->proportional_objects) {
|
2010-07-31 19:26:21 +00:00
|
|
|
t->flag |= T_PROP_EDIT;
|
|
|
|
}
|
2009-11-27 16:15:34 +00:00
|
|
|
}
|
2010-10-03 21:10:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)))
|
2010-10-03 21:10:59 +00:00
|
|
|
{
|
2013-06-16 04:37:39 +00:00
|
|
|
t->prop_size = RNA_property_float_get(op->ptr, prop);
|
2010-10-03 21:10:59 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2010-10-03 21:10:59 +00:00
|
|
|
t->prop_size = ts->proportional_size;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2010-10-03 21:10:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* TRANSFORM_FIX_ME rna restrictions */
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->prop_size <= 0.00001f) {
|
2012-10-20 20:36:51 +00:00
|
|
|
printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size);
|
2010-10-03 21:10:59 +00:00
|
|
|
t->prop_size = 1.0f;
|
|
|
|
}
|
|
|
|
|
2013-06-16 04:37:39 +00:00
|
|
|
if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) &&
|
|
|
|
RNA_property_is_set(op->ptr, prop)))
|
2010-10-03 21:10:59 +00:00
|
|
|
{
|
2013-06-16 04:37:39 +00:00
|
|
|
t->prop_mode = RNA_property_enum_get(op->ptr, prop);
|
2010-10-03 21:10:59 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2010-10-03 21:10:59 +00:00
|
|
|
t->prop_mode = ts->prop_mode;
|
|
|
|
}
|
|
|
|
}
|
2012-04-28 06:31:57 +00:00
|
|
|
else { /* add not pet option to context when not available */
|
2010-10-03 21:10:59 +00:00
|
|
|
t->options |= CTX_NO_PET;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2011-10-04 23:42:06 +00:00
|
|
|
// Mirror is not supported with PET, turn it off.
|
2013-06-20 18:19:42 +00:00
|
|
|
#if 0
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2011-10-04 23:42:06 +00:00
|
|
|
t->flag &= ~T_MIRROR;
|
|
|
|
}
|
2013-06-20 18:19:42 +00:00
|
|
|
#endif
|
2011-10-04 23:42:06 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
setTransformViewAspect(t, t->aspect);
|
2016-03-30 07:15:33 +11:00
|
|
|
setTransformViewMatrices(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
|
|
|
initNumInput(&t->num);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
|
2012-04-29 17:11:40 +00:00
|
|
|
void postTrans(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
|
|
|
{
|
|
|
|
TransData *td;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-11-01 00:06:53 +00:00
|
|
|
if (t->draw_handle_view)
|
|
|
|
ED_region_draw_cb_exit(t->ar->type, t->draw_handle_view);
|
2010-02-03 21:01:41 +00:00
|
|
|
if (t->draw_handle_apply)
|
|
|
|
ED_region_draw_cb_exit(t->ar->type, t->draw_handle_apply);
|
2009-11-01 00:06:53 +00:00
|
|
|
if (t->draw_handle_pixel)
|
|
|
|
ED_region_draw_cb_exit(t->ar->type, t->draw_handle_pixel);
|
2009-12-07 18:10:11 +00:00
|
|
|
if (t->draw_handle_cursor)
|
|
|
|
WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor);
|
2009-11-01 00:06:53 +00:00
|
|
|
|
2016-02-01 15:15:10 +11:00
|
|
|
/* Free all custom-data */
|
|
|
|
{
|
|
|
|
TransCustomData *custom_data = &t->custom.first_elem;
|
|
|
|
for (int i = 0; i < TRANS_CUSTOM_DATA_ELEM_MAX; i++, custom_data++) {
|
|
|
|
if (custom_data->free_cb) {
|
|
|
|
/* Can take over freeing t->data and data2d etc... */
|
|
|
|
custom_data->free_cb(t, custom_data);
|
|
|
|
BLI_assert(custom_data->data == NULL);
|
|
|
|
}
|
|
|
|
else if ((custom_data->data != NULL) && custom_data->use_free) {
|
|
|
|
MEM_freeN(custom_data->data);
|
|
|
|
custom_data->data = NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-01-10 18:33:16 +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
|
|
|
/* postTrans can be called when nothing is selected, so data is NULL already */
|
|
|
|
if (t->data) {
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2010-03-09 08:31:41 +00:00
|
|
|
/* free data malloced per trans-data */
|
2012-09-28 14:51:33 +00:00
|
|
|
if ((t->obedit && ELEM(t->obedit->type, OB_CURVE, OB_SURF)) ||
|
|
|
|
(t->spacetype == SPACE_IPO))
|
|
|
|
{
|
|
|
|
int a;
|
|
|
|
for (a = 0, td = t->data; a < t->total; a++, td++) {
|
|
|
|
if (td->flag & TD_BEZTRIPLE) {
|
|
|
|
MEM_freeN(td->hdata);
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->data);
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2009-12-01 18:26:18 +00:00
|
|
|
BLI_freelistN(&t->tsnap.points);
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->ext) MEM_freeN(t->ext);
|
|
|
|
if (t->data2d) {
|
|
|
|
MEM_freeN(t->data2d);
|
2012-06-10 19:59:02 +00:00
|
|
|
t->data2d = 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
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
2014-07-21 12:02:05 +02:00
|
|
|
if (t->options & (CTX_MASK | CTX_PAINT_CURVE)) {
|
2012-07-25 16:03:08 +00:00
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SpaceImage *sima = t->sa->spacedata.first;
|
|
|
|
if (sima->flag & SI_LIVE_UNWRAP)
|
|
|
|
ED_uvedit_live_unwrap_end(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
|
|
|
}
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_VIEW3D) {
|
2010-12-16 17:19:24 +00:00
|
|
|
View3D *v3d = t->sa->spacedata.first;
|
|
|
|
/* restore manipulator */
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
v3d->twtype = t->twtype;
|
|
|
|
}
|
|
|
|
}
|
2009-10-22 23:22:05 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
if (t->mouse.data) {
|
2009-10-22 23:22:05 +00:00
|
|
|
MEM_freeN(t->mouse.data);
|
|
|
|
}
|
2016-04-21 11:29:32 +10:00
|
|
|
|
|
|
|
freeSnapping(t);
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 applyTransObjects(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (td = t->data; td < t->data + t->total; td++) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->iloc, td->loc);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->ext->rot) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->irot, td->ext->rot);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
if (td->ext->size) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->isize, td->ext->size);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-28 05:53:40 +00:00
|
|
|
static void restoreElement(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
|
|
|
/* TransData for crease has no loc */
|
|
|
|
if (td->loc) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(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
|
|
|
}
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival;
|
|
|
|
}
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (td->ext && (td->flag & TD_NO_EXT) == 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 (td->ext->rot) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rot, td->ext->irot);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (td->ext->rotAngle) {
|
2012-06-10 19:59:02 +00:00
|
|
|
*td->ext->rotAngle = td->ext->irotAngle;
|
2010-10-19 11:15:08 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
if (td->ext->rotAxis) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis);
|
2010-10-19 11:15:08 +00:00
|
|
|
}
|
|
|
|
/* XXX, drotAngle & drotAxis not used yet */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->ext->size) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(td->ext->size, td->ext->isize);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
if (td->ext->quat) {
|
2011-10-28 12:40:15 +00:00
|
|
|
copy_qt_qt(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
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_BEZTRIPLE) {
|
|
|
|
*(td->hdata->h1) = td->hdata->ih1;
|
|
|
|
*(td->hdata->h2) = td->hdata->ih2;
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
void restoreTransObjects(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (td = t->data; td < t->data + t->total; td++) {
|
|
|
|
restoreElement(td);
|
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
for (td2d = t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) {
|
2010-05-06 19:54:43 +00:00
|
|
|
if (td2d->h1) {
|
|
|
|
td2d->h1[0] = td2d->ih1[0];
|
|
|
|
td2d->h1[1] = td2d->ih1[1];
|
|
|
|
}
|
|
|
|
if (td2d->h2) {
|
|
|
|
td2d->h2[0] = td2d->ih2[0];
|
|
|
|
td2d->h2[1] = td2d->ih2[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->mat);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenter2D(TransInfo *t)
|
|
|
|
{
|
2016-03-30 07:15:33 +11:00
|
|
|
BLI_assert(!is_zero_v3(t->aspect));
|
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->flag & (T_EDIT | T_POSE)) {
|
|
|
|
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, t->center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, vec);
|
2013-10-12 03:42:06 +00:00
|
|
|
projectFloatView(t, vec, t->center2d);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-10-12 03:42:06 +00:00
|
|
|
projectFloatView(t, t->center, t->center2d);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-31 23:56:59 +10:00
|
|
|
void calculateCenterGlobal(
|
|
|
|
TransInfo *t, const float center_local[3],
|
|
|
|
float r_center_global[3])
|
2015-06-26 16:19:39 +10:00
|
|
|
{
|
|
|
|
/* setting constraint center */
|
|
|
|
/* note, init functions may over-ride t->center */
|
|
|
|
if (t->flag & (T_EDIT | T_POSE)) {
|
|
|
|
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
2016-05-31 23:56:59 +10:00
|
|
|
mul_v3_m4v3(r_center_global, ob->obmat, center_local);
|
2015-06-26 16:19:39 +10:00
|
|
|
}
|
|
|
|
else {
|
2016-05-31 23:56:59 +10:00
|
|
|
copy_v3_v3(r_center_global, center_local);
|
2015-06-26 16:19:39 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenterCursor(TransInfo *t, float r_center[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-12-17 05:38:50 +00:00
|
|
|
const float *cursor;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2013-10-26 04:07:18 +00:00
|
|
|
cursor = ED_view3d_cursor3d_get(t->scene, t->view);
|
2014-05-09 16:52:09 +10:00
|
|
|
copy_v3_v3(r_center, cursor);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* If edit or pose mode, move cursor in local space */
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->flag & (T_EDIT | T_POSE)) {
|
|
|
|
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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], imat[3][3];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
sub_v3_v3v3(r_center, r_center, ob->obmat[3]);
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m3_m4(mat, ob->obmat);
|
|
|
|
invert_m3_m3(imat, mat);
|
2014-05-09 16:52:09 +10:00
|
|
|
mul_m3_v3(imat, r_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
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
if (ED_view3d_project_float_global(t->ar, cursor, r_center, V3D_PROJ_TEST_NOP) != V3D_PROJ_RET_OK) {
|
|
|
|
r_center[0] = t->ar->winx / 2.0f;
|
|
|
|
r_center[1] = t->ar->winy / 2.0f;
|
|
|
|
}
|
|
|
|
r_center[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
|
|
|
}
|
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenterCursor2D(TransInfo *t, float r_center[2])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2014-04-27 00:22:49 +10:00
|
|
|
const float *cursor = NULL;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
|
2010-03-30 05:52:05 +00:00
|
|
|
cursor = sima->cursor;
|
|
|
|
}
|
2013-08-29 13:04:12 +00:00
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
|
|
|
SpaceClip *space_clip = (SpaceClip *) t->sa->spacedata.first;
|
|
|
|
cursor = space_clip->cursor;
|
|
|
|
}
|
2015-06-26 15:45:09 +10:00
|
|
|
|
2010-03-30 11:38:06 +00:00
|
|
|
if (cursor) {
|
2012-07-26 10:52:59 +00:00
|
|
|
if (t->options & CTX_MASK) {
|
|
|
|
float co[2];
|
|
|
|
|
2013-08-29 13:04:12 +00:00
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
|
2014-05-28 18:44:15 +06:00
|
|
|
BKE_mask_coord_from_image(sima->image, &sima->iuser, co, cursor);
|
2013-08-29 13:04:12 +00:00
|
|
|
}
|
|
|
|
else if (t->spacetype == SPACE_CLIP) {
|
|
|
|
SpaceClip *space_clip = (SpaceClip *) t->sa->spacedata.first;
|
2014-05-28 18:44:15 +06:00
|
|
|
BKE_mask_coord_from_movieclip(space_clip->clip, &space_clip->user, co, cursor);
|
2013-08-29 13:04:12 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
BLI_assert(!"Shall not happen");
|
|
|
|
}
|
2012-07-26 10:52:59 +00:00
|
|
|
|
2015-06-26 15:45:09 +10:00
|
|
|
r_center[0] = co[0] * t->aspect[0];
|
|
|
|
r_center[1] = co[1] * t->aspect[1];
|
2012-07-26 10:52:59 +00:00
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
|
|
|
if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
r_center[0] = UI_view2d_view_to_region_x(&t->ar->v2d, cursor[0]);
|
|
|
|
r_center[1] = UI_view2d_view_to_region_y(&t->ar->v2d, cursor[1]);
|
|
|
|
}
|
|
|
|
}
|
2012-07-26 10:52:59 +00:00
|
|
|
else {
|
2015-06-26 15:45:09 +10:00
|
|
|
r_center[0] = cursor[0] * t->aspect[0];
|
|
|
|
r_center[1] = cursor[1] * t->aspect[1];
|
2012-07-26 10:52:59 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2])
|
2009-11-01 00:06:53 +00:00
|
|
|
{
|
2012-06-10 19:59:02 +00:00
|
|
|
SpaceIpo *sipo = (SpaceIpo *)t->sa->spacedata.first;
|
|
|
|
Scene *scene = t->scene;
|
2009-11-01 00:06:53 +00:00
|
|
|
|
|
|
|
/* cursor is combination of current frame, and graph-editor cursor value */
|
2015-10-26 20:15:27 +13:00
|
|
|
if (sipo->mode == SIPO_MODE_DRIVERS) {
|
|
|
|
r_center[0] = sipo->cursorTime;
|
|
|
|
r_center[1] = sipo->cursorVal;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
r_center[0] = (float)(scene->r.cfra);
|
|
|
|
r_center[1] = sipo->cursorVal;
|
|
|
|
}
|
2009-11-01 00:06:53 +00:00
|
|
|
}
|
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
void calculateCenterMedian(TransInfo *t, float r_center[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 partial[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
int total = 0;
|
|
|
|
int i;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0; i < t->total; i++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->data[i].flag & TD_SELECTED) {
|
2012-04-28 06:31:57 +00:00
|
|
|
if (!(t->data[i].flag & TD_NOCENTER)) {
|
2010-04-21 12:27:48 +00:00
|
|
|
add_v3_v3(partial, t->data[i].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
|
|
|
total++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-10-19 20:13:05 +02:00
|
|
|
if (total) {
|
|
|
|
mul_v3_fl(partial, 1.0f / (float)total);
|
|
|
|
}
|
2014-05-09 16:52:09 +10:00
|
|
|
copy_v3_v3(r_center, partial);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-05-09 16:52:09 +10:00
|
|
|
void calculateCenterBound(TransInfo *t, float r_center[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 max[3];
|
|
|
|
float min[3];
|
|
|
|
int i;
|
2012-03-24 06:38:07 +00:00
|
|
|
for (i = 0; i < t->total; i++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (i) {
|
|
|
|
if (t->data[i].flag & TD_SELECTED) {
|
|
|
|
if (!(t->data[i].flag & TD_NOCENTER))
|
2010-09-28 11:48:13 +00:00
|
|
|
minmax_v3v3_v3(min, max, t->data[i].center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(max, t->data[i].center);
|
|
|
|
copy_v3_v3(min, t->data[i].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
|
|
|
}
|
|
|
|
}
|
2014-05-09 16:52:09 +10:00
|
|
|
mid_v3_v3v3(r_center, min, max);
|
|
|
|
}
|
2012-10-30 14:22:49 +00:00
|
|
|
|
2014-05-09 16:52:09 +10:00
|
|
|
/**
|
|
|
|
* \param select_only only get active center from data being transformed.
|
|
|
|
*/
|
|
|
|
bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3])
|
|
|
|
{
|
|
|
|
bool ok = false;
|
|
|
|
|
|
|
|
if (t->obedit) {
|
2015-02-23 23:05:54 +11:00
|
|
|
if (ED_object_editmode_calc_active_center(t->obedit, select_only, r_center)) {
|
|
|
|
ok = true;
|
2014-05-09 16:52:09 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (t->flag & T_POSE) {
|
2017-04-11 16:09:30 +02:00
|
|
|
SceneLayer *sl = t->scene_layer;
|
2017-08-15 15:59:38 +02:00
|
|
|
Object *ob = OBACT_NEW(sl);
|
2014-05-09 16:52:09 +10:00
|
|
|
if (ob) {
|
|
|
|
bPoseChannel *pchan = BKE_pose_channel_active(ob);
|
|
|
|
if (pchan && (!select_only || (pchan->bone->flag & BONE_SELECTED))) {
|
|
|
|
copy_v3_v3(r_center, pchan->pose_head);
|
|
|
|
ok = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-07-21 12:02:05 +02:00
|
|
|
else if (t->options & CTX_PAINT_CURVE) {
|
2017-04-11 16:09:30 +02:00
|
|
|
Paint *p = BKE_paint_get_active(t->scene, t->scene_layer);
|
2014-07-21 12:02:05 +02:00
|
|
|
Brush *br = p->brush;
|
|
|
|
PaintCurve *pc = br->paint_curve;
|
|
|
|
copy_v3_v3(r_center, pc->points[pc->add_index - 1].bez.vec[1]);
|
|
|
|
r_center[2] = 0.0f;
|
|
|
|
ok = true;
|
|
|
|
}
|
2014-05-09 16:52:09 +10:00
|
|
|
else {
|
|
|
|
/* object mode */
|
2017-04-11 16:09:30 +02:00
|
|
|
SceneLayer *sl = t->scene_layer;
|
2017-08-15 15:59:38 +02:00
|
|
|
Object *ob = OBACT_NEW(sl);
|
|
|
|
Base *base = BASACT_NEW(sl);
|
2017-02-09 16:34:26 +01:00
|
|
|
if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) {
|
2014-05-09 16:52:09 +10:00
|
|
|
copy_v3_v3(r_center, ob->obmat[3]);
|
|
|
|
ok = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ok;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-31 23:56:59 +10:00
|
|
|
static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[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
|
|
|
{
|
2016-05-31 23:56:59 +10:00
|
|
|
switch (around) {
|
2015-12-01 18:52:24 +11:00
|
|
|
case V3D_AROUND_CENTER_BOUNDS:
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterBound(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
2015-12-01 18:52:24 +11:00
|
|
|
case V3D_AROUND_CENTER_MEAN:
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterMedian(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
2015-12-01 18:52:24 +11:00
|
|
|
case V3D_AROUND_CURSOR:
|
2013-08-29 13:04:12 +00:00
|
|
|
if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP))
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterCursor2D(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO)
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterCursorGraph2D(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
else
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterCursor(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
2015-12-01 18:52:24 +11:00
|
|
|
case V3D_AROUND_LOCAL_ORIGINS:
|
2012-06-10 19:59:02 +00:00
|
|
|
/* Individual element center uses median center for helpline and such */
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterMedian(t, r_center);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
2015-12-01 18:52:24 +11:00
|
|
|
case V3D_AROUND_ACTIVE:
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-31 23:56:59 +10:00
|
|
|
if (calculateCenterActive(t, false, r_center)) {
|
2014-05-09 16:52:09 +10:00
|
|
|
/* pass */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* fallback */
|
2016-05-31 23:56:59 +10:00
|
|
|
calculateCenterMedian(t, r_center);
|
2009-11-05 04:37:42 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
2016-05-31 23:56:59 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenter(TransInfo *t)
|
|
|
|
{
|
|
|
|
calculateCenter_FromAround(t, t->around, t->center);
|
|
|
|
calculateCenterGlobal(t, t->center, t->center_global);
|
|
|
|
|
|
|
|
/* avoid calculating again */
|
|
|
|
{
|
|
|
|
TransCenterData *cd = &t->center_cache[t->around];
|
|
|
|
copy_v3_v3(cd->local, t->center);
|
|
|
|
copy_v3_v3(cd->global, t->center_global);
|
|
|
|
cd->is_set = true;
|
|
|
|
}
|
2014-05-09 16:52:09 +10:00
|
|
|
|
|
|
|
calculateCenter2D(t);
|
|
|
|
|
2009-10-22 23:22:05 +00:00
|
|
|
/* for panning from cameraview */
|
2012-03-07 04:53:43 +00:00
|
|
|
if (t->flag & T_OBJECT) {
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW) {
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2014-03-01 01:21:25 +11:00
|
|
|
if (t->flag & T_CAMERA) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float axis[3];
|
|
|
|
/* persinv is nasty, use viewinv instead, always right */
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(axis, t->viewinv[2]);
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(axis);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* 6.0 = 6 grid units */
|
2012-06-10 19:59:02 +00:00
|
|
|
axis[0] = t->center[0] - 6.0f * axis[0];
|
|
|
|
axis[1] = t->center[1] - 6.0f * axis[1];
|
|
|
|
axis[2] = t->center[2] - 6.0f * axis[2];
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2013-10-12 03:42:06 +00:00
|
|
|
projectFloatView(t, axis, t->center2d);
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2013-03-09 11:40:42 +00:00
|
|
|
/* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->mode == TFM_TRANSLATION) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(t->center, axis);
|
2015-06-26 16:19:39 +10:00
|
|
|
copy_v3_v3(t->center_global, t->center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2013-03-09 11:40:42 +00:00
|
|
|
/* ED_view3d_calc_zfac() defines a factor for perspective depth correction, used in ED_view3d_win_to_delta() */
|
|
|
|
float vec[3];
|
2012-06-10 19:59:02 +00:00
|
|
|
if (t->flag & (T_EDIT | T_POSE)) {
|
|
|
|
Object *ob = t->obedit ? t->obedit : t->poseobj;
|
2013-03-09 11:40:42 +00:00
|
|
|
mul_v3_m4v3(vec, ob->obmat, t->center);
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
|
|
|
else {
|
2013-03-09 11:40:42 +00:00
|
|
|
copy_v3_v3(vec, t->center);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2013-06-10 09:45:51 +00:00
|
|
|
|
|
|
|
/* zfac is only used convertViewVec only in cases operator was invoked in RGN_TYPE_WINDOW
|
|
|
|
* and never used in other cases.
|
|
|
|
*
|
2015-09-14 02:21:15 +10:00
|
|
|
* We need special case here as well, since ED_view3d_calc_zfac will crash when called
|
2013-06-10 09:45:51 +00:00
|
|
|
* for a region different from RGN_TYPE_WINDOW.
|
|
|
|
*/
|
|
|
|
if (t->ar->regiontype == RGN_TYPE_WINDOW) {
|
|
|
|
t->zfac = ED_view3d_calc_zfac(t->ar->regiondata, vec, NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->zfac = 0.0f;
|
|
|
|
}
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2016-05-31 23:56:59 +10:00
|
|
|
BLI_STATIC_ASSERT(ARRAY_SIZE(((TransInfo *)NULL)->center_cache) == (V3D_AROUND_ACTIVE + 1), "test size");
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lazy initialize transform center data, when we need to access center values from other types.
|
|
|
|
*/
|
|
|
|
const TransCenterData *transformCenter_from_type(TransInfo *t, int around)
|
|
|
|
{
|
|
|
|
BLI_assert(around <= V3D_AROUND_ACTIVE);
|
|
|
|
TransCenterData *cd = &t->center_cache[around];
|
|
|
|
if (cd->is_set == false) {
|
|
|
|
calculateCenter_FromAround(t, around, cd->local);
|
|
|
|
calculateCenterGlobal(t, cd->local, cd->global);
|
|
|
|
cd->is_set = true;
|
|
|
|
}
|
|
|
|
return cd;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 calculatePropRatio(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
float dist;
|
2015-02-04 05:43:34 +11:00
|
|
|
const bool connected = (t->flag & T_PROP_CONNECTED) != 0;
|
|
|
|
|
|
|
|
t->proptext[0] = '\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 (t->flag & T_PROP_EDIT) {
|
2015-02-04 05:43:34 +11:00
|
|
|
const char *pet_id = NULL;
|
2012-06-10 19:59:02 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_SELECTED) {
|
|
|
|
td->factor = 1.0f;
|
|
|
|
}
|
2012-03-07 04:53:43 +00:00
|
|
|
else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f) {
|
2009-10-22 23:22:05 +00:00
|
|
|
td->flag |= TD_SKIP;
|
|
|
|
td->factor = 0.0f;
|
|
|
|
restoreElement(td);
|
|
|
|
}
|
2012-05-19 13:55:54 +00:00
|
|
|
else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) ||
|
2012-04-28 06:31:57 +00:00
|
|
|
(connected == 0 && td->rdist > t->prop_size))
|
2012-04-21 15:11:03 +00:00
|
|
|
{
|
2009-07-12 02:01:13 +00:00
|
|
|
/*
|
2012-03-03 16:31:46 +00:00
|
|
|
* The elements are sorted according to their dist member in the array,
|
|
|
|
* that means we can stop when it finds one element outside of the propsize.
|
2012-10-29 15:43:54 +00:00
|
|
|
* do not set 'td->flag |= TD_NOACTION', the prop circle is being changed.
|
2012-03-03 16:31:46 +00:00
|
|
|
*/
|
2012-10-26 09:55: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
|
|
|
td->factor = 0.0f;
|
|
|
|
restoreElement(td);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Use rdist for falloff calculations, it is the real distance */
|
|
|
|
td->flag &= ~TD_NOACTION;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2010-02-01 21:31:32 +00:00
|
|
|
if (connected)
|
2012-06-10 19:59:02 +00:00
|
|
|
dist = (t->prop_size - td->dist) / t->prop_size;
|
2010-02-01 21:31:32 +00:00
|
|
|
else
|
2012-06-10 19:59:02 +00:00
|
|
|
dist = (t->prop_size - td->rdist) / t->prop_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
|
|
|
/*
|
|
|
|
* Clamp to positive numbers.
|
|
|
|
* Certain corner cases with connectivity and individual centers
|
|
|
|
* can give values of rdist larger than propsize.
|
|
|
|
*/
|
|
|
|
if (dist < 0.0f)
|
|
|
|
dist = 0.0f;
|
2011-05-11 09:28:00 +00:00
|
|
|
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->prop_mode) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case PROP_SHARP:
|
|
|
|
td->factor = dist * dist;
|
|
|
|
break;
|
|
|
|
case PROP_SMOOTH:
|
|
|
|
td->factor = 3.0f * dist * dist - 2.0f * dist * dist * dist;
|
|
|
|
break;
|
|
|
|
case PROP_ROOT:
|
2014-03-28 14:53:37 +11:00
|
|
|
td->factor = sqrtf(dist);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_LIN:
|
|
|
|
td->factor = dist;
|
|
|
|
break;
|
|
|
|
case PROP_CONST:
|
|
|
|
td->factor = 1.0f;
|
|
|
|
break;
|
|
|
|
case PROP_SPHERE:
|
2014-03-28 14:53:37 +11:00
|
|
|
td->factor = sqrtf(2 * dist - dist * dist);
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_RANDOM:
|
|
|
|
td->factor = BLI_frand() * dist;
|
|
|
|
break;
|
2015-02-04 05:35:09 +11:00
|
|
|
case PROP_INVSQUARE:
|
|
|
|
td->factor = dist * (2.0f - dist);
|
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
default:
|
|
|
|
td->factor = 1;
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-04-28 06:31:57 +00:00
|
|
|
switch (t->prop_mode) {
|
2012-06-10 19:59:02 +00:00
|
|
|
case PROP_SHARP:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Sharp)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_SMOOTH:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Smooth)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_ROOT:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Root)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_LIN:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Linear)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_CONST:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Constant)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_SPHERE:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Sphere)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
|
|
|
case PROP_RANDOM:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(Random)");
|
2012-06-10 19:59:02 +00:00
|
|
|
break;
|
2015-02-04 05:35:09 +11:00
|
|
|
case PROP_INVSQUARE:
|
2015-02-04 05:43:34 +11:00
|
|
|
pet_id = N_("(InvSquare)");
|
2015-02-04 05:35:09 +11:00
|
|
|
break;
|
2012-06-10 19:59:02 +00:00
|
|
|
default:
|
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
|
|
|
}
|
2015-02-04 05:43:34 +11:00
|
|
|
|
|
|
|
if (pet_id) {
|
|
|
|
BLI_strncpy(t->proptext, IFACE_(pet_id), sizeof(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 {
|
2012-06-10 19:59:02 +00:00
|
|
|
for (i = 0; i < t->total; i++, td++) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
td->factor = 1.0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-07-14 04:27:32 +10:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Rotate an element, low level code, ignore protected channels.
|
|
|
|
* (use for objects or pose-bones)
|
|
|
|
* Similar to #ElementRotation.
|
|
|
|
*/
|
|
|
|
void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot)
|
|
|
|
{
|
|
|
|
float totmat[3][3];
|
|
|
|
float smat[3][3];
|
|
|
|
float fmat[3][3];
|
|
|
|
float obmat[3][3];
|
|
|
|
|
|
|
|
float dmat[3][3]; /* delta rotation */
|
|
|
|
float dmat_inv[3][3];
|
|
|
|
|
|
|
|
mul_m3_m3m3(totmat, mat, td->mtx);
|
|
|
|
mul_m3_m3m3(smat, td->smtx, mat);
|
|
|
|
|
|
|
|
/* logic from BKE_object_rot_to_mat3 */
|
|
|
|
if (use_drot) {
|
|
|
|
if (td->ext->rotOrder > 0) {
|
|
|
|
eulO_to_mat3(dmat, td->ext->drot, td->ext->rotOrder);
|
|
|
|
}
|
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
|
|
|
#if 0
|
|
|
|
axis_angle_to_mat3(dmat, td->ext->drotAxis, td->ext->drotAngle);
|
|
|
|
#else
|
|
|
|
unit_m3(dmat);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
float tquat[4];
|
|
|
|
normalize_qt_qt(tquat, td->ext->dquat);
|
|
|
|
quat_to_mat3(dmat, tquat);
|
|
|
|
}
|
|
|
|
|
|
|
|
invert_m3_m3(dmat_inv, dmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (td->ext->rotOrder == ROT_MODE_QUAT) {
|
|
|
|
float quat[4];
|
|
|
|
|
|
|
|
/* calculate the total rotatation */
|
|
|
|
quat_to_mat3(obmat, td->ext->iquat);
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(obmat, dmat, obmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mat = transform, obmat = object rotation */
|
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
|
|
|
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(fmat, dmat_inv, fmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
mat3_to_quat(quat, fmat);
|
|
|
|
|
|
|
|
/* apply */
|
|
|
|
copy_qt_qt(td->ext->quat, quat);
|
|
|
|
}
|
|
|
|
else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) {
|
|
|
|
float axis[3], angle;
|
|
|
|
|
|
|
|
/* calculate the total rotatation */
|
|
|
|
axis_angle_to_mat3(obmat, td->ext->irotAxis, td->ext->irotAngle);
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(obmat, dmat, obmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mat = transform, obmat = object rotation */
|
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
|
|
|
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(fmat, dmat_inv, fmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
mat3_to_axis_angle(axis, &angle, fmat);
|
|
|
|
|
|
|
|
/* apply */
|
|
|
|
copy_v3_v3(td->ext->rotAxis, axis);
|
|
|
|
*td->ext->rotAngle = angle;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
float eul[3];
|
|
|
|
|
|
|
|
/* calculate the total rotatation */
|
|
|
|
eulO_to_mat3(obmat, td->ext->irot, td->ext->rotOrder);
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(obmat, dmat, obmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mat = transform, obmat = object rotation */
|
|
|
|
mul_m3_m3m3(fmat, smat, obmat);
|
|
|
|
|
|
|
|
if (use_drot) {
|
|
|
|
mul_m3_m3m3(fmat, dmat_inv, fmat);
|
|
|
|
}
|
|
|
|
|
|
|
|
mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat);
|
|
|
|
|
|
|
|
/* apply */
|
|
|
|
copy_v3_v3(td->ext->rot, eul);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|