| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  |  * ***** BEGIN GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is: all of this file. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Contributor(s): none yet. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * ***** END GPL LICENSE BLOCK ***** | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-27 20:29:51 +00:00
										 |  |  | /** \file blender/editors/transform/transform_constraints.c
 | 
					
						
							|  |  |  |  *  \ingroup edtransform | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							|  |  |  | #include <math.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef WIN32
 | 
					
						
							|  |  |  | #include <unistd.h>
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #include <io.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #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"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "BIF_gl.h"
 | 
					
						
							|  |  |  | #include "BIF_glutil.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
More cleanup!
- removed old UI font completely, including from uiBeginBlock
- emboss hints for uiBlock only have three types now;
  Regular, Pulldown, or "Nothing" (only icon/text)
- removed old font path from Userdef
- removed all old button theme hinting
- removed old "auto block" to merge buttons in groups
  (was only in use for radiosity buttons)
And went over all warnings. One hooray for make giving clean output :)
Well, we need uniform definitions for warnings, so people at least fix
them... here's the real bad bugs I found:
- in mesh code, a call to editmesh mixed *em and *me
- in armature, ED_util.h was not included, so no warnings for wrong call
  to ED_undo_push()
- The extern Py api .h was not included in the bpy_interface.c, showing
  a several calls using different args.
Further just added the missing includes, and removed unused vars.
											
										 
											2009-04-14 15:59:52 +00:00
										 |  |  | #include "BKE_context.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 19:18:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-09 20:58:31 +00:00
										 |  |  | #include "ED_image.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "ED_view3d.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | #include "BLI_math.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 18:36:47 +00:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | #include "BLI_string.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | //#include "blendef.h"
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | //#include "mydevice.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void drawObjectConstraint(TransInfo *t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************** CONSTRAINTS ************************* */ | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void constraintAutoValues(TransInfo *t, float vec[3]) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	int mode = t->con.mode; | 
					
						
							|  |  |  | 	if (mode & CON_APPLY) | 
					
						
							|  |  |  | 	{ | 
					
						
							|  |  |  | 		float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if ((mode & CON_AXIS0) == 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			vec[0] = nval; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if ((mode & CON_AXIS1) == 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			vec[1] = nval; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if ((mode & CON_AXIS2) == 0) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			vec[2] = nval; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) { | 
					
						
							|  |  |  | 		float nval = (t->flag & T_NULL_ONE)?1.0f:0.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (getConstraintSpaceDimension(t) == 2) { | 
					
						
							|  |  |  | 			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; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			else if (axis == (CON_AXIS1|CON_AXIS2)) { | 
					
						
							|  |  |  | 				vec[2] = vec[1]; | 
					
						
							|  |  |  | 				vec[1] = vec[0]; | 
					
						
							|  |  |  | 				vec[0] = nval; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			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; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		else if (getConstraintSpaceDimension(t) == 1) { | 
					
						
							|  |  |  | 			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; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	int i = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	mul_m3_v3(t->con.imtx, 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
										 |  |  | 
 | 
					
						
							|  |  |  | 	snapGrid(t, vec); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (t->num.flag & T_NULL_ONE) { | 
					
						
							|  |  |  | 		if (!(t->con.mode & CON_AXIS0)) | 
					
						
							|  |  |  | 			vec[0] = 1.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (!(t->con.mode & CON_AXIS1)) | 
					
						
							|  |  |  | 			vec[1] = 1.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if (!(t->con.mode & CON_AXIS2)) | 
					
						
							|  |  |  | 			vec[2] = 1.0f; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (hasNumInput(&t->num)) { | 
					
						
							|  |  |  | 		applyNumInput(&t->num, vec); | 
					
						
							| 
									
										
										
										
											2010-11-16 17:37:26 +00:00
										 |  |  | 		removeAspectRatio(t, 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
										 |  |  | 		constraintNumInput(t, vec); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-29 19:52:53 +00:00
										 |  |  | 	/* autovalues is operator param, use that directly but not if snapping is forced */ | 
					
						
							|  |  |  | 	if (t->flag & T_AUTOVALUES && (t->tsnap.status & SNAP_FORCED) == 0) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2010-11-10 07:10:23 +00:00
										 |  |  | 		mul_v3_m3v3(vec, t->con.imtx, t->auto_values); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 		constraintAutoValues(t, vec); | 
					
						
							| 
									
										
										
										
											2010-11-10 07:10:23 +00:00
										 |  |  | 		/* inverse transformation at the end */ | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	if (t->con.mode & CON_AXIS0) { | 
					
						
							|  |  |  | 		pvec[i++] = vec[0]; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS1) { | 
					
						
							|  |  |  | 		pvec[i++] = vec[1]; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS2) { | 
					
						
							|  |  |  | 		pvec[i++] = vec[2]; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	mul_m3_v3(t->con.mtx, 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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-29 05:01:50 +00:00
										 |  |  | static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if(t->spacetype == SPACE_VIEW3D) { | 
					
						
							|  |  |  | 		// View3D *v3d = t->sa->spacedata.first;
 | 
					
						
							|  |  |  | 		const float min_dist= 1.0f; // v3d->near;
 | 
					
						
							|  |  |  | 		float dir[3]; | 
					
						
							|  |  |  | 		float l; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		sub_v3_v3v3(dir, t_con_center, t->viewinv[3]); | 
					
						
							|  |  |  | 		if(dot_v3v3(dir, t->viewinv[2]) < 0.0f) { | 
					
						
							|  |  |  | 			negate_v3(dir); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		project_v3_v3v3(dir, dir, t->viewinv[2]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		l= len_v3(dir); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		if(l < min_dist) { | 
					
						
							|  |  |  | 			float diff[3]; | 
					
						
							|  |  |  | 			normalize_v3_v3(diff, t->viewinv[2]); | 
					
						
							|  |  |  | 			mul_v3_fl(diff, min_dist - l); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			sub_v3_v3(t_con_center, diff); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											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]; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	if(in[0]==0.0f && in[1]==0.0f && in[2]==0.0f) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-29 05:01:50 +00:00
										 |  |  | 	copy_v3_v3(t_con_center, t->con.center); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* checks for center being too close to the view center */ | 
					
						
							|  |  |  | 	viewAxisCorrectCenter(t, t_con_center); | 
					
						
							|  |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-03-28 17:06:15 +00:00
										 |  |  | 	angle = fabsf(angle_v3v3(axis, t->viewinv[2])); | 
					
						
							|  |  |  | 	if (angle > (float)M_PI / 2.0f) { | 
					
						
							|  |  |  | 		angle = (float)M_PI - angle; | 
					
						
							| 
									
										
										
										
											2010-01-15 00:35:21 +00:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2011-03-28 17:06:15 +00:00
										 |  |  | 	angle = RAD2DEGF(angle); | 
					
						
							| 
									
										
										
										
											2010-01-15 00:35:21 +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 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 */ | 
					
						
							| 
									
										
										
										
											2010-01-15 00:35:21 +00:00
										 |  |  | 	if(angle < 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; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */ | 
					
						
							|  |  |  | 		if(factor<0.0f) factor*= -factor; | 
					
						
							|  |  |  | 		else factor*= factor; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 		copy_v3_v3(out, axis); | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		normalize_v3(out); | 
					
						
							|  |  |  | 		mul_v3_fl(out, -factor);	/* -factor makes move down going backwards */ | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 		float v[3], i1[3], i2[3]; | 
					
						
							|  |  |  | 		float v2[3], v4[3]; | 
					
						
							|  |  |  | 		float norm_center[3]; | 
					
						
							|  |  |  | 		float plane[3]; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00: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); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		project_v3_v3v3(vec, in, plane); | 
					
						
							|  |  |  | 		sub_v3_v3v3(vec, in, vec); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00: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); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/* 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); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2011-03-28 17:06:15 +00:00
										 |  |  | 				mul_v3_fl(out, -1000000000.0f); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 			} | 
					
						
							|  |  |  | 		} else { | 
					
						
							| 
									
										
										
										
											2011-04-29 05:01:50 +00:00
										 |  |  | 			add_v3_v3v3(v2, t_con_center, axis); | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			add_v3_v3v3(v4, v, norm); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2011-04-29 05:01:50 +00:00
										 |  |  | 			isect_line_line_v3(t_con_center, v2, v, v4, i1, i2); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 			 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			sub_v3_v3v3(v, i2, v); | 
					
						
							| 
									
										
										
										
											2009-11-02 19:37:18 +00:00
										 |  |  | 	 | 
					
						
							| 
									
										
										
										
											2011-04-29 05:01:50 +00:00
										 |  |  | 			sub_v3_v3v3(out, i1, t_con_center); | 
					
						
							| 
									
										
										
										
											2011-04-20 09:46:45 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			/* possible some values become nan when
 | 
					
						
							|  |  |  | 			 * viewpoint and object are both zero */ | 
					
						
							|  |  |  | 			if(!finite(out[0])) out[0]= 0.0f; | 
					
						
							|  |  |  | 			if(!finite(out[1])) out[1]= 0.0f; | 
					
						
							|  |  |  | 			if(!finite(out[2])) out[2]= 0.0f; | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | static void planeProjection(TransInfo *t, 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
										 |  |  | 	float vec[3], factor, norm[3]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	add_v3_v3v3(vec, in, t->con.center); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	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); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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 (fabs(factor) <= 0.001) { | 
					
						
							|  |  |  | 		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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Generic callback for constant spacial 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) | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyAxisConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											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) { | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		mul_m3_v3(t->con.pmtx, out); | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 		// With snap, a projection is alright, no need to correct for view alignment
 | 
					
						
							| 
									
										
										
										
											2009-12-03 19:18:00 +00:00
										 |  |  | 		if (!(t->tsnap.mode != SCE_SNAP_MODE_INCREMENT && activeSnap(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 (getConstraintSpaceDimension(t) == 2) { | 
					
						
							|  |  |  | 				if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { | 
					
						
							|  |  |  | 					planeProjection(t, in, out); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			else if (getConstraintSpaceDimension(t) == 1) { | 
					
						
							|  |  |  | 				float c[3]; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				if (t->con.mode & CON_AXIS0) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[0]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				else if (t->con.mode & CON_AXIS1) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[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
										 |  |  | 				} | 
					
						
							|  |  |  | 				else if (t->con.mode & CON_AXIS2) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[2]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				axisProjection(t, c, in, out); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		postConstraintChecks(t, out, pvec); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  |  * | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  |  * At first, the following is applied to the first data in the array | 
					
						
							|  |  |  |  * 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. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], float out[3], float pvec[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											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 (t->con.mode & CON_APPLY) { | 
					
						
							|  |  |  | 		if (!td) { | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			mul_m3_v3(t->con.pmtx, 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
										 |  |  | 			if (getConstraintSpaceDimension(t) == 2) { | 
					
						
							|  |  |  | 				if (out[0] != 0.0f || out[1] != 0.0f || out[2] != 0.0f) { | 
					
						
							|  |  |  | 					planeProjection(t, in, out); | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			else if (getConstraintSpaceDimension(t) == 1) { | 
					
						
							|  |  |  | 				float c[3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				if (t->con.mode & CON_AXIS0) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[0]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				else if (t->con.mode & CON_AXIS1) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[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
										 |  |  | 				} | 
					
						
							|  |  |  | 				else if (t->con.mode & CON_AXIS2) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 					copy_v3_v3(c, t->con.mtx[2]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				} | 
					
						
							|  |  |  | 				axisProjection(t, c, in, out); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			postConstraintChecks(t, out, pvec); | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(out, pvec); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							|  |  |  | 			int i=0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			out[0] = out[1] = out[2] = 0.0f; | 
					
						
							|  |  |  | 			if (t->con.mode & CON_AXIS0) { | 
					
						
							|  |  |  | 				out[0] = in[i++]; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (t->con.mode & CON_AXIS1) { | 
					
						
							|  |  |  | 				out[1] = in[i++]; | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			if (t->con.mode & CON_AXIS2) { | 
					
						
							|  |  |  | 				out[2] = in[i++]; | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			mul_m3_v3(td->axismtx, 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
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Generic callback for constant spacial constraints applied to resize 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
										 |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (!td && t->con.mode & CON_APPLY) { | 
					
						
							|  |  |  | 		float tmat[3][3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		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; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		mul_m3_m3m3(tmat, smat, t->con.imtx); | 
					
						
							|  |  |  | 		mul_m3_m3m3(smat, t->con.mtx, 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
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Callback for object based spacial constraints applied to resize 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
										 |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3][3]) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (td && t->con.mode & CON_APPLY) { | 
					
						
							|  |  |  | 		float tmat[3][3]; | 
					
						
							|  |  |  | 		float imat[3][3]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		invert_m3_m3(imat, td->axismtx); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		mul_m3_m3m3(tmat, smat, imat); | 
					
						
							|  |  |  | 		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
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Generic callback for constant spacial 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). | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (!td && 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): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, t->con.mtx[0]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 		case CON_AXIS1: | 
					
						
							|  |  |  | 		case (CON_AXIS0|CON_AXIS2): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, t->con.mtx[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
										 |  |  | 			break; | 
					
						
							|  |  |  | 		case CON_AXIS2: | 
					
						
							|  |  |  | 		case (CON_AXIS0|CON_AXIS1): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, t->con.mtx[2]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		/* don't flip axis if asked to or if num input */ | 
					
						
							|  |  |  | 		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) { | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			if (dot_v3v3(vec, t->viewinv[2]) > 0.0f) { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				*angle = -(*angle); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * Callback for object based spacial 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). | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void applyObjectConstraintRot(TransInfo *t, TransData *td, float vec[3], float *angle) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (t->con.mode & CON_APPLY) { | 
					
						
							|  |  |  | 		int mode = t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2); | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 		/* on setup call, use first object */ | 
					
						
							|  |  |  | 		if (td == NULL) { | 
					
						
							|  |  |  | 			td= t->data; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		switch(mode) { | 
					
						
							|  |  |  | 		case CON_AXIS0: | 
					
						
							|  |  |  | 		case (CON_AXIS1|CON_AXIS2): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, td->axismtx[0]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 		case CON_AXIS1: | 
					
						
							|  |  |  | 		case (CON_AXIS0|CON_AXIS2): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, td->axismtx[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
										 |  |  | 			break; | 
					
						
							|  |  |  | 		case CON_AXIS2: | 
					
						
							|  |  |  | 		case (CON_AXIS0|CON_AXIS1): | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 			copy_v3_v3(vec, td->axismtx[2]); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			break; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 		if (angle && (mode & CON_NOFLIP) == 0 && hasNumInput(&t->num) == 0) { | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			if (dot_v3v3(vec, t->viewinv[2]) > 0.0f) { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 				*angle = -(*angle); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*--------------------- INTERNAL SETUP CALLS ------------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 	BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1); | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	copy_m3_m3(t->con.mtx, space); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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; | 
					
						
							|  |  |  | 	getConstraintMatrix(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	startConstraint(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	t->con.drawExtra = NULL; | 
					
						
							|  |  |  | 	t->con.applyVec = applyAxisConstraintVec; | 
					
						
							|  |  |  | 	t->con.applySize = applyAxisConstraintSize; | 
					
						
							|  |  |  | 	t->con.applyRot = applyAxisConstraintRot; | 
					
						
							|  |  |  | 	t->redraw = 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | void setLocalConstraint(TransInfo *t, int mode, const char 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
										 |  |  | 	if (t->flag & T_EDIT) { | 
					
						
							|  |  |  | 		float obmat[3][3]; | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 		copy_m3_m4(obmat, t->scene->obedit->obmat); | 
					
						
							| 
									
										
										
										
											2010-05-05 02:07:26 +00:00
										 |  |  | 		normalize_m3(obmat); | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | 		setConstraint(t, obmat, 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
										 |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							|  |  |  | 		if (t->total == 1) { | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | 			setConstraint(t, t->data->axismtx, 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
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1); | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 			copy_m3_m3(t->con.mtx, t->data->axismtx); | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | 			t->con.mode = mode; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			getConstraintMatrix(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			startConstraint(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			t->con.drawExtra = drawObjectConstraint; | 
					
						
							|  |  |  | 			t->con.applyVec = applyObjectConstraintVec; | 
					
						
							|  |  |  | 			t->con.applySize = applyObjectConstraintSize; | 
					
						
							|  |  |  | 			t->con.applyRot = applyObjectConstraintRot; | 
					
						
							|  |  |  | 			t->redraw = 1; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											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). | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | void setUserConstraint(TransInfo *t, short orientation, int mode, const char ftext[]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	char text[40]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-07 20:55:14 +00:00
										 |  |  | 	switch(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
										 |  |  | 	case V3D_MANIP_GLOBAL: | 
					
						
							| 
									
										
										
										
											2009-01-10 19:45:48 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2010-11-28 06:03:30 +00:00
										 |  |  | 			float mtx[3][3]= MAT3_UNITY; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(text, sizeof(text), ftext, "global"); | 
					
						
							| 
									
										
										
										
											2009-01-10 19:45:48 +00:00
										 |  |  | 			setConstraint(t, mtx, 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
										 |  |  | 		break; | 
					
						
							|  |  |  | 	case V3D_MANIP_LOCAL: | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(text, sizeof(text), ftext, "local"); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		setLocalConstraint(t, mode, text); | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case V3D_MANIP_NORMAL: | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(text, sizeof(text), ftext, "normal"); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		setConstraint(t, t->spacemtx, mode, text); | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	case V3D_MANIP_VIEW: | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(text, sizeof(text), ftext, "view"); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		setConstraint(t, t->spacemtx, mode, text); | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
										
											2009-10-28 20:30:33 +00:00
										 |  |  | 	case V3D_MANIP_GIMBAL: | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(text, sizeof(text), ftext, "gimbal"); | 
					
						
							| 
									
										
										
										
											2009-10-28 20:30:33 +00:00
										 |  |  | 		setConstraint(t, t->spacemtx, mode, text); | 
					
						
							|  |  |  | 		break; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	default: /* V3D_MANIP_CUSTOM */ | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(text, sizeof(text), ftext, 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
										 |  |  | 		setConstraint(t, t->spacemtx, mode, text); | 
					
						
							|  |  |  | 		break; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-17 17:34:56 +00:00
										 |  |  | 	t->con.orientation = 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
										 |  |  | 	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); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-09 20:58:31 +00:00
										 |  |  | 	if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		return; | 
					
						
							|  |  |  | 	if (!(tc->mode & CON_APPLY)) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	if (t->flag & T_USES_MANIPULATOR) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 	if (t->flag & T_NO_CONSTRAINT) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	/* nasty exception for Z constraint in camera view */ | 
					
						
							|  |  |  | 	// TRANSFORM_FIX_ME
 | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | //	if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | //		return;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (tc->drawExtra) { | 
					
						
							|  |  |  | 		tc->drawExtra(t); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	else { | 
					
						
							|  |  |  | 		if (tc->mode & CON_SELECT) { | 
					
						
							|  |  |  | 			float vec[3]; | 
					
						
							|  |  |  | 			char col2[3] = {255,255,255}; | 
					
						
							| 
									
										
										
										
											2010-07-21 16:18:00 +00:00
										 |  |  | 			int depth_test_enabled; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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])); | 
					
						
							| 
									
										
										
										
											2010-04-21 12:27:48 +00:00
										 |  |  | 			add_v3_v3(vec, tc->center); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, tc->center, tc->mtx[0], 'X', 0); | 
					
						
							|  |  |  | 			drawLine(t, tc->center, tc->mtx[1], 'Y', 0); | 
					
						
							|  |  |  | 			drawLine(t, tc->center, tc->mtx[2], 'Z', 0); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			glColor3ubv((GLubyte *)col2); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-07-21 16:18:00 +00:00
										 |  |  | 			depth_test_enabled = glIsEnabled(GL_DEPTH_TEST); | 
					
						
							|  |  |  | 			if(depth_test_enabled) | 
					
						
							|  |  |  | 				glDisable(GL_DEPTH_TEST); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 			setlinestyle(1); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 			glBegin(GL_LINE_STRIP); | 
					
						
							|  |  |  | 				glVertex3fv(tc->center); | 
					
						
							|  |  |  | 				glVertex3fv(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
										 |  |  | 			glEnd(); | 
					
						
							|  |  |  | 			setlinestyle(0); | 
					
						
							| 
									
										
										
										
											2010-07-21 16:18:00 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			if(depth_test_enabled) | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 				glEnable(GL_DEPTH_TEST); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, tc->center, tc->mtx[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) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, tc->center, tc->mtx[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) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, tc->center, tc->mtx[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]; | 
					
						
							| 
									
										
										
										
											2009-11-30 19:43:59 +00:00
										 |  |  | 		float center[3]; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | 		UI_ThemeColor(TH_GRID); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  | 		if(t->spacetype == SPACE_VIEW3D && rv3d != NULL) | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-09 20:58:31 +00:00
										 |  |  | 		glPushMatrix(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 		copy_v3_v3(center, t->center); | 
					
						
							| 
									
										
										
										
											2009-11-30 19:43:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-09 20:58:31 +00:00
										 |  |  | 		if((t->spacetype == SPACE_VIEW3D) && t->obedit) | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2009-11-30 19:43:59 +00:00
										 |  |  | 			mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */ | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2009-02-09 20:58:31 +00:00
										 |  |  | 		else if(t->spacetype == SPACE_IMAGE) | 
					
						
							|  |  |  | 		{ | 
					
						
							|  |  |  | 			float aspx, aspy; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); | 
					
						
							|  |  |  | 			glScalef(1.0f/aspx, 1.0f/aspy, 1.0); | 
					
						
							|  |  |  | 		} | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		set_inverted_drawing(1); | 
					
						
							| 
									
										
										
										
											2009-11-30 19:43:59 +00:00
										 |  |  | 		drawcircball(GL_LINE_LOOP, center, t->prop_size, imat); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		set_inverted_drawing(0); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 		glPopMatrix(); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	int i; | 
					
						
							|  |  |  | 	TransData * td = t->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* 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
										 |  |  | 	 */ | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS0) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 		drawLine(t, td->ob->obmat[3], td->axismtx[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 (t->con.mode & CON_AXIS1) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 		drawLine(t, td->ob->obmat[3], td->axismtx[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 (t->con.mode & CON_AXIS2) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 		drawLine(t, td->ob->obmat[3], td->axismtx[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
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	td++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	for(i=1;i<t->total;i++,td++) { | 
					
						
							|  |  |  | 		if (t->con.mode & CON_AXIS0) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		if (t->con.mode & CON_AXIS1) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, td->ob->obmat[3], td->axismtx[1], 'Y', 0); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 		if (t->con.mode & CON_AXIS2) { | 
					
						
							| 
									
										
										
										
											2010-12-20 13:57:52 +00:00
										 |  |  | 			drawLine(t, td->ob->obmat[3], td->axismtx[2], 'Z', 0); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*--------------------- 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 = ' '; | 
					
						
							|  |  |  | 	t->num.idx_max = MIN2(getConstraintSpaceDimension(t) - 1, t->idx_max); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | void stopConstraint(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|CON_SELECT); | 
					
						
							|  |  |  | 	*t->con.text = '\0'; | 
					
						
							|  |  |  | 	t->num.idx_max = t->idx_max; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void getConstraintMatrix(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	float mat[3][3]; | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	invert_m3_m3(t->con.imtx, t->con.mtx); | 
					
						
							|  |  |  | 	unit_m3(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
										 |  |  | 
 | 
					
						
							|  |  |  | 	if (!(t->con.mode & CON_AXIS0)) { | 
					
						
							|  |  |  | 		t->con.pmtx[0][0]		= | 
					
						
							|  |  |  | 			t->con.pmtx[0][1]	= | 
					
						
							|  |  |  | 			t->con.pmtx[0][2]	= 0.0f; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!(t->con.mode & CON_AXIS1)) { | 
					
						
							|  |  |  | 		t->con.pmtx[1][0]		= | 
					
						
							|  |  |  | 			t->con.pmtx[1][1]	= | 
					
						
							|  |  |  | 			t->con.pmtx[1][2]	= 0.0f; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (!(t->con.mode & CON_AXIS2)) { | 
					
						
							|  |  |  | 		t->con.pmtx[2][0]		= | 
					
						
							|  |  |  | 			t->con.pmtx[2][1]	= | 
					
						
							|  |  |  | 			t->con.pmtx[2][2]	= 0.0f; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	mul_m3_m3m3(mat, t->con.pmtx, t->con.imtx); | 
					
						
							|  |  |  | 	mul_m3_m3m3(t->con.pmtx, t->con.mtx, 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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*------------------------- MMB Select -------------------------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void initSelectConstraint(TransInfo *t, float mtx[3][3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	copy_m3_m3(t->con.mtx, mtx); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	t->con.mode |= CON_APPLY; | 
					
						
							|  |  |  | 	t->con.mode |= CON_SELECT; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setNearestAxis(t); | 
					
						
							|  |  |  | 	t->con.drawExtra = NULL; | 
					
						
							|  |  |  | 	t->con.applyVec = applyAxisConstraintVec; | 
					
						
							|  |  |  | 	t->con.applySize = applyAxisConstraintSize; | 
					
						
							|  |  |  | 	t->con.applyRot = applyAxisConstraintRot; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	if (!(t->con.mode & CON_SELECT)) | 
					
						
							|  |  |  | 		return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	t->con.mode &= ~CON_AXIS0; | 
					
						
							|  |  |  | 	t->con.mode &= ~CON_AXIS1; | 
					
						
							|  |  |  | 	t->con.mode &= ~CON_AXIS2; | 
					
						
							|  |  |  | 	t->con.mode &= ~CON_SELECT; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	setNearestAxis(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	startConstraint(t); | 
					
						
							|  |  |  | 	t->redraw = 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void setNearestAxis2d(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	/* no correction needed... just use whichever one is lower */ | 
					
						
							|  |  |  | 	if ( abs(t->mval[0]-t->con.imval[0]) < abs(t->mval[1]-t->con.imval[1]) ) { | 
					
						
							|  |  |  | 		t->con.mode |= CON_AXIS1; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(t->con.text, sizeof(t->con.text), " along Y 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 { | 
					
						
							|  |  |  | 		t->con.mode |= CON_AXIS0; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 		BLI_snprintf(t->con.text, sizeof(t->con.text), " along X 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
										 |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void setNearestAxis3d(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	float zfac; | 
					
						
							|  |  |  | 	float mvec[3], axis[3], proj[3]; | 
					
						
							|  |  |  | 	float len[3]; | 
					
						
							|  |  |  | 	int i, icoord[2]; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	/* calculate mouse 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; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	/* we need to correct axis length for the current zoomlevel 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. | 
					
						
							|  |  |  | 	 * The formula used is a bit stupid, just a simplification of the substraction | 
					
						
							|  |  |  | 	 * of two 2D points 30 pixels apart (that's the last factor in the formula) after | 
					
						
							|  |  |  | 	 * projecting them with window_to_3d_delta and then get the length of that vector. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	zfac= t->persmat[0][3]*t->center[0]+ t->persmat[1][3]*t->center[1]+ t->persmat[2][3]*t->center[2]+ t->persmat[3][3]; | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | 	zfac = len_v3(t->persinv[0]) * 2.0f/t->ar->winx * zfac * 30.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
										 |  |  | 
 | 
					
						
							|  |  |  | 	for (i = 0; i<3; i++) { | 
					
						
							| 
									
										
										
										
											2011-09-12 04:14:12 +00:00
										 |  |  | 		copy_v3_v3(axis, t->con.mtx[i]); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00: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 */ | 
					
						
							| 
									
										
										
										
											2010-04-21 12:27:48 +00:00
										 |  |  | 		add_v3_v3(axis, t->con.center); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 		projectIntView(t, axis, icoord); | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 		axis[0] = (float)(icoord[0] - t->center2d[0]); | 
					
						
							|  |  |  | 		axis[1] = (float)(icoord[1] - t->center2d[1]); | 
					
						
							|  |  |  | 		axis[2] = 0.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-04-21 15:53:30 +00:00
										 |  |  | 		if (normalize_v3(axis) != 0.0f) { | 
					
						
							| 
									
										
										
										
											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 { | 
					
						
							|  |  |  | 			len[i] = 10000000000.0f; | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (len[0] <= len[1] && len[0] <= len[2]) { | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  | 		if (t->modifiers & MOD_CONSTRAINT_PLANE) { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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|CON_AXIS2); | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %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 { | 
					
						
							|  |  |  | 			t->con.mode |= CON_AXIS0; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " 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]) { | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  | 		if (t->modifiers & MOD_CONSTRAINT_PLANE) { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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|CON_AXIS2); | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %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 { | 
					
						
							|  |  |  | 			t->con.mode |= CON_AXIS1; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " 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]) { | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  | 		if (t->modifiers & MOD_CONSTRAINT_PLANE) { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, 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|CON_AXIS1); | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " locking %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
										 |  |  | 		} | 
					
						
							|  |  |  | 		else { | 
					
						
							|  |  |  | 			t->con.mode |= CON_AXIS2; | 
					
						
							| 
									
										
										
										
											2012-01-11 12:33:51 +00:00
										 |  |  | 			BLI_snprintf(t->con.text, sizeof(t->con.text), " 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; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	/* 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); | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 	getConstraintMatrix(t); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*-------------- HELPER FUNCTIONS ----------------*/ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | char constraintModeToChar(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_APPLY)==0) { | 
					
						
							|  |  |  | 		return '\0'; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	switch (t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2)) { | 
					
						
							|  |  |  | 	case (CON_AXIS0): | 
					
						
							|  |  |  | 	case (CON_AXIS1|CON_AXIS2): | 
					
						
							|  |  |  | 		return 'X'; | 
					
						
							|  |  |  | 	case (CON_AXIS1): | 
					
						
							|  |  |  | 	case (CON_AXIS0|CON_AXIS2): | 
					
						
							|  |  |  | 		return 'Y'; | 
					
						
							|  |  |  | 	case (CON_AXIS2): | 
					
						
							|  |  |  | 	case (CON_AXIS0|CON_AXIS1): | 
					
						
							|  |  |  | 		return 'Z'; | 
					
						
							|  |  |  | 	default: | 
					
						
							|  |  |  | 		return '\0'; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-12-17 00:52:36 +00:00
										 |  |  | int isLockConstraint(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 	int mode = t->con.mode; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ( (mode & (CON_AXIS0|CON_AXIS1)) == (CON_AXIS0|CON_AXIS1)) | 
					
						
							|  |  |  | 		return 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ( (mode & (CON_AXIS1|CON_AXIS2)) == (CON_AXIS1|CON_AXIS2)) | 
					
						
							|  |  |  | 		return 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if ( (mode & (CON_AXIS0|CON_AXIS2)) == (CON_AXIS0|CON_AXIS2)) | 
					
						
							|  |  |  | 		return 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  * 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; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS0) | 
					
						
							|  |  |  | 		n++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS1) | 
					
						
							|  |  |  | 		n++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	if (t->con.mode & CON_AXIS2) | 
					
						
							|  |  |  | 		n++; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	return n; | 
					
						
							|  |  |  | /*
 | 
					
						
							| 
									
										
										
										
											2012-03-04 04:35:12 +00:00
										 |  |  |  * Someone willing to do it cryptically could do the following instead: | 
					
						
							| 
									
										
										
										
											2012-03-03 16:31:46 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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
										 |  |  | } |