2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup edtransform
|
2011-02-27 20:29:51 +00:00
|
|
|
*/
|
|
|
|
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <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 <stdio.h>
|
2020-03-19 09:33:03 +01:00
|
|
|
#include <stdlib.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 <string.h>
|
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
2017-01-26 12:39:36 -02:00
|
|
|
#include "GPU_immediate.h"
|
2017-03-21 16:08:14 -04:00
|
|
|
#include "GPU_matrix.h"
|
2018-06-27 19:07:23 -06:00
|
|
|
#include "GPU_state.h"
|
2017-01-26 12:39:36 -02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
#include "BLI_math.h"
|
2015-03-27 15:23:39 +01:00
|
|
|
#include "BLI_rect.h"
|
2020-03-19 09:33:03 +01:00
|
|
|
#include "BLI_string.h"
|
|
|
|
#include "BLI_utildefines.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-04-05 17:56:54 +00:00
|
|
|
#include "BKE_context.h"
|
|
|
|
|
2013-03-04 07:15:09 +00:00
|
|
|
#include "ED_view3d.h"
|
|
|
|
|
2015-08-16 17:32:01 +10:00
|
|
|
#include "BLT_translation.h"
|
2013-02-19 15:45:56 +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 "transform.h"
|
2020-10-08 11:42:14 -03:00
|
|
|
#include "transform_orientations.h"
|
2019-10-29 00:45:05 +11:00
|
|
|
#include "transform_snap.h"
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2020-02-28 21:25:47 -03:00
|
|
|
/* Own include. */
|
|
|
|
#include "transform_constraints.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
|
|
|
static void drawObjectConstraint(TransInfo *t);
|
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
static void projection_matrix_calc(const TransInfo *t, float r_pmtx[3][3])
|
|
|
|
{
|
|
|
|
unit_m3(r_pmtx);
|
|
|
|
|
|
|
|
if (!(t->con.mode & CON_AXIS0)) {
|
|
|
|
zero_v3(r_pmtx[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(t->con.mode & CON_AXIS1)) {
|
|
|
|
zero_v3(r_pmtx[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!(t->con.mode & CON_AXIS2)) {
|
|
|
|
zero_v3(r_pmtx[2]);
|
|
|
|
}
|
|
|
|
|
|
|
|
float mat[3][3];
|
|
|
|
mul_m3_m3m3(mat, r_pmtx, t->spacemtx_inv);
|
|
|
|
mul_m3_m3m3(r_pmtx, t->spacemtx, mat);
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* ************************** CONSTRAINTS ************************* */
|
2020-06-18 00:00:43 -03:00
|
|
|
#define CONSTRAIN_EPSILON 0.0001f
|
|
|
|
|
|
|
|
static void constraint_plane_calc(TransInfo *t, float r_plane[4])
|
|
|
|
{
|
|
|
|
const float *constraint_vector[2];
|
|
|
|
int n = 0;
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
if (t->con.mode & (CON_AXIS0 << i)) {
|
|
|
|
constraint_vector[n++] = t->spacemtx[i];
|
|
|
|
if (n == 2) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BLI_assert(n == 2);
|
|
|
|
|
|
|
|
cross_v3_v3v3(r_plane, constraint_vector[0], constraint_vector[1]);
|
|
|
|
normalize_v3(r_plane);
|
|
|
|
r_plane[3] = -dot_v3v3(r_plane, t->center_global);
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
void constraintNumInput(TransInfo *t, float vec[3])
|
|
|
|
{
|
|
|
|
int mode = t->con.mode;
|
|
|
|
if (mode & CON_APPLY) {
|
2012-06-10 22:13:17 +00:00
|
|
|
float nval = (t->flag & T_NULL_ONE) ? 1.0f : 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-02-01 18:06:34 +11:00
|
|
|
const int dims = getConstraintSpaceDimension(t);
|
|
|
|
if (dims == 2) {
|
2012-06-10 22:13:17 +00:00
|
|
|
int axis = mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
|
|
|
|
if (axis == (CON_AXIS0 | CON_AXIS1)) {
|
2011-06-27 03:36:14 +00:00
|
|
|
/* vec[0] = vec[0]; */ /* same */
|
|
|
|
/* vec[1] = vec[1]; */ /* same */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec[2] = nval;
|
|
|
|
}
|
2012-06-10 22:13:17 +00:00
|
|
|
else if (axis == (CON_AXIS1 | CON_AXIS2)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec[2] = vec[1];
|
|
|
|
vec[1] = vec[0];
|
|
|
|
vec[0] = nval;
|
|
|
|
}
|
2012-06-10 22:13:17 +00:00
|
|
|
else if (axis == (CON_AXIS0 | CON_AXIS2)) {
|
2011-06-27 03:36:14 +00:00
|
|
|
/* vec[0] = vec[0]; */ /* same */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec[2] = vec[1];
|
|
|
|
vec[1] = nval;
|
|
|
|
}
|
|
|
|
}
|
2016-02-01 18:06:34 +11:00
|
|
|
else if (dims == 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
|
|
|
if (mode & CON_AXIS0) {
|
2011-06-27 03:36:14 +00:00
|
|
|
/* vec[0] = vec[0]; */ /* same */
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
vec[1] = nval;
|
|
|
|
vec[2] = nval;
|
|
|
|
}
|
|
|
|
else if (mode & CON_AXIS1) {
|
|
|
|
vec[1] = vec[0];
|
|
|
|
vec[0] = nval;
|
|
|
|
vec[2] = nval;
|
|
|
|
}
|
|
|
|
else if (mode & CON_AXIS2) {
|
|
|
|
vec[2] = vec[0];
|
|
|
|
vec[0] = nval;
|
|
|
|
vec[1] = nval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-21 17:24:14 +02:00
|
|
|
static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3])
|
2011-04-29 05:01:50 +00:00
|
|
|
{
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
2020-04-03 13:25:03 +02:00
|
|
|
// View3D *v3d = t->area->spacedata.first;
|
2019-02-16 12:21:44 +11:00
|
|
|
const float min_dist = 1.0f; /* v3d->clip_start; */
|
2011-04-29 05:01:50 +00:00
|
|
|
float dir[3];
|
|
|
|
float l;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-29 05:01:50 +00:00
|
|
|
sub_v3_v3v3(dir, t_con_center, t->viewinv[3]);
|
2012-03-24 06:38:07 +00:00
|
|
|
if (dot_v3v3(dir, t->viewinv[2]) < 0.0f) {
|
2011-04-29 05:01:50 +00:00
|
|
|
negate_v3(dir);
|
|
|
|
}
|
|
|
|
project_v3_v3v3(dir, dir, t->viewinv[2]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 22:13:17 +00:00
|
|
|
l = len_v3(dir);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (l < min_dist) {
|
2011-04-29 05:01:50 +00:00
|
|
|
float diff[3];
|
2016-07-08 10:14:49 +10:00
|
|
|
normalize_v3_v3_length(diff, t->viewinv[2], min_dist - l);
|
2011-04-29 05:01:50 +00:00
|
|
|
sub_v3_v3(t_con_center, diff);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-21 17:24:14 +02:00
|
|
|
/**
|
|
|
|
* Axis calculation taking the view into account, correcting view-aligned axis.
|
|
|
|
*/
|
|
|
|
static void axisProjection(const TransInfo *t,
|
|
|
|
const float axis[3],
|
|
|
|
const float in[3],
|
|
|
|
float out[3])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2010-01-15 00:35:21 +00:00
|
|
|
float norm[3], vec[3], factor, angle;
|
2011-04-29 05:01:50 +00:00
|
|
|
float t_con_center[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-01-15 13:08:51 +00:00
|
|
|
if (is_zero_v3(in)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
2013-01-15 13:08:51 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 16:19:39 +10:00
|
|
|
copy_v3_v3(t_con_center, t->center_global);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-29 05:01:50 +00:00
|
|
|
/* checks for center being too close to the view center */
|
|
|
|
viewAxisCorrectCenter(t, t_con_center);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-03-28 17:06:15 +00:00
|
|
|
angle = fabsf(angle_v3v3(axis, t->viewinv[2]));
|
2015-01-31 17:23:30 +11:00
|
|
|
if (angle > (float)M_PI_2) {
|
2011-03-28 17:06:15 +00:00
|
|
|
angle = (float)M_PI - angle;
|
2010-01-15 00:35:21 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* For when view is parallel to constraint... will cause NaNs otherwise
|
2012-03-03 16:31:46 +00:00
|
|
|
* So we take vertical motion in 3D space and apply it to the
|
|
|
|
* constraint axis. Nice for camera grab + MMB */
|
2018-05-21 17:24:14 +02:00
|
|
|
if (angle < DEG2RADF(5.0f)) {
|
2009-11-10 20:43:45 +00:00
|
|
|
project_v3_v3v3(vec, in, t->viewinv[1]);
|
|
|
|
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
|
2019-04-17 08:44:58 +02:00
|
|
|
/* Since camera distance is quite relative, use quadratic relationship.
|
|
|
|
* holding shift can compensate. */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (factor < 0.0f) {
|
2012-06-10 22:13:17 +00:00
|
|
|
factor *= -factor;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
else {
|
2012-06-10 22:13:17 +00:00
|
|
|
factor *= factor;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-07-08 10:14:49 +10:00
|
|
|
/* -factor makes move down going backwards */
|
|
|
|
normalize_v3_v3_length(out, axis, -factor);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-07-23 14:50:59 +10:00
|
|
|
float v[3];
|
2009-11-02 19:37:18 +00:00
|
|
|
float norm_center[3];
|
|
|
|
float plane[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-29 05:01:50 +00:00
|
|
|
getViewVector(t, t_con_center, norm_center);
|
2009-11-10 20:43:45 +00:00
|
|
|
cross_v3_v3v3(plane, norm_center, axis);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
project_v3_v3v3(vec, in, plane);
|
|
|
|
sub_v3_v3v3(vec, in, vec);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-29 05:01:50 +00:00
|
|
|
add_v3_v3v3(v, vec, t_con_center);
|
2009-11-02 19:37:18 +00:00
|
|
|
getViewVector(t, v, norm);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-02 19:37:18 +00:00
|
|
|
/* give arbitrary large value if projection is impossible */
|
2009-11-10 20:43:45 +00:00
|
|
|
factor = dot_v3v3(axis, norm);
|
2011-03-28 17:06:15 +00:00
|
|
|
if (1.0f - fabsf(factor) < 0.0002f) {
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(out, axis);
|
2009-11-02 19:37:18 +00:00
|
|
|
if (factor > 0) {
|
2011-03-28 17:06:15 +00:00
|
|
|
mul_v3_fl(out, 1000000000.0f);
|
2012-03-24 06:38:07 +00:00
|
|
|
}
|
|
|
|
else {
|
2011-03-28 17:06:15 +00:00
|
|
|
mul_v3_fl(out, -1000000000.0f);
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
2009-11-02 19:37:18 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else {
|
2019-07-23 14:50:59 +10:00
|
|
|
/* Use ray-ray intersection instead of line-line because this gave
|
|
|
|
* precision issues adding small values to large numbers. */
|
|
|
|
float mul;
|
2019-07-23 08:11:46 -03:00
|
|
|
if (isect_ray_ray_v3(t_con_center, axis, v, norm, &mul, NULL)) {
|
|
|
|
mul_v3_v3fl(out, axis, mul);
|
2019-07-23 14:50:59 +10:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* In practice this should never fail. */
|
|
|
|
BLI_assert(0);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-04-20 09:46:45 +00:00
|
|
|
/* possible some values become nan when
|
2012-06-30 22:49:33 +00:00
|
|
|
* viewpoint and object are both zero */
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!isfinite(out[0])) {
|
2016-05-16 00:48:02 +02:00
|
|
|
out[0] = 0.0f;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
if (!isfinite(out[1])) {
|
2016-05-16 00:48:02 +02:00
|
|
|
out[1] = 0.0f;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
if (!isfinite(out[2])) {
|
2016-05-16 00:48:02 +02:00
|
|
|
out[2] = 0.0f;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2009-11-02 19:37:18 +00:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-01 21:42:39 +11:00
|
|
|
/**
|
2020-06-18 00:00:43 -03:00
|
|
|
* Snap to the intersection between the edge direction and the constraint plane.
|
2016-02-01 21:42:39 +11:00
|
|
|
*/
|
2020-06-22 09:07:51 -03:00
|
|
|
static void constraint_snap_plane_to_edge(const TransInfo *t, const float plane[4], float r_out[3])
|
2016-02-01 21:42:39 +11:00
|
|
|
{
|
2020-06-18 00:00:43 -03:00
|
|
|
float lambda;
|
|
|
|
const float *edge_snap_point = t->tsnap.snapPoint;
|
|
|
|
const float *edge_dir = t->tsnap.snapNormal;
|
|
|
|
bool is_aligned = fabsf(dot_v3v3(edge_dir, plane)) < CONSTRAIN_EPSILON;
|
|
|
|
if (!is_aligned && isect_ray_plane_v3(edge_snap_point, edge_dir, plane, &lambda, false)) {
|
|
|
|
madd_v3_v3v3fl(r_out, edge_snap_point, edge_dir, lambda);
|
|
|
|
sub_v3_v3(r_out, t->tsnap.snapTarget);
|
2016-02-01 21:42:39 +11:00
|
|
|
}
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Snap to the nearest point between the snap point and the line that
|
|
|
|
* intersects the face plane with the constraint plane.
|
|
|
|
*/
|
2020-11-06 10:29:00 +11:00
|
|
|
static void UNUSED_FUNCTION(constraint_snap_plane_to_face(const TransInfo *t,
|
|
|
|
const float plane[4],
|
|
|
|
float r_out[3]))
|
2020-06-18 00:00:43 -03:00
|
|
|
{
|
|
|
|
float face_plane[4], isect_orig[3], isect_dir[3];
|
|
|
|
const float *face_snap_point = t->tsnap.snapPoint;
|
|
|
|
const float *face_normal = t->tsnap.snapNormal;
|
|
|
|
plane_from_point_normal_v3(face_plane, face_snap_point, face_normal);
|
|
|
|
bool is_aligned = fabsf(dot_v3v3(plane, face_plane)) > (1.0f - CONSTRAIN_EPSILON);
|
|
|
|
if (!is_aligned && isect_plane_plane_v3(plane, face_plane, isect_orig, isect_dir)) {
|
|
|
|
closest_to_ray_v3(r_out, face_snap_point, isect_orig, isect_dir);
|
|
|
|
sub_v3_v3(r_out, t->tsnap.snapTarget);
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
/**
|
|
|
|
* Snap to the nearest point on the axis to the edge/line element.
|
|
|
|
*/
|
2020-06-22 09:07:51 -03:00
|
|
|
void transform_constraint_snap_axis_to_edge(const TransInfo *t,
|
|
|
|
const float axis[3],
|
|
|
|
float r_out[3])
|
2020-06-18 00:00:43 -03:00
|
|
|
{
|
|
|
|
float lambda;
|
|
|
|
const float *edge_snap_point = t->tsnap.snapPoint;
|
|
|
|
const float *edge_dir = t->tsnap.snapNormal;
|
2020-07-01 17:13:13 -03:00
|
|
|
bool is_aligned = fabsf(dot_v3v3(axis, edge_dir)) > (1.0f - CONSTRAIN_EPSILON);
|
2020-06-18 00:00:43 -03:00
|
|
|
if (!is_aligned &&
|
|
|
|
isect_ray_ray_v3(t->tsnap.snapTarget, axis, edge_snap_point, edge_dir, &lambda, NULL)) {
|
|
|
|
mul_v3_v3fl(r_out, axis, lambda);
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
/**
|
|
|
|
* Snap to the intersection of the axis and the plane defined by the face.
|
|
|
|
*/
|
2020-06-22 09:07:51 -03:00
|
|
|
void transform_constraint_snap_axis_to_face(const TransInfo *t,
|
|
|
|
const float axis[3],
|
|
|
|
float r_out[3])
|
2020-06-18 00:00:43 -03:00
|
|
|
{
|
|
|
|
float lambda;
|
|
|
|
float face_plane[4];
|
|
|
|
const float *face_snap_point = t->tsnap.snapPoint;
|
|
|
|
const float *face_normal = t->tsnap.snapNormal;
|
|
|
|
plane_from_point_normal_v3(face_plane, face_snap_point, face_normal);
|
2020-06-22 09:53:33 -03:00
|
|
|
bool is_aligned = fabsf(dot_v3v3(axis, face_plane)) < CONSTRAIN_EPSILON;
|
2020-06-18 00:00:43 -03:00
|
|
|
if (!is_aligned && isect_ray_plane_v3(t->tsnap.snapTarget, axis, face_plane, &lambda, false)) {
|
|
|
|
mul_v3_v3fl(r_out, axis, lambda);
|
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
/**
|
|
|
|
* Return true if the 2x axis are both aligned when projected into the view.
|
|
|
|
* In this case, we can't usefully project the cursor onto the plane.
|
|
|
|
*/
|
2020-08-07 22:56:13 +10:00
|
|
|
static bool isPlaneProjectionViewAligned(const TransInfo *t, const float plane[4])
|
2020-06-18 00:00:43 -03:00
|
|
|
{
|
|
|
|
const float eps = 0.001f;
|
|
|
|
float view_to_plane[3];
|
|
|
|
getViewVector(t, t->center_global, view_to_plane);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
float factor = dot_v3v3(plane, view_to_plane);
|
2016-02-02 12:03:32 +11:00
|
|
|
return fabsf(factor) < eps;
|
2016-02-01 21:42:39 +11:00
|
|
|
}
|
|
|
|
|
2018-05-21 17:24:14 +02:00
|
|
|
static void planeProjection(const TransInfo *t, const float in[3], float out[3])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float vec[3], factor, norm[3];
|
|
|
|
|
2015-06-26 16:19:39 +10:00
|
|
|
add_v3_v3v3(vec, in, t->center_global);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
getViewVector(t, vec, norm);
|
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
sub_v3_v3v3(vec, out, in);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
factor = dot_v3v3(vec, norm);
|
2019-08-12 17:13:23 -03:00
|
|
|
if (factor == 0.0f) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return; /* prevent divide by zero */
|
|
|
|
}
|
2009-11-10 20:43:45 +00:00
|
|
|
factor = dot_v3v3(vec, vec) / factor;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(vec, norm);
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(vec, factor);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
add_v3_v3v3(out, in, 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
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-27 05:59:41 +00:00
|
|
|
* Generic callback for constant spatial constraints applied to linear motion
|
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 IN vector in projected into the constrained space and then further
|
|
|
|
* projected along the view vector.
|
|
|
|
* (in perspective mode, the view vector is relative to the position on screen)
|
|
|
|
*/
|
|
|
|
|
2020-05-19 18:54:46 -03:00
|
|
|
static void applyAxisConstraintVec(
|
|
|
|
TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, const float in[3], float out[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2011-09-12 04:14:12 +00:00
|
|
|
copy_v3_v3(out, in);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 && t->con.mode & CON_APPLY) {
|
2020-09-11 22:59:21 -03:00
|
|
|
bool is_snap_to_point = false, is_snap_to_edge = false, is_snap_to_face = false;
|
2020-05-22 14:43:38 -03:00
|
|
|
mul_m3_v3(t->con.pmtx, out);
|
2020-09-11 22:59:21 -03:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
if (activeSnap(t)) {
|
2020-09-11 22:59:21 -03:00
|
|
|
if (validSnap(t)) {
|
|
|
|
is_snap_to_edge = (t->tsnap.snapElem & SCE_SNAP_MODE_EDGE) != 0;
|
|
|
|
is_snap_to_face = (t->tsnap.snapElem & SCE_SNAP_MODE_FACE) != 0;
|
2020-10-06 16:19:22 -03:00
|
|
|
is_snap_to_point = !is_snap_to_edge && !is_snap_to_face;
|
2020-09-11 22:59:21 -03:00
|
|
|
}
|
|
|
|
else if (t->tsnap.snapElem & SCE_SNAP_MODE_GRID) {
|
|
|
|
is_snap_to_point = true;
|
|
|
|
}
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
2020-05-22 14:43:38 -03:00
|
|
|
|
2020-06-18 00:00:43 -03:00
|
|
|
/* With snap points, a projection is alright, no adjustments needed. */
|
2020-09-11 22:59:21 -03:00
|
|
|
if (!is_snap_to_point || is_snap_to_edge || is_snap_to_face) {
|
2020-05-22 14:43:38 -03:00
|
|
|
const int dims = getConstraintSpaceDimension(t);
|
|
|
|
if (dims == 2) {
|
|
|
|
if (!is_zero_v3(out)) {
|
2020-06-18 00:00:43 -03:00
|
|
|
float plane[4];
|
|
|
|
constraint_plane_calc(t, plane);
|
|
|
|
|
|
|
|
if (is_snap_to_edge) {
|
2020-06-22 09:07:51 -03:00
|
|
|
constraint_snap_plane_to_edge(t, plane, out);
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
|
|
|
else if (is_snap_to_face) {
|
2020-11-04 15:22:01 -03:00
|
|
|
/* Disabled, as it has not proven to be really useful. (See T82386). */
|
|
|
|
// constraint_snap_plane_to_face(t, plane, out);
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* View alignment correction. */
|
|
|
|
if (!isPlaneProjectionViewAligned(t, plane)) {
|
|
|
|
planeProjection(t, in, out);
|
|
|
|
}
|
2020-05-22 14:43:38 -03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dims == 1) {
|
|
|
|
float c[3];
|
|
|
|
|
|
|
|
if (t->con.mode & CON_AXIS0) {
|
|
|
|
copy_v3_v3(c, t->spacemtx[0]);
|
|
|
|
}
|
|
|
|
else if (t->con.mode & CON_AXIS1) {
|
|
|
|
copy_v3_v3(c, t->spacemtx[1]);
|
|
|
|
}
|
2020-10-08 13:24:04 -03:00
|
|
|
else {
|
|
|
|
BLI_assert(t->con.mode & CON_AXIS2);
|
2020-05-22 14:43:38 -03:00
|
|
|
copy_v3_v3(c, t->spacemtx[2]);
|
|
|
|
}
|
2020-06-18 00:00:43 -03:00
|
|
|
|
|
|
|
if (is_snap_to_edge) {
|
2020-06-22 09:07:51 -03:00
|
|
|
transform_constraint_snap_axis_to_edge(t, c, out);
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
|
|
|
else if (is_snap_to_face) {
|
2020-06-22 09:07:51 -03:00
|
|
|
transform_constraint_snap_axis_to_face(t, c, out);
|
2020-06-18 00:00:43 -03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* View alignment correction. */
|
|
|
|
axisProjection(t, c, in, out);
|
|
|
|
}
|
2020-05-22 14:43:38 -03:00
|
|
|
}
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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-26 19:47:55 +00:00
|
|
|
* Generic callback for object based spatial constraints applied to linear motion
|
2009-07-12 02:01:13 +00:00
|
|
|
*
|
2020-05-22 12:34:29 -03:00
|
|
|
* At first, the following is applied without orientation
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 IN vector in projected into the constrained space and then further
|
|
|
|
* projected along the view vector.
|
|
|
|
* (in perspective mode, the view vector is relative to the position on screen)
|
|
|
|
*
|
|
|
|
* Further down, that vector is mapped to each data's space.
|
|
|
|
*/
|
|
|
|
|
2020-05-19 18:54:46 -03:00
|
|
|
static void applyObjectConstraintVec(
|
|
|
|
TransInfo *t, TransDataContainer *tc, TransData *td, const float in[3], float out[3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2020-05-22 14:43:38 -03:00
|
|
|
if (!td) {
|
|
|
|
applyAxisConstraintVec(t, tc, td, in, out);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* Specific TransData's space. */
|
|
|
|
copy_v3_v3(out, in);
|
2020-07-29 09:09:34 -03:00
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
mul_m3_v3(t->spacemtx_inv, out);
|
|
|
|
mul_m3_v3(td->axismtx, out);
|
|
|
|
if (t->flag & T_EDIT) {
|
|
|
|
mul_m3_v3(tc->mat3_unit, out);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-27 05:59:41 +00:00
|
|
|
* Generic callback for constant spatial constraints applied to resize motion
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void applyAxisConstraintSize(TransInfo *t,
|
|
|
|
TransDataContainer *UNUSED(tc),
|
|
|
|
TransData *td,
|
|
|
|
float smat[3][3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
if (!td && t->con.mode & CON_APPLY) {
|
|
|
|
float tmat[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (!(t->con.mode & CON_AXIS0)) {
|
|
|
|
smat[0][0] = 1.0f;
|
|
|
|
}
|
|
|
|
if (!(t->con.mode & CON_AXIS1)) {
|
|
|
|
smat[1][1] = 1.0f;
|
|
|
|
}
|
|
|
|
if (!(t->con.mode & CON_AXIS2)) {
|
|
|
|
smat[2][2] = 1.0f;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
mul_m3_m3m3(tmat, smat, t->spacemtx_inv);
|
|
|
|
mul_m3_m3m3(smat, t->spacemtx, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-27 05:59:41 +00:00
|
|
|
* Callback for object based spatial constraints applied to resize motion
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
|
|
|
|
2018-04-16 16:27:55 +02:00
|
|
|
static void applyObjectConstraintSize(TransInfo *t,
|
|
|
|
TransDataContainer *tc,
|
|
|
|
TransData *td,
|
|
|
|
float smat[3][3])
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
if (td && t->con.mode & CON_APPLY) {
|
|
|
|
float tmat[3][3];
|
|
|
|
float imat[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
invert_m3_m3(imat, td->axismtx);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (!(t->con.mode & CON_AXIS0)) {
|
|
|
|
smat[0][0] = 1.0f;
|
|
|
|
}
|
|
|
|
if (!(t->con.mode & CON_AXIS1)) {
|
|
|
|
smat[1][1] = 1.0f;
|
|
|
|
}
|
|
|
|
if (!(t->con.mode & CON_AXIS2)) {
|
|
|
|
smat[2][2] = 1.0f;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_m3_m3m3(tmat, smat, imat);
|
2013-04-12 02:16:44 +00:00
|
|
|
if (t->flag & T_EDIT) {
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_m3m3(smat, tc->mat3_unit, smat);
|
2013-04-12 02:16:44 +00:00
|
|
|
}
|
2013-04-22 16:46:37 +00:00
|
|
|
mul_m3_m3m3(smat, td->axismtx, tmat);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-31 17:15:58 +11:00
|
|
|
static void constraints_rotation_imp(TransInfo *t, float r_vec[3], float *r_angle)
|
2021-01-30 12:55:07 -03:00
|
|
|
{
|
|
|
|
BLI_assert(t->con.mode & CON_APPLY);
|
|
|
|
int mode = t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2);
|
|
|
|
|
|
|
|
switch (mode) {
|
|
|
|
case CON_AXIS0:
|
|
|
|
case (CON_AXIS1 | CON_AXIS2):
|
|
|
|
negate_v3_v3(r_vec, t->spacemtx[0]);
|
|
|
|
break;
|
|
|
|
case CON_AXIS1:
|
|
|
|
case (CON_AXIS0 | CON_AXIS2):
|
|
|
|
negate_v3_v3(r_vec, t->spacemtx[1]);
|
|
|
|
break;
|
|
|
|
case CON_AXIS2:
|
|
|
|
case (CON_AXIS0 | CON_AXIS1):
|
|
|
|
negate_v3_v3(r_vec, t->spacemtx[2]);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* don't flip axis if asked to or if num input */
|
|
|
|
if (r_angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) {
|
|
|
|
if (dot_v3v3(r_vec, t->viewinv[2]) > 0.0f) {
|
|
|
|
*r_angle = -(*r_angle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/*
|
2012-06-27 05:59:41 +00:00
|
|
|
* Generic callback for constant spatial constraints applied to rotations
|
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 rotation axis is copied into VEC.
|
|
|
|
*
|
|
|
|
* In the case of single axis constraints, the rotation axis is directly the one constrained to.
|
|
|
|
* For planar constraints (2 axis), the rotation axis is the normal of the plane.
|
|
|
|
*
|
|
|
|
* The following only applies when CON_NOFLIP is not set.
|
|
|
|
* The vector is then modified to always point away from the screen (in global space)
|
|
|
|
* This insures that the rotation is always logically following the mouse.
|
|
|
|
* (ie: not doing counterclockwise rotations when the mouse moves clockwise).
|
|
|
|
*/
|
2018-04-16 16:27:55 +02:00
|
|
|
static void applyAxisConstraintRot(
|
|
|
|
TransInfo *t, TransDataContainer *UNUSED(tc), TransData *td, float vec[3], float *angle)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
if (!td && t->con.mode & CON_APPLY) {
|
2021-01-31 17:15:58 +11:00
|
|
|
constraints_rotation_imp(t, vec, angle);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-06-27 05:59:41 +00:00
|
|
|
* Callback for object based spatial constraints applied to rotations
|
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 rotation axis is copied into VEC.
|
|
|
|
*
|
|
|
|
* In the case of single axis constraints, the rotation axis is directly the one constrained to.
|
|
|
|
* For planar constraints (2 axis), the rotation axis is the normal of the plane.
|
|
|
|
*
|
|
|
|
* The following only applies when CON_NOFLIP is not set.
|
|
|
|
* The vector is then modified to always point away from the screen (in global space)
|
|
|
|
* This insures that the rotation is always logically following the mouse.
|
|
|
|
* (ie: not doing counterclockwise rotations when the mouse moves clockwise).
|
|
|
|
*/
|
2018-04-16 16:27:55 +02:00
|
|
|
static void applyObjectConstraintRot(
|
|
|
|
TransInfo *t, TransDataContainer *tc, TransData *td, float vec[3], float *angle)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
if (t->con.mode & CON_APPLY) {
|
|
|
|
/* on setup call, use first object */
|
|
|
|
if (td == NULL) {
|
2018-07-30 20:53:34 +10:00
|
|
|
BLI_assert(tc == NULL);
|
|
|
|
tc = TRANS_DATA_CONTAINER_FIRST_OK(t);
|
|
|
|
td = tc->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
|
|
|
}
|
2021-01-31 17:15:58 +11:00
|
|
|
constraints_rotation_imp(t, vec, angle);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------- INTERNAL SETUP CALLS ------------------*/
|
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
void setConstraint(TransInfo *t, int mode, const char text[])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2012-01-11 12:33:51 +00:00
|
|
|
BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->con.mode = mode;
|
2020-05-22 12:34:29 -03:00
|
|
|
projection_matrix_calc(t, t->con.pmtx);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
startConstraint(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->con.drawExtra = NULL;
|
|
|
|
t->con.applyVec = applyAxisConstraintVec;
|
|
|
|
t->con.applySize = applyAxisConstraintSize;
|
|
|
|
t->con.applyRot = applyAxisConstraintRot;
|
2013-10-23 06:48:36 +00:00
|
|
|
t->redraw = TREDRAW_HARD;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2013-05-01 05:26:10 +00:00
|
|
|
/* applies individual td->axismtx constraints */
|
|
|
|
void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[])
|
|
|
|
{
|
2020-05-22 12:34:29 -03:00
|
|
|
BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
|
|
|
|
t->con.mode = mode;
|
|
|
|
projection_matrix_calc(t, t->con.pmtx);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
startConstraint(t);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
t->con.drawExtra = drawObjectConstraint;
|
|
|
|
t->con.applyVec = applyObjectConstraintVec;
|
|
|
|
t->con.applySize = applyObjectConstraintSize;
|
|
|
|
t->con.applyRot = applyObjectConstraintRot;
|
|
|
|
t->redraw = TREDRAW_HARD;
|
2013-05-01 05:26:10 +00:00
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
void setLocalConstraint(TransInfo *t, int mode, const char text[])
|
|
|
|
{
|
2021-01-20 12:35:38 -03:00
|
|
|
if ((t->flag & T_EDIT) || t->data_len_all == 1) {
|
2020-05-22 12:34:29 -03:00
|
|
|
/* Although in edit-mode each object has its local space, use the
|
|
|
|
* orientation of the active object. */
|
|
|
|
setConstraint(t, mode, text);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2013-05-01 05:26:10 +00:00
|
|
|
else {
|
|
|
|
setAxisMatrixConstraint(t, mode, text);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2012-03-03 16:31:46 +00:00
|
|
|
* Set the constraint according to the user defined orientation
|
|
|
|
*
|
|
|
|
* ftext is a format string passed to BLI_snprintf. It will add the name of
|
|
|
|
* the orientation where %s is (logically).
|
|
|
|
*/
|
2020-09-24 19:16:41 -03:00
|
|
|
void setUserConstraint(TransInfo *t, int mode, const char ftext[])
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2020-05-22 14:05:51 -03:00
|
|
|
char text[256];
|
2020-09-24 19:16:41 -03:00
|
|
|
short orientation = t->orient[t->orient_curr].type;
|
|
|
|
if (orientation == V3D_ORIENT_CUSTOM_MATRIX) {
|
|
|
|
/* Use the real value of the "orient_type". */
|
|
|
|
orientation = t->orient[0].type;
|
|
|
|
}
|
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
const char *spacename = transform_orientations_spacename_get(t, orientation);
|
2020-05-22 14:05:51 -03:00
|
|
|
BLI_snprintf(text, sizeof(text), ftext, spacename);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2021-01-20 12:25:58 -03:00
|
|
|
switch (orientation) {
|
|
|
|
case V3D_ORIENT_LOCAL:
|
|
|
|
setLocalConstraint(t, mode, text);
|
|
|
|
break;
|
|
|
|
case V3D_ORIENT_NORMAL:
|
|
|
|
if (checkUseAxisMatrix(t)) {
|
|
|
|
setAxisMatrixConstraint(t, mode, text);
|
2020-05-22 14:58:56 -03:00
|
|
|
break;
|
2013-05-01 05:26:10 +00:00
|
|
|
}
|
2021-01-20 12:25:58 -03:00
|
|
|
ATTR_FALLTHROUGH;
|
|
|
|
case V3D_ORIENT_GLOBAL:
|
|
|
|
case V3D_ORIENT_VIEW:
|
|
|
|
case V3D_ORIENT_CURSOR:
|
|
|
|
case V3D_ORIENT_GIMBAL:
|
|
|
|
case V3D_ORIENT_CUSTOM_MATRIX:
|
|
|
|
case V3D_ORIENT_CUSTOM:
|
|
|
|
default: {
|
|
|
|
setConstraint(t, mode, text);
|
|
|
|
break;
|
2017-06-01 20:41:18 +02:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
t->con.mode |= CON_USER;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------- DRAWING CONSTRAINTS -------------------*/
|
|
|
|
|
2010-10-16 14:32:17 +00:00
|
|
|
void drawConstraint(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
|
|
|
{
|
|
|
|
TransCon *tc = &(t->con);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, 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
|
|
|
return;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
if (!(tc->mode & CON_APPLY)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
|
|
|
if (t->flag & T_NO_CONSTRAINT) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (tc->drawExtra) {
|
|
|
|
tc->drawExtra(t);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (tc->mode & CON_SELECT) {
|
|
|
|
float vec[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2011-05-12 16:47:36 +00:00
|
|
|
convertViewVec(t, vec, (t->mval[0] - t->con.imval[0]), (t->mval[1] - t->con.imval[1]));
|
2015-06-26 16:19:39 +10:00
|
|
|
add_v3_v3(vec, t->center_global);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
drawLine(t, t->center_global, t->spacemtx[0], 'X', 0);
|
|
|
|
drawLine(t, t->center_global, t->spacemtx[1], 'Y', 0);
|
|
|
|
drawLine(t, t->center_global, t->spacemtx[2], 'Z', 0);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-20 16:38:34 +02:00
|
|
|
eGPUDepthTest depth_test_enabled = GPU_depth_test_get();
|
2019-04-22 09:19:45 +10:00
|
|
|
if (depth_test_enabled) {
|
2020-08-20 16:38:34 +02:00
|
|
|
GPU_depth_test(GPU_DEPTH_NONE);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
const uint shdr_pos = GPU_vertformat_attr_add(
|
|
|
|
immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-07-13 16:44:02 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-04-27 15:27:00 +02:00
|
|
|
float viewport_size[4];
|
2018-07-02 18:27:05 +02:00
|
|
|
GPU_viewport_size_get_f(viewport_size);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform2f("viewport_size", viewport_size[2], viewport_size[3]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-01 08:42:16 +02:00
|
|
|
immUniform1i("colors_len", 0); /* "simple" mode */
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
2017-04-27 15:27:00 +02:00
|
|
|
immUniform1f("dash_width", 2.0f);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immUniform1f("dash_factor", 0.5f);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
immBegin(GPU_PRIM_LINES, 2);
|
Reworked version of dashed line shader.
Using geometry shader allows us to get rid of the 'line origin' extra
vertex attribute, which means dashed shader no longer requires fiddling
with those vertex attributes definition, and, most importantly, does not
require anymore special drawing code!
As you can see, this makes code much simpler, and much less verbose,
especially in complex cases.
In addition, changed how dashes are handled, to have two 'modes', a
simple one with single color (using default "color" uniform name), and a
more advanced one allowing more complex and multi-color patterns.
Note that since GLSL 1.2 does not support geometry shaders, a hack was
added for now (which gives solid lines, but at least does not make
Blender crash).
2017-05-01 16:21:53 +02:00
|
|
|
immVertex3fv(shdr_pos, t->center_global);
|
|
|
|
immVertex3fv(shdr_pos, vec);
|
2017-01-26 12:39:36 -02:00
|
|
|
immEnd();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-01-26 12:39:36 -02:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (depth_test_enabled) {
|
2020-08-20 16:38:34 +02:00
|
|
|
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (tc->mode & CON_AXIS0) {
|
2020-05-22 12:34:29 -03:00
|
|
|
drawLine(t, t->center_global, t->spacemtx[0], 'X', DRAWLIGHT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (tc->mode & CON_AXIS1) {
|
2020-05-22 12:34:29 -03:00
|
|
|
drawLine(t, t->center_global, t->spacemtx[1], 'Y', DRAWLIGHT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (tc->mode & CON_AXIS2) {
|
2020-05-22 12:34:29 -03:00
|
|
|
drawLine(t, t->center_global, t->spacemtx[2], 'Z', DRAWLIGHT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 from drawview.c, as an extra per-window draw option */
|
2009-03-28 20:46:38 +00:00
|
|
|
void drawPropCircle(const struct bContext *C, TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
|
|
|
if (t->flag & T_PROP_EDIT) {
|
2009-03-28 20:46:38 +00:00
|
|
|
RegionView3D *rv3d = CTX_wm_region_view3d(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
|
|
|
float tmat[4][4], imat[4][4];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-03-24 06:38:07 +00:00
|
|
|
if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
|
2009-11-10 20:43:45 +00:00
|
|
|
copy_m4_m4(tmat, rv3d->viewmat);
|
|
|
|
invert_m4_m4(imat, tmat);
|
2009-01-10 18:33:16 +00:00
|
|
|
}
|
2012-03-06 18:40:15 +00:00
|
|
|
else {
|
2009-11-10 20:43:45 +00:00
|
|
|
unit_m4(tmat);
|
|
|
|
unit_m4(imat);
|
2009-01-10 18:33:16 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_push();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2015-06-26 16:19:39 +10:00
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
/* pass */
|
2009-01-10 18:33:16 +00:00
|
|
|
}
|
2012-03-24 06:38:07 +00:00
|
|
|
else if (t->spacetype == SPACE_IMAGE) {
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_scale_2f(1.0f / t->aspect[0], 1.0f / t->aspect[1]);
|
2015-03-27 15:23:39 +01:00
|
|
|
}
|
2019-02-16 16:42:11 +11:00
|
|
|
else if (ELEM(t->spacetype, SPACE_GRAPH, SPACE_ACTION)) {
|
2015-03-27 15:23:39 +01:00
|
|
|
/* only scale y */
|
2020-03-06 16:56:42 +01:00
|
|
|
rcti *mask = &t->region->v2d.mask;
|
|
|
|
rctf *datamask = &t->region->v2d.cur;
|
2015-03-27 15:23:39 +01:00
|
|
|
float xsize = BLI_rctf_size_x(datamask);
|
|
|
|
float ysize = BLI_rctf_size_y(datamask);
|
|
|
|
float xmask = BLI_rcti_size_x(mask);
|
|
|
|
float ymask = BLI_rcti_size_y(mask);
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_scale_2f(1.0f, (ysize / xsize) * (xmask / ymask));
|
2009-02-09 20:58:31 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-08-20 16:38:34 +02:00
|
|
|
eGPUDepthTest depth_test_enabled = GPU_depth_test_get();
|
2019-04-22 09:19:45 +10:00
|
|
|
if (depth_test_enabled) {
|
2020-08-20 16:38:34 +02:00
|
|
|
GPU_depth_test(GPU_DEPTH_NONE);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-30 18:21:35 +02:00
|
|
|
immBindBuiltinProgram(GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-06-30 18:21:35 +02:00
|
|
|
float viewport[4];
|
|
|
|
GPU_viewport_size_get_f(viewport);
|
2020-08-16 15:38:34 +02:00
|
|
|
GPU_blend(GPU_BLEND_ALPHA);
|
2020-06-30 18:21:35 +02:00
|
|
|
|
|
|
|
immUniform2fv("viewportSize", &viewport[2]);
|
|
|
|
immUniform1f("lineWidth", 3.0f * U.pixelsize);
|
|
|
|
|
|
|
|
immUniformThemeColorShadeAlpha(TH_GRID, -20, 255);
|
|
|
|
imm_drawcircball(t->center_global, t->prop_size, imat, pos);
|
|
|
|
|
|
|
|
immUniform1f("lineWidth", 1.0f * U.pixelsize);
|
|
|
|
immUniformThemeColorShadeAlpha(TH_GRID, 20, 255);
|
2017-02-07 20:53:20 -02:00
|
|
|
imm_drawcircball(t->center_global, t->prop_size, imat, pos);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2017-02-07 20:53:20 -02:00
|
|
|
immUnbindProgram();
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (depth_test_enabled) {
|
2020-08-20 16:38:34 +02:00
|
|
|
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-15 15:27:15 +02:00
|
|
|
GPU_matrix_pop();
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
static void drawObjectConstraint(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
|
|
|
/* Draw the first one lighter because that's the one who controls the others.
|
2012-03-03 16:31:46 +00:00
|
|
|
* Meaning the transformation is projected on that one and just copied on the others
|
|
|
|
* constraint space.
|
|
|
|
* In a nutshell, the object with light axis is controlled by the user and the others follow.
|
|
|
|
* Without drawing the first light, users have little clue what they are doing.
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*/
|
2013-04-04 09:20:46 +00:00
|
|
|
short options = DRAWLIGHT;
|
2013-04-12 02:16:44 +00:00
|
|
|
float tmp_axismtx[3][3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-21 04:40:16 +10:00
|
|
|
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
2018-04-16 17:54:33 +02:00
|
|
|
TransData *td = tc->data;
|
2020-09-09 18:41:07 +02:00
|
|
|
for (int i = 0; i < tc->data_len; i++, td++) {
|
2018-04-16 17:54:33 +02:00
|
|
|
float co[3];
|
|
|
|
float(*axismtx)[3];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (t->flag & T_PROP_EDIT) {
|
|
|
|
/* we're sorted, so skip the rest */
|
|
|
|
if (td->factor == 0.0f) {
|
|
|
|
break;
|
2013-10-23 05:33:42 +00:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (t->options & CTX_GPENCIL_STROKES) {
|
|
|
|
/* only draw a constraint line for one point, otherwise we can't see anything */
|
|
|
|
if ((options & DRAWLIGHT) == 0) {
|
|
|
|
break;
|
2017-09-26 12:56:24 +13:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
}
|
|
|
|
|
2020-05-30 11:10:07 -03:00
|
|
|
if (t->flag & T_EDIT) {
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_v3_m4v3(co, tc->mat, td->center);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_m3_m3m3(tmp_axismtx, tc->mat3_unit, td->axismtx);
|
2018-04-16 17:54:33 +02:00
|
|
|
axismtx = tmp_axismtx;
|
|
|
|
}
|
|
|
|
else if (t->flag & T_POSE) {
|
2018-05-04 14:41:51 +02:00
|
|
|
mul_v3_m4v3(co, tc->mat, td->center);
|
2018-04-16 17:54:33 +02:00
|
|
|
axismtx = td->axismtx;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
copy_v3_v3(co, td->center);
|
|
|
|
axismtx = td->axismtx;
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-04-16 17:54:33 +02:00
|
|
|
if (t->con.mode & CON_AXIS0) {
|
|
|
|
drawLine(t, co, axismtx[0], 'X', options);
|
|
|
|
}
|
|
|
|
if (t->con.mode & CON_AXIS1) {
|
|
|
|
drawLine(t, co, axismtx[1], 'Y', options);
|
|
|
|
}
|
|
|
|
if (t->con.mode & CON_AXIS2) {
|
|
|
|
drawLine(t, co, axismtx[2], 'Z', options);
|
|
|
|
}
|
|
|
|
options &= ~DRAWLIGHT;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
2018-04-16 16:27:55 +02:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*--------------------- START / STOP CONSTRAINTS ---------------------- */
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
void startConstraint(TransInfo *t)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->con.mode |= CON_APPLY;
|
|
|
|
*t->con.text = ' ';
|
2012-10-24 05:06:40 +00:00
|
|
|
t->num.idx_max = min_ii(getConstraintSpaceDimension(t) - 1, t->idx_max);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
void stopConstraint(TransInfo *t)
|
|
|
|
{
|
2020-09-03 17:57:58 -03:00
|
|
|
if (t->orient_curr != 0) {
|
|
|
|
t->orient_curr = 0;
|
|
|
|
transform_orientations_current_set(t, t->orient_curr);
|
|
|
|
}
|
|
|
|
|
2012-06-10 22:13:17 +00:00
|
|
|
t->con.mode &= ~(CON_APPLY | CON_SELECT);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
*t->con.text = '\0';
|
|
|
|
t->num.idx_max = t->idx_max;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*------------------------- MMB Select -------------------------------*/
|
|
|
|
|
2020-05-31 15:19:29 -03:00
|
|
|
void initSelectConstraint(TransInfo *t)
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
{
|
2020-05-31 15:19:29 -03:00
|
|
|
if (t->orient_curr == 0) {
|
2020-09-24 19:16:41 -03:00
|
|
|
transform_orientations_current_set(t, 1);
|
2020-04-29 08:07:25 -03:00
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-09-24 19:16:41 -03:00
|
|
|
setUserConstraint(t, CON_APPLY | CON_SELECT, "%s");
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
setNearestAxis(t);
|
|
|
|
}
|
|
|
|
|
2011-12-17 00:52:36 +00:00
|
|
|
void selectConstraint(TransInfo *t)
|
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
if (t->con.mode & CON_SELECT) {
|
|
|
|
setNearestAxis(t);
|
|
|
|
startConstraint(t);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void postSelectConstraint(TransInfo *t)
|
|
|
|
{
|
2019-04-22 09:19:45 +10:00
|
|
|
if (!(t->con.mode & CON_SELECT)) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
return;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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.mode &= ~CON_AXIS0;
|
|
|
|
t->con.mode &= ~CON_AXIS1;
|
|
|
|
t->con.mode &= ~CON_AXIS2;
|
|
|
|
t->con.mode &= ~CON_SELECT;
|
|
|
|
|
|
|
|
setNearestAxis(t);
|
|
|
|
|
|
|
|
startConstraint(t);
|
2013-10-23 06:48:36 +00:00
|
|
|
t->redraw = TREDRAW_HARD;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void setNearestAxis2d(TransInfo *t)
|
|
|
|
{
|
|
|
|
/* no correction needed... just use whichever one is lower */
|
2014-01-16 19:15:53 +11:00
|
|
|
if (abs(t->mval[0] - t->con.imval[0]) < abs(t->mval[1] - t->con.imval[1])) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
t->con.mode |= CON_AXIS1;
|
2019-06-11 22:25:01 +02:00
|
|
|
BLI_strncpy(t->con.text, TIP_(" along Y axis"), sizeof(t->con.text));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 {
|
|
|
|
t->con.mode |= CON_AXIS0;
|
2019-06-11 22:25:01 +02:00
|
|
|
BLI_strncpy(t->con.text, TIP_(" along X axis"), sizeof(t->con.text));
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 setNearestAxis3d(TransInfo *t)
|
|
|
|
{
|
|
|
|
float zfac;
|
2013-11-21 02:15:38 +11:00
|
|
|
float mvec[3], proj[3];
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
float len[3];
|
2013-11-21 02:15:38 +11:00
|
|
|
int i;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* calculate mouse movement */
|
|
|
|
mvec[0] = (float)(t->mval[0] - t->con.imval[0]);
|
|
|
|
mvec[1] = (float)(t->mval[1] - t->con.imval[1]);
|
|
|
|
mvec[2] = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-04-10 08:40:49 +02:00
|
|
|
/* We need to correct axis length for the current zoom-level of view,
|
2012-03-03 16:31:46 +00:00
|
|
|
* this to prevent projected values to be clipped behind the camera
|
|
|
|
* and to overflow the short integers.
|
2012-03-08 04:12:11 +00:00
|
|
|
* The formula used is a bit stupid, just a simplification of the subtraction
|
2012-03-03 16:31:46 +00:00
|
|
|
* of two 2D points 30 pixels apart (that's the last factor in the formula) after
|
2013-03-09 11:40:42 +00:00
|
|
|
* projecting them with ED_view3d_win_to_delta and then get the length of that vector.
|
2012-03-03 16:31:46 +00:00
|
|
|
*/
|
2018-04-10 16:13:32 +02:00
|
|
|
zfac = mul_project_m4_v3_zfac(t->persmat, t->center_global);
|
2020-03-06 16:56:42 +01:00
|
|
|
zfac = len_v3(t->persinv[0]) * 2.0f / t->region->winx * zfac * 30.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2012-06-10 22:13:17 +00:00
|
|
|
for (i = 0; i < 3; i++) {
|
2013-11-21 02:15:38 +11:00
|
|
|
float axis[3], axis_2d[2];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
copy_v3_v3(axis, t->spacemtx[i]);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2009-11-10 20:43:45 +00:00
|
|
|
mul_v3_fl(axis, zfac);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* now we can project to get window coordinate */
|
2015-06-26 16:19:39 +10:00
|
|
|
add_v3_v3(axis, t->center_global);
|
2013-11-21 02:15:38 +11:00
|
|
|
projectFloatView(t, axis, axis_2d);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2013-11-21 02:15:38 +11:00
|
|
|
sub_v2_v2v2(axis, axis_2d, t->center2d);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
axis[2] = 0.0f;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2014-04-06 11:11:56 +02:00
|
|
|
if (normalize_v3(axis) > 1e-3f) {
|
2009-11-10 20:43:45 +00:00
|
|
|
project_v3_v3v3(proj, mvec, axis);
|
|
|
|
sub_v3_v3v3(axis, mvec, proj);
|
|
|
|
len[i] = normalize_v3(axis);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
else {
|
2014-04-06 11:11:56 +02:00
|
|
|
len[i] = 1e10f;
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (len[0] <= len[1] && len[0] <= len[2]) {
|
2020-09-23 10:45:47 -03:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
|
|
|
t->con.mode |= (CON_AXIS1 | CON_AXIS2);
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" locking %s X axis"), t->spacename);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->con.mode |= CON_AXIS0;
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" along %s X axis"), t->spacename);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (len[1] <= len[0] && len[1] <= len[2]) {
|
2020-09-23 10:45:47 -03:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
|
|
|
t->con.mode |= (CON_AXIS0 | CON_AXIS2);
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" locking %s Y axis"), t->spacename);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->con.mode |= CON_AXIS1;
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" along %s Y axis"), t->spacename);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (len[2] <= len[1] && len[2] <= len[0]) {
|
2020-09-23 10:45:47 -03:00
|
|
|
if (t->modifiers & MOD_CONSTRAINT_PLANE) {
|
|
|
|
t->con.mode |= (CON_AXIS0 | CON_AXIS1);
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" locking %s Z axis"), t->spacename);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
t->con.mode |= CON_AXIS2;
|
|
|
|
BLI_snprintf(t->con.text, sizeof(t->con.text), TIP_(" along %s Z axis"), t->spacename);
|
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 setNearestAxis(TransInfo *t)
|
|
|
|
{
|
|
|
|
/* clear any prior constraint flags */
|
|
|
|
t->con.mode &= ~CON_AXIS0;
|
|
|
|
t->con.mode &= ~CON_AXIS1;
|
|
|
|
t->con.mode &= ~CON_AXIS2;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
/* constraint setting - depends on spacetype */
|
|
|
|
if (t->spacetype == SPACE_VIEW3D) {
|
|
|
|
/* 3d-view */
|
2009-07-12 02:01:13 +00:00
|
|
|
setNearestAxis3d(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 {
|
|
|
|
/* assume that this means a 2D-Editor */
|
|
|
|
setNearestAxis2d(t);
|
|
|
|
}
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2020-05-22 12:34:29 -03:00
|
|
|
projection_matrix_calc(t, t->con.pmtx);
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------- HELPER FUNCTIONS ----------------*/
|
|
|
|
|
2019-02-26 20:17:40 +11:00
|
|
|
int constraintModeToIndex(const TransInfo *t)
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2012-06-10 22:13:17 +00:00
|
|
|
if ((t->con.mode & CON_APPLY) == 0) {
|
2019-02-26 20:17:40 +11: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
|
|
|
}
|
2012-06-10 22:13:17 +00:00
|
|
|
switch (t->con.mode & (CON_AXIS0 | CON_AXIS1 | CON_AXIS2)) {
|
|
|
|
case (CON_AXIS0):
|
|
|
|
case (CON_AXIS1 | CON_AXIS2):
|
2019-02-26 20:17:40 +11:00
|
|
|
return 0;
|
2012-06-10 22:13:17 +00:00
|
|
|
case (CON_AXIS1):
|
|
|
|
case (CON_AXIS0 | CON_AXIS2):
|
2019-02-26 20:17:40 +11:00
|
|
|
return 1;
|
2012-06-10 22:13:17 +00:00
|
|
|
case (CON_AXIS2):
|
|
|
|
case (CON_AXIS0 | CON_AXIS1):
|
2019-02-26 20:17:40 +11:00
|
|
|
return 2;
|
2012-06-10 22:13:17 +00:00
|
|
|
default:
|
2019-02-26 20:17:40 +11: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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-04 09:20:46 +00:00
|
|
|
bool isLockConstraint(TransInfo *t)
|
2011-12-17 00:52:36 +00:00
|
|
|
{
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
int mode = t->con.mode;
|
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((mode & (CON_AXIS0 | CON_AXIS1)) == (CON_AXIS0 | CON_AXIS1)) {
|
2013-04-04 09:20:46 +00:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((mode & (CON_AXIS1 | CON_AXIS2)) == (CON_AXIS1 | CON_AXIS2)) {
|
2013-04-04 09:20:46 +00:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if ((mode & (CON_AXIS0 | CON_AXIS2)) == (CON_AXIS0 | CON_AXIS2)) {
|
2013-04-04 09:20:46 +00:00
|
|
|
return true;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2013-04-04 09:20:46 +00:00
|
|
|
return 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
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Returns the dimension of the constraint space.
|
2009-07-12 02:01:13 +00:00
|
|
|
*
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
* For that reason, the flags always needs to be set to properly evaluate here,
|
|
|
|
* even if they aren't actually used in the callback function. (Which could happen
|
|
|
|
* for weird constraints not yet designed. Along a path for example.)
|
|
|
|
*/
|
|
|
|
|
|
|
|
int getConstraintSpaceDimension(TransInfo *t)
|
|
|
|
{
|
|
|
|
int n = 0;
|
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (t->con.mode & CON_AXIS0) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
n++;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (t->con.mode & CON_AXIS1) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
n++;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
2019-04-22 09:19:45 +10:00
|
|
|
if (t->con.mode & CON_AXIS2) {
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
n++;
|
2019-04-22 09:19:45 +10:00
|
|
|
}
|
2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
2008-12-29 01:41:28 +00:00
|
|
|
|
|
|
|
return n;
|
|
|
|
/*
|
2019-04-18 07:21:26 +02:00
|
|
|
* Someone willing to do it cryptically could do the following instead:
|
|
|
|
*
|
|
|
|
* return t->con & (CON_AXIS0|CON_AXIS1|CON_AXIS2);
|
|
|
|
*
|
|
|
|
* Based on the assumptions that the axis flags are one after the other and start at 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
|
|
|
}
|