| 
									
										
										
										
											2011-02-23 10:52:22 +00:00
										 |  |  | /*
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  |  * This program is free software; you can redistribute it and/or | 
					
						
							|  |  |  |  * modify it under the terms of the GNU General Public License | 
					
						
							|  |  |  |  * as published by the Free Software Foundation; either version 2 | 
					
						
							|  |  |  |  * of the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |  * along with this program; if not, write to the Free Software Foundation, | 
					
						
							| 
									
										
										
										
											2010-02-12 13:34:04 +00:00
										 |  |  |  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. | 
					
						
							|  |  |  |  * All rights reserved. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup edtransform | 
					
						
							| 
									
										
										
										
											2011-02-27 20:29:51 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include <string.h>
 | 
					
						
							|  |  |  | #include <math.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "MEM_guardedalloc.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 19:35:26 +00:00
										 |  |  | #include "BLI_sys_types.h" /* for intptr_t support */
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 02:56:58 +00:00
										 |  |  | #include "DNA_anim_types.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "DNA_armature_types.h"
 | 
					
						
							| 
									
										
										
										
											2014-07-21 12:02:05 +02:00
										 |  |  | #include "DNA_brush_types.h"
 | 
					
						
							| 
									
										
										
										
											2020-01-02 12:48:30 -03:00
										 |  |  | #include "DNA_constraint_types.h"
 | 
					
						
							| 
									
										
										
										
											2015-12-13 21:03:13 +13:00
										 |  |  | #include "DNA_gpencil_types.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "DNA_lattice_types.h"
 | 
					
						
							|  |  |  | #include "DNA_screen_types.h"
 | 
					
						
							| 
									
										
										
										
											2012-09-13 10:51:13 +00:00
										 |  |  | #include "DNA_sequence_types.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "DNA_space_types.h"
 | 
					
						
							| 
									
										
										
										
											2010-08-10 05:41:51 +00:00
										 |  |  | #include "DNA_scene_types.h"
 | 
					
						
							|  |  |  | #include "DNA_object_types.h"
 | 
					
						
							| 
									
										
										
										
											2012-02-19 22:17:30 +00:00
										 |  |  | #include "DNA_mesh_types.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "DNA_view3d_types.h"
 | 
					
						
							| 
									
										
										
										
											2010-08-10 05:41:51 +00:00
										 |  |  | #include "DNA_modifier_types.h"
 | 
					
						
							| 
									
										
										
										
											2011-11-07 12:55:18 +00:00
										 |  |  | #include "DNA_movieclip_types.h"
 | 
					
						
							| 
									
										
										
										
											2012-06-04 16:42:58 +00:00
										 |  |  | #include "DNA_mask_types.h"
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | #include "DNA_meta_types.h"
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-03-24 01:24:58 +00:00
										 |  |  | #include "BLI_math.h"
 | 
					
						
							|  |  |  | #include "BLI_blenlib.h"
 | 
					
						
							|  |  |  | #include "BLI_rand.h"
 | 
					
						
							|  |  |  | #include "BLI_utildefines.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-12 17:00:07 +02:00
										 |  |  | #include "PIL_time.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-16 17:32:01 +10:00
										 |  |  | #include "BLT_translation.h"
 | 
					
						
							| 
									
										
										
										
											2013-02-19 15:45:56 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | #include "RNA_access.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | #include "GPU_immediate.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-21 17:49:21 -04:00
										 |  |  | #include "GPU_matrix.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-29 19:43:08 +00:00
										 |  |  | #include "BIK_api.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "BKE_action.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_animsys.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "BKE_armature.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_context.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "BKE_curve.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_editmesh.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-28 02:56:58 +00:00
										 |  |  | #include "BKE_fcurve.h"
 | 
					
						
							| 
									
										
										
										
											2018-07-31 10:22:19 +02:00
										 |  |  | #include "BKE_gpencil.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "BKE_lattice.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_layer.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-10 12:58:59 +01:00
										 |  |  | #include "BKE_lib_id.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_mask.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-07 02:12:50 +00:00
										 |  |  | #include "BKE_nla.h"
 | 
					
						
							| 
									
										
										
										
											2014-07-21 12:02:05 +02:00
										 |  |  | #include "BKE_paint.h"
 | 
					
						
							| 
									
										
										
										
											2018-11-07 18:00:24 +01:00
										 |  |  | #include "BKE_scene.h"
 | 
					
						
							| 
									
										
										
										
											2012-08-21 10:42:21 +00:00
										 |  |  | #include "BKE_sequencer.h"
 | 
					
						
							| 
									
										
										
										
											2011-11-07 12:55:18 +00:00
										 |  |  | #include "BKE_tracking.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-01 20:41:18 +02:00
										 |  |  | #include "BKE_workspace.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  | #include "DEG_depsgraph.h"
 | 
					
						
							| 
									
										
										
										
											2019-08-22 13:45:31 +10:00
										 |  |  | #include "DEG_depsgraph_query.h"
 | 
					
						
							| 
									
										
										
										
											2017-06-08 10:14:53 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-28 02:56:58 +00:00
										 |  |  | #include "ED_anim_api.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-05 15:19:31 +00:00
										 |  |  | #include "ED_armature.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-28 21:43:43 +00:00
										 |  |  | #include "ED_image.h"
 | 
					
						
							| 
									
										
										
										
											2009-02-16 03:01:56 +00:00
										 |  |  | #include "ED_keyframing.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-07 06:16:06 +00:00
										 |  |  | #include "ED_markers.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  | #include "ED_mesh.h"
 | 
					
						
							| 
									
										
										
										
											2015-02-23 23:05:54 +11:00
										 |  |  | #include "ED_object.h"
 | 
					
						
							| 
									
										
										
										
											2016-12-28 17:30:58 +01:00
										 |  |  | #include "ED_particle.h"
 | 
					
						
							| 
									
										
										
										
											2009-07-31 07:43:47 +00:00
										 |  |  | #include "ED_screen_types.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | #include "ED_space_api.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-28 21:43:43 +00:00
										 |  |  | #include "ED_uvedit.h"
 | 
					
						
							|  |  |  | #include "ED_view3d.h"
 | 
					
						
							| 
									
										
										
										
											2011-09-14 00:37:27 +00:00
										 |  |  | #include "ED_curve.h" /* for curve_editnurbs */
 | 
					
						
							| 
									
										
										
										
											2011-11-07 12:55:18 +00:00
										 |  |  | #include "ED_clip.h"
 | 
					
						
							| 
									
										
										
										
											2012-05-25 12:37:11 +00:00
										 |  |  | #include "ED_screen.h"
 | 
					
						
							| 
									
										
										
										
											2018-07-31 10:22:19 +02:00
										 |  |  | #include "ED_gpencil.h"
 | 
					
						
							| 
									
										
										
										
											2019-09-10 19:55:15 +02:00
										 |  |  | #include "ED_sculpt.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "WM_types.h"
 | 
					
						
							| 
									
										
										
										
											2009-12-07 18:10:11 +00:00
										 |  |  | #include "WM_api.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-16 17:15:03 -02:00
										 |  |  | #include "RE_engine.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | #include "UI_resources.h"
 | 
					
						
							| 
									
										
										
										
											2014-07-21 12:02:05 +02:00
										 |  |  | #include "UI_view2d.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-10 18:33:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | #include "transform.h"
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:34:54 -03:00
										 |  |  | #include "transform_convert.h"
 | 
					
						
							| 
									
										
										
										
											2020-02-14 08:42:17 -03:00
										 |  |  | #include "transform_mode.h"
 | 
					
						
							| 
									
										
										
										
											2019-10-29 00:45:05 +11:00
										 |  |  | #include "transform_snap.h"
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* ************************** Functions *************************** */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-21 17:24:14 +02:00
										 |  |  | void getViewVector(const TransInfo *t, const float coord[3], float vec[3]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if (t->persp != RV3D_ORTHO) { | 
					
						
							|  |  |  |     sub_v3_v3v3(vec, coord, t->viewinv[3]); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     copy_v3_v3(vec, t->viewinv[2]); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   normalize_v3(vec); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* ************************** GENERICS **************************** */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | static void clipMirrorModifier(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
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     Object *ob = tc->obedit; | 
					
						
							|  |  |  |     ModifierData *md = ob->modifiers.first; | 
					
						
							|  |  |  |     float tolerance[3] = {0.0f, 0.0f, 0.0f}; | 
					
						
							|  |  |  |     int axis = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (; md; md = md->next) { | 
					
						
							|  |  |  |       if ((md->type == eModifierType_Mirror) && (md->mode & eModifierMode_Realtime)) { | 
					
						
							|  |  |  |         MirrorModifierData *mmd = (MirrorModifierData *)md; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (mmd->flag & MOD_MIR_CLIPPING) { | 
					
						
							|  |  |  |           axis = 0; | 
					
						
							|  |  |  |           if (mmd->flag & MOD_MIR_AXIS_X) { | 
					
						
							|  |  |  |             axis |= 1; | 
					
						
							|  |  |  |             tolerance[0] = mmd->tolerance; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (mmd->flag & MOD_MIR_AXIS_Y) { | 
					
						
							|  |  |  |             axis |= 2; | 
					
						
							|  |  |  |             tolerance[1] = mmd->tolerance; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (mmd->flag & MOD_MIR_AXIS_Z) { | 
					
						
							|  |  |  |             axis |= 4; | 
					
						
							|  |  |  |             tolerance[2] = mmd->tolerance; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (axis) { | 
					
						
							|  |  |  |             float mtx[4][4], imtx[4][4]; | 
					
						
							|  |  |  |             int i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (mmd->mirror_ob) { | 
					
						
							|  |  |  |               float obinv[4][4]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               invert_m4_m4(obinv, mmd->mirror_ob->obmat); | 
					
						
							|  |  |  |               mul_m4_m4m4(mtx, obinv, ob->obmat); | 
					
						
							|  |  |  |               invert_m4_m4(imtx, mtx); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             TransData *td = tc->data; | 
					
						
							|  |  |  |             for (i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |               int clip; | 
					
						
							|  |  |  |               float loc[3], iloc[3]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               if (td->flag & TD_NOACTION) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							|  |  |  |               if (td->loc == NULL) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               if (td->flag & TD_SKIP) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 continue; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |               copy_v3_v3(loc, td->loc); | 
					
						
							|  |  |  |               copy_v3_v3(iloc, td->iloc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               if (mmd->mirror_ob) { | 
					
						
							|  |  |  |                 mul_m4_v3(mtx, loc); | 
					
						
							|  |  |  |                 mul_m4_v3(mtx, iloc); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               clip = 0; | 
					
						
							|  |  |  |               if (axis & 1) { | 
					
						
							|  |  |  |                 if (fabsf(iloc[0]) <= tolerance[0] || loc[0] * iloc[0] < 0.0f) { | 
					
						
							|  |  |  |                   loc[0] = 0.0f; | 
					
						
							|  |  |  |                   clip = 1; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               if (axis & 2) { | 
					
						
							|  |  |  |                 if (fabsf(iloc[1]) <= tolerance[1] || loc[1] * iloc[1] < 0.0f) { | 
					
						
							|  |  |  |                   loc[1] = 0.0f; | 
					
						
							|  |  |  |                   clip = 1; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               if (axis & 4) { | 
					
						
							|  |  |  |                 if (fabsf(iloc[2]) <= tolerance[2] || loc[2] * iloc[2] < 0.0f) { | 
					
						
							|  |  |  |                   loc[2] = 0.0f; | 
					
						
							|  |  |  |                   clip = 1; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               if (clip) { | 
					
						
							|  |  |  |                 if (mmd->mirror_ob) { | 
					
						
							|  |  |  |                   mul_m4_v3(imtx, loc); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |                 copy_v3_v3(td->loc, loc); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-02 19:10:35 +00:00
										 |  |  | /* assumes obedit set to mesh object */ | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  | static void transform_apply_to_mirror(TransInfo *t) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |     if (tc->mirror.use_mirror_any) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       int i; | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |       TransData *td; | 
					
						
							|  |  |  |       for (i = 0, td = tc->data; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |         if (td->flag & (TD_MIRROR_EDGE_X | TD_MIRROR_EDGE_Y | TD_MIRROR_EDGE_Z)) { | 
					
						
							|  |  |  |           if (td->flag & TD_MIRROR_EDGE_X) { | 
					
						
							|  |  |  |             td->loc[0] = 0.0f; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (td->flag & TD_MIRROR_EDGE_Y) { | 
					
						
							|  |  |  |             td->loc[1] = 0.0f; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           if (td->flag & TD_MIRROR_EDGE_Z) { | 
					
						
							|  |  |  |             td->loc[2] = 0.0f; | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |       TransDataMirror *tdm; | 
					
						
							|  |  |  |       for (i = 0, tdm = tc->mirror.data; i < tc->mirror.data_len; i++, tdm++) { | 
					
						
							|  |  |  |         tdm->loc_dst[0] = tdm->loc_src[0] * tdm->sign_x; | 
					
						
							|  |  |  |         tdm->loc_dst[1] = tdm->loc_src[1] * tdm->sign_y; | 
					
						
							|  |  |  |         tdm->loc_dst[2] = tdm->loc_src[2] * tdm->sign_z; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-31 07:43:47 +00:00
										 |  |  | /* for the realtime animation recording feature, handle overlapping data */ | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  | static void animrecord_check_state(Scene *scene, ID *id, wmTimer *animtimer) | 
					
						
							| 
									
										
										
										
											2009-07-31 07:43:47 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ScreenAnimData *sad = (animtimer) ? animtimer->customdata : NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* sanity checks */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (ELEM(NULL, scene, id, sad)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     return; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* check if we need a new strip if:
 | 
					
						
							|  |  |  |    * - if animtimer is running | 
					
						
							|  |  |  |    * - we're not only keying for available channels | 
					
						
							|  |  |  |    * - the option to add new actions for each round is not enabled | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   if (IS_AUTOKEY_FLAG(scene, INSERTAVAIL) == 0 && | 
					
						
							|  |  |  |       (scene->toolsettings->autokey_flag & ANIMRECORD_FLAG_WITHNLA)) { | 
					
						
							|  |  |  |     /* if playback has just looped around,
 | 
					
						
							|  |  |  |      * we need to add a new NLA track+strip to allow a clean pass to occur */ | 
					
						
							|  |  |  |     if ((sad) && (sad->flag & ANIMPLAY_FLAG_JUMPED)) { | 
					
						
							|  |  |  |       AnimData *adt = BKE_animdata_from_id(id); | 
					
						
							|  |  |  |       const bool is_first = (adt) && (adt->nla_tracks.first == NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* perform push-down manually with some differences
 | 
					
						
							|  |  |  |        * NOTE: BKE_nla_action_pushdown() sync warning... | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  |       if ((adt->action) && !(adt->flag & ADT_NLA_EDIT_ON)) { | 
					
						
							|  |  |  |         float astart, aend; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* only push down if action is more than 1-2 frames long */ | 
					
						
							|  |  |  |         calc_action_range(adt->action, &astart, &aend, 1); | 
					
						
							|  |  |  |         if (aend > astart + 2.0f) { | 
					
						
							|  |  |  |           NlaStrip *strip = BKE_nlastack_add_strip(adt, adt->action); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           /* clear reference to action now that we've pushed it onto the stack */ | 
					
						
							|  |  |  |           id_us_min(&adt->action->id); | 
					
						
							|  |  |  |           adt->action = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           /* adjust blending + extend so that they will behave correctly */ | 
					
						
							|  |  |  |           strip->extendmode = NLASTRIP_EXTEND_NOTHING; | 
					
						
							|  |  |  |           strip->flag &= ~(NLASTRIP_FLAG_AUTO_BLENDS | NLASTRIP_FLAG_SELECT | | 
					
						
							|  |  |  |                            NLASTRIP_FLAG_ACTIVE); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           /* copy current "action blending" settings from adt to the strip,
 | 
					
						
							|  |  |  |            * as it was keyframed with these settings, so omitting them will | 
					
						
							|  |  |  |            * change the effect  [T54766] | 
					
						
							|  |  |  |            */ | 
					
						
							|  |  |  |           if (is_first == false) { | 
					
						
							|  |  |  |             strip->blendmode = adt->act_blendmode; | 
					
						
							|  |  |  |             strip->influence = adt->act_influence; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (adt->act_influence < 1.0f) { | 
					
						
							|  |  |  |               /* enable "user-controlled" influence (which will insert a default keyframe)
 | 
					
						
							|  |  |  |                * so that the influence doesn't get lost on the new update | 
					
						
							|  |  |  |                * | 
					
						
							|  |  |  |                * NOTE: An alternative way would have been to instead hack the influence | 
					
						
							|  |  |  |                * to not get always get reset to full strength if NLASTRIP_FLAG_USR_INFLUENCE | 
					
						
							|  |  |  |                * is disabled but auto-blending isn't being used. However, that approach | 
					
						
							|  |  |  |                * is a bit hacky/hard to discover, and may cause backwards compatibility issues, | 
					
						
							|  |  |  |                * so it's better to just do it this way. | 
					
						
							|  |  |  |                */ | 
					
						
							|  |  |  |               strip->flag |= NLASTRIP_FLAG_USR_INFLUENCE; | 
					
						
							|  |  |  |               BKE_nlastrip_validate_fcurves(strip); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           /* also, adjust the AnimData's action extend mode to be on
 | 
					
						
							|  |  |  |            * 'nothing' so that previous result still play | 
					
						
							|  |  |  |            */ | 
					
						
							|  |  |  |           adt->act_extendmode = NLASTRIP_EXTEND_NOTHING; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-07-12 03:42:39 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-05 22:36:15 +11:00
										 |  |  | static bool fcu_test_selected(FCurve *fcu) | 
					
						
							| 
									
										
										
										
											2010-02-10 18:22:55 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   BezTriple *bezt = fcu->bezt; | 
					
						
							|  |  |  |   unsigned int i; | 
					
						
							| 
									
										
										
										
											2010-02-10 18:22:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (bezt == NULL) { /* ignore baked */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2010-03-03 13:20:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   for (i = 0; i < fcu->totvert; i++, bezt++) { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (BEZT_ISSEL_ANY(bezt)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       return 1; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2010-02-10 18:22:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   return 0; | 
					
						
							| 
									
										
										
										
											2010-02-10 18:22:55 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | /* helper for recalcData() - for Action Editor transforms */ | 
					
						
							|  |  |  | static void recalcData_actedit(TransInfo *t) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ViewLayer *view_layer = t->view_layer; | 
					
						
							|  |  |  |   SpaceAction *saction = (SpaceAction *)t->sa->spacedata.first; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bAnimContext ac = {NULL}; | 
					
						
							|  |  |  |   ListBase anim_data = {NULL, NULL}; | 
					
						
							|  |  |  |   bAnimListElem *ale; | 
					
						
							|  |  |  |   int filter; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* initialize relevant anim-context 'context' data from TransInfo data */ | 
					
						
							|  |  |  |   /* NOTE: sync this with the code in ANIM_animdata_get_context() */ | 
					
						
							|  |  |  |   ac.bmain = CTX_data_main(t->context); | 
					
						
							|  |  |  |   ac.scene = t->scene; | 
					
						
							|  |  |  |   ac.view_layer = t->view_layer; | 
					
						
							|  |  |  |   ac.obact = OBACT(view_layer); | 
					
						
							|  |  |  |   ac.sa = t->sa; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   ac.region = t->region; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; | 
					
						
							|  |  |  |   ac.spacetype = (t->sa) ? t->sa->spacetype : 0; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   ac.regiontype = (t->region) ? t->region->regiontype : 0; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   ANIM_animdata_context_getdata(&ac); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* perform flush */ | 
					
						
							|  |  |  |   if (ELEM(ac.datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK)) { | 
					
						
							|  |  |  |     /* flush transform values back to actual coordinates */ | 
					
						
							|  |  |  |     flushTransIntFrameActionData(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (ac.datatype != ANIMCONT_MASK) { | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |     /* Get animdata blocks visible in editor,
 | 
					
						
							|  |  |  |      * assuming that these will be the ones where things changed. */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ANIMDATA); | 
					
						
							|  |  |  |     ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* just tag these animdata-blocks to recalc, assuming that some data there changed
 | 
					
						
							|  |  |  |      * BUT only do this if realtime updates are enabled | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     if ((saction->flag & SACTION_NOREALTIMEUPDATES) == 0) { | 
					
						
							|  |  |  |       for (ale = anim_data.first; ale; ale = ale->next) { | 
					
						
							|  |  |  |         /* set refresh tags for objects using this animation */ | 
					
						
							|  |  |  |         ANIM_list_elem_update(CTX_data_main(t->context), t->scene, ale); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* now free temp channels */ | 
					
						
							|  |  |  |     ANIM_animdata_freelist(&anim_data); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | } | 
					
						
							|  |  |  | /* helper for recalcData() - for Graph Editor transforms */ | 
					
						
							|  |  |  | static void recalcData_graphedit(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first; | 
					
						
							|  |  |  |   ViewLayer *view_layer = t->view_layer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ListBase anim_data = {NULL, NULL}; | 
					
						
							|  |  |  |   bAnimContext ac = {NULL}; | 
					
						
							|  |  |  |   int filter; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bAnimListElem *ale; | 
					
						
							|  |  |  |   int dosort = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* initialize relevant anim-context 'context' data from TransInfo data */ | 
					
						
							|  |  |  |   /* NOTE: sync this with the code in ANIM_animdata_get_context() */ | 
					
						
							|  |  |  |   ac.bmain = CTX_data_main(t->context); | 
					
						
							|  |  |  |   ac.scene = t->scene; | 
					
						
							|  |  |  |   ac.view_layer = t->view_layer; | 
					
						
							|  |  |  |   ac.obact = OBACT(view_layer); | 
					
						
							|  |  |  |   ac.sa = t->sa; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   ac.region = t->region; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ac.sl = (t->sa) ? t->sa->spacedata.first : NULL; | 
					
						
							|  |  |  |   ac.spacetype = (t->sa) ? t->sa->spacetype : 0; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   ac.regiontype = (t->region) ? t->region->regiontype : 0; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   ANIM_animdata_context_getdata(&ac); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* do the flush first */ | 
					
						
							|  |  |  |   flushTransGraphData(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* get curves to check if a re-sort is needed */ | 
					
						
							|  |  |  |   filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_FOREDIT | ANIMFILTER_CURVE_VISIBLE); | 
					
						
							|  |  |  |   ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* now test if there is a need to re-sort */ | 
					
						
							|  |  |  |   for (ale = anim_data.first; ale; ale = ale->next) { | 
					
						
							|  |  |  |     FCurve *fcu = (FCurve *)ale->key_data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* ignore FC-Curves without any selected verts */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (!fcu_test_selected(fcu)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       continue; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* watch it: if the time is wrong: do not correct handles yet */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (test_time_fcurve(fcu)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       dosort++; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							| 
									
										
										
										
											2019-11-22 16:46:15 +01:00
										 |  |  |       calchandles_fcurve_ex(fcu, BEZT_FLAG_TEMP_TAG); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* set refresh tags for objects using this animation,
 | 
					
						
							|  |  |  |      * BUT only if realtime updates are enabled | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if ((sipo->flag & SIPO_NOREALTIMEUPDATES) == 0) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       ANIM_list_elem_update(CTX_data_main(t->context), t->scene, ale); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* do resort and other updates? */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (dosort) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     remake_graph_transdata(t, &anim_data); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* now free temp channels */ | 
					
						
							|  |  |  |   ANIM_animdata_freelist(&anim_data); | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* helper for recalcData() - for NLA Editor transforms */ | 
					
						
							|  |  |  | static void recalcData_nla(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   SpaceNla *snla = (SpaceNla *)t->sa->spacedata.first; | 
					
						
							|  |  |  |   Scene *scene = t->scene; | 
					
						
							|  |  |  |   double secf = FPS; | 
					
						
							|  |  |  |   int i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | 
					
						
							|  |  |  |   TransDataNla *tdn = tc->custom.type.data; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |   /* For each strip we've got, perform some additional validation of the values
 | 
					
						
							|  |  |  |    * that got set before using RNA to set the value (which does some special | 
					
						
							|  |  |  |    * operations when setting these values to make sure that everything works ok). | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |    */ | 
					
						
							|  |  |  |   for (i = 0; i < tc->data_len; i++, tdn++) { | 
					
						
							|  |  |  |     NlaStrip *strip = tdn->strip; | 
					
						
							|  |  |  |     PointerRNA strip_ptr; | 
					
						
							|  |  |  |     short pExceeded, nExceeded, iter; | 
					
						
							|  |  |  |     int delta_y1, delta_y2; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* if this tdn has no handles, that means it is just a dummy that should be skipped */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (tdn->handle == 0) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       continue; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* set refresh tags for objects using this animation,
 | 
					
						
							|  |  |  |      * BUT only if realtime updates are enabled | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if ((snla->flag & SNLA_NOREALTIMEUPDATES) == 0) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       ANIM_id_update(CTX_data_main(t->context), tdn->id); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* if canceling transform, just write the values without validating, then move on */ | 
					
						
							|  |  |  |     if (t->state == TRANS_CANCEL) { | 
					
						
							|  |  |  |       /* clear the values by directly overwriting the originals, but also need to restore
 | 
					
						
							|  |  |  |        * endpoints of neighboring transition-strips | 
					
						
							|  |  |  |        */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* start */ | 
					
						
							|  |  |  |       strip->start = tdn->h1[0]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         strip->prev->end = tdn->h1[0]; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       /* end */ | 
					
						
							|  |  |  |       strip->end = tdn->h2[0]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       if ((strip->next) && (strip->next->type == NLASTRIP_TYPE_TRANSITION)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         strip->next->start = tdn->h2[0]; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       /* flush transforms to child strips (since this should be a meta) */ | 
					
						
							|  |  |  |       BKE_nlameta_flush_transforms(strip); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* restore to original track (if needed) */ | 
					
						
							|  |  |  |       if (tdn->oldTrack != tdn->nlt) { | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |         /* Just append to end of list for now,
 | 
					
						
							|  |  |  |          * since strips get sorted in special_aftertrans_update(). */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         BLI_remlink(&tdn->nlt->strips, strip); | 
					
						
							|  |  |  |         BLI_addtail(&tdn->oldTrack->strips, strip); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       continue; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* firstly, check if the proposed transform locations would overlap with any neighboring strips
 | 
					
						
							|  |  |  |      * (barring transitions) which are absolute barriers since they are not being moved | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * this is done as a iterative procedure (done 5 times max for now) | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     for (iter = 0; iter < 5; iter++) { | 
					
						
							|  |  |  |       pExceeded = ((strip->prev) && (strip->prev->type != NLASTRIP_TYPE_TRANSITION) && | 
					
						
							|  |  |  |                    (tdn->h1[0] < strip->prev->end)); | 
					
						
							|  |  |  |       nExceeded = ((strip->next) && (strip->next->type != NLASTRIP_TYPE_TRANSITION) && | 
					
						
							|  |  |  |                    (tdn->h2[0] > strip->next->start)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if ((pExceeded && nExceeded) || (iter == 4)) { | 
					
						
							|  |  |  |         /* both endpoints exceeded (or iteration ping-pong'd meaning that we need a compromise)
 | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |          * - Simply crop strip to fit within the bounds of the strips bounding it | 
					
						
							|  |  |  |          * - If there were no neighbors, clear the transforms | 
					
						
							|  |  |  |          *   (make it default to the strip's current values). | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |          */ | 
					
						
							|  |  |  |         if (strip->prev && strip->next) { | 
					
						
							|  |  |  |           tdn->h1[0] = strip->prev->end; | 
					
						
							|  |  |  |           tdn->h2[0] = strip->next->start; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |           tdn->h1[0] = strip->start; | 
					
						
							|  |  |  |           tdn->h2[0] = strip->end; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (nExceeded) { | 
					
						
							|  |  |  |         /* move backwards */ | 
					
						
							|  |  |  |         float offset = tdn->h2[0] - strip->next->start; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         tdn->h1[0] -= offset; | 
					
						
							|  |  |  |         tdn->h2[0] -= offset; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (pExceeded) { | 
					
						
							|  |  |  |         /* more forwards */ | 
					
						
							|  |  |  |         float offset = strip->prev->end - tdn->h1[0]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         tdn->h1[0] += offset; | 
					
						
							|  |  |  |         tdn->h2[0] += offset; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       else { /* all is fine and well */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* handle auto-snapping
 | 
					
						
							|  |  |  |      * NOTE: only do this when transform is still running, or we can't restore | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |       switch (snla->autosnap) { | 
					
						
							|  |  |  |         case SACTSNAP_FRAME: /* snap to nearest frame */ | 
					
						
							|  |  |  |         case SACTSNAP_STEP:  /* frame step - this is basically the same,
 | 
					
						
							| 
									
										
										
										
											2019-04-18 07:21:26 +02:00
										 |  |  |                               * since we don't have any remapping going on */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |           tdn->h1[0] = floorf(tdn->h1[0] + 0.5f); | 
					
						
							|  |  |  |           tdn->h2[0] = floorf(tdn->h2[0] + 0.5f); | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         case SACTSNAP_SECOND: /* snap to nearest second */ | 
					
						
							|  |  |  |         case SACTSNAP_TSTEP:  /* second step - this is basically the same,
 | 
					
						
							| 
									
										
										
										
											2019-04-18 07:21:26 +02:00
										 |  |  |                                * since we don't have any remapping going on */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         { | 
					
						
							|  |  |  |           /* This case behaves differently from the rest, since lengths of strips
 | 
					
						
							|  |  |  |            * may not be multiples of a second. If we just naively resize adjust | 
					
						
							|  |  |  |            * the handles, things may not work correctly. Instead, we only snap | 
					
						
							|  |  |  |            * the first handle, and move the other to fit. | 
					
						
							|  |  |  |            * | 
					
						
							|  |  |  |            * FIXME: we do run into problems here when user attempts to negatively | 
					
						
							|  |  |  |            *        scale the strip, as it then just compresses down and refuses | 
					
						
							|  |  |  |            *        to expand out the other end. | 
					
						
							|  |  |  |            */ | 
					
						
							|  |  |  |           float h1_new = (float)(floor(((double)tdn->h1[0] / secf) + 0.5) * secf); | 
					
						
							|  |  |  |           float delta = h1_new - tdn->h1[0]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           tdn->h1[0] = h1_new; | 
					
						
							|  |  |  |           tdn->h2[0] += delta; | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         case SACTSNAP_MARKER: /* snap to nearest marker */ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           tdn->h1[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h1[0]); | 
					
						
							|  |  |  |           tdn->h2[0] = (float)ED_markers_find_nearest_marker_time(&t->scene->markers, tdn->h2[0]); | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Use RNA to write the values to ensure that constraints on these are obeyed
 | 
					
						
							|  |  |  |      * (e.g. for transition strips, the values are taken from the neighbors) | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * NOTE: we write these twice to avoid truncation errors which can arise when | 
					
						
							|  |  |  |      * moving the strips a large distance using numeric input [#33852] | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     RNA_pointer_create(NULL, &RNA_NlaStrip, strip, &strip_ptr); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]); | 
					
						
							|  |  |  |     RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     RNA_float_set(&strip_ptr, "frame_start", tdn->h1[0]); | 
					
						
							|  |  |  |     RNA_float_set(&strip_ptr, "frame_end", tdn->h2[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* flush transforms to child strips (since this should be a meta) */ | 
					
						
							|  |  |  |     BKE_nlameta_flush_transforms(strip); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |     /* Now, check if we need to try and move track:
 | 
					
						
							|  |  |  |      * - we need to calculate both, | 
					
						
							|  |  |  |      *   as only one may have been altered by transform if only 1 handle moved. | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |      */ | 
					
						
							|  |  |  |     delta_y1 = ((int)tdn->h1[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); | 
					
						
							|  |  |  |     delta_y2 = ((int)tdn->h2[1] / NLACHANNEL_STEP(snla) - tdn->trackIndex); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (delta_y1 || delta_y2) { | 
					
						
							|  |  |  |       NlaTrack *track; | 
					
						
							|  |  |  |       int delta = (delta_y2) ? delta_y2 : delta_y1; | 
					
						
							|  |  |  |       int n; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |       /* Move in the requested direction,
 | 
					
						
							|  |  |  |        * checking at each layer if there's space for strip to pass through, | 
					
						
							|  |  |  |        * stopping on the last track available or that we're able to fit in. | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |        */ | 
					
						
							|  |  |  |       if (delta > 0) { | 
					
						
							|  |  |  |         for (track = tdn->nlt->next, n = 0; (track) && (n < delta); track = track->next, n++) { | 
					
						
							|  |  |  |           /* check if space in this track for the strip */ | 
					
						
							|  |  |  |           if (BKE_nlatrack_has_space(track, strip->start, strip->end)) { | 
					
						
							|  |  |  |             /* move strip to this track */ | 
					
						
							|  |  |  |             BLI_remlink(&tdn->nlt->strips, strip); | 
					
						
							|  |  |  |             BKE_nlatrack_add_strip(track, strip); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             tdn->nlt = track; | 
					
						
							|  |  |  |             tdn->trackIndex++; | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           else { /* can't move any further */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							|  |  |  |         /* make delta 'positive' before using it, since we now know to go backwards */ | 
					
						
							|  |  |  |         delta = -delta; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         for (track = tdn->nlt->prev, n = 0; (track) && (n < delta); track = track->prev, n++) { | 
					
						
							|  |  |  |           /* check if space in this track for the strip */ | 
					
						
							|  |  |  |           if (BKE_nlatrack_has_space(track, strip->start, strip->end)) { | 
					
						
							|  |  |  |             /* move strip to this track */ | 
					
						
							|  |  |  |             BLI_remlink(&tdn->nlt->strips, strip); | 
					
						
							|  |  |  |             BKE_nlatrack_add_strip(track, strip); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             tdn->nlt = track; | 
					
						
							|  |  |  |             tdn->trackIndex--; | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           else { /* can't move any further */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-25 19:36:59 +00:00
										 |  |  | static void recalcData_mask_common(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   Mask *mask = CTX_data_edit_mask(t->context); | 
					
						
							| 
									
										
										
										
											2012-07-25 19:36:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   flushTransMasking(t); | 
					
						
							| 
									
										
										
										
											2012-07-25 19:36:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   DEG_id_tag_update(&mask->id, 0); | 
					
						
							| 
									
										
										
										
											2012-07-25 19:36:59 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-08 06:09:16 +00:00
										 |  |  | /* helper for recalcData() - for Image Editor transforms */ | 
					
						
							|  |  |  | static void recalcData_image(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if (t->options & CTX_MASK) { | 
					
						
							|  |  |  |     recalcData_mask_common(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_PAINT_CURVE) { | 
					
						
							|  |  |  |     flushTransPaintCurve(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if ((t->flag & T_EDIT) && t->obedit_type == OB_MESH) { | 
					
						
							|  |  |  |     SpaceImage *sima = t->sa->spacedata.first; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flushTransUVs(t); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (sima->flag & SI_LIVE_UNWRAP) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       ED_uvedit_live_unwrap_re_solve(); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       if (tc->data_len) { | 
					
						
							|  |  |  |         DEG_id_tag_update(tc->obedit->data, 0); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-11-08 06:09:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* helper for recalcData() - for Movie Clip transforms */ | 
					
						
							| 
									
										
										
										
											2012-04-29 12:32:26 +00:00
										 |  |  | static void recalcData_spaceclip(TransInfo *t) | 
					
						
							| 
									
										
										
										
											2011-11-08 06:09:16 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   SpaceClip *sc = t->sa->spacedata.first; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (ED_space_clip_check_show_trackedit(sc)) { | 
					
						
							|  |  |  |     MovieClip *clip = ED_space_clip_get_clip(sc); | 
					
						
							|  |  |  |     ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking); | 
					
						
							|  |  |  |     MovieTrackingTrack *track; | 
					
						
							|  |  |  |     int framenr = ED_space_clip_get_clip_frame_number(sc); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flushTransTracking(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     track = tracksbase->first; | 
					
						
							|  |  |  |     while (track) { | 
					
						
							|  |  |  |       if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) { | 
					
						
							|  |  |  |         MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (t->mode == TFM_TRANSLATION) { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             BKE_tracking_marker_clamp(marker, CLAMP_PAT_POS); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							|  |  |  |           if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_POS); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         else if (t->mode == TFM_RESIZE) { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							|  |  |  |           if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         else if (t->mode == TFM_ROTATION) { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             BKE_tracking_marker_clamp(marker, CLAMP_PAT_POS); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       track = track->next; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     DEG_id_tag_update(&clip->id, 0); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_MASK) { | 
					
						
							|  |  |  |     recalcData_mask_common(t); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-11-08 06:09:16 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-12 17:00:46 +01:00
										 |  |  | /* helper for recalcData() - for object transforms, typically in the 3D view */ | 
					
						
							|  |  |  | static void recalcData_objects(TransInfo *t) | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   Base *base = t->view_layer->basact; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->obedit_type != -1) { | 
					
						
							|  |  |  |     if (ELEM(t->obedit_type, OB_CURVE, OB_SURF)) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |         clipMirrorModifier(t); | 
					
						
							|  |  |  |         applyProject(t); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |       FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         Curve *cu = tc->obedit->data; | 
					
						
							|  |  |  |         ListBase *nurbs = BKE_curve_editNurbs_get(cu); | 
					
						
							|  |  |  |         Nurb *nu = nurbs->first; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         DEG_id_tag_update(tc->obedit->data, 0); /* sets recalc flags */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (t->state == TRANS_CANCEL) { | 
					
						
							|  |  |  |           while (nu) { | 
					
						
							|  |  |  |             /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */ | 
					
						
							|  |  |  |             BKE_nurb_handles_calc(nu); | 
					
						
							|  |  |  |             nu = nu->next; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |           /* Normal updating */ | 
					
						
							|  |  |  |           while (nu) { | 
					
						
							|  |  |  |             BKE_nurb_test_2d(nu); | 
					
						
							|  |  |  |             BKE_nurb_handles_calc(nu); | 
					
						
							|  |  |  |             nu = nu->next; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (t->obedit_type == OB_LATTICE) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |         applyProject(t); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |       FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         Lattice *la = tc->obedit->data; | 
					
						
							|  |  |  |         DEG_id_tag_update(tc->obedit->data, 0); /* sets recalc flags */ | 
					
						
							|  |  |  |         if (la->editlatt->latt->flag & LT_OUTSIDE) { | 
					
						
							|  |  |  |           outside_lattice(la->editlatt->latt); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (t->obedit_type == OB_MESH) { | 
					
						
							|  |  |  |       /* mirror modifier clipping? */ | 
					
						
							|  |  |  |       if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |         /* apply clipping after so we never project past the clip plane [#25423] */ | 
					
						
							|  |  |  |         applyProject(t); | 
					
						
							|  |  |  |         clipMirrorModifier(t); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if ((t->flag & T_NO_MIRROR) == 0 && (t->options & CTX_NO_MIRROR) == 0) { | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |         transform_apply_to_mirror(t); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (t->mode == TFM_EDGE_SLIDE) { | 
					
						
							|  |  |  |         projectEdgeSlideData(t, false); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (t->mode == TFM_VERT_SLIDE) { | 
					
						
							|  |  |  |         projectVertSlideData(t, false); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |       FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         DEG_id_tag_update(tc->obedit->data, 0); /* sets recalc flags */ | 
					
						
							|  |  |  |         BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); | 
					
						
							|  |  |  |         EDBM_mesh_normals_update(em); | 
					
						
							| 
									
										
										
										
											2019-08-25 14:32:47 +10:00
										 |  |  |         BKE_editmesh_looptri_calc(em); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (t->obedit_type == OB_ARMATURE) { /* no recalc flag, does pose */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |         applyProject(t); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |       FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         bArmature *arm = tc->obedit->data; | 
					
						
							|  |  |  |         ListBase *edbo = arm->edbo; | 
					
						
							|  |  |  |         EditBone *ebo, *ebo_parent; | 
					
						
							|  |  |  |         TransData *td = tc->data; | 
					
						
							|  |  |  |         int i; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* Ensure all bones are correctly adjusted */ | 
					
						
							|  |  |  |         for (ebo = edbo->first; ebo; ebo = ebo->next) { | 
					
						
							|  |  |  |           ebo_parent = (ebo->flag & BONE_CONNECTED) ? ebo->parent : NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           if (ebo_parent) { | 
					
						
							|  |  |  |             /* If this bone has a parent tip that has been moved */ | 
					
						
							|  |  |  |             if (ebo_parent->flag & BONE_TIPSEL) { | 
					
						
							|  |  |  |               copy_v3_v3(ebo->head, ebo_parent->tail); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               if (t->mode == TFM_BONE_ENVELOPE) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 ebo->rad_head = ebo_parent->rad_tail; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |             /* If this bone has a parent tip that has NOT been moved */ | 
					
						
							|  |  |  |             else { | 
					
						
							|  |  |  |               copy_v3_v3(ebo_parent->tail, ebo->head); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               if (t->mode == TFM_BONE_ENVELOPE) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 ebo_parent->rad_tail = ebo->rad_head; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           /* on extrude bones, oldlength==0.0f, so we scale radius of points */ | 
					
						
							|  |  |  |           ebo->length = len_v3v3(ebo->head, ebo->tail); | 
					
						
							|  |  |  |           if (ebo->oldlength == 0.0f) { | 
					
						
							|  |  |  |             ebo->rad_head = 0.25f * ebo->length; | 
					
						
							|  |  |  |             ebo->rad_tail = 0.10f * ebo->length; | 
					
						
							|  |  |  |             ebo->dist = 0.25f * ebo->length; | 
					
						
							|  |  |  |             if (ebo->parent) { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               if (ebo->rad_head > ebo->parent->rad_tail) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 ebo->rad_head = ebo->parent->rad_tail; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |               } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else if (t->mode != TFM_BONE_ENVELOPE) { | 
					
						
							|  |  |  |             /* if bones change length, lets do that for the deform distance as well */ | 
					
						
							|  |  |  |             ebo->dist *= ebo->length / ebo->oldlength; | 
					
						
							|  |  |  |             ebo->rad_head *= ebo->length / ebo->oldlength; | 
					
						
							|  |  |  |             ebo->rad_tail *= ebo->length / ebo->oldlength; | 
					
						
							|  |  |  |             ebo->oldlength = ebo->length; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             if (ebo_parent) { | 
					
						
							|  |  |  |               ebo_parent->rad_tail = ebo->rad_head; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (!ELEM( | 
					
						
							|  |  |  |                 t->mode, TFM_BONE_ROLL, TFM_BONE_ENVELOPE, TFM_BONE_ENVELOPE_DIST, TFM_BONESIZE)) { | 
					
						
							|  |  |  |           /* fix roll */ | 
					
						
							|  |  |  |           for (i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |             if (td->extra) { | 
					
						
							|  |  |  |               float vec[3], up_axis[3]; | 
					
						
							|  |  |  |               float qrot[4]; | 
					
						
							|  |  |  |               float roll; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               ebo = td->extra; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |               if (t->state == TRANS_CANCEL) { | 
					
						
							|  |  |  |                 /* restore roll */ | 
					
						
							|  |  |  |                 ebo->roll = td->ival; | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               else { | 
					
						
							|  |  |  |                 copy_v3_v3(up_axis, td->axismtx[2]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 sub_v3_v3v3(vec, ebo->tail, ebo->head); | 
					
						
							|  |  |  |                 normalize_v3(vec); | 
					
						
							|  |  |  |                 rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec); | 
					
						
							|  |  |  |                 mul_qt_v3(qrot, up_axis); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 /* roll has a tendency to flip in certain orientations - [#34283], [#33974] */ | 
					
						
							|  |  |  |                 roll = ED_armature_ebone_roll_to_vector(ebo, up_axis, false); | 
					
						
							|  |  |  |                 ebo->roll = angle_compat_rad(roll, td->ival); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (arm->flag & ARM_MIRROR_EDIT) { | 
					
						
							|  |  |  |           if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |             ED_armature_edit_transform_mirror_update(tc->obedit); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							|  |  |  |             restoreBones(tc); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-12-02 01:40:58 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |         /* Tag for redraw/invalidate overlay cache. */ | 
					
						
							|  |  |  |         DEG_id_tag_update(&arm->id, ID_RECALC_SELECT); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |         applyProject(t); | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |       FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         if (tc->data_len) { | 
					
						
							|  |  |  |           DEG_id_tag_update(tc->obedit->data, 0); /* sets recalc flags */ | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-24 15:42:06 +02:00
										 |  |  |   else if (t->flag & T_POSE && (t->mode == TFM_BONESIZE)) { | 
					
						
							|  |  |  |     /* Handle the exception where for TFM_BONESIZE in edit mode we pretend to be
 | 
					
						
							|  |  |  |      * in pose mode (to use bone orientation matrix), | 
					
						
							|  |  |  |      * in that case we have to do mirroring as well. */ | 
					
						
							|  |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							|  |  |  |       Object *ob = tc->poseobj; | 
					
						
							|  |  |  |       bArmature *arm = ob->data; | 
					
						
							| 
									
										
										
										
											2019-05-13 13:16:22 +02:00
										 |  |  |       if (ob->mode == OB_MODE_EDIT) { | 
					
						
							|  |  |  |         if (arm->flag & ARM_MIRROR_EDIT) { | 
					
						
							|  |  |  |           if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |             ED_armature_edit_transform_mirror_update(ob); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							|  |  |  |             restoreBones(tc); | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-24 15:42:06 +02:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-05-13 13:16:22 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |       else if (ob->mode == OB_MODE_POSE) { | 
					
						
							|  |  |  |         /* actually support TFM_BONESIZE in posemode as well */ | 
					
						
							|  |  |  |         DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | 
					
						
							|  |  |  |         bPose *pose = ob->pose; | 
					
						
							|  |  |  |         if (arm->flag & ARM_MIRROR_EDIT || pose->flag & POSE_MIRROR_EDIT) { | 
					
						
							| 
									
										
										
										
											2020-02-15 18:43:58 -03:00
										 |  |  |           pose_transform_mirror_update(t, tc, ob); | 
					
						
							| 
									
										
										
										
											2019-04-24 15:42:06 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   else if (t->flag & T_POSE) { | 
					
						
							|  |  |  |     GSet *motionpath_updates = BLI_gset_ptr_new("motionpath updates"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       Object *ob = tc->poseobj; | 
					
						
							| 
									
										
										
										
											2019-05-09 11:19:38 +02:00
										 |  |  |       bPose *pose = ob->pose; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-09 11:19:38 +02:00
										 |  |  |       if (pose->flag & POSE_MIRROR_EDIT) { | 
					
						
							| 
									
										
										
										
											2019-05-06 09:47:45 +02:00
										 |  |  |         if (t->state != TRANS_CANCEL) { | 
					
						
							| 
									
										
										
										
											2020-02-15 18:43:58 -03:00
										 |  |  |           pose_transform_mirror_update(t, tc, ob); | 
					
						
							| 
									
										
										
										
											2019-05-06 09:47:45 +02:00
										 |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |           restoreMirrorPoseBones(tc); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       /* if animtimer is running, and the object already has animation data,
 | 
					
						
							|  |  |  |        * check if the auto-record feature means that we should record 'samples' | 
					
						
							|  |  |  |        * (i.e. un-editable animation values) | 
					
						
							|  |  |  |        * | 
					
						
							|  |  |  |        * context is needed for keying set poll() functions. | 
					
						
							|  |  |  |        */ | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       /* TODO: autokeyframe calls need some setting to specify to add samples
 | 
					
						
							|  |  |  |        * (FPoints) instead of keyframes? */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) { | 
					
						
							|  |  |  |         int targetless_ik = | 
					
						
							|  |  |  |             (t->flag & T_AUTOIK);  // XXX this currently doesn't work, since flags aren't set yet!
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         animrecord_check_state(t->scene, &ob->id, t->animtimer); | 
					
						
							|  |  |  |         autokeyframe_pose(t->context, t->scene, ob, t->mode, targetless_ik); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (motionpath_need_update_pose(t->scene, ob)) { | 
					
						
							|  |  |  |         BLI_gset_insert(motionpath_updates, ob); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-07 10:44:18 +02:00
										 |  |  |       DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Update motion paths once for all transformed bones in an object. */ | 
					
						
							|  |  |  |     GSetIterator gs_iter; | 
					
						
							|  |  |  |     GSET_ITER (gs_iter, motionpath_updates) { | 
					
						
							|  |  |  |       Object *ob = BLI_gsetIterator_getKey(&gs_iter); | 
					
						
							| 
									
										
										
										
											2019-09-20 12:48:28 +02:00
										 |  |  |       ED_pose_recalculate_paths(t->context, t->scene, ob, POSE_PATH_CALC_RANGE_CURRENT_FRAME); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     BLI_gset_free(motionpath_updates, NULL); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (base && (base->object->mode & OB_MODE_PARTICLE_EDIT) && | 
					
						
							| 
									
										
										
										
											2019-09-26 17:24:29 +02:00
										 |  |  |            PE_get_current(t->depsgraph, t->scene, base->object)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |       applyProject(t); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     flushTransParticles(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     bool motionpath_update = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (t->state != TRANS_CANCEL) { | 
					
						
							|  |  |  |       applyProject(t); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       TransData *td = tc->data; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       for (int i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |         Object *ob = td->ob; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         if (td->flag & TD_NOACTION) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |           break; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         if (td->flag & TD_SKIP) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |           continue; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |         /* if animtimer is running, and the object already has animation data,
 | 
					
						
							|  |  |  |          * check if the auto-record feature means that we should record 'samples' | 
					
						
							|  |  |  |          * (i.e. uneditable animation values) | 
					
						
							|  |  |  |          */ | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |         /* TODO: autokeyframe calls need some setting to specify to add samples
 | 
					
						
							|  |  |  |          * (FPoints) instead of keyframes? */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         if ((t->animtimer) && IS_AUTOKEY_ON(t->scene)) { | 
					
						
							|  |  |  |           animrecord_check_state(t->scene, &ob->id, t->animtimer); | 
					
						
							|  |  |  |           autokeyframe_object(t->context, t->scene, t->view_layer, ob, t->mode); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         motionpath_update |= motionpath_need_update_object(t->scene, ob); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* sets recalc flags fully, instead of flushing existing ones
 | 
					
						
							|  |  |  |          * otherwise proxies don't function correctly | 
					
						
							|  |  |  |          */ | 
					
						
							|  |  |  |         DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         if (t->flag & T_TEXTURE) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |           DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (motionpath_update) { | 
					
						
							|  |  |  |       /* Update motion paths once for all transformed objects. */ | 
					
						
							| 
									
										
										
										
											2019-09-20 12:48:28 +02:00
										 |  |  |       ED_objects_recalculate_paths(t->context, t->scene, OBJECT_PATH_CALC_RANGE_CHANGED); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-08-22 13:45:31 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-29 01:45:36 +10:00
										 |  |  |     if (t->options & CTX_OBMODE_XFORM_SKIP_CHILDREN) { | 
					
						
							|  |  |  |       trans_obchild_in_obmode_update_all(t); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-08-31 03:36:13 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (t->options & CTX_OBMODE_XFORM_OBDATA) { | 
					
						
							|  |  |  |       trans_obdata_in_obmode_update_all(t); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2010-11-14 16:31:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 19:43:23 +02:00
										 |  |  | static void recalcData_cursor(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   DEG_id_tag_update(&t->scene->id, ID_RECALC_COPY_ON_WRITE); | 
					
						
							| 
									
										
										
										
											2018-05-25 19:43:23 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-21 10:42:21 +00:00
										 |  |  | /* helper for recalcData() - for sequencer transforms */ | 
					
						
							|  |  |  | static void recalcData_sequencer(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransData *td; | 
					
						
							|  |  |  |   int a; | 
					
						
							|  |  |  |   Sequence *seq_prev = NULL; | 
					
						
							| 
									
										
										
										
											2012-09-13 10:51:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   for (a = 0, td = tc->data; a < tc->data_len; a++, td++) { | 
					
						
							|  |  |  |     TransDataSeq *tdsq = (TransDataSeq *)td->extra; | 
					
						
							|  |  |  |     Sequence *seq = tdsq->seq; | 
					
						
							| 
									
										
										
										
											2012-10-04 18:30:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     if (seq != seq_prev) { | 
					
						
							| 
									
										
										
										
											2019-05-23 11:52:28 -07:00
										 |  |  |       BKE_sequence_invalidate_cache_composite(t->scene, seq); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-10-04 18:30:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     seq_prev = seq; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2012-09-13 10:51:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-04 16:52:48 +02:00
										 |  |  |   DEG_id_tag_update(&t->scene->id, ID_RECALC_SEQUENCER_STRIPS); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   flushTransSeq(t); | 
					
						
							| 
									
										
										
										
											2012-08-21 10:42:21 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-04-29 01:10:33 +12:00
										 |  |  | /* force recalculation of triangles during transformation */ | 
					
						
							|  |  |  | static void recalcData_gpencil_strokes(TransInfo *t) | 
					
						
							| 
									
										
										
										
											2017-06-12 13:35:00 +10:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   TransData *td = tc->data; | 
					
						
							|  |  |  |   for (int i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |     bGPDstroke *gps = td->extra; | 
					
						
							|  |  |  |     if (gps != NULL) { | 
					
						
							|  |  |  |       gps->flag |= GP_STROKE_RECALC_GEOMETRY; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-04-29 01:10:33 +12:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-10 19:55:15 +02:00
										 |  |  | static void recalcData_sculpt(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   ED_sculpt_update_modal_transform(t->context); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-22 07:25:52 +00:00
										 |  |  | /* called for updating while transform acts, once per redraw */ | 
					
						
							|  |  |  | void recalcData(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* if tests must match createTransData for correct updates */ | 
					
						
							|  |  |  |   if (t->options & CTX_CURSOR) { | 
					
						
							|  |  |  |     recalcData_cursor(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_TEXTURE) { | 
					
						
							|  |  |  |     recalcData_objects(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_EDGE) { | 
					
						
							|  |  |  |     recalcData_objects(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_PAINT_CURVE) { | 
					
						
							|  |  |  |     flushTransPaintCurve(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_GPENCIL_STROKES) { | 
					
						
							|  |  |  |     /* set recalc triangle cache flag */ | 
					
						
							|  |  |  |     recalcData_gpencil_strokes(t); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-09-12 11:14:44 +02:00
										 |  |  |   else if (t->options & CTX_SCULPT) { | 
					
						
							| 
									
										
										
										
											2019-09-10 19:55:15 +02:00
										 |  |  |     recalcData_sculpt(t); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   else if (t->spacetype == SPACE_IMAGE) { | 
					
						
							|  |  |  |     recalcData_image(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_ACTION) { | 
					
						
							|  |  |  |     recalcData_actedit(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_NLA) { | 
					
						
							|  |  |  |     recalcData_nla(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_SEQ) { | 
					
						
							|  |  |  |     recalcData_sequencer(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_GRAPH) { | 
					
						
							|  |  |  |     recalcData_graphedit(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_NODE) { | 
					
						
							|  |  |  |     flushTransNodes(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_CLIP) { | 
					
						
							|  |  |  |     recalcData_spaceclip(t); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     recalcData_objects(t); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-10-22 23:22:05 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-05 20:40:26 +00:00
										 |  |  | void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis, short options) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float v1[3], v2[3], v3[3]; | 
					
						
							|  |  |  |   unsigned char col[3], col2[3]; | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if (t->spacetype == SPACE_VIEW3D) { | 
					
						
							|  |  |  |     View3D *v3d = t->view; | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     GPU_matrix_push(); | 
					
						
							| 
									
										
										
										
											2017-03-21 17:49:21 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     copy_v3_v3(v3, dir); | 
					
						
							|  |  |  |     mul_v3_fl(v3, v3d->clip_end); | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     sub_v3_v3v3(v2, center, v3); | 
					
						
							|  |  |  |     add_v3_v3v3(v1, center, v3); | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     if (options & DRAWLIGHT) { | 
					
						
							|  |  |  |       col[0] = col[1] = col[2] = 220; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       UI_GetThemeColor3ubv(TH_GRID, col); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     UI_make_axis_color(col, col2, axis); | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | 
					
						
							|  |  |  |     immUniformColor3ubv(col2); | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     immBegin(GPU_PRIM_LINES, 2); | 
					
						
							|  |  |  |     immVertex3fv(pos, v1); | 
					
						
							|  |  |  |     immVertex3fv(pos, v2); | 
					
						
							|  |  |  |     immEnd(); | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     immUnbindProgram(); | 
					
						
							| 
									
										
										
										
											2017-01-26 12:13:50 -02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     GPU_matrix_pop(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-24 15:15:01 +00:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * Free data before switching to another mode. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void resetTransModal(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   freeTransCustomDataForMode(t); | 
					
						
							| 
									
										
										
										
											2013-04-24 15:15:01 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | void resetTransRestrictions(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   t->flag &= ~T_ALL_RESTRICTIONS; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-20 13:24:07 +00:00
										 |  |  | static int initTransInfo_edit_pet_to_flag(const int proportional) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |   int flag = 0; | 
					
						
							|  |  |  |   if (proportional & PROP_EDIT_USE) { | 
					
						
							|  |  |  |     flag |= T_PROP_EDIT; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |   if (proportional & PROP_EDIT_CONNECTED) { | 
					
						
							|  |  |  |     flag |= T_PROP_CONNECTED; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (proportional & PROP_EDIT_PROJECTED) { | 
					
						
							|  |  |  |     flag |= T_PROP_PROJECTED; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return flag; | 
					
						
							| 
									
										
										
										
											2013-06-20 13:24:07 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | void initTransDataContainers_FromObjectData(TransInfo *t, | 
					
						
							|  |  |  |                                             Object *obact, | 
					
						
							|  |  |  |                                             Object **objects, | 
					
						
							|  |  |  |                                             uint objects_len) | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT; | 
					
						
							|  |  |  |   const short object_type = obact ? obact->type : -1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if ((object_mode & OB_MODE_EDIT) || (t->options & CTX_GPENCIL_STROKES) || | 
					
						
							|  |  |  |       ((object_mode & OB_MODE_POSE) && (object_type == OB_ARMATURE))) { | 
					
						
							|  |  |  |     if (t->data_container) { | 
					
						
							|  |  |  |       MEM_freeN(t->data_container); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool free_objects = false; | 
					
						
							|  |  |  |     if (objects == NULL) { | 
					
						
							|  |  |  |       objects = BKE_view_layer_array_from_objects_in_mode( | 
					
						
							|  |  |  |           t->view_layer, | 
					
						
							|  |  |  |           (t->spacetype == SPACE_VIEW3D) ? t->view : NULL, | 
					
						
							|  |  |  |           &objects_len, | 
					
						
							|  |  |  |           { | 
					
						
							|  |  |  |               .object_mode = object_mode, | 
					
						
							|  |  |  |               .no_dup_data = true, | 
					
						
							|  |  |  |           }); | 
					
						
							|  |  |  |       free_objects = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     t->data_container = MEM_callocN(sizeof(*t->data_container) * objects_len, __func__); | 
					
						
							|  |  |  |     t->data_container_len = objects_len; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (int i = 0; i < objects_len; i++) { | 
					
						
							|  |  |  |       TransDataContainer *tc = &t->data_container[i]; | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |       if (((t->flag & T_NO_MIRROR) == 0) && ((t->options & CTX_NO_MIRROR) == 0) && | 
					
						
							|  |  |  |           (objects[i]->type == OB_MESH)) { | 
					
						
							|  |  |  |         tc->mirror.axis_x = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_X) != 0; | 
					
						
							|  |  |  |         tc->mirror.axis_y = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_Y) != 0; | 
					
						
							|  |  |  |         tc->mirror.axis_z = (((Mesh *)objects[i]->data)->editflag & ME_EDIT_MIRROR_Z) != 0; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       if (object_mode & OB_MODE_EDIT) { | 
					
						
							|  |  |  |         tc->obedit = objects[i]; | 
					
						
							|  |  |  |         /* Check needed for UV's */ | 
					
						
							|  |  |  |         if ((t->flag & T_2D_EDIT) == 0) { | 
					
						
							|  |  |  |           tc->use_local_mat = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (object_mode & OB_MODE_POSE) { | 
					
						
							|  |  |  |         tc->poseobj = objects[i]; | 
					
						
							|  |  |  |         tc->use_local_mat = true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (t->options & CTX_GPENCIL_STROKES) { | 
					
						
							|  |  |  |         tc->use_local_mat = true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (tc->use_local_mat) { | 
					
						
							|  |  |  |         BLI_assert((t->flag & T_2D_EDIT) == 0); | 
					
						
							|  |  |  |         copy_m4_m4(tc->mat, objects[i]->obmat); | 
					
						
							|  |  |  |         copy_m3_m4(tc->mat3, tc->mat); | 
					
						
							| 
									
										
										
										
											2019-05-05 16:04:10 +02:00
										 |  |  |         /* for non-invertible scale matrices, invert_m4_m4_fallback()
 | 
					
						
							|  |  |  |          * can still provide a valid pivot */ | 
					
						
							|  |  |  |         invert_m4_m4_fallback(tc->imat, tc->mat); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         invert_m3_m3(tc->imat3, tc->mat3); | 
					
						
							|  |  |  |         normalize_m3_m3(tc->mat3_unit, tc->mat3); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       /* Otherwise leave as zero. */ | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (free_objects) { | 
					
						
							|  |  |  |       MEM_freeN(objects); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-25 07:49:49 +11:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * Setup internal data, mouse, vectors | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * \note \a op and \a event can be NULL | 
					
						
							| 
									
										
										
										
											2015-05-25 15:45:56 +10:00
										 |  |  |  * | 
					
						
							|  |  |  |  * \see #saveTransform does the reverse. | 
					
						
							| 
									
										
										
										
											2013-11-25 07:49:49 +11:00
										 |  |  |  */ | 
					
						
							|  |  |  | void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   Scene *sce = CTX_data_scene(C); | 
					
						
							|  |  |  |   ViewLayer *view_layer = CTX_data_view_layer(C); | 
					
						
							| 
									
										
										
										
											2019-11-09 16:12:27 -03:00
										 |  |  |   Object *obact = OBACT(view_layer); | 
					
						
							|  |  |  |   const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ToolSettings *ts = CTX_data_tool_settings(C); | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   ARegion *region = CTX_wm_region(C); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   ScrArea *sa = CTX_wm_area(C); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   bGPdata *gpd = CTX_data_gpencil_data(C); | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-07-25 16:36:22 +02:00
										 |  |  |   t->depsgraph = CTX_data_depsgraph_pointer(C); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   t->scene = sce; | 
					
						
							|  |  |  |   t->view_layer = view_layer; | 
					
						
							|  |  |  |   t->sa = sa; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   t->region = region; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   t->settings = ts; | 
					
						
							|  |  |  |   t->reports = op ? op->reports : NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->helpline = HLP_NONE; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->flag = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-09 16:12:27 -03:00
										 |  |  |   if (obact && !(t->options & (CTX_CURSOR | CTX_TEXTURE)) && | 
					
						
							|  |  |  |       ELEM(object_mode, OB_MODE_EDIT, OB_MODE_EDIT_GPENCIL)) { | 
					
						
							|  |  |  |     t->obedit_type = obact->type; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     t->obedit_type = -1; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* Many kinds of transform only use a single handle. */ | 
					
						
							|  |  |  |   if (t->data_container == NULL) { | 
					
						
							|  |  |  |     t->data_container = MEM_callocN(sizeof(*t->data_container), __func__); | 
					
						
							|  |  |  |     t->data_container_len = 1; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->redraw = TREDRAW_HARD; /* redraw first time */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-27 16:42:34 -03:00
										 |  |  |   int mval[2]; | 
					
						
							|  |  |  |   if (event) { | 
					
						
							|  |  |  |     copy_v2_v2_int(mval, event->mval); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     zero_v2_int(mval); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   copy_v2_v2_int(t->mval, mval); | 
					
						
							|  |  |  |   copy_v2_v2_int(t->mouse.imval, mval); | 
					
						
							|  |  |  |   copy_v2_v2_int(t->con.imval, mval); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   t->transform = NULL; | 
					
						
							|  |  |  |   t->handleEvent = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->data_len_all = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->val = 0.0f; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   zero_v3(t->vec); | 
					
						
							|  |  |  |   zero_v3(t->center_global); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   unit_m3(t->mat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   unit_m3(t->orient_matrix); | 
					
						
							|  |  |  |   negate_m3(t->orient_matrix); | 
					
						
							|  |  |  |   /* Leave 't->orient_matrix_is_set' to false,
 | 
					
						
							|  |  |  |    * so we overwrite it when we have a useful value. */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* Default to rotate on the Z axis. */ | 
					
						
							|  |  |  |   t->orient_axis = 2; | 
					
						
							|  |  |  |   t->orient_axis_ortho = 1; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* if there's an event, we're modal */ | 
					
						
							|  |  |  |   if (event) { | 
					
						
							|  |  |  |     t->flag |= T_MODAL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* Crease needs edge flag */ | 
					
						
							|  |  |  |   if (ELEM(t->mode, TFM_CREASE, TFM_BWEIGHT)) { | 
					
						
							|  |  |  |     t->options |= CTX_EDGE; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->remove_on_cancel = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (op && (prop = RNA_struct_find_property(op->ptr, "remove_on_cancel")) && | 
					
						
							|  |  |  |       RNA_property_is_set(op->ptr, prop)) { | 
					
						
							|  |  |  |     if (RNA_property_boolean_get(op->ptr, prop)) { | 
					
						
							|  |  |  |       t->remove_on_cancel = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* GPencil editing context */ | 
					
						
							|  |  |  |   if (GPENCIL_EDIT_MODE(gpd)) { | 
					
						
							|  |  |  |     t->options |= CTX_GPENCIL_STROKES; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* Assign the space type, some exceptions for running in different mode */ | 
					
						
							|  |  |  |   if (sa == NULL) { | 
					
						
							|  |  |  |     /* background mode */ | 
					
						
							|  |  |  |     t->spacetype = SPACE_EMPTY; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |   else if ((region == NULL) && (sa->spacetype == SPACE_VIEW3D)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     /* running in the text editor */ | 
					
						
							|  |  |  |     t->spacetype = SPACE_EMPTY; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     /* normal operation */ | 
					
						
							|  |  |  |     t->spacetype = sa->spacetype; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* handle T_ALT_TRANSFORM initialization, we may use for different operators */ | 
					
						
							|  |  |  |   if (op) { | 
					
						
							|  |  |  |     const char *prop_id = NULL; | 
					
						
							|  |  |  |     if (t->mode == TFM_SHRINKFATTEN) { | 
					
						
							|  |  |  |       prop_id = "use_even_offset"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (prop_id && (prop = RNA_struct_find_property(op->ptr, prop_id))) { | 
					
						
							|  |  |  |       SET_FLAG_FROM_TEST(t->flag, RNA_property_boolean_get(op->ptr, prop), T_ALT_TRANSFORM); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->spacetype == SPACE_VIEW3D) { | 
					
						
							|  |  |  |     View3D *v3d = sa->spacedata.first; | 
					
						
							|  |  |  |     bScreen *animscreen = ED_screen_animation_playing(CTX_wm_manager(C)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     t->view = v3d; | 
					
						
							|  |  |  |     t->animtimer = (animscreen) ? animscreen->animtimer : NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* turn gizmo off during transform */ | 
					
						
							|  |  |  |     if (t->flag & T_MODAL) { | 
					
						
							|  |  |  |       t->gizmo_flag = v3d->gizmo_flag; | 
					
						
							|  |  |  |       v3d->gizmo_flag = V3D_GIZMO_HIDE; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (t->scene->toolsettings->transform_flag & SCE_XFORM_AXIS_ALIGN) { | 
					
						
							|  |  |  |       t->flag |= T_V3D_ALIGN; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     t->around = t->scene->toolsettings->transform_pivot_point; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* bend always uses the cursor */ | 
					
						
							|  |  |  |     if (t->mode == TFM_BEND) { | 
					
						
							|  |  |  |       t->around = V3D_AROUND_CURSOR; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     TransformOrientationSlot *orient_slot = &t->scene->orientation_slots[SCE_ORIENT_DEFAULT]; | 
					
						
							|  |  |  |     t->orientation.unset = V3D_ORIENT_GLOBAL; | 
					
						
							|  |  |  |     t->orientation.user = orient_slot->type; | 
					
						
							|  |  |  |     t->orientation.custom = BKE_scene_transform_orientation_find(t->scene, | 
					
						
							|  |  |  |                                                                  orient_slot->index_custom); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     t->orientation.index = 0; | 
					
						
							|  |  |  |     ARRAY_SET_ITEMS(t->orientation.types, &t->orientation.user, NULL); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* Make second orientation local if both are global. */ | 
					
						
							|  |  |  |     if (t->orientation.user == V3D_ORIENT_GLOBAL) { | 
					
						
							|  |  |  |       t->orientation.user_alt = V3D_ORIENT_LOCAL; | 
					
						
							|  |  |  |       t->orientation.types[0] = &t->orientation.user_alt; | 
					
						
							|  |  |  |       SWAP(short *, t->orientation.types[0], t->orientation.types[1]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* exceptional case */ | 
					
						
							|  |  |  |     if (t->around == V3D_AROUND_LOCAL_ORIGINS) { | 
					
						
							|  |  |  |       if (ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL)) { | 
					
						
							|  |  |  |         const bool use_island = transdata_check_local_islands(t, t->around); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if ((t->obedit_type != -1) && !use_island) { | 
					
						
							|  |  |  |           t->options |= CTX_NO_PET; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (object_mode & OB_MODE_ALL_PAINT) { | 
					
						
							|  |  |  |       Paint *p = BKE_paint_get_active_from_context(C); | 
					
						
							|  |  |  |       if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) { | 
					
						
							|  |  |  |         t->options |= CTX_PAINT_CURVE; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* initialize UV transform from */ | 
					
						
							|  |  |  |     if (op && ((prop = RNA_struct_find_property(op->ptr, "correct_uv")))) { | 
					
						
							|  |  |  |       if (RNA_property_is_set(op->ptr, prop)) { | 
					
						
							|  |  |  |         if (RNA_property_boolean_get(op->ptr, prop)) { | 
					
						
							|  |  |  |           t->settings->uvcalc_flag |= UVCALC_TRANSFORM_CORRECT; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |           t->settings->uvcalc_flag &= ~UVCALC_TRANSFORM_CORRECT; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							|  |  |  |         RNA_property_boolean_set( | 
					
						
							|  |  |  |             op->ptr, prop, (t->settings->uvcalc_flag & UVCALC_TRANSFORM_CORRECT) != 0); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_IMAGE) { | 
					
						
							|  |  |  |     SpaceImage *sima = sa->spacedata.first; | 
					
						
							|  |  |  |     // XXX for now, get View2D from the active region
 | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     t->view = ®ion->v2d; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     t->around = sima->around; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (ED_space_image_show_uvedit(sima, OBACT(t->view_layer))) { | 
					
						
							|  |  |  |       /* UV transform */ | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (sima->mode == SI_MODE_MASK) { | 
					
						
							|  |  |  |       t->options |= CTX_MASK; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (sima->mode == SI_MODE_PAINT) { | 
					
						
							|  |  |  |       Paint *p = &sce->toolsettings->imapaint.paint; | 
					
						
							|  |  |  |       if (p->brush && (p->brush->flag & BRUSH_CURVE)) { | 
					
						
							|  |  |  |         t->options |= CTX_PAINT_CURVE; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     /* image not in uv edit, nor in mask mode, can happen for some tools */ | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_NODE) { | 
					
						
							|  |  |  |     // XXX for now, get View2D from the active region
 | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     t->view = ®ion->v2d; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     t->around = V3D_AROUND_CENTER_BOUNDS; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_GRAPH) { | 
					
						
							|  |  |  |     SpaceGraph *sipo = sa->spacedata.first; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     t->view = ®ion->v2d; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     t->around = sipo->around; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_CLIP) { | 
					
						
							|  |  |  |     SpaceClip *sclip = sa->spacedata.first; | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     t->view = ®ion->v2d; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     t->around = sclip->around; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     if (ED_space_clip_check_show_trackedit(sclip)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       t->options |= CTX_MOVIECLIP; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							|  |  |  |     else if (ED_space_clip_check_show_maskedit(sclip)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       t->options |= CTX_MASK; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     if (region) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       // XXX for now, get View2D  from the active region
 | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |       t->view = ®ion->v2d; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       // XXX for now, the center point is the midpoint of the data
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       t->view = NULL; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     t->around = V3D_AROUND_CENTER_BOUNDS; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis"))) { | 
					
						
							|  |  |  |     t->orient_axis = RNA_property_enum_get(op->ptr, prop); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (op && (prop = RNA_struct_find_property(op->ptr, "orient_axis_ortho"))) { | 
					
						
							|  |  |  |     t->orient_axis_ortho = RNA_property_enum_get(op->ptr, prop); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (op && | 
					
						
							|  |  |  |       ((prop = RNA_struct_find_property(op->ptr, "orient_matrix")) && | 
					
						
							|  |  |  |        RNA_property_is_set(op->ptr, prop)) && | 
					
						
							|  |  |  |       ((t->flag & T_MODAL) || | 
					
						
							| 
									
										
										
										
											2019-11-25 00:55:11 +11:00
										 |  |  |        /* When using redo, don't use the custom constraint matrix
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         * if the user selects a different orientation. */ | 
					
						
							|  |  |  |        (RNA_enum_get(op->ptr, "orient_type") == RNA_enum_get(op->ptr, "orient_matrix_type")))) { | 
					
						
							| 
									
										
										
										
											2020-02-17 13:03:58 -03:00
										 |  |  |     RNA_property_float_get_array(op->ptr, prop, &t->orient_matrix[0][0]); | 
					
						
							|  |  |  |     copy_m3_m3(t->spacemtx, t->orient_matrix); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     /* Some transform modes use this to operate on an axis. */ | 
					
						
							|  |  |  |     t->orient_matrix_is_set = true; | 
					
						
							|  |  |  |     t->orientation.user = V3D_ORIENT_CUSTOM_MATRIX; | 
					
						
							|  |  |  |     t->orientation.custom = 0; | 
					
						
							|  |  |  |     if (t->flag & T_MODAL) { | 
					
						
							|  |  |  |       RNA_enum_set(op->ptr, "orient_matrix_type", RNA_enum_get(op->ptr, "orient_type")); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (op && ((prop = RNA_struct_find_property(op->ptr, "orient_type")) && | 
					
						
							|  |  |  |                   RNA_property_is_set(op->ptr, prop))) { | 
					
						
							|  |  |  |     short orientation = RNA_property_enum_get(op->ptr, prop); | 
					
						
							|  |  |  |     TransformOrientation *custom_orientation = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (orientation >= V3D_ORIENT_CUSTOM) { | 
					
						
							|  |  |  |       if (orientation >= V3D_ORIENT_CUSTOM + BIF_countTransformOrientation(C)) { | 
					
						
							|  |  |  |         orientation = V3D_ORIENT_GLOBAL; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							|  |  |  |         custom_orientation = BKE_scene_transform_orientation_find(t->scene, | 
					
						
							|  |  |  |                                                                   orientation - V3D_ORIENT_CUSTOM); | 
					
						
							|  |  |  |         orientation = V3D_ORIENT_CUSTOM; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     t->orientation.user = orientation; | 
					
						
							|  |  |  |     t->orientation.custom = custom_orientation; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (op && ((prop = RNA_struct_find_property(op->ptr, "release_confirm")) && | 
					
						
							|  |  |  |              RNA_property_is_set(op->ptr, prop))) { | 
					
						
							|  |  |  |     if (RNA_property_boolean_get(op->ptr, prop)) { | 
					
						
							|  |  |  |       t->flag |= T_RELEASE_CONFIRM; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2019-10-04 15:50:42 +02:00
										 |  |  |     /* Release confirms preference should not affect node editor (T69288, T70504). */ | 
					
						
							| 
									
										
										
										
											2019-10-07 15:17:44 +11:00
										 |  |  |     if (ISMOUSE(t->launch_event) && | 
					
						
							|  |  |  |         ((U.flag & USER_RELEASECONFIRM) || (t->spacetype == SPACE_NODE))) { | 
					
						
							| 
									
										
										
										
											2019-07-31 17:59:03 +02:00
										 |  |  |       /* Global "release confirm" on mouse bindings */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       t->flag |= T_RELEASE_CONFIRM; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (op && ((prop = RNA_struct_find_property(op->ptr, "mirror")) && | 
					
						
							|  |  |  |              RNA_property_is_set(op->ptr, prop))) { | 
					
						
							|  |  |  |     if (!RNA_property_boolean_get(op->ptr, prop)) { | 
					
						
							|  |  |  |       t->flag |= T_NO_MIRROR; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if ((t->spacetype == SPACE_VIEW3D) && (t->obedit_type == OB_MESH)) { | 
					
						
							|  |  |  |     /* pass */ | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     /* Avoid mirroring for unsupported contexts. */ | 
					
						
							|  |  |  |     t->options |= CTX_NO_MIRROR; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* setting PET flag only if property exist in operator. Otherwise, assume it's not supported */ | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |   if (op && (prop = RNA_struct_find_property(op->ptr, "use_proportional_edit"))) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     if (RNA_property_is_set(op->ptr, prop)) { | 
					
						
							| 
									
										
										
										
											2019-04-30 14:32:35 +02:00
										 |  |  |       int proportional = 0; | 
					
						
							| 
									
										
										
										
											2019-05-01 08:36:36 +10:00
										 |  |  |       if (RNA_property_boolean_get(op->ptr, prop)) { | 
					
						
							| 
									
										
										
										
											2019-04-30 14:32:35 +02:00
										 |  |  |         proportional |= PROP_EDIT_USE; | 
					
						
							|  |  |  |         if (RNA_boolean_get(op->ptr, "use_proportional_connected")) { | 
					
						
							|  |  |  |           proportional |= PROP_EDIT_CONNECTED; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         if (RNA_boolean_get(op->ptr, "use_proportional_projected")) { | 
					
						
							|  |  |  |           proportional |= PROP_EDIT_PROJECTED; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |       } | 
					
						
							|  |  |  |       t->flag |= initTransInfo_edit_pet_to_flag(proportional); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       /* use settings from scene only if modal */ | 
					
						
							|  |  |  |       if (t->flag & T_MODAL) { | 
					
						
							|  |  |  |         if ((t->options & CTX_NO_PET) == 0) { | 
					
						
							|  |  |  |           if (t->spacetype == SPACE_GRAPH) { | 
					
						
							|  |  |  |             t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_fcurve); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else if (t->spacetype == SPACE_ACTION) { | 
					
						
							|  |  |  |             t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_action); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else if (t->obedit_type != -1) { | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |             t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |           } | 
					
						
							|  |  |  |           else if (t->options & CTX_GPENCIL_STROKES) { | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |             t->flag |= initTransInfo_edit_pet_to_flag(ts->proportional_edit); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |           } | 
					
						
							|  |  |  |           else if (t->options & CTX_MASK) { | 
					
						
							|  |  |  |             if (ts->proportional_mask) { | 
					
						
							|  |  |  |               t->flag |= T_PROP_EDIT; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |               if (ts->proportional_edit & PROP_EDIT_CONNECTED) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |                 t->flag |= T_PROP_CONNECTED; | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-11-09 16:12:27 -03:00
										 |  |  |           else if (!(t->options & CTX_CURSOR) && ts->proportional_objects) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             t->flag |= T_PROP_EDIT; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_size")) && | 
					
						
							|  |  |  |                RNA_property_is_set(op->ptr, prop))) { | 
					
						
							|  |  |  |       t->prop_size = RNA_property_float_get(op->ptr, prop); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       t->prop_size = ts->proportional_size; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* TRANSFORM_FIX_ME rna restrictions */ | 
					
						
							|  |  |  |     if (t->prop_size <= 0.00001f) { | 
					
						
							|  |  |  |       printf("Proportional size (%f) under 0.00001, resetting to 1!\n", t->prop_size); | 
					
						
							|  |  |  |       t->prop_size = 1.0f; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (op && ((prop = RNA_struct_find_property(op->ptr, "proportional_edit_falloff")) && | 
					
						
							|  |  |  |                RNA_property_is_set(op->ptr, prop))) { | 
					
						
							|  |  |  |       t->prop_mode = RNA_property_enum_get(op->ptr, prop); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       t->prop_mode = ts->prop_mode; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { /* add not pet option to context when not available */ | 
					
						
							|  |  |  |     t->options |= CTX_NO_PET; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // Mirror is not supported with PET, turn it off.
 | 
					
						
							| 
									
										
										
										
											2013-06-20 18:19:42 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if (t->flag & T_PROP_EDIT) { | 
					
						
							|  |  |  |     t->flag &= ~T_MIRROR; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2013-06-20 18:19:42 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-10-04 23:42:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setTransformViewAspect(t, t->aspect); | 
					
						
							| 
									
										
										
										
											2017-08-29 16:01:16 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-20 22:21:21 -03:00
										 |  |  |   if (op && (prop = RNA_struct_find_property(op->ptr, "center_override")) && | 
					
						
							|  |  |  |       RNA_property_is_set(op->ptr, prop)) { | 
					
						
							|  |  |  |     RNA_property_float_get_array(op->ptr, prop, t->center_global); | 
					
						
							|  |  |  |     mul_v3_v3(t->center_global, t->aspect); | 
					
						
							|  |  |  |     t->flag |= T_OVERRIDE_CENTER; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   setTransformViewMatrices(t); | 
					
						
							|  |  |  |   initNumInput(&t->num); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | static void freeTransCustomData(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data) | 
					
						
							| 
									
										
										
										
											2018-04-26 10:08:41 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if (custom_data->free_cb) { | 
					
						
							|  |  |  |     /* Can take over freeing t->data and data_2d etc... */ | 
					
						
							|  |  |  |     custom_data->free_cb(t, tc, custom_data); | 
					
						
							|  |  |  |     BLI_assert(custom_data->data == NULL); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if ((custom_data->data != NULL) && custom_data->use_free) { | 
					
						
							|  |  |  |     MEM_freeN(custom_data->data); | 
					
						
							|  |  |  |     custom_data->data = NULL; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   /* In case modes are switched in the same transform session. */ | 
					
						
							| 
									
										
										
										
											2019-10-03 07:31:24 +10:00
										 |  |  |   custom_data->free_cb = NULL; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   custom_data->use_free = false; | 
					
						
							| 
									
										
										
										
											2018-04-26 10:08:41 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | static void freeTransCustomDataContainer(TransInfo *t, | 
					
						
							|  |  |  |                                          TransDataContainer *tc, | 
					
						
							|  |  |  |                                          TransCustomDataContainer *tcdc) | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransCustomData *custom_data = &tcdc->first_elem; | 
					
						
							|  |  |  |   for (int i = 0; i < TRANS_CUSTOM_DATA_ELEM_MAX; i++, custom_data++) { | 
					
						
							|  |  |  |     freeTransCustomData(t, tc, custom_data); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-04-26 10:08:41 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Needed for mode switching. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void freeTransCustomDataForMode(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   freeTransCustomData(t, NULL, &t->custom.mode); | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     freeTransCustomData(t, tc, &tc->custom.mode); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-04-16 16:27:55 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | /* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */ | 
					
						
							| 
									
										
										
										
											2012-04-29 17:11:40 +00:00
										 |  |  | void postTrans(bContext *C, TransInfo *t) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (t->draw_handle_view) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     ED_region_draw_cb_exit(t->region->type, t->draw_handle_view); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (t->draw_handle_apply) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     ED_region_draw_cb_exit(t->region->type, t->draw_handle_apply); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (t->draw_handle_pixel) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     ED_region_draw_cb_exit(t->region->type, t->draw_handle_pixel); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (t->draw_handle_cursor) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     WM_paint_cursor_end(CTX_wm_manager(C), t->draw_handle_cursor); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (t->flag & T_MODAL_CURSOR_SET) { | 
					
						
							|  |  |  |     WM_cursor_modal_restore(CTX_wm_window(C)); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* Free all custom-data */ | 
					
						
							|  |  |  |   freeTransCustomDataContainer(t, NULL, &t->custom); | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     freeTransCustomDataContainer(t, tc, &tc->custom); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* postTrans can be called when nothing is selected, so data is NULL already */ | 
					
						
							|  |  |  |   if (t->data_len_all != 0) { | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       /* free data malloced per trans-data */ | 
					
						
							|  |  |  |       if (ELEM(t->obedit_type, OB_CURVE, OB_SURF) || (t->spacetype == SPACE_GRAPH)) { | 
					
						
							|  |  |  |         TransData *td = tc->data; | 
					
						
							|  |  |  |         for (int a = 0; a < tc->data_len; a++, td++) { | 
					
						
							|  |  |  |           if (td->flag & TD_BEZTRIPLE) { | 
					
						
							|  |  |  |             MEM_freeN(td->hdata); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       MEM_freeN(tc->data); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       MEM_SAFE_FREE(tc->data_ext); | 
					
						
							|  |  |  |       MEM_SAFE_FREE(tc->data_2d); | 
					
						
							| 
									
										
										
										
											2019-09-11 13:48:42 -03:00
										 |  |  |       MEM_SAFE_FREE(tc->mirror.data); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   MEM_SAFE_FREE(t->data_container); | 
					
						
							|  |  |  |   t->data_container = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   BLI_freelistN(&t->tsnap.points); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->spacetype == SPACE_IMAGE) { | 
					
						
							|  |  |  |     if (t->options & (CTX_MASK | CTX_PAINT_CURVE)) { | 
					
						
							|  |  |  |       /* pass */ | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       SpaceImage *sima = t->sa->spacedata.first; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       if (sima->flag & SI_LIVE_UNWRAP) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         ED_uvedit_live_unwrap_end(t->state == TRANS_CANCEL); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_VIEW3D) { | 
					
						
							|  |  |  |     View3D *v3d = t->sa->spacedata.first; | 
					
						
							|  |  |  |     /* restore gizmo */ | 
					
						
							|  |  |  |     if (t->flag & T_MODAL) { | 
					
						
							|  |  |  |       v3d->gizmo_flag = t->gizmo_flag; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->mouse.data) { | 
					
						
							|  |  |  |     MEM_freeN(t->mouse.data); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->rng != NULL) { | 
					
						
							|  |  |  |     BLI_rng_free(t->rng); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   freeSnapping(t); | 
					
						
							| 
									
										
										
										
											2009-11-01 00:06:53 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void applyTransObjects(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   TransData *td; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   for (td = tc->data; td < tc->data + tc->data_len; td++) { | 
					
						
							|  |  |  |     copy_v3_v3(td->iloc, td->loc); | 
					
						
							|  |  |  |     if (td->ext->rot) { | 
					
						
							|  |  |  |       copy_v3_v3(td->ext->irot, td->ext->rot); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (td->ext->size) { | 
					
						
							|  |  |  |       copy_v3_v3(td->ext->isize, td->ext->size); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   recalcData(t); | 
					
						
							| 
									
										
										
										
											2009-07-12 02:01:13 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-28 05:53:40 +00:00
										 |  |  | static void restoreElement(TransData *td) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* TransData for crease has no loc */ | 
					
						
							|  |  |  |   if (td->loc) { | 
					
						
							|  |  |  |     copy_v3_v3(td->loc, td->iloc); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (td->val) { | 
					
						
							|  |  |  |     *td->val = td->ival; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (td->ext && (td->flag & TD_NO_EXT) == 0) { | 
					
						
							|  |  |  |     if (td->ext->rot) { | 
					
						
							|  |  |  |       copy_v3_v3(td->ext->rot, td->ext->irot); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (td->ext->rotAngle) { | 
					
						
							|  |  |  |       *td->ext->rotAngle = td->ext->irotAngle; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (td->ext->rotAxis) { | 
					
						
							|  |  |  |       copy_v3_v3(td->ext->rotAxis, td->ext->irotAxis); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     /* XXX, drotAngle & drotAxis not used yet */ | 
					
						
							|  |  |  |     if (td->ext->size) { | 
					
						
							|  |  |  |       copy_v3_v3(td->ext->size, td->ext->isize); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (td->ext->quat) { | 
					
						
							|  |  |  |       copy_qt_qt(td->ext->quat, td->ext->iquat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (td->flag & TD_BEZTRIPLE) { | 
					
						
							|  |  |  |     *(td->hdata->h1) = td->hdata->ih1; | 
					
						
							|  |  |  |     *(td->hdata->h2) = td->hdata->ih2; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-05-11 09:28:00 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | void restoreTransObjects(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     TransData *td; | 
					
						
							|  |  |  |     TransData2D *td2d; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (td = tc->data; td < tc->data + tc->data_len; td++) { | 
					
						
							|  |  |  |       restoreElement(td); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     for (td2d = tc->data_2d; tc->data_2d && td2d < tc->data_2d + tc->data_len; td2d++) { | 
					
						
							|  |  |  |       if (td2d->h1) { | 
					
						
							|  |  |  |         td2d->h1[0] = td2d->ih1[0]; | 
					
						
							|  |  |  |         td2d->h1[1] = td2d->ih1[1]; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (td2d->h2) { | 
					
						
							|  |  |  |         td2d->h2[0] = td2d->ih2[0]; | 
					
						
							|  |  |  |         td2d->h2[1] = td2d->ih2[1]; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     unit_m3(t->mat); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   recalcData(t); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void calculateCenter2D(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   BLI_assert(!is_zero_v3(t->aspect)); | 
					
						
							|  |  |  |   projectFloatView(t, t->center_global, t->center2d); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | void calculateCenterLocal(TransInfo *t, const float center_global[3]) | 
					
						
							| 
									
										
										
										
											2015-06-26 16:19:39 +10:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   /* setting constraint center */ | 
					
						
							|  |  |  |   /* note, init functions may over-ride t->center */ | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     if (tc->use_local_mat) { | 
					
						
							|  |  |  |       mul_v3_m4v3(tc->center_local, tc->imat, center_global); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       copy_v3_v3(tc->center_local, center_global); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-06-26 16:19:39 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | void calculateCenterCursor(TransInfo *t, float r_center[3]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   const float *cursor = t->scene->cursor.location; | 
					
						
							|  |  |  |   copy_v3_v3(r_center, cursor); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* If edit or pose mode, move cursor in local space */ | 
					
						
							|  |  |  |   if (t->options & CTX_PAINT_CURVE) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     if (ED_view3d_project_float_global(t->region, cursor, r_center, V3D_PROJ_TEST_NOP) != | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         V3D_PROJ_RET_OK) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |       r_center[0] = t->region->winx / 2.0f; | 
					
						
							|  |  |  |       r_center[1] = t->region->winy / 2.0f; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     r_center[2] = 0.0f; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | void calculateCenterCursor2D(TransInfo *t, float r_center[2]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   const float *cursor = NULL; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->spacetype == SPACE_IMAGE) { | 
					
						
							|  |  |  |     SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; | 
					
						
							|  |  |  |     cursor = sima->cursor; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->spacetype == SPACE_CLIP) { | 
					
						
							|  |  |  |     SpaceClip *space_clip = (SpaceClip *)t->sa->spacedata.first; | 
					
						
							|  |  |  |     cursor = space_clip->cursor; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (cursor) { | 
					
						
							|  |  |  |     if (t->options & CTX_MASK) { | 
					
						
							|  |  |  |       float co[2]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       if (t->spacetype == SPACE_IMAGE) { | 
					
						
							|  |  |  |         SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first; | 
					
						
							|  |  |  |         BKE_mask_coord_from_image(sima->image, &sima->iuser, co, cursor); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else if (t->spacetype == SPACE_CLIP) { | 
					
						
							|  |  |  |         SpaceClip *space_clip = (SpaceClip *)t->sa->spacedata.first; | 
					
						
							|  |  |  |         BKE_mask_coord_from_movieclip(space_clip->clip, &space_clip->user, co, cursor); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							|  |  |  |         BLI_assert(!"Shall not happen"); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       r_center[0] = co[0] * t->aspect[0]; | 
					
						
							|  |  |  |       r_center[1] = co[1] * t->aspect[1]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (t->options & CTX_PAINT_CURVE) { | 
					
						
							|  |  |  |       if (t->spacetype == SPACE_IMAGE) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |         r_center[0] = UI_view2d_view_to_region_x(&t->region->v2d, cursor[0]); | 
					
						
							|  |  |  |         r_center[1] = UI_view2d_view_to_region_y(&t->region->v2d, cursor[1]); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       r_center[0] = cursor[0] * t->aspect[0]; | 
					
						
							|  |  |  |       r_center[1] = cursor[1] * t->aspect[1]; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]) | 
					
						
							| 
									
										
										
										
											2009-11-01 00:06:53 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   SpaceGraph *sipo = (SpaceGraph *)t->sa->spacedata.first; | 
					
						
							|  |  |  |   Scene *scene = t->scene; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* cursor is combination of current frame, and graph-editor cursor value */ | 
					
						
							|  |  |  |   if (sipo->mode == SIPO_MODE_DRIVERS) { | 
					
						
							|  |  |  |     r_center[0] = sipo->cursorTime; | 
					
						
							|  |  |  |     r_center[1] = sipo->cursorVal; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     r_center[0] = (float)(scene->r.cfra); | 
					
						
							|  |  |  |     r_center[1] = sipo->cursorVal; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-11-01 00:06:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | void calculateCenterMedian(TransInfo *t, float r_center[3]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float partial[3] = {0.0f, 0.0f, 0.0f}; | 
					
						
							|  |  |  |   int total = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     for (int i = 0; i < tc->data_len; i++) { | 
					
						
							|  |  |  |       if (tc->data[i].flag & TD_SELECTED) { | 
					
						
							|  |  |  |         if (!(tc->data[i].flag & TD_NOCENTER)) { | 
					
						
							|  |  |  |           if (tc->use_local_mat) { | 
					
						
							|  |  |  |             float v[3]; | 
					
						
							|  |  |  |             mul_v3_m4v3(v, tc->mat, tc->data[i].center); | 
					
						
							|  |  |  |             add_v3_v3(partial, v); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							|  |  |  |             add_v3_v3(partial, tc->data[i].center); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           total++; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (total) { | 
					
						
							|  |  |  |     mul_v3_fl(partial, 1.0f / (float)total); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   copy_v3_v3(r_center, partial); | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | void calculateCenterBound(TransInfo *t, float r_center[3]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float max[3], min[3]; | 
					
						
							|  |  |  |   bool changed = false; | 
					
						
							|  |  |  |   INIT_MINMAX(min, max); | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |   FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     for (int i = 0; i < tc->data_len; i++) { | 
					
						
							|  |  |  |       if (tc->data[i].flag & TD_SELECTED) { | 
					
						
							|  |  |  |         if (!(tc->data[i].flag & TD_NOCENTER)) { | 
					
						
							|  |  |  |           if (tc->use_local_mat) { | 
					
						
							|  |  |  |             float v[3]; | 
					
						
							|  |  |  |             mul_v3_m4v3(v, tc->mat, tc->data[i].center); | 
					
						
							|  |  |  |             minmax_v3v3_v3(min, max, v); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							|  |  |  |             minmax_v3v3_v3(min, max, tc->data[i].center); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |           changed = true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   if (changed) { | 
					
						
							|  |  |  |     mid_v3_v3v3(r_center, min, max); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-10-30 14:22:49 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  | /**
 | 
					
						
							| 
									
										
										
										
											2018-12-12 12:50:58 +11:00
										 |  |  |  * \param select_only: only get active center from data being transformed. | 
					
						
							| 
									
										
										
										
											2014-05-09 16:52:09 +10:00
										 |  |  |  */ | 
					
						
							|  |  |  | bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->spacetype != SPACE_VIEW3D) { | 
					
						
							|  |  |  |     return false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (tc->obedit) { | 
					
						
							|  |  |  |     if (ED_object_calc_active_center_for_editmode(tc->obedit, select_only, r_center)) { | 
					
						
							|  |  |  |       mul_m4_v3(tc->obedit->obmat, r_center); | 
					
						
							|  |  |  |       return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->flag & T_POSE) { | 
					
						
							|  |  |  |     ViewLayer *view_layer = t->view_layer; | 
					
						
							|  |  |  |     Object *ob = OBACT(view_layer); | 
					
						
							|  |  |  |     if (ED_object_calc_active_center_for_posemode(ob, select_only, r_center)) { | 
					
						
							|  |  |  |       mul_m4_v3(ob->obmat, r_center); | 
					
						
							|  |  |  |       return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (t->options & CTX_PAINT_CURVE) { | 
					
						
							|  |  |  |     Paint *p = BKE_paint_get_active(t->scene, t->view_layer); | 
					
						
							|  |  |  |     Brush *br = p->brush; | 
					
						
							|  |  |  |     PaintCurve *pc = br->paint_curve; | 
					
						
							|  |  |  |     copy_v3_v3(r_center, pc->points[pc->add_index - 1].bez.vec[1]); | 
					
						
							|  |  |  |     r_center[2] = 0.0f; | 
					
						
							|  |  |  |     return true; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     /* object mode */ | 
					
						
							|  |  |  |     ViewLayer *view_layer = t->view_layer; | 
					
						
							|  |  |  |     Object *ob = OBACT(view_layer); | 
					
						
							|  |  |  |     Base *base = BASACT(view_layer); | 
					
						
							|  |  |  |     if (ob && ((!select_only) || ((base->flag & BASE_SELECTED) != 0))) { | 
					
						
							|  |  |  |       copy_v3_v3(r_center, ob->obmat[3]); | 
					
						
							|  |  |  |       return true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return false; | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-31 23:56:59 +10:00
										 |  |  | static void calculateCenter_FromAround(TransInfo *t, int around, float r_center[3]) | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   switch (around) { | 
					
						
							|  |  |  |     case V3D_AROUND_CENTER_BOUNDS: | 
					
						
							|  |  |  |       calculateCenterBound(t, r_center); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case V3D_AROUND_CENTER_MEDIAN: | 
					
						
							|  |  |  |       calculateCenterMedian(t, r_center); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case V3D_AROUND_CURSOR: | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       if (ELEM(t->spacetype, SPACE_IMAGE, SPACE_CLIP)) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         calculateCenterCursor2D(t, r_center); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							|  |  |  |       else if (t->spacetype == SPACE_GRAPH) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         calculateCenterCursorGraph2D(t, r_center); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |         calculateCenterCursor(t, r_center); | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       break; | 
					
						
							|  |  |  |     case V3D_AROUND_LOCAL_ORIGINS: | 
					
						
							|  |  |  |       /* Individual element center uses median center for helpline and such */ | 
					
						
							|  |  |  |       calculateCenterMedian(t, r_center); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case V3D_AROUND_ACTIVE: { | 
					
						
							|  |  |  |       if (calculateCenterActive(t, false, r_center)) { | 
					
						
							|  |  |  |         /* pass */ | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       else { | 
					
						
							|  |  |  |         /* fallback */ | 
					
						
							|  |  |  |         calculateCenterMedian(t, r_center); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2016-05-31 23:56:59 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void calculateCenter(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   if ((t->flag & T_OVERRIDE_CENTER) == 0) { | 
					
						
							|  |  |  |     calculateCenter_FromAround(t, t->around, t->center_global); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   calculateCenterLocal(t, t->center_global); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* avoid calculating again */ | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     TransCenterData *cd = &t->center_cache[t->around]; | 
					
						
							|  |  |  |     copy_v3_v3(cd->global, t->center_global); | 
					
						
							|  |  |  |     cd->is_set = true; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   calculateCenter2D(t); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* for panning from cameraview */ | 
					
						
							|  |  |  |   if ((t->flag & T_OBJECT) && (t->flag & T_OVERRIDE_CENTER) == 0) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     if (t->spacetype == SPACE_VIEW3D && t->region && t->region->regiontype == RGN_TYPE_WINDOW) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       if (t->flag & T_CAMERA) { | 
					
						
							|  |  |  |         float axis[3]; | 
					
						
							|  |  |  |         /* persinv is nasty, use viewinv instead, always right */ | 
					
						
							|  |  |  |         copy_v3_v3(axis, t->viewinv[2]); | 
					
						
							|  |  |  |         normalize_v3(axis); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* 6.0 = 6 grid units */ | 
					
						
							|  |  |  |         axis[0] = t->center_global[0] - 6.0f * axis[0]; | 
					
						
							|  |  |  |         axis[1] = t->center_global[1] - 6.0f * axis[1]; | 
					
						
							|  |  |  |         axis[2] = t->center_global[2] - 6.0f * axis[2]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         projectFloatView(t, axis, t->center2d); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         /* rotate only needs correct 2d center, grab needs ED_view3d_calc_zfac() value */ | 
					
						
							|  |  |  |         if (t->mode == TFM_TRANSLATION) { | 
					
						
							|  |  |  |           copy_v3_v3(t->center_global, axis); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->spacetype == SPACE_VIEW3D) { | 
					
						
							| 
									
										
										
										
											2019-04-17 08:44:58 +02:00
										 |  |  |     /* ED_view3d_calc_zfac() defines a factor for perspective depth correction,
 | 
					
						
							|  |  |  |      * used in ED_view3d_win_to_delta() */ | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     /* zfac is only used convertViewVec only in cases operator was invoked in RGN_TYPE_WINDOW
 | 
					
						
							|  |  |  |      * and never used in other cases. | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * We need special case here as well, since ED_view3d_calc_zfac will crash when called | 
					
						
							|  |  |  |      * for a region different from RGN_TYPE_WINDOW. | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     if (t->region->regiontype == RGN_TYPE_WINDOW) { | 
					
						
							|  |  |  |       t->zfac = ED_view3d_calc_zfac(t->region->regiondata, t->center_global, NULL); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       t->zfac = 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
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | BLI_STATIC_ASSERT(ARRAY_SIZE(((TransInfo *)NULL)->center_cache) == (V3D_AROUND_ACTIVE + 1), | 
					
						
							|  |  |  |                   "test size"); | 
					
						
							| 
									
										
										
										
											2016-05-31 23:56:59 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Lazy initialize transform center data, when we need to access center values from other types. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | const TransCenterData *transformCenter_from_type(TransInfo *t, int around) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   BLI_assert(around <= V3D_AROUND_ACTIVE); | 
					
						
							|  |  |  |   TransCenterData *cd = &t->center_cache[around]; | 
					
						
							|  |  |  |   if (cd->is_set == false) { | 
					
						
							|  |  |  |     calculateCenter_FromAround(t, around, cd->global); | 
					
						
							|  |  |  |     cd->is_set = true; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return cd; | 
					
						
							| 
									
										
										
										
											2016-05-31 23:56:59 +10:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												2.5
Transform:
First working port of the transform code:
- Object mode only (other conversions need to be ported)
- Contraints (global and local only) working
- Snap (no edit mode, obviously) working
- Numinput working
- Gears (Ctrl and Shift) working
- Only grap, rotate, scale, shear, warp and to sphere have been added as hotkey, but the rest should work too once accessible
- No manipulator
- No drawn feedback other than moving stuff and header print (no constraint line, snap circle, ...)
- No NDOF support
I've only tested Scons support, though Makefil *should* work, I *think*.
Misc:
-QuatIsNull function in arith
-Exporting project_* and view[line|ray] functions from view3d
											
										 
											2008-12-29 01:41:28 +00:00
										 |  |  | void calculatePropRatio(TransInfo *t) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   int i; | 
					
						
							|  |  |  |   float dist; | 
					
						
							|  |  |  |   const bool connected = (t->flag & T_PROP_CONNECTED) != 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->proptext[0] = '\0'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (t->flag & T_PROP_EDIT) { | 
					
						
							|  |  |  |     const char *pet_id = NULL; | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       TransData *td = tc->data; | 
					
						
							|  |  |  |       for (i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |         if (td->flag & TD_SELECTED) { | 
					
						
							|  |  |  |           td->factor = 1.0f; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else if ((connected && (td->flag & TD_NOTCONNECTED || td->dist > t->prop_size)) || | 
					
						
							|  |  |  |                  (connected == 0 && td->rdist > t->prop_size)) { | 
					
						
							|  |  |  |           /*
 | 
					
						
							|  |  |  |            * The elements are sorted according to their dist member in the array, | 
					
						
							|  |  |  |            * that means we can stop when it finds one element outside of the propsize. | 
					
						
							|  |  |  |            * do not set 'td->flag |= TD_NOACTION', the prop circle is being changed. | 
					
						
							|  |  |  |            */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           td->factor = 0.0f; | 
					
						
							|  |  |  |           restoreElement(td); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         else { | 
					
						
							|  |  |  |           /* Use rdist for falloff calculations, it is the real distance */ | 
					
						
							|  |  |  |           td->flag &= ~TD_NOACTION; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           if (connected) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             dist = (t->prop_size - td->dist) / t->prop_size; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							|  |  |  |           else { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             dist = (t->prop_size - td->rdist) / t->prop_size; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |           /*
 | 
					
						
							|  |  |  |            * Clamp to positive numbers. | 
					
						
							|  |  |  |            * Certain corner cases with connectivity and individual centers | 
					
						
							|  |  |  |            * can give values of rdist larger than propsize. | 
					
						
							|  |  |  |            */ | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           if (dist < 0.0f) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |             dist = 0.0f; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |           switch (t->prop_mode) { | 
					
						
							|  |  |  |             case PROP_SHARP: | 
					
						
							|  |  |  |               td->factor = dist * dist; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_SMOOTH: | 
					
						
							|  |  |  |               td->factor = 3.0f * dist * dist - 2.0f * dist * dist * dist; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_ROOT: | 
					
						
							|  |  |  |               td->factor = sqrtf(dist); | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_LIN: | 
					
						
							|  |  |  |               td->factor = dist; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_CONST: | 
					
						
							|  |  |  |               td->factor = 1.0f; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_SPHERE: | 
					
						
							|  |  |  |               td->factor = sqrtf(2 * dist - dist * dist); | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_RANDOM: | 
					
						
							|  |  |  |               if (t->rng == NULL) { | 
					
						
							|  |  |  |                 /* Lazy initialization. */ | 
					
						
							|  |  |  |                 uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX); | 
					
						
							|  |  |  |                 t->rng = BLI_rng_new(rng_seed); | 
					
						
							|  |  |  |               } | 
					
						
							|  |  |  |               td->factor = BLI_rng_get_float(t->rng) * dist; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             case PROP_INVSQUARE: | 
					
						
							|  |  |  |               td->factor = dist * (2.0f - dist); | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |             default: | 
					
						
							|  |  |  |               td->factor = 1; | 
					
						
							|  |  |  |               break; | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     switch (t->prop_mode) { | 
					
						
							|  |  |  |       case PROP_SHARP: | 
					
						
							|  |  |  |         pet_id = N_("(Sharp)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_SMOOTH: | 
					
						
							|  |  |  |         pet_id = N_("(Smooth)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_ROOT: | 
					
						
							|  |  |  |         pet_id = N_("(Root)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_LIN: | 
					
						
							|  |  |  |         pet_id = N_("(Linear)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_CONST: | 
					
						
							|  |  |  |         pet_id = N_("(Constant)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_SPHERE: | 
					
						
							|  |  |  |         pet_id = N_("(Sphere)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_RANDOM: | 
					
						
							|  |  |  |         pet_id = N_("(Random)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       case PROP_INVSQUARE: | 
					
						
							|  |  |  |         pet_id = N_("(InvSquare)"); | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |       default: | 
					
						
							|  |  |  |         break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (pet_id) { | 
					
						
							|  |  |  |       BLI_strncpy(t->proptext, IFACE_(pet_id), sizeof(t->proptext)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							| 
									
										
										
										
											2019-04-21 04:40:16 +10:00
										 |  |  |     FOREACH_TRANS_DATA_CONTAINER (t, tc) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       TransData *td = tc->data; | 
					
						
							|  |  |  |       for (i = 0; i < tc->data_len; i++, td++) { | 
					
						
							|  |  |  |         td->factor = 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
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2015-07-14 04:27:32 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Rotate an element, low level code, ignore protected channels. | 
					
						
							|  |  |  |  * (use for objects or pose-bones) | 
					
						
							|  |  |  |  * Similar to #ElementRotation. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |   float totmat[3][3]; | 
					
						
							|  |  |  |   float smat[3][3]; | 
					
						
							|  |  |  |   float fmat[3][3]; | 
					
						
							|  |  |  |   float obmat[3][3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   float dmat[3][3]; /* delta rotation */ | 
					
						
							|  |  |  |   float dmat_inv[3][3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mul_m3_m3m3(totmat, mat, td->mtx); | 
					
						
							|  |  |  |   mul_m3_m3m3(smat, td->smtx, mat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* logic from BKE_object_rot_to_mat3 */ | 
					
						
							|  |  |  |   if (use_drot) { | 
					
						
							|  |  |  |     if (td->ext->rotOrder > 0) { | 
					
						
							|  |  |  |       eulO_to_mat3(dmat, td->ext->drot, td->ext->rotOrder); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) { | 
					
						
							| 
									
										
										
										
											2015-07-14 04:27:32 +10:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       axis_angle_to_mat3(dmat, td->ext->drotAxis, td->ext->drotAngle); | 
					
						
							| 
									
										
										
										
											2015-07-14 04:27:32 +10:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       unit_m3(dmat); | 
					
						
							| 
									
										
										
										
											2015-07-14 04:27:32 +10:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       float tquat[4]; | 
					
						
							|  |  |  |       normalize_qt_qt(tquat, td->ext->dquat); | 
					
						
							|  |  |  |       quat_to_mat3(dmat, tquat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     invert_m3_m3(dmat_inv, dmat); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (td->ext->rotOrder == ROT_MODE_QUAT) { | 
					
						
							|  |  |  |     float quat[4]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* calculate the total rotatation */ | 
					
						
							|  |  |  |     quat_to_mat3(obmat, td->ext->iquat); | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(obmat, dmat, obmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* mat = transform, obmat = object rotation */ | 
					
						
							|  |  |  |     mul_m3_m3m3(fmat, smat, obmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(fmat, dmat_inv, fmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     mat3_to_quat(quat, fmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* apply */ | 
					
						
							|  |  |  |     copy_qt_qt(td->ext->quat, quat); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else if (td->ext->rotOrder == ROT_MODE_AXISANGLE) { | 
					
						
							|  |  |  |     float axis[3], angle; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* calculate the total rotatation */ | 
					
						
							|  |  |  |     axis_angle_to_mat3(obmat, td->ext->irotAxis, td->ext->irotAngle); | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(obmat, dmat, obmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* mat = transform, obmat = object rotation */ | 
					
						
							|  |  |  |     mul_m3_m3m3(fmat, smat, obmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(fmat, dmat_inv, fmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     mat3_to_axis_angle(axis, &angle, fmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* apply */ | 
					
						
							|  |  |  |     copy_v3_v3(td->ext->rotAxis, axis); | 
					
						
							|  |  |  |     *td->ext->rotAngle = angle; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     float eul[3]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* calculate the total rotatation */ | 
					
						
							|  |  |  |     eulO_to_mat3(obmat, td->ext->irot, td->ext->rotOrder); | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(obmat, dmat, obmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* mat = transform, obmat = object rotation */ | 
					
						
							|  |  |  |     mul_m3_m3m3(fmat, smat, obmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (use_drot) { | 
					
						
							|  |  |  |       mul_m3_m3m3(fmat, dmat_inv, fmat); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /* apply */ | 
					
						
							|  |  |  |     copy_v3_v3(td->ext->rot, eul); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2015-07-14 04:27:32 +10:00
										 |  |  | } |