2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/**
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "BLO_sys_types.h" // for intptr_t support
|
|
|
|
|
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"
|
|
|
|
#include "DNA_lattice_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
2010-08-10 05:41:51 +00:00
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_meshdata_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"
|
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
|
|
|
|
|
|
|
//#include "BIF_screen.h"
|
|
|
|
//#include "BIF_mywindow.h"
|
|
|
|
#include "BIF_gl.h"
|
2009-10-13 07:39:08 +00:00
|
|
|
#include "BIF_glutil.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
//#include "BIF_editmesh.h"
|
|
|
|
//#include "BIF_editsima.h"
|
|
|
|
//#include "BIF_editparticle.h"
|
|
|
|
//#include "BIF_meshtools.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"
|
|
|
|
#include "BKE_depsgraph.h"
|
|
|
|
#include "BKE_displist.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"
|
|
|
|
#include "BKE_mesh.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"
|
|
|
|
|
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"
|
2009-09-28 14:51:42 +00: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"
|
2010-07-25 11:57:36 +00:00
|
|
|
#include "ED_curve.h" /* for ED_curve_editnurbs */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 "BDR_unwrapper.h"
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
#include "BLI_editVert.h"
|
|
|
|
#include "BLI_rand.h"
|
2011-01-07 18:36:47 +00:00
|
|
|
#include "BLI_utildefines.h"
|
2009-06-09 11:26:45 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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"
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
//#include "blendef.h"
|
|
|
|
//
|
|
|
|
//#include "mydevice.h"
|
|
|
|
|
|
|
|
#include "transform.h"
|
|
|
|
|
|
|
|
extern ListBase editelems;
|
|
|
|
|
|
|
|
/* ************************** Functions *************************** */
|
|
|
|
|
|
|
|
void getViewVector(TransInfo *t, float coord[3], float vec[3])
|
|
|
|
{
|
2009-10-27 02:54:25 +00:00
|
|
|
if (t->persp != RV3D_ORTHO)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
float p1[4], p2[4];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(p1, coord);
|
|
|
|
p1[3] = 1.0f;
|
|
|
|
VECCOPY(p2, p1);
|
|
|
|
p2[3] = 1.0f;
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v4(t->viewmat, p2);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
p2[0] = 2.0f * p2[0];
|
|
|
|
p2[1] = 2.0f * p2[1];
|
|
|
|
p2[2] = 2.0f * p2[2];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v4(t->viewinv, p2);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, p1, p2);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(vec, t->viewinv[2]);
|
|
|
|
}
|
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 **************************** */
|
|
|
|
|
|
|
|
static void clipMirrorModifier(TransInfo *t, Object *ob)
|
|
|
|
{
|
|
|
|
ModifierData *md= ob->modifiers.first;
|
|
|
|
float tolerance[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
int axis = 0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (; md; md=md->next) {
|
|
|
|
if (md->type==eModifierType_Mirror) {
|
2009-07-12 02:01:13 +00:00
|
|
|
MirrorModifierData *mmd = (MirrorModifierData*) md;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(mmd->flag & MOD_MIR_CLIPPING) {
|
|
|
|
axis = 0;
|
|
|
|
if(mmd->flag & MOD_MIR_AXIS_X) {
|
|
|
|
axis |= 1;
|
|
|
|
tolerance[0] = mmd->tolerance;
|
|
|
|
}
|
|
|
|
if(mmd->flag & MOD_MIR_AXIS_Y) {
|
|
|
|
axis |= 2;
|
|
|
|
tolerance[1] = mmd->tolerance;
|
|
|
|
}
|
|
|
|
if(mmd->flag & MOD_MIR_AXIS_Z) {
|
|
|
|
axis |= 4;
|
|
|
|
tolerance[2] = mmd->tolerance;
|
|
|
|
}
|
|
|
|
if (axis) {
|
|
|
|
float mtx[4][4], imtx[4][4];
|
|
|
|
int i;
|
|
|
|
TransData *td = t->data;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (mmd->mirror_ob) {
|
|
|
|
float obinv[4][4];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m4_m4(obinv, mmd->mirror_ob->obmat);
|
|
|
|
mul_m4_m4m4(mtx, ob->obmat, obinv);
|
|
|
|
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
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
int clip;
|
|
|
|
float loc[3], iloc[3];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
if (td->loc==NULL)
|
|
|
|
break;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(loc, td->loc);
|
|
|
|
copy_v3_v3(iloc, td->iloc);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (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
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
clip = 0;
|
|
|
|
if(axis & 1) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if(fabs(iloc[0])<=tolerance[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
|
|
|
loc[0]*iloc[0]<0.0f) {
|
|
|
|
loc[0]= 0.0f;
|
|
|
|
clip = 1;
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(axis & 2) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if(fabs(iloc[1])<=tolerance[1] ||
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
loc[1]*iloc[1]<0.0f) {
|
|
|
|
loc[1]= 0.0f;
|
|
|
|
clip = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(axis & 4) {
|
2009-07-12 02:01:13 +00:00
|
|
|
if(fabs(iloc[2])<=tolerance[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
|
|
|
loc[2]*iloc[2]<0.0f) {
|
|
|
|
loc[2]= 0.0f;
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-01-02 19:10:35 +00:00
|
|
|
/* assumes obedit set to mesh object */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 editmesh_apply_to_mirror(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
EditVert *eve;
|
|
|
|
int i;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
if (td->loc==NULL)
|
|
|
|
break;
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
eve = td->extra;
|
2009-10-15 21:54:22 +00:00
|
|
|
if (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
|
|
|
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-15 21:54:22 +00:00
|
|
|
|
|
|
|
if (td->flag & TD_MIRROR_EDGE)
|
|
|
|
{
|
|
|
|
td->loc[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
|
|
|
}
|
|
|
|
|
2009-07-31 07:43:47 +00:00
|
|
|
/* for the realtime animation recording feature, handle overlapping data */
|
|
|
|
static void animrecord_check_state (Scene *scene, ID *id, wmTimer *animtimer)
|
|
|
|
{
|
2009-08-02 03:15:24 +00:00
|
|
|
ScreenAnimData *sad= (animtimer) ? animtimer->customdata : NULL;
|
|
|
|
|
|
|
|
/* sanity checks */
|
|
|
|
if ELEM3(NULL, scene, id, sad)
|
|
|
|
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:
|
|
|
|
* - if animtimer is running
|
|
|
|
* - 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
|
|
|
*/
|
2011-02-04 08:33:07 +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)) {
|
2009-07-31 07:43:47 +00:00
|
|
|
AnimData *adt= BKE_animdata_from_id(id);
|
|
|
|
|
|
|
|
/* 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);
|
|
|
|
if (aend > astart+2.0f) {
|
|
|
|
NlaStrip *strip= add_nlastrip_to_stack(adt, adt->action);
|
|
|
|
|
|
|
|
/* clear reference to action now that we've pushed it onto the stack */
|
|
|
|
adt->action->id.us--;
|
|
|
|
adt->action= NULL;
|
|
|
|
|
|
|
|
/* adjust blending + extend so that they will behave correctly */
|
|
|
|
strip->extendmode= NLASTRIP_EXTEND_NOTHING;
|
|
|
|
strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS|NLASTRIP_FLAG_SELECT|NLASTRIP_FLAG_ACTIVE);
|
|
|
|
|
|
|
|
/* also, adjust the AnimData's action extend mode to be on
|
|
|
|
* 'nothing' so that previous result still play
|
|
|
|
*/
|
|
|
|
adt->act_extendmode= NLASTRIP_EXTEND_NOTHING;
|
|
|
|
}
|
2009-07-31 07:43:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-10 18:22:55 +00:00
|
|
|
static int fcu_test_selected(FCurve *fcu)
|
|
|
|
{
|
2010-03-03 13:20:18 +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
|
|
|
|
2010-03-09 08:31:41 +00:00
|
|
|
if (bezt==NULL) /* ignore baked */
|
2010-03-03 13:20:18 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i=0; i < fcu->totvert; i++, bezt++) {
|
2010-02-10 18:22:55 +00:00
|
|
|
if (BEZSELECTED(bezt)) return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* called for updating while transform acts, once per redraw */
|
|
|
|
void recalcData(TransInfo *t)
|
|
|
|
{
|
2010-12-03 12:30:59 +00:00
|
|
|
Base *base = t->scene->basact;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2009-01-08 17:12:50 +00:00
|
|
|
if (t->spacetype==SPACE_NODE) {
|
|
|
|
flushTransNodes(t);
|
|
|
|
}
|
2009-01-21 07:01:20 +00:00
|
|
|
else if (t->spacetype==SPACE_SEQ) {
|
|
|
|
flushTransSeq(t);
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
else if (t->spacetype == SPACE_ACTION) {
|
2009-08-02 03:15:24 +00:00
|
|
|
Scene *scene= t->scene;
|
2010-01-20 11:20:20 +00:00
|
|
|
SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-10-31 15:39:37 +00:00
|
|
|
bAnimContext ac= {0};
|
2009-07-12 03:42:39 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimListElem *ale;
|
|
|
|
int filter;
|
|
|
|
|
|
|
|
/* initialise relevant anim-context 'context' data from TransInfo data */
|
|
|
|
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
|
2009-08-02 03:15:24 +00:00
|
|
|
ac.scene= t->scene;
|
2009-07-12 03:42:39 +00:00
|
|
|
ac.obact= OBACT;
|
|
|
|
ac.sa= t->sa;
|
|
|
|
ac.ar= t->ar;
|
|
|
|
ac.spacetype= (t->sa)? t->sa->spacetype : 0;
|
|
|
|
ac.regiontype= (t->ar)? t->ar->regiontype : 0;
|
|
|
|
|
|
|
|
ANIM_animdata_context_getdata(&ac);
|
|
|
|
|
2011-01-10 22:10:28 +00:00
|
|
|
/* perform flush */
|
|
|
|
if (ac.datatype == ANIMCONT_GPENCIL) {
|
|
|
|
/* flush transform values back to actual coordinates */
|
|
|
|
flushTransGPactionData(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* get animdata blocks visible in editor, assuming that these will be the ones where things changed */
|
|
|
|
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_ANIMDATA);
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
|
|
|
|
|
|
|
/* 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) {
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
|
|
|
/* set refresh tags for objects using this animation */
|
|
|
|
ANIM_list_elem_update(t->scene, ale);
|
|
|
|
}
|
2010-01-20 11:20:20 +00:00
|
|
|
}
|
2011-01-10 22:10:28 +00:00
|
|
|
|
|
|
|
/* now free temp channels */
|
|
|
|
BLI_freelistN(&anim_data);
|
2009-07-12 03:42:39 +00:00
|
|
|
}
|
|
|
|
}
|
2009-01-28 02:56:58 +00:00
|
|
|
else if (t->spacetype == SPACE_IPO) {
|
|
|
|
Scene *scene;
|
2010-01-20 11:20:20 +00:00
|
|
|
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
ListBase anim_data = {NULL, NULL};
|
|
|
|
bAnimContext ac;
|
|
|
|
int filter;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
bAnimListElem *ale;
|
|
|
|
int dosort = 0;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* initialise relevant anim-context 'context' data from TransInfo data */
|
|
|
|
/* NOTE: sync this with the code in ANIM_animdata_get_context() */
|
|
|
|
memset(&ac, 0, sizeof(bAnimContext));
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
scene= ac.scene= t->scene;
|
|
|
|
ac.obact= OBACT;
|
|
|
|
ac.sa= t->sa;
|
|
|
|
ac.ar= t->ar;
|
|
|
|
ac.spacetype= (t->sa)? t->sa->spacetype : 0;
|
|
|
|
ac.regiontype= (t->ar)? t->ar->regiontype : 0;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-02-15 23:48:05 +00:00
|
|
|
ANIM_animdata_context_getdata(&ac);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* do the flush first */
|
|
|
|
flushTransGraphData(t);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* get curves to check if a re-sort is needed */
|
|
|
|
filter= (ANIMFILTER_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY | ANIMFILTER_CURVEVISIBLE);
|
|
|
|
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* now test if there is a need to re-sort */
|
|
|
|
for (ale= anim_data.first; ale; ale= ale->next) {
|
|
|
|
FCurve *fcu= (FCurve *)ale->key_data;
|
2010-03-09 08:31:41 +00:00
|
|
|
|
2010-02-10 18:22:55 +00:00
|
|
|
/* ignore unselected fcurves */
|
2010-03-09 08:31:41 +00:00
|
|
|
if (!fcu_test_selected(fcu))
|
2010-02-10 18:22:55 +00:00
|
|
|
continue;
|
2010-03-09 08:31:41 +00:00
|
|
|
|
2010-01-26 09:25:32 +00:00
|
|
|
// fixme: only do this for selected verts...
|
|
|
|
ANIM_unit_mapping_apply_fcurve(ac.scene, ale->id, ale->key_data, ANIM_UNITCONV_ONLYSEL|ANIM_UNITCONV_SELVERTS|ANIM_UNITCONV_RESTORE);
|
2010-01-26 05:58:03 +00:00
|
|
|
|
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* watch it: if the time is wrong: do not correct handles yet */
|
|
|
|
if (test_time_fcurve(fcu))
|
|
|
|
dosort++;
|
|
|
|
else
|
|
|
|
calchandles_fcurve(fcu);
|
2010-01-26 05:58:03 +00:00
|
|
|
|
2010-01-20 11:20:20 +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);
|
2009-01-28 02:56:58 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* do resort and other updates? */
|
|
|
|
if (dosort) remake_graph_transdata(t, &anim_data);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-01-28 02:56:58 +00:00
|
|
|
/* now free temp channels */
|
|
|
|
BLI_freelistN(&anim_data);
|
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
else if (t->spacetype == SPACE_NLA) {
|
2009-07-07 05:41:59 +00:00
|
|
|
TransDataNla *tdn= (TransDataNla *)t->customData;
|
2009-07-07 06:16:06 +00:00
|
|
|
SpaceNla *snla= (SpaceNla *)t->sa->spacedata.first;
|
2009-07-07 06:21:38 +00:00
|
|
|
Scene *scene= t->scene;
|
|
|
|
double secf= FPS;
|
2009-06-09 11:26:45 +00:00
|
|
|
int i;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* for each strip we've got, perform some additional validation of the values that got set before
|
2009-07-07 05:41:59 +00:00
|
|
|
* using RNA to set the value (which does some special operations when setting these values to make
|
|
|
|
* sure that everything works ok)
|
2009-06-09 11:26:45 +00:00
|
|
|
*/
|
2009-07-07 05:41:59 +00:00
|
|
|
for (i = 0; i < t->total; i++, tdn++) {
|
|
|
|
NlaStrip *strip= tdn->strip;
|
|
|
|
PointerRNA strip_ptr;
|
|
|
|
short pExceeded, nExceeded, iter;
|
|
|
|
int delta_y1, delta_y2;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +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-07-12 03:42:39 +00:00
|
|
|
|
2010-01-20 11:20:20 +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-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* if cancelling transform, just write the values without validating, then move on */
|
|
|
|
if (t->state == TRANS_CANCEL) {
|
2009-07-12 02:01:13 +00:00
|
|
|
/* clear the values by directly overwriting the originals, but also need to restore
|
2009-07-07 05:41:59 +00:00
|
|
|
* endpoints of neighboring transition-strips
|
2009-06-09 11:26:45 +00:00
|
|
|
*/
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* start */
|
|
|
|
strip->start= tdn->h1[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
|
|
|
|
strip->prev->end= tdn->h1[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* end */
|
|
|
|
strip->end= tdn->h2[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION))
|
|
|
|
strip->next->start= tdn->h2[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 06:16:06 +00:00
|
|
|
/* flush transforms to child strips (since this should be a meta) */
|
|
|
|
BKE_nlameta_flush_transforms(strip);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* 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);
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
continue;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* firstly, check if the proposed transform locations would overlap with any neighbouring strips
|
2009-07-07 05:41:59 +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)
|
|
|
|
*/
|
|
|
|
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
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
if ((pExceeded && nExceeded) || (iter == 4) ) {
|
2009-07-12 02:01:13 +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
|
2009-07-07 05:41:59 +00:00
|
|
|
* - if there were no neighbours, clear the transforms (make it default to the strip's current values)
|
2009-06-25 12:30:49 +00:00
|
|
|
*/
|
2009-07-07 05:41:59 +00:00
|
|
|
if (strip->prev && strip->next) {
|
|
|
|
tdn->h1[0]= strip->prev->end;
|
|
|
|
tdn->h2[0]= strip->next->start;
|
2009-06-25 12:30:49 +00:00
|
|
|
}
|
|
|
|
else {
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->h1[0]= strip->start;
|
|
|
|
tdn->h2[0]= strip->end;
|
2009-06-25 12:30:49 +00:00
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-07-07 05:41:59 +00:00
|
|
|
else if (nExceeded) {
|
|
|
|
/* move backwards */
|
|
|
|
float offset= tdn->h2[0] - strip->next->start;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->h1[0] -= offset;
|
|
|
|
tdn->h2[0] -= offset;
|
|
|
|
}
|
|
|
|
else if (pExceeded) {
|
|
|
|
/* more forwards */
|
|
|
|
float offset= strip->prev->end - tdn->h1[0];
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->h1[0] += offset;
|
|
|
|
tdn->h2[0] += offset;
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-07-07 05:41:59 +00:00
|
|
|
else /* all is fine and well */
|
|
|
|
break;
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 06:16:06 +00:00
|
|
|
/* handle auto-snapping */
|
|
|
|
switch (snla->autosnap) {
|
2009-07-07 06:21:38 +00:00
|
|
|
case SACTSNAP_FRAME: /* snap to nearest frame/time */
|
|
|
|
if (snla->flag & SNLA_DRAWTIME) {
|
|
|
|
tdn->h1[0]= (float)( floor((tdn->h1[0]/secf) + 0.5f) * secf );
|
|
|
|
tdn->h2[0]= (float)( floor((tdn->h2[0]/secf) + 0.5f) * secf );
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tdn->h1[0]= (float)( floor(tdn->h1[0]+0.5f) );
|
|
|
|
tdn->h2[0]= (float)( floor(tdn->h2[0]+0.5f) );
|
|
|
|
}
|
2009-07-07 06:16:06 +00:00
|
|
|
break;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 06:16:06 +00:00
|
|
|
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;
|
|
|
|
}
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* use RNA to write the values... */
|
|
|
|
// TODO: do we need to write in 2 passes to make sure that no truncation goes on?
|
|
|
|
RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2010-04-01 21:44:56 +00:00
|
|
|
RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]);
|
|
|
|
RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
/* flush transforms to child strips (since this should be a meta) */
|
|
|
|
BKE_nlameta_flush_transforms(strip);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* now, check if we need to try and move track
|
2009-07-07 05:41:59 +00:00
|
|
|
* - we need to calculate both, as only one may have been altered by transform if only 1 handle moved
|
|
|
|
*/
|
2009-07-07 06:16:06 +00:00
|
|
|
delta_y1= ((int)tdn->h1[1] / NLACHANNEL_STEP - tdn->trackIndex);
|
|
|
|
delta_y2= ((int)tdn->h2[1] / NLACHANNEL_STEP - tdn->trackIndex);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +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
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
/* move in the requested direction, checking at each layer if there's space for strip to pass through,
|
2009-07-07 05:41:59 +00:00
|
|
|
* stopping on the last track available or that we're able to fit in
|
|
|
|
*/
|
|
|
|
if (delta > 0) {
|
|
|
|
for (track=tdn->nlt->next, n=0; (track) && (n < delta); track=track->next, n++) {
|
|
|
|
/* 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);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->nlt= track;
|
2010-11-11 10:27:24 +00:00
|
|
|
tdn->trackIndex++;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
|
|
|
else /* can't move any further */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* make delta 'positive' before using it, since we now know to go backwards */
|
|
|
|
delta= -delta;
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
for (track=tdn->nlt->prev, n=0; (track) && (n < delta); track=track->prev, n++) {
|
|
|
|
/* 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);
|
2009-07-12 03:42:39 +00:00
|
|
|
|
2009-07-07 05:41:59 +00:00
|
|
|
tdn->nlt= track;
|
2010-11-11 10:27:24 +00:00
|
|
|
tdn->trackIndex--;
|
2009-07-07 05:41:59 +00:00
|
|
|
}
|
|
|
|
else /* can't move any further */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2009-07-07 02:12:50 +00:00
|
|
|
}
|
|
|
|
}
|
2009-06-09 11:26:45 +00:00
|
|
|
}
|
2009-10-14 09:08:48 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
|
|
|
if (t->obedit && t->obedit->type == OB_MESH) {
|
|
|
|
SpaceImage *sima= t->sa->spacedata.first;
|
|
|
|
|
|
|
|
flushTransUVs(t);
|
|
|
|
if(sima->flag & SI_LIVE_UNWRAP)
|
|
|
|
ED_uvedit_live_unwrap_re_solve();
|
|
|
|
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(t->obedit->data, 0);
|
2009-10-14 09:08:48 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
else if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
|
|
|
|
if (t->obedit) {
|
|
|
|
if ELEM(t->obedit->type, OB_CURVE, OB_SURF) {
|
|
|
|
Curve *cu= t->obedit->data;
|
2010-07-25 11:57:36 +00:00
|
|
|
ListBase *nurbs= ED_curve_editnurbs(cu);
|
|
|
|
Nurb *nu= nurbs->first;
|
2010-03-29 09:29:50 +00:00
|
|
|
|
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
clipMirrorModifier(t, t->obedit);
|
2010-11-14 16:31:06 +00:00
|
|
|
applyProject(t);
|
2010-03-29 09:29:50 +00:00
|
|
|
}
|
|
|
|
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2010-07-25 11:57:36 +00:00
|
|
|
|
2009-10-12 22:33:32 +00:00
|
|
|
if (t->state == TRANS_CANCEL) {
|
|
|
|
while(nu) {
|
|
|
|
calchandlesNurb(nu); /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */
|
|
|
|
nu= nu->next;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Normal updating */
|
|
|
|
while(nu) {
|
|
|
|
test2DNurb(nu);
|
|
|
|
calchandlesNurb(nu);
|
|
|
|
nu= nu->next;
|
|
|
|
}
|
2009-01-08 17:12:50 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
|
|
|
else if(t->obedit->type==OB_LATTICE) {
|
|
|
|
Lattice *la= t->obedit->data;
|
2010-11-14 16:31:06 +00:00
|
|
|
|
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
|
|
|
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2009-10-12 22:33:32 +00:00
|
|
|
|
2010-08-10 06:36:42 +00:00
|
|
|
if(la->editlatt->latt->flag & LT_OUTSIDE) outside_lattice(la->editlatt->latt);
|
2009-01-08 17:12:50 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
else if (t->obedit->type == OB_MESH) {
|
2009-10-14 09:08:48 +00:00
|
|
|
EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
|
|
|
|
/* mirror modifier clipping? */
|
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
clipMirrorModifier(t, t->obedit);
|
2010-11-14 16:31:06 +00:00
|
|
|
applyProject(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-10-14 09:08:48 +00:00
|
|
|
if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
|
|
|
|
editmesh_apply_to_mirror(t);
|
|
|
|
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2009-10-14 09:08:48 +00:00
|
|
|
|
|
|
|
recalc_editnormals(em);
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
|
|
|
else if(t->obedit->type==OB_ARMATURE) { /* no recalc flag, does pose */
|
|
|
|
bArmature *arm= t->obedit->data;
|
|
|
|
ListBase *edbo = arm->edbo;
|
|
|
|
EditBone *ebo;
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-11-14 16:31:06 +00:00
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
|
|
|
|
2009-10-12 22:33:32 +00:00
|
|
|
/* Ensure all bones are correctly adjusted */
|
|
|
|
for (ebo = edbo->first; ebo; ebo = ebo->next){
|
|
|
|
|
|
|
|
if ((ebo->flag & BONE_CONNECTED) && ebo->parent){
|
|
|
|
/* If this bone has a parent tip that has been moved */
|
|
|
|
if (ebo->parent->flag & BONE_TIPSEL){
|
|
|
|
VECCOPY (ebo->head, ebo->parent->tail);
|
|
|
|
if(t->mode==TFM_BONE_ENVELOPE) ebo->rad_head= ebo->parent->rad_tail;
|
|
|
|
}
|
|
|
|
/* If this bone has a parent tip that has NOT been moved */
|
|
|
|
else{
|
|
|
|
VECCOPY (ebo->parent->tail, ebo->head);
|
|
|
|
if(t->mode==TFM_BONE_ENVELOPE) ebo->parent->rad_tail= ebo->rad_head;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* on extrude bones, oldlength==0.0f, so we scale radius of points */
|
2009-11-10 20:43:45 +00:00
|
|
|
ebo->length= len_v3v3(ebo->head, ebo->tail);
|
2009-10-12 22:33:32 +00:00
|
|
|
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;
|
|
|
|
if(ebo->parent) {
|
|
|
|
if(ebo->rad_head > ebo->parent->rad_tail)
|
|
|
|
ebo->rad_head= ebo->parent->rad_tail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(t->mode!=TFM_BONE_ENVELOPE) {
|
|
|
|
/* if bones change length, lets do that for the deform distance as well */
|
|
|
|
ebo->dist*= ebo->length/ebo->oldlength;
|
|
|
|
ebo->rad_head*= ebo->length/ebo->oldlength;
|
|
|
|
ebo->rad_tail*= ebo->length/ebo->oldlength;
|
|
|
|
ebo->oldlength= ebo->length;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
if (t->mode != TFM_BONE_ROLL)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-10-12 22:33:32 +00:00
|
|
|
/* fix roll */
|
|
|
|
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
|
|
|
{
|
2009-10-12 22:33:32 +00:00
|
|
|
if (td->extra)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-12 22:33:32 +00:00
|
|
|
float vec[3], up_axis[3];
|
|
|
|
float qrot[4];
|
|
|
|
|
|
|
|
ebo = td->extra;
|
|
|
|
VECCOPY(up_axis, td->axismtx[2]);
|
|
|
|
|
|
|
|
if (t->mode != TFM_ROTATION)
|
|
|
|
{
|
2009-11-10 20:43:45 +00: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);
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_v3(t->mat, up_axis);
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
|
|
|
|
2010-11-25 19:49:07 +00:00
|
|
|
ebo->roll = ED_rollBoneToVector(ebo, up_axis, FALSE);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
|
|
|
|
if(arm->flag & ARM_MIRROR_EDIT)
|
|
|
|
transform_armature_mirror_update(t->obedit);
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
else
|
2010-11-14 16:31:06 +00:00
|
|
|
{
|
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
2011-01-03 12:41:16 +00:00
|
|
|
DAG_id_tag_update(t->obedit->data, 0); /* sets recalc flags */
|
2010-11-14 16:31:06 +00:00
|
|
|
}
|
2009-01-24 10:03:19 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
else if( (t->flag & T_POSE) && t->poseobj) {
|
|
|
|
Object *ob= t->poseobj;
|
|
|
|
bArmature *arm= ob->data;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-12 22:33:32 +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)
|
2010-12-10 00:10:43 +00:00
|
|
|
*
|
|
|
|
* context is needed for keying set poll() functions.
|
2009-10-12 22:33:32 +00:00
|
|
|
*/
|
|
|
|
// TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
|
2010-12-10 00:10:43 +00:00
|
|
|
if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
|
2009-10-12 22:33:32 +00:00
|
|
|
int targetless_ik= (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
|
|
|
|
|
|
|
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
2010-12-10 00:10:43 +00:00
|
|
|
autokeyframe_pose_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-12 22:33:32 +00:00
|
|
|
/* old optimize trick... this enforces to bypass the depgraph */
|
|
|
|
if (!(arm->flag & ARM_DELAYDEFORM)) {
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA); /* sets recalc flags */
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
|
|
|
else
|
2010-12-03 12:30:59 +00:00
|
|
|
where_is_pose(t->scene, ob);
|
2009-10-12 22:33:32 +00:00
|
|
|
}
|
2010-12-03 12:30:59 +00:00
|
|
|
else if(base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && PE_get_current(t->scene, base->object)) {
|
2010-11-14 16:31:06 +00:00
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
2009-10-19 17:50:26 +00:00
|
|
|
flushTransParticles(t);
|
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
else {
|
2009-11-01 02:52:38 +00:00
|
|
|
int i;
|
|
|
|
|
2010-11-14 16:31:06 +00:00
|
|
|
if(t->state != TRANS_CANCEL) {
|
|
|
|
applyProject(t);
|
|
|
|
}
|
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
for (i = 0; i < t->total; i++) {
|
|
|
|
TransData *td = t->data + i;
|
|
|
|
Object *ob = td->ob;
|
2009-10-12 22:33:32 +00:00
|
|
|
|
2009-11-01 02:52:38 +00:00
|
|
|
if (td->flag & TD_NOACTION)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (td->flag & TD_SKIP)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* 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?
|
|
|
|
if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
|
|
|
|
animrecord_check_state(t->scene, &ob->id, t->animtimer);
|
2010-11-20 21:43:16 +00:00
|
|
|
autokeyframe_ob_cb_func(t->context, t->scene, (View3D *)t->view, ob, t->mode);
|
2009-02-18 06:25:57 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
|
2010-01-20 22:21:10 +00:00
|
|
|
/* sets recalc flags fully, instead of flushing existing ones
|
|
|
|
* otherwise proxies don't function correctly
|
|
|
|
*/
|
2010-12-05 18:59:23 +00:00
|
|
|
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2009-10-12 22:33:32 +00:00
|
|
|
|
2009-10-14 09:08:48 +00:00
|
|
|
if(((View3D*)t->view)->drawtype == OB_SHADED)
|
2009-10-12 22:33:32 +00:00
|
|
|
reshadeall_displist(t->scene);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
void drawLine(TransInfo *t, float *center, float *dir, 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
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D)
|
|
|
|
{
|
|
|
|
View3D *v3d = t->view;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
glPushMatrix();
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
//if(t->obedit) glLoadMatrixf(t->obedit->obmat); // sets opengl viewing
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_v3_v3(v3, dir);
|
|
|
|
mul_v3_fl(v3, v3d->far);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(v2, center, v3);
|
|
|
|
add_v3_v3v3(v1, center, v3);
|
2009-09-28 10:19:20 +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-04-30 11:47:35 +00:00
|
|
|
UI_make_axis_color(col, col2, axis);
|
2010-12-20 03:59:22 +00:00
|
|
|
glColor3ubv(col2);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
setlinestyle(0);
|
2009-07-12 02:01:13 +00:00
|
|
|
glBegin(GL_LINE_STRIP);
|
|
|
|
glVertex3fv(v1);
|
2010-02-28 17:51:23 +00:00
|
|
|
glVertex3fv(v2);
|
2009-01-10 18:33:16 +00:00
|
|
|
glEnd();
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-10 18:33:16 +00:00
|
|
|
glPopMatrix();
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
|
|
|
}
|
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, 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);
|
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);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* moving: is shown in drawobject() (transform color) */
|
2009-07-12 02:01:13 +00:00
|
|
|
// TRANSFORM_FIX_ME
|
2009-01-02 19:10:35 +00:00
|
|
|
// if(obedit || (t->flag & T_POSE) ) G.moving= G_TRANSFORM_EDIT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
// else if(G.f & G_PARTICLEEDIT) G.moving= G_TRANSFORM_PARTICLE;
|
|
|
|
// else G.moving= G_TRANSFORM_OBJ;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->scene = sce;
|
|
|
|
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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->data = NULL;
|
|
|
|
t->ext = NULL;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-04-30 11:47:35 +00:00
|
|
|
t->helpline = HLP_NONE;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->flag = 0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
t->redraw = 1; /* redraw first time */
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-03 22:15:59 +00:00
|
|
|
if (event)
|
|
|
|
{
|
|
|
|
t->imval[0] = event->x - t->ar->winrct.xmin;
|
|
|
|
t->imval[1] = event->y - t->ar->winrct.ymin;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-01-28 15:39:39 +00:00
|
|
|
t->event_type = event->type;
|
2009-01-03 22:15:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t->imval[0] = 0;
|
|
|
|
t->imval[1] = 0;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->con.imval[0] = t->imval[0];
|
|
|
|
t->con.imval[1] = t->imval[1];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->mval[0] = t->imval[0];
|
|
|
|
t->mval[1] = t->imval[1];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->transform = NULL;
|
|
|
|
t->handleEvent = NULL;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->total = 0;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->val = 0.0f;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->vec[0] =
|
|
|
|
t->vec[1] =
|
|
|
|
t->vec[2] = 0.0f;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->center[0] =
|
|
|
|
t->center[1] =
|
|
|
|
t->center[2] = 0.0f;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m3(t->mat);
|
2009-09-28 10:19:20 +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 */
|
|
|
|
if (t->mode == TFM_CREASE) {
|
|
|
|
t->options |= CTX_EDGE;
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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->spacetype = sa->spacetype;
|
|
|
|
if(t->spacetype == SPACE_VIEW3D)
|
|
|
|
{
|
|
|
|
View3D *v3d = sa->spacedata.first;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->view = v3d;
|
Record Transform Animation - Quicky feature which makes it super-easy to animate stuff quickly
To use, simply enable Auto-Keyframing and start the animation playback from the TimeLine.
Then at any time while the playback is still running (and Auto-Keyframing is still enabled), select any object/bone and start moving it around.
You can also select other objects/bones and move them around using standard transform tools (grab/rotate/scale), or exit transform for the active/selected object(s), and move on to other objects instead. Repeat until satisfactory!
This is similar to the old 'Record IPO' functionality (and/or is closer to the 'Mouse Recording' in 3DSMax), except it's much cooler, and is more flexible at the same time. It's
"good for quick and dirty tests, or things with timing, where it's easier to do it real time" - William Reynish, or "handycam effect or eyes animation" - Pepeland.
Additional Notes:
- for now, the objects that are used for this currently need some animation data already. This limitation is temporary.
- eventually, 'samples' (i.e. baked-data) not keyframes will be made by this tool as samples are more suitable for such large sets of densely spaced points
2009-02-17 08:55:50 +00:00
|
|
|
t->animtimer= CTX_wm_screen(C)->animtimer;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-12-17 17:50:55 +00:00
|
|
|
/* turn manipulator off during transform */
|
2010-02-21 11:42:32 +00:00
|
|
|
// FIXME: but don't do this when USING the manipulator...
|
2009-12-17 17:50:55 +00:00
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
t->twtype = v3d->twtype;
|
|
|
|
v3d->twtype = 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(v3d->flag & V3D_ALIGN) t->flag |= T_V3D_ALIGN;
|
|
|
|
t->around = v3d->around;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-12 13:37:07 +00:00
|
|
|
if (op && RNA_struct_find_property(op->ptr, "constraint_orientation") && RNA_property_is_set(op->ptr, "constraint_orientation"))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2009-07-16 03:16:03 +00:00
|
|
|
t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-05-16 17:01:05 +00:00
|
|
|
if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
|
|
|
t->current_orientation = V3D_MANIP_GLOBAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t->current_orientation = v3d->twmode;
|
|
|
|
}
|
2011-01-10 06:00:56 +00:00
|
|
|
|
|
|
|
/* exceptional case */
|
|
|
|
if(t->around==V3D_LOCAL && (t->settings->selectmode & SCE_SELECT_FACE)) {
|
|
|
|
if(ELEM3(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) {
|
|
|
|
t->options |= CTX_NO_PET;
|
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-01-02 23:58:03 +00:00
|
|
|
else if(t->spacetype==SPACE_IMAGE || t->spacetype==SPACE_NODE)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2009-06-23 00:45:41 +00:00
|
|
|
SpaceImage *sima = sa->spacedata.first;
|
2009-01-28 21:43:43 +00:00
|
|
|
// XXX for now, get View2D from the active region
|
|
|
|
t->view = &ar->v2d;
|
2009-06-23 00:45:41 +00:00
|
|
|
t->around = sima->around;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-10-21 10:36:46 +00:00
|
|
|
else if(t->spacetype==SPACE_IPO)
|
|
|
|
{
|
|
|
|
SpaceIpo *sipo= sa->spacedata.first;
|
|
|
|
t->view = &ar->v2d;
|
|
|
|
t->around = sipo->around;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
|
|
|
{
|
2008-12-29 07:19:16 +00:00
|
|
|
// XXX for now, get View2D from the active region
|
|
|
|
t->view = &ar->v2d;
|
2009-10-21 10:36:46 +00:00
|
|
|
// XXX for now, the center point is the midpoint of the data
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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_CENTER;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-04-02 19:40:51 +00:00
|
|
|
if (op && RNA_property_is_set(op->ptr, "release_confirm"))
|
|
|
|
{
|
|
|
|
if (RNA_boolean_get(op->ptr, "release_confirm"))
|
|
|
|
{
|
|
|
|
t->flag |= T_RELEASE_CONFIRM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-04-03 17:38:43 +00:00
|
|
|
if (U.flag & USER_RELEASECONFIRM)
|
2010-04-02 19:40:51 +00:00
|
|
|
{
|
|
|
|
t->flag |= T_RELEASE_CONFIRM;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
if (op && RNA_struct_find_property(op->ptr, "mirror") && RNA_property_is_set(op->ptr, "mirror"))
|
|
|
|
{
|
|
|
|
if (RNA_boolean_get(op->ptr, "mirror"))
|
|
|
|
{
|
|
|
|
t->flag |= T_MIRROR;
|
2009-10-15 21:54:22 +00:00
|
|
|
t->mirror = 1;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Need stuff to take it from edit mesh or whatnot here
|
|
|
|
else
|
|
|
|
{
|
2009-10-14 14:28:05 +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-15 21:54:22 +00:00
|
|
|
t->mirror = 1;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-09-22 20:16:56 +00:00
|
|
|
/* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */
|
|
|
|
if (op && RNA_struct_find_property(op->ptr, "proportional"))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2009-09-22 20:16:56 +00:00
|
|
|
if (RNA_property_is_set(op->ptr, "proportional"))
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2009-09-22 20:16:56 +00:00
|
|
|
switch(RNA_enum_get(op->ptr, "proportional"))
|
|
|
|
{
|
2010-07-31 19:26:21 +00:00
|
|
|
case PROP_EDIT_CONNECTED:
|
2009-09-22 20:16:56 +00:00
|
|
|
t->flag |= T_PROP_CONNECTED;
|
2010-07-31 19:26:21 +00:00
|
|
|
case PROP_EDIT_ON:
|
2009-09-22 20:16:56 +00:00
|
|
|
t->flag |= T_PROP_EDIT;
|
|
|
|
break;
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-09-22 20:16:56 +00:00
|
|
|
else
|
|
|
|
{
|
2009-11-27 16:15:34 +00:00
|
|
|
/* use settings from scene only if modal */
|
|
|
|
if (t->flag & T_MODAL)
|
|
|
|
{
|
2010-07-31 19:26:21 +00:00
|
|
|
if ((t->options & CTX_NO_PET) == 0)
|
|
|
|
{
|
|
|
|
if (t->obedit && ts->proportional != PROP_EDIT_OFF)
|
|
|
|
{
|
|
|
|
t->flag |= T_PROP_EDIT;
|
2009-11-27 16:15:34 +00:00
|
|
|
|
2010-07-31 19:26:21 +00:00
|
|
|
if(ts->proportional == PROP_EDIT_CONNECTED)
|
|
|
|
t->flag |= T_PROP_CONNECTED;
|
|
|
|
}
|
|
|
|
else if (t->obedit == NULL && ts->proportional_objects)
|
|
|
|
{
|
|
|
|
t->flag |= T_PROP_EDIT;
|
|
|
|
}
|
2009-11-27 16:15:34 +00:00
|
|
|
}
|
2009-09-22 20:16:56 +00:00
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-09-22 20:16:56 +00:00
|
|
|
if (op && RNA_struct_find_property(op->ptr, "proportional_size") && RNA_property_is_set(op->ptr, "proportional_size"))
|
|
|
|
{
|
|
|
|
t->prop_size = RNA_float_get(op->ptr, "proportional_size");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t->prop_size = ts->proportional_size;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
|
2009-09-22 20:16:56 +00:00
|
|
|
/* TRANSFORM_FIX_ME rna restrictions */
|
2010-11-27 19:18:13 +00:00
|
|
|
if (t->prop_size <= 0.00001f)
|
2009-09-22 20:16:56 +00:00
|
|
|
{
|
2010-11-27 19:18:13 +00:00
|
|
|
printf("Proportional size (%f) under 0.00001, reseting to 1!\n", t->prop_size);
|
2009-09-22 20:16:56 +00:00
|
|
|
t->prop_size = 1.0f;
|
|
|
|
}
|
|
|
|
|
2010-08-18 03:24:52 +00:00
|
|
|
if (op && RNA_struct_find_property(op->ptr, "proportional_edit_falloff") && RNA_property_is_set(op->ptr, "proportional_edit_falloff"))
|
2009-09-22 20:16:56 +00:00
|
|
|
{
|
2010-08-18 03:24:52 +00:00
|
|
|
t->prop_mode = RNA_enum_get(op->ptr, "proportional_edit_falloff");
|
2009-09-22 20:16:56 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
t->prop_mode = ts->prop_mode;
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-09-22 20:16:56 +00:00
|
|
|
else /* add not pet option to context when not available */
|
2009-03-06 15:50:15 +00:00
|
|
|
{
|
2009-09-22 20:16:56 +00:00
|
|
|
t->options |= CTX_NO_PET;
|
2009-03-06 15:50:15 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
setTransformViewMatrices(t);
|
|
|
|
initNumInput(&t->num);
|
|
|
|
initNDofInput(&t->ndof);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-03-28 20:46:38 +00:00
|
|
|
return 1;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
|
2009-12-07 18:10:11 +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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-20 21:05:22 +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-10-20 21:05:22 +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-10-19 08:01:30 +00:00
|
|
|
|
|
|
|
if (t->customFree) {
|
|
|
|
/* Can take over freeing t->data and data2d etc... */
|
|
|
|
t->customFree(t);
|
|
|
|
}
|
|
|
|
else if (t->customData) {
|
|
|
|
MEM_freeN(t->customData);
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
2009-03-28 16:45:22 +00:00
|
|
|
if (t->data) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int a;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-09 08:31:41 +00:00
|
|
|
/* free data malloced per trans-data */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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(a=0, td= t->data; a<t->total; a++, td++) {
|
2009-09-28 10:19:20 +00:00
|
|
|
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);
|
|
|
|
}
|
2009-09-21 00:48:36 +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);
|
|
|
|
t->data2d= NULL;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(t->spacetype==SPACE_IMAGE) {
|
2009-01-28 21:43:43 +00:00
|
|
|
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
|
|
|
}
|
2010-12-16 17:19:24 +00:00
|
|
|
else if(t->spacetype==SPACE_VIEW3D) {
|
|
|
|
View3D *v3d = t->sa->spacedata.first;
|
|
|
|
/* restore manipulator */
|
|
|
|
if (t->flag & T_MODAL) {
|
|
|
|
v3d->twtype = t->twtype;
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-09-21 00:48:36 +00:00
|
|
|
if (t->mouse.data)
|
|
|
|
{
|
|
|
|
MEM_freeN(t->mouse.data);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for (td = t->data; td < t->data + t->total; td++) {
|
|
|
|
VECCOPY(td->iloc, td->loc);
|
|
|
|
if (td->ext->rot) {
|
|
|
|
VECCOPY(td->ext->irot, td->ext->rot);
|
|
|
|
}
|
|
|
|
if (td->ext->size) {
|
|
|
|
VECCOPY(td->ext->isize, td->ext->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
|
|
|
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
|
|
|
|
|
|
|
static void restoreElement(TransData *td) {
|
|
|
|
/* TransData for crease has no loc */
|
|
|
|
if (td->loc) {
|
|
|
|
VECCOPY(td->loc, td->iloc);
|
|
|
|
}
|
|
|
|
if (td->val) {
|
|
|
|
*td->val = td->ival;
|
|
|
|
}
|
2010-05-06 19:54:43 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 && (td->flag&TD_NO_EXT)==0) {
|
|
|
|
if (td->ext->rot) {
|
|
|
|
VECCOPY(td->ext->rot, td->ext->irot);
|
|
|
|
}
|
2010-10-19 11:15:08 +00:00
|
|
|
if(td->ext->rotAngle) {
|
|
|
|
*td->ext->rotAngle= td->ext->irotAngle;
|
|
|
|
}
|
|
|
|
if(td->ext->rotAxis) {
|
|
|
|
VECCOPY(td->ext->rotAxis, td->ext->irotAxis);
|
|
|
|
}
|
|
|
|
/* 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) {
|
|
|
|
VECCOPY(td->ext->size, td->ext->isize);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
if (td->ext->quat) {
|
|
|
|
QUATCOPY(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
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (td->flag & TD_BEZTRIPLE) {
|
|
|
|
*(td->hdata->h1) = td->hdata->ih1;
|
|
|
|
*(td->hdata->h2) = td->hdata->ih2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void restoreTransObjects(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td;
|
2010-05-06 19:54:43 +00:00
|
|
|
TransData2D *td2d;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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);
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-05-06 19:54:43 +00:00
|
|
|
for (td2d=t->data2d; t->data2d && td2d < t->data2d + t->total; td2d++) {
|
|
|
|
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);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
recalcData(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenter2D(TransInfo *t)
|
|
|
|
{
|
|
|
|
if (t->flag & (T_EDIT|T_POSE)) {
|
2009-01-02 19:10:35 +00:00
|
|
|
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];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(vec, t->center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, 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
|
|
|
projectIntView(t, vec, t->center2d);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
projectIntView(t, t->center, t->center2d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenterCursor(TransInfo *t)
|
|
|
|
{
|
|
|
|
float *cursor;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
cursor = give_cursor(t->scene, t->view);
|
|
|
|
VECCOPY(t->center, cursor);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* If edit or pose mode, move cursor in local space */
|
|
|
|
if (t->flag & (T_EDIT|T_POSE)) {
|
2009-01-02 19:10:35 +00:00
|
|
|
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];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(t->center, t->center, ob->obmat[3]);
|
|
|
|
copy_m3_m4(mat, ob->obmat);
|
|
|
|
invert_m3_m3(imat, mat);
|
|
|
|
mul_m3_v3(imat, 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-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter2D(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenterCursor2D(TransInfo *t)
|
|
|
|
{
|
|
|
|
float aspx=1.0, aspy=1.0;
|
2010-03-30 11:38:06 +00:00
|
|
|
float *cursor= NULL;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-30 05:52:05 +00:00
|
|
|
if(t->spacetype==SPACE_IMAGE) {
|
|
|
|
SpaceImage *sima= (SpaceImage *)t->sa->spacedata.first;
|
|
|
|
/* only space supported right now but may change */
|
|
|
|
ED_space_image_uv_aspect(sima, &aspx, &aspy);
|
|
|
|
cursor = sima->cursor;
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-03-30 11:38:06 +00:00
|
|
|
if (cursor) {
|
2010-03-30 05:52:05 +00:00
|
|
|
t->center[0] = cursor[0] * aspx;
|
|
|
|
t->center[1] = cursor[1] * aspy;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter2D(t);
|
|
|
|
}
|
|
|
|
|
2011-02-14 17:55:27 +00:00
|
|
|
static void calculateCenterCursorGraph2D(TransInfo *t)
|
2009-10-21 10:36:46 +00:00
|
|
|
{
|
|
|
|
SpaceIpo *sipo= (SpaceIpo *)t->sa->spacedata.first;
|
|
|
|
Scene *scene= t->scene;
|
|
|
|
|
|
|
|
/* cursor is combination of current frame, and graph-editor cursor value */
|
|
|
|
t->center[0]= (float)(scene->r.cfra);
|
|
|
|
t->center[1]= sipo->cursorVal;
|
|
|
|
|
|
|
|
calculateCenter2D(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
|
|
|
void calculateCenterMedian(TransInfo *t)
|
|
|
|
{
|
|
|
|
float partial[3] = {0.0f, 0.0f, 0.0f};
|
|
|
|
int total = 0;
|
|
|
|
int i;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
for(i = 0; i < t->total; i++) {
|
|
|
|
if (t->data[i].flag & TD_SELECTED) {
|
|
|
|
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++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2009-07-12 02:01:13 +00:00
|
|
|
/*
|
|
|
|
All the selected elements are at the head of the array
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
which means we can stop when it finds unselected data
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(i)
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(partial, 1.0f / total);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
VECCOPY(t->center, partial);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter2D(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void calculateCenterBound(TransInfo *t)
|
|
|
|
{
|
|
|
|
float max[3];
|
|
|
|
float min[3];
|
|
|
|
int i;
|
|
|
|
for(i = 0; i < t->total; i++) {
|
|
|
|
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 {
|
2009-07-12 02:01:13 +00:00
|
|
|
/*
|
|
|
|
All the selected elements are at the head of the array
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
which means we can stop when it finds unselected data
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
VECCOPY(max, t->data[i].center);
|
|
|
|
VECCOPY(min, t->data[i].center);
|
|
|
|
}
|
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(t->center, min, max);
|
|
|
|
mul_v3_fl(t->center, 0.5);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenter2D(t);
|
|
|
|
}
|
|
|
|
|
2009-07-12 02:01:13 +00:00
|
|
|
void calculateCenter(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
|
|
|
{
|
|
|
|
switch(t->around) {
|
|
|
|
case V3D_CENTER:
|
|
|
|
calculateCenterBound(t);
|
|
|
|
break;
|
|
|
|
case V3D_CENTROID:
|
|
|
|
calculateCenterMedian(t);
|
|
|
|
break;
|
|
|
|
case V3D_CURSOR:
|
|
|
|
if(t->spacetype==SPACE_IMAGE)
|
|
|
|
calculateCenterCursor2D(t);
|
2009-10-21 10:36:46 +00:00
|
|
|
else if(t->spacetype==SPACE_IPO)
|
|
|
|
calculateCenterCursorGraph2D(t);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
else
|
|
|
|
calculateCenterCursor(t);
|
|
|
|
break;
|
|
|
|
case V3D_LOCAL:
|
|
|
|
/* Individual element center uses median center for helpline and such */
|
|
|
|
calculateCenterMedian(t);
|
|
|
|
break;
|
|
|
|
case V3D_ACTIVE:
|
|
|
|
{
|
|
|
|
/* set median, and if if if... do object center */
|
2009-11-05 04:37:42 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* EDIT MODE ACTIVE EDITMODE ELEMENT */
|
|
|
|
|
2009-11-05 04:37:42 +00:00
|
|
|
if (t->obedit && t->obedit->type == OB_MESH) {
|
|
|
|
EditSelection ese;
|
|
|
|
EditMesh *em = BKE_mesh_get_editmesh(t->obedit->data);
|
|
|
|
|
|
|
|
if (EM_get_actSelection(em, &ese)) {
|
|
|
|
EM_editselection_center(t->center, &ese);
|
|
|
|
calculateCenter2D(t);
|
|
|
|
break;
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
} /* END EDIT MODE ACTIVE ELEMENT */
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
calculateCenterMedian(t);
|
|
|
|
if((t->flag & (T_EDIT|T_POSE))==0)
|
|
|
|
{
|
|
|
|
Scene *scene = t->scene;
|
|
|
|
Object *ob= OBACT;
|
|
|
|
if(ob)
|
|
|
|
{
|
|
|
|
VECCOPY(t->center, ob->obmat[3]);
|
|
|
|
projectIntView(t, t->center, t->center2d);
|
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* setting constraint center */
|
|
|
|
VECCOPY(t->con.center, t->center);
|
|
|
|
if(t->flag & (T_EDIT|T_POSE))
|
|
|
|
{
|
2009-01-02 19:10:35 +00:00
|
|
|
Object *ob= t->obedit?t->obedit:t->poseobj;
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, t->con.center);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
|
|
|
/* for panning from cameraview */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(t->flag & T_OBJECT)
|
|
|
|
{
|
2009-12-02 19:59:57 +00:00
|
|
|
if(t->spacetype==SPACE_VIEW3D && t->ar && t->ar->regiontype == RGN_TYPE_WINDOW)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 = t->view;
|
|
|
|
Scene *scene = t->scene;
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
RegionView3D *rv3d = t->ar->regiondata;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-10-27 02:54:25 +00:00
|
|
|
if(v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 */
|
|
|
|
VECCOPY(axis, t->viewinv[2]);
|
2009-11-10 20:43:45 +00:00
|
|
|
normalize_v3(axis);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* 6.0 = 6 grid units */
|
|
|
|
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];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
projectIntView(t, axis, t->center2d);
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* rotate only needs correct 2d center, grab needs initgrabz() value */
|
|
|
|
if(t->mode==TFM_TRANSLATION)
|
|
|
|
{
|
|
|
|
VECCOPY(t->center, axis);
|
|
|
|
VECCOPY(t->con.center, t->center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if(t->spacetype==SPACE_VIEW3D)
|
2008-12-29 20:37:54 +00:00
|
|
|
{
|
2009-01-20 18:31:11 +00:00
|
|
|
/* initgrabz() defines a factor for perspective depth correction, used in window_to_3d_delta() */
|
2008-12-29 20:37:54 +00:00
|
|
|
if(t->flag & (T_EDIT|T_POSE)) {
|
2009-01-02 19:10:35 +00:00
|
|
|
Object *ob= t->obedit?t->obedit:t->poseobj;
|
2008-12-29 20:37:54 +00:00
|
|
|
float vec[3];
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2008-12-29 20:37:54 +00:00
|
|
|
VECCOPY(vec, t->center);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m4_v3(ob->obmat, vec);
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
initgrabz(t->ar->regiondata, vec[0], vec[1], vec[2]);
|
2008-12-29 20:37:54 +00:00
|
|
|
}
|
|
|
|
else {
|
2.5
View3D has been split now in a local part (RegionView3D) and a
per-area part (old View3D). Currently local is:
- view transform
- camera zoom/offset
- gpencil (todo)
- custom clipping planes
Rest is in Area still, like active camera, draw type, layers,
localview, custom centers, around-settings, transform widget,
gridlines, and so on (mostly stuff as available in header).
To see it work; also added new feature for region split,
press SHIFT+ALT+CTRL+S for four-split.
The idea is to make a preset 4-split, configured to stick
to top/right/front views for three views.
Another cool idea to explore is to then box-clip all drawing
based on these 3 views.
Note about the code:
- currently view3d still stores some depricated settings, to
convert from older files. Not all settings are copied over
though, like custom clip planes or the 'lock view to object'.
- since some view3d ops are now on area level, the operators
for it should keep track of that.
Bugfix in transform: quat initialize in operator-invoke missed
one zero.
Als brought back GE to compile for missing Ipos and channels.
2009-01-19 16:54:41 +00:00
|
|
|
initgrabz(t->ar->regiondata, t->center[0], t->center[1], t->center[2]);
|
2009-07-12 02:01:13 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
|
|
|
void calculatePropRatio(TransInfo *t)
|
|
|
|
{
|
|
|
|
TransData *td = t->data;
|
|
|
|
int i;
|
|
|
|
float dist;
|
|
|
|
short connected = t->flag & T_PROP_CONNECTED;
|
2009-07-12 02:01:13 +00:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) {
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
if (td->flag & TD_SELECTED) {
|
|
|
|
td->factor = 1.0f;
|
|
|
|
}
|
2009-10-15 21:54:22 +00:00
|
|
|
else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f)
|
|
|
|
{
|
|
|
|
td->flag |= TD_SKIP;
|
|
|
|
td->factor = 0.0f;
|
|
|
|
restoreElement(td);
|
|
|
|
}
|
2009-07-12 02:01:13 +00:00
|
|
|
else if ((connected &&
|
2009-03-06 15:50:15 +00:00
|
|
|
(td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
||
|
|
|
|
(connected == 0 &&
|
2009-03-06 15:50:15 +00:00
|
|
|
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
|
|
|
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.
|
|
|
|
*/
|
|
|
|
td->flag |= TD_NOACTION;
|
|
|
|
td->factor = 0.0f;
|
|
|
|
restoreElement(td);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Use rdist for falloff calculations, it is the real distance */
|
|
|
|
td->flag &= ~TD_NOACTION;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2010-02-01 21:31:32 +00:00
|
|
|
if (connected)
|
|
|
|
dist= (t->prop_size-td->dist)/t->prop_size;
|
|
|
|
else
|
|
|
|
dist= (t->prop_size-td->rdist)/t->prop_size;
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/*
|
|
|
|
* 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;
|
2009-09-28 10:19:20 +00:00
|
|
|
|
2009-03-06 15:50:15 +00:00
|
|
|
switch(t->prop_mode) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
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:
|
|
|
|
td->factor = (float)sqrt(dist);
|
|
|
|
break;
|
|
|
|
case PROP_LIN:
|
|
|
|
td->factor = dist;
|
|
|
|
break;
|
|
|
|
case PROP_CONST:
|
|
|
|
td->factor = 1.0f;
|
|
|
|
break;
|
|
|
|
case PROP_SPHERE:
|
|
|
|
td->factor = (float)sqrt(2*dist - dist * dist);
|
|
|
|
break;
|
|
|
|
case PROP_RANDOM:
|
|
|
|
BLI_srand( BLI_rand() ); /* random seed */
|
|
|
|
td->factor = BLI_frand()*dist;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
td->factor = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-03-06 15:50:15 +00:00
|
|
|
switch(t->prop_mode) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
case PROP_SHARP:
|
|
|
|
strcpy(t->proptext, "(Sharp)");
|
|
|
|
break;
|
|
|
|
case PROP_SMOOTH:
|
|
|
|
strcpy(t->proptext, "(Smooth)");
|
|
|
|
break;
|
|
|
|
case PROP_ROOT:
|
|
|
|
strcpy(t->proptext, "(Root)");
|
|
|
|
break;
|
|
|
|
case PROP_LIN:
|
|
|
|
strcpy(t->proptext, "(Linear)");
|
|
|
|
break;
|
|
|
|
case PROP_CONST:
|
|
|
|
strcpy(t->proptext, "(Constant)");
|
|
|
|
break;
|
|
|
|
case PROP_SPHERE:
|
|
|
|
strcpy(t->proptext, "(Sphere)");
|
|
|
|
break;
|
|
|
|
case PROP_RANDOM:
|
|
|
|
strcpy(t->proptext, "(Random)");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
strcpy(t->proptext, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
for(i = 0 ; i < t->total; i++, td++) {
|
|
|
|
td->factor = 1.0;
|
|
|
|
}
|
|
|
|
strcpy(t->proptext, "");
|
|
|
|
}
|
|
|
|
}
|