| 
									
										
										
										
											2022-02-11 09:07:11 +11:00
										 |  |  | /* SPDX-License-Identifier: GPL-2.0-or-later */ | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-18 08:08:12 +11:00
										 |  |  | /** \file
 | 
					
						
							|  |  |  |  * \ingroup edtransform | 
					
						
							| 
									
										
										
										
											2011-02-27 20:29:51 +00:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | #include "MEM_guardedalloc.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  | #include "DNA_object_types.h"
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | #include "DNA_scene_types.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:43:45 +00:00
										 |  |  | #include "BLI_math.h"
 | 
					
						
							| 
									
										
										
										
											2011-01-07 18:36:47 +00:00
										 |  |  | #include "BLI_utildefines.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-16 17:32:01 +10:00
										 |  |  | #include "BLT_translation.h"
 | 
					
						
							| 
									
										
										
										
											2013-02-24 15:40:28 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | #include "BKE_context.h"
 | 
					
						
							| 
									
										
										
										
											2015-04-29 19:39:58 +10:00
										 |  |  | #include "BKE_editmesh.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #include "BKE_global.h"
 | 
					
						
							|  |  |  | #include "BKE_report.h"
 | 
					
						
							| 
									
										
										
										
											2018-12-19 20:51:04 +11:00
										 |  |  | #include "BKE_scene.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 02:44:55 +00:00
										 |  |  | #include "RNA_access.h"
 | 
					
						
							|  |  |  | #include "RNA_define.h"
 | 
					
						
							|  |  |  | #include "RNA_enum_types.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | #include "WM_api.h"
 | 
					
						
							| 
									
										
										
										
											2018-06-15 15:44:14 +02:00
										 |  |  | #include "WM_message.h"
 | 
					
						
							| 
									
										
										
										
											2018-10-19 11:54:26 +11:00
										 |  |  | #include "WM_toolsystem.h"
 | 
					
						
							| 
									
										
										
										
											2020-03-19 09:33:03 +01:00
										 |  |  | #include "WM_types.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | #include "UI_interface.h"
 | 
					
						
							| 
									
										
										
										
											2011-02-27 18:03:19 +00:00
										 |  |  | #include "UI_resources.h"
 | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | #include "ED_screen.h"
 | 
					
						
							| 
									
										
										
										
											2014-08-14 12:04:42 +10:00
										 |  |  | /* for USE_LOOPSLIDE_HACK only */ | 
					
						
							|  |  |  | #include "ED_mesh.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "transform.h"
 | 
					
						
							| 
									
										
										
										
											2019-09-05 14:34:54 -03:00
										 |  |  | #include "transform_convert.h"
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-06 22:38:39 +00:00
										 |  |  | typedef struct TransformModeItem { | 
					
						
							| 
									
										
										
										
											2014-04-27 00:22:49 +10:00
										 |  |  |   const char *idname; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   int mode; | 
					
						
							|  |  |  |   void (*opfunc)(wmOperatorType *); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } TransformModeItem; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-08 12:09:27 +02:00
										 |  |  | static const float VecZero[3] = {0, 0, 0}; | 
					
						
							| 
									
										
										
										
											2013-10-10 20:22:17 +00:00
										 |  |  | static const float VecOne[3] = {1, 1, 1}; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-25 10:26:32 +10:00
										 |  |  | static const char OP_TRANSLATION[] = "TRANSFORM_OT_translate"; | 
					
						
							|  |  |  | static const char OP_ROTATION[] = "TRANSFORM_OT_rotate"; | 
					
						
							|  |  |  | static const char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere"; | 
					
						
							|  |  |  | static const char OP_RESIZE[] = "TRANSFORM_OT_resize"; | 
					
						
							|  |  |  | static const char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize"; | 
					
						
							|  |  |  | static const char OP_SHEAR[] = "TRANSFORM_OT_shear"; | 
					
						
							|  |  |  | static const char OP_BEND[] = "TRANSFORM_OT_bend"; | 
					
						
							|  |  |  | static const char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten"; | 
					
						
							|  |  |  | static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull"; | 
					
						
							|  |  |  | static const char OP_TILT[] = "TRANSFORM_OT_tilt"; | 
					
						
							|  |  |  | static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball"; | 
					
						
							|  |  |  | static const char OP_MIRROR[] = "TRANSFORM_OT_mirror"; | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  | static const char OP_BONE_SIZE[] = "TRANSFORM_OT_bbone_resize"; | 
					
						
							| 
									
										
										
										
											2015-05-25 10:26:32 +10:00
										 |  |  | static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide"; | 
					
						
							|  |  |  | static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide"; | 
					
						
							|  |  |  | static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease"; | 
					
						
							| 
									
										
											  
											
												Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.
For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.
The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.
For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).
Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.
For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.
Reviewed By: brecht, fclem, sergey, sybren, campbellbarton
Differential Revision: https://developer.blender.org/D10145
											
										 
											2022-01-20 12:20:30 +01:00
										 |  |  | static const char OP_VERT_CREASE[] = "TRANSFORM_OT_vert_crease"; | 
					
						
							| 
									
										
										
										
											2015-05-25 10:26:32 +10:00
										 |  |  | static const char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight"; | 
					
						
							|  |  |  | static const char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide"; | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  | static const char OP_NORMAL_ROTATION[] = "TRANSFORM_OT_rotate_normal"; | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_translate(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_rotate(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_resize(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  | static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_shear(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2013-11-20 12:14:10 +11:00
										 |  |  | static void TRANSFORM_OT_bend(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_tilt(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_trackball(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_mirror(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  | static void TRANSFORM_OT_bbone_resize(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  | static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot); | 
					
						
							| 
									
										
											  
											
												Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.
For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.
The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.
For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).
Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.
For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.
Reviewed By: brecht, fclem, sergey, sybren, campbellbarton
Differential Revision: https://developer.blender.org/D10145
											
										 
											2022-01-20 12:20:30 +01:00
										 |  |  | static void TRANSFORM_OT_vert_crease(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot); | 
					
						
							|  |  |  | static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  | static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static TransformModeItem transform_modes[] = { | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_TRANSLATION, TFM_TRANSLATION, TRANSFORM_OT_translate}, | 
					
						
							|  |  |  |     {OP_ROTATION, TFM_ROTATION, TRANSFORM_OT_rotate}, | 
					
						
							|  |  |  |     {OP_TOSPHERE, TFM_TOSPHERE, TRANSFORM_OT_tosphere}, | 
					
						
							|  |  |  |     {OP_RESIZE, TFM_RESIZE, TRANSFORM_OT_resize}, | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  |     {OP_SKIN_RESIZE, TFM_SKIN_RESIZE, TRANSFORM_OT_skin_resize}, | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_SHEAR, TFM_SHEAR, TRANSFORM_OT_shear}, | 
					
						
							| 
									
										
										
										
											2013-11-20 12:14:10 +11:00
										 |  |  |     {OP_BEND, TFM_BEND, TRANSFORM_OT_bend}, | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN, TRANSFORM_OT_shrink_fatten}, | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  |     {OP_PUSH_PULL, TFM_PUSHPULL, TRANSFORM_OT_push_pull}, | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_TILT, TFM_TILT, TRANSFORM_OT_tilt}, | 
					
						
							|  |  |  |     {OP_TRACKBALL, TFM_TRACKBALL, TRANSFORM_OT_trackball}, | 
					
						
							|  |  |  |     {OP_MIRROR, TFM_MIRROR, TRANSFORM_OT_mirror}, | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  |     {OP_BONE_SIZE, TFM_BONESIZE, TRANSFORM_OT_bbone_resize}, | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_EDGE_SLIDE, TFM_EDGE_SLIDE, TRANSFORM_OT_edge_slide}, | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  |     {OP_VERT_SLIDE, TFM_VERT_SLIDE, TRANSFORM_OT_vert_slide}, | 
					
						
							| 
									
										
											  
											
												Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.
For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.
The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.
For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).
Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.
For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.
Reviewed By: brecht, fclem, sergey, sybren, campbellbarton
Differential Revision: https://developer.blender.org/D10145
											
										 
											2022-01-20 12:20:30 +01:00
										 |  |  |     {OP_EDGE_CREASE, TFM_EDGE_CREASE, TRANSFORM_OT_edge_crease}, | 
					
						
							|  |  |  |     {OP_VERT_CREASE, TFM_VERT_CREASE, TRANSFORM_OT_vert_crease}, | 
					
						
							| 
									
										
										
										
											2012-05-12 23:07:52 +00:00
										 |  |  |     {OP_EDGE_BWEIGHT, TFM_BWEIGHT, TRANSFORM_OT_edge_bevelweight}, | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     {OP_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide}, | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  |     {OP_NORMAL_ROTATION, TFM_NORMAL_ROTATION, TRANSFORM_OT_rotate_normal}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |     {NULL, 0}, | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-18 15:07:26 +11:00
										 |  |  | const EnumPropertyItem rna_enum_transform_mode_types[] = { | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  |     {TFM_INIT, "INIT", 0, "Init", ""}, | 
					
						
							|  |  |  |     {TFM_DUMMY, "DUMMY", 0, "Dummy", ""}, | 
					
						
							|  |  |  |     {TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""}, | 
					
						
							|  |  |  |     {TFM_ROTATION, "ROTATION", 0, "Rotation", ""}, | 
					
						
							|  |  |  |     {TFM_RESIZE, "RESIZE", 0, "Resize", ""}, | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  |     {TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_TOSPHERE, "TOSPHERE", 0, "To Sphere", ""}, | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  |     {TFM_SHEAR, "SHEAR", 0, "Shear", ""}, | 
					
						
							| 
									
										
										
										
											2013-11-20 12:14:10 +11:00
										 |  |  |     {TFM_BEND, "BEND", 0, "Bend", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrink/Fatten", ""}, | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  |     {TFM_TILT, "TILT", 0, "Tilt", ""}, | 
					
						
							|  |  |  |     {TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_PUSHPULL, "PUSHPULL", 0, "Push/Pull", ""}, | 
					
						
							| 
									
										
											  
											
												Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.
For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.
The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.
For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).
Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.
For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.
Reviewed By: brecht, fclem, sergey, sybren, campbellbarton
Differential Revision: https://developer.blender.org/D10145
											
										 
											2022-01-20 12:20:30 +01:00
										 |  |  |     {TFM_EDGE_CREASE, "CREASE", 0, "Crease", ""}, | 
					
						
							|  |  |  |     {TFM_VERT_CREASE, "VERTEX_CREASE", 0, "Vertex Crease", ""}, | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  |     {TFM_MIRROR, "MIRROR", 0, "Mirror", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_BONESIZE, "BONE_SIZE", 0, "Bone Size", ""}, | 
					
						
							| 
									
										
										
										
											2019-08-19 10:41:59 +02:00
										 |  |  |     {TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone Envelope", ""}, | 
					
						
							|  |  |  |     {TFM_BONE_ENVELOPE_DIST, "BONE_ENVELOPE_DIST", 0, "Bone Envelope Distance", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve Shrink/Fatten", ""}, | 
					
						
							|  |  |  |     {TFM_MASK_SHRINKFATTEN, "MASK_SHRINKFATTEN", 0, "Mask Shrink/Fatten", ""}, | 
					
						
							|  |  |  |     {TFM_GPENCIL_SHRINKFATTEN, "GPENCIL_SHRINKFATTEN", 0, "Grease Pencil Shrink/Fatten", ""}, | 
					
						
							| 
									
										
										
										
											2019-08-19 10:41:59 +02:00
										 |  |  |     {TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone Roll", ""}, | 
					
						
							|  |  |  |     {TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time Translate", ""}, | 
					
						
							|  |  |  |     {TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time Slide", ""}, | 
					
						
							|  |  |  |     {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time Scale", ""}, | 
					
						
							|  |  |  |     {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time Extend", ""}, | 
					
						
							|  |  |  |     {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake Time", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_BWEIGHT, "BWEIGHT", 0, "Bevel Weight", ""}, | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  |     {TFM_ALIGN, "ALIGN", 0, "Align", ""}, | 
					
						
							|  |  |  |     {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""}, | 
					
						
							|  |  |  |     {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""}, | 
					
						
							| 
									
										
										
										
											2020-12-24 13:11:22 -06:00
										 |  |  |     {TFM_GPENCIL_OPACITY, "GPENCIL_OPACITY", 0, "Grease Pencil Opacity", ""}, | 
					
						
							| 
									
										
										
										
											2019-02-03 14:01:45 +11:00
										 |  |  |     {0, NULL, 0, NULL, NULL}, | 
					
						
							| 
									
										
										
										
											2011-04-01 08:51:12 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | static int select_orientation_exec(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-18 09:12:44 +02:00
										 |  |  |   Scene *scene = CTX_data_scene(C); | 
					
						
							| 
									
										
										
										
											2019-03-09 11:41:04 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-04 11:52:16 +00:00
										 |  |  |   int orientation = RNA_enum_get(op->ptr, "orientation"); | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-19 20:51:04 +11:00
										 |  |  |   BKE_scene_orientation_slot_set_index(&scene->orientation_slots[SCE_ORIENT_DEFAULT], orientation); | 
					
						
							| 
									
										
										
										
											2018-04-18 09:12:44 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   WM_event_add_notifier(C, NC_SCENE | ND_TOOLSETTINGS, NULL); | 
					
						
							| 
									
										
										
										
											2021-03-11 17:30:39 +01:00
										 |  |  |   WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); | 
					
						
							| 
									
										
										
										
											2009-02-04 11:52:16 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-15 15:44:14 +02:00
										 |  |  |   struct wmMsgBus *mbus = CTX_wm_message_bus(C); | 
					
						
							| 
									
										
										
										
											2018-12-19 20:51:04 +11:00
										 |  |  |   WM_msg_publish_rna_prop(mbus, &scene->id, scene, TransformOrientationSlot, type); | 
					
						
							| 
									
										
										
										
											2018-06-15 15:44:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-02-04 11:52:16 +00:00
										 |  |  |   return OPERATOR_FINISHED; | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int select_orientation_invoke(bContext *C, | 
					
						
							|  |  |  |                                      wmOperator *UNUSED(op), | 
					
						
							|  |  |  |                                      const wmEvent *UNUSED(event)) | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-04-22 18:39:44 +00:00
										 |  |  |   uiPopupMenu *pup; | 
					
						
							|  |  |  |   uiLayout *layout; | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-09 21:20:40 +01:00
										 |  |  |   pup = UI_popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE); | 
					
						
							|  |  |  |   layout = UI_popup_menu_layout(pup); | 
					
						
							| 
									
										
										
										
											2020-09-15 08:10:23 -06:00
										 |  |  |   uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation"); | 
					
						
							| 
									
										
										
										
											2014-11-09 21:20:40 +01:00
										 |  |  |   UI_popup_menu_end(C, pup); | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 17:51:06 +01:00
										 |  |  |   return OPERATOR_INTERFACE; | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
											
												RNA
* Enums can now be dynamically created in the _itemf callback,
  using RNA_enum_item(s)_add, RNA_enum_item_end. All places asking
  for enum items now need to potentially free the items.
* This callback now also gets context, this was added specifically
  for operators. This doesn't fit design well at all, needed to do
  some ugly hacks, but can't find a good solution at the moment.
* All enums must have a default list of items too, even with an
  _itemf callback, for docs and fallback in case there is no context.
* Used by MESH_OT_merge, MESH_OT_select_similar, TFM_OT_select_orientation.
* Also changes some operator properties that were enums to booleas
  (unselected, deselect), to make them consistent with other ops.
											
										 
											2009-07-10 19:56:13 +00:00
										 |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Select Orientation"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Select transformation orientation"; | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   ot->idname = "TRANSFORM_OT_select_orientation"; | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   ot->flag = OPTYPE_UNDO; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = select_orientation_invoke; | 
					
						
							|  |  |  |   ot->exec = select_orientation_exec; | 
					
						
							| 
									
										
										
										
											2010-11-14 18:27:25 +00:00
										 |  |  |   ot->poll = ED_operator_view3d_active; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2010-02-10 21:15:44 +00:00
										 |  |  |   RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); | 
					
						
							| 
									
										
										
										
											2009-10-10 17:40:56 +00:00
										 |  |  |   RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); | 
					
						
							| 
									
										
										
										
											2009-01-18 21:36:38 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-10-15 01:36:14 +00:00
										 |  |  | static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op)) | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-04-18 09:12:44 +02:00
										 |  |  |   Scene *scene = CTX_data_scene(C); | 
					
						
							| 
									
										
										
										
											2018-12-19 20:51:04 +11:00
										 |  |  |   BIF_removeTransformOrientationIndex(C, | 
					
						
							|  |  |  |                                       scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom); | 
					
						
							| 
									
										
										
										
											2017-06-01 20:41:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-18 09:12:44 +02:00
										 |  |  |   WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene); | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-20 19:09:04 +10:00
										 |  |  |   struct wmMsgBus *mbus = CTX_wm_message_bus(C); | 
					
						
							|  |  |  |   WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   return OPERATOR_FINISHED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   return delete_orientation_exec(C, op); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-02 11:47:00 +02:00
										 |  |  | static bool delete_orientation_poll(bContext *C) | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (ED_operator_areaactive(C) == 0) { | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |     return 0; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
											  
											
												Main Workspace Integration
This commit does the main integration of workspaces, which is a design we agreed on during the 2.8 UI workshop (see https://wiki.blender.org/index.php/Dev:2.8/UI/Workshop_Writeup)
Workspaces should generally be stable, I'm not aware of any remaining bugs (or I've forgotten them :) ). If you find any, let me know!
(Exception: mode switching button might get out of sync with actual mode in some cases, would consider that a limitation/ToDo. Needs to be resolved at some point.)
== Main Changes/Features
* Introduces the new Workspaces as data-blocks.
* Allow storing a number of custom workspaces as part of the user configuration. Needs further work to allow adding and deleting individual workspaces.
* Bundle a default workspace configuration with Blender (current screen-layouts converted to workspaces).
* Pressing button to add a workspace spawns a menu to select between "Duplicate Current" and the workspaces from the user configuration. If no workspaces are stored in the user configuration, the default workspaces are listed instead.
* Store screen-layouts (`bScreen`) per workspace.
* Store an active screen-layout per workspace. Changing the workspace will enable this layout.
* Store active mode in workspace. Changing the workspace will also enter the mode of the new workspace. (Note that we still store the active mode in the object, moving this completely to workspaces is a separate project.)
* Store an active render layer per workspace.
* Moved mode switch from 3D View header to Info Editor header.
* Store active scene in window (not directly workspace related, but overlaps quite a bit).
* Removed 'Use Global Scene' User Preference option.
* Compatibility with old files - a new workspace is created for every screen-layout of old files. Old Blender versions should be able to read files saved with workspace support as well.
* Default .blend only contains one workspace ("General").
* Support appending workspaces.
Opening files without UI and commandline rendering should work fine.
Note that the UI is temporary! We plan to introduce a new global topbar
that contains the workspace options and tabs for switching workspaces.
== Technical Notes
* Workspaces are data-blocks.
* Adding and removing `bScreen`s should be done through `ED_workspace_layout` API now.
* A workspace can be active in multiple windows at the same time.
* The mode menu (which is now in the Info Editor header) doesn't display "Grease Pencil Edit" mode anymore since its availability depends on the active editor. Will be fixed by making Grease Pencil an own object type (as planned).
* The button to change the active workspace object mode may get out of sync with the mode of the active object. Will either be resolved by moving mode out of object data, or we'll disable workspace modes again (there's a `#define USE_WORKSPACE_MODE` for that).
* Screen-layouts (`bScreen`) are IDs and thus stored in a main list-base. Had to add a wrapper `WorkSpaceLayout` so we can store them in a list-base within workspaces, too. On the long run we could completely replace `bScreen` by workspace structs.
* `WorkSpace` types use some special compiler trickery to allow marking structs and struct members as private. BKE_workspace API should be used for accessing those.
* Added scene operators `SCENE_OT_`. Was previously done through screen operators.
== BPY API Changes
* Removed `Screen.scene`, added `Window.scene`
* Removed `UserPreferencesView.use_global_scene`
* Added `Context.workspace`, `Window.workspace` and `BlendData.workspaces`
* Added `bpy.types.WorkSpace` containing `screens`, `object_mode` and `render_layer`
* Added Screen.layout_name for the layout name that'll be displayed in the UI (may differ from internal name)
== What's left?
* There are a few open design questions (T50521). We should find the needed answers and implement them.
* Allow adding and removing individual workspaces from workspace configuration (needs UI design).
* Get the override system ready and support overrides per workspace.
* Support custom UI setups as part of workspaces (hidden panels, hidden buttons, customizable toolbars, etc).
* Allow enabling add-ons per workspace.
* Support custom workspace keymaps.
* Remove special exception for workspaces in linking code (so they're always appended, never linked). Depends on a few things, so best to solve later.
* Get the topbar done.
* Workspaces need a proper icon, current one is just a placeholder :)
Reviewed By: campbellbarton, mont29
Tags: #user_interface, #bf_blender_2.8
Maniphest Tasks: T50521
Differential Revision: https://developer.blender.org/D2451
											
										 
											2017-06-01 19:56:58 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-20 19:09:04 +10:00
										 |  |  |   Scene *scene = CTX_data_scene(C); | 
					
						
							| 
									
										
										
										
											2019-02-08 15:14:54 +11:00
										 |  |  |   return ((scene->orientation_slots[SCE_ORIENT_DEFAULT].type >= V3D_ORIENT_CUSTOM) && | 
					
						
							| 
									
										
										
										
											2018-12-19 20:51:04 +11:00
										 |  |  |           (scene->orientation_slots[SCE_ORIENT_DEFAULT].index_custom != -1)); | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Delete Orientation"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Delete transformation orientation"; | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   ot->idname = "TRANSFORM_OT_delete_orientation"; | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   ot->flag = OPTYPE_UNDO; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = delete_orientation_invoke; | 
					
						
							|  |  |  |   ot->exec = delete_orientation_exec; | 
					
						
							|  |  |  |   ot->poll = delete_orientation_poll; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int create_orientation_exec(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2012-01-11 08:51:06 +00:00
										 |  |  |   char name[MAX_NAME]; | 
					
						
							| 
									
										
										
										
											2014-02-03 18:55:59 +11:00
										 |  |  |   const bool use = RNA_boolean_get(op->ptr, "use"); | 
					
						
							|  |  |  |   const bool overwrite = RNA_boolean_get(op->ptr, "overwrite"); | 
					
						
							|  |  |  |   const bool use_view = RNA_boolean_get(op->ptr, "use_view"); | 
					
						
							| 
									
										
										
										
											2014-03-01 21:47:46 +11:00
										 |  |  |   View3D *v3d = CTX_wm_view3d(C); | 
					
						
							| 
									
										
										
										
											2020-04-20 19:09:04 +10:00
										 |  |  |   Scene *scene = CTX_data_scene(C); | 
					
						
							| 
									
										
										
										
											2013-05-12 15:52:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   RNA_string_get(op->ptr, "name", name); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-03-01 21:47:46 +11:00
										 |  |  |   if (use && !v3d) { | 
					
						
							| 
									
										
										
										
											2012-10-26 17:32:50 +00:00
										 |  |  |     BKE_report(op->reports, | 
					
						
							|  |  |  |                RPT_ERROR, | 
					
						
							|  |  |  |                "Create Orientation's 'use' parameter only valid in a 3DView context"); | 
					
						
							| 
									
										
										
										
											2012-06-13 23:04:32 +00:00
										 |  |  |     return OPERATOR_CANCELLED; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-20 19:09:04 +10:00
										 |  |  |   if (!BIF_createTransformOrientation(C, op->reports, name, use_view, use, overwrite)) { | 
					
						
							|  |  |  |     BKE_report(op->reports, RPT_ERROR, "Unable to create orientation"); | 
					
						
							|  |  |  |     return OPERATOR_CANCELLED; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   if (use) { | 
					
						
							|  |  |  |     struct wmMsgBus *mbus = CTX_wm_message_bus(C); | 
					
						
							|  |  |  |     WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots); | 
					
						
							|  |  |  |     WM_event_add_notifier(C, NC_SCENE | NA_EDITED, scene); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-11 17:30:39 +01:00
										 |  |  |   WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL); | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   return OPERATOR_FINISHED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-14 17:55:27 +00:00
										 |  |  | static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Create Orientation"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Create transformation orientation from selection"; | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   ot->idname = "TRANSFORM_OT_create_orientation"; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->exec = create_orientation_exec; | 
					
						
							|  |  |  |   ot->poll = ED_operator_areaactive; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-01-16 21:43:22 +11:00
										 |  |  |   RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the new custom orientation"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  |   RNA_def_boolean( | 
					
						
							|  |  |  |       ot->srna, | 
					
						
							|  |  |  |       "use_view", | 
					
						
							|  |  |  |       false, | 
					
						
							|  |  |  |       "Use View", | 
					
						
							| 
									
										
										
										
											2013-05-12 15:52:05 +00:00
										 |  |  |       "Use the current view instead of the active object to create the new orientation"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  |   RNA_def_boolean( | 
					
						
							| 
									
										
										
										
											2019-09-20 14:31:24 +02:00
										 |  |  |       ot->srna, "use", false, "Use After Creation", "Select orientation after its creation"); | 
					
						
							| 
									
										
										
										
											2014-04-01 11:34:00 +11:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "overwrite", | 
					
						
							|  |  |  |                   false, | 
					
						
							| 
									
										
										
										
											2019-09-20 14:31:24 +02:00
										 |  |  |                   "Overwrite Previous", | 
					
						
							| 
									
										
										
										
											2013-05-12 15:52:05 +00:00
										 |  |  |                   "Overwrite previously created orientation with same name"); | 
					
						
							| 
									
										
										
										
											2009-09-28 19:49:36 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  | #ifdef USE_LOOPSLIDE_HACK
 | 
					
						
							|  |  |  | /**
 | 
					
						
							|  |  |  |  * Special hack for MESH_OT_loopcut_slide so we get back to the selection mode | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static void transformops_loopsel_hack(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if (op->type->idname == OP_EDGE_SLIDE) { | 
					
						
							|  |  |  |     if (op->opm && op->opm->opm && op->opm->opm->prev) { | 
					
						
							|  |  |  |       wmOperator *op_prev = op->opm->opm->prev; | 
					
						
							|  |  |  |       Scene *scene = CTX_data_scene(C); | 
					
						
							| 
									
										
										
										
											2018-07-01 15:47:09 +02:00
										 |  |  |       bool mesh_select_mode[3]; | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  |       PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-21 05:01:14 +00:00
										 |  |  |       if (prop && RNA_property_is_set(op_prev->ptr, prop)) { | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  |         ToolSettings *ts = scene->toolsettings; | 
					
						
							|  |  |  |         short selectmode_orig; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  |         RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode); | 
					
						
							|  |  |  |         selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) | | 
					
						
							|  |  |  |                            (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) | | 
					
						
							|  |  |  |                            (mesh_select_mode[2] ? SCE_SELECT_FACE : 0)); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  |         /* still switch if we were originally in face select mode */ | 
					
						
							|  |  |  |         if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) { | 
					
						
							| 
									
										
										
										
											2018-02-13 18:44:53 +11:00
										 |  |  |           Object *obedit = CTX_data_edit_object(C); | 
					
						
							|  |  |  |           BMEditMesh *em = BKE_editmesh_from_object(obedit); | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  |           em->selectmode = ts->selectmode = selectmode_orig; | 
					
						
							|  |  |  |           EDBM_selectmode_set(em); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2014-11-28 15:50:43 +01:00
										 |  |  | #else
 | 
					
						
							|  |  |  | /* prevent removal by cleanup */ | 
					
						
							|  |  |  | #  error "loopslide hack removed!"
 | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  | #endif /* USE_LOOPSLIDE_HACK */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | static void transformops_exit(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2013-05-16 18:33:07 +00:00
										 |  |  | #ifdef USE_LOOPSLIDE_HACK
 | 
					
						
							|  |  |  |   transformops_loopsel_hack(C, op); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |   saveTransform(C, op->customdata, op); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   MEM_freeN(op->customdata); | 
					
						
							|  |  |  |   op->customdata = NULL; | 
					
						
							| 
									
										
										
										
											2009-07-19 17:42:01 +00:00
										 |  |  |   G.moving = 0; | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 11:29:28 -03:00
										 |  |  | static int transformops_mode(wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   for (TransformModeItem *tmode = transform_modes; tmode->idname; tmode++) { | 
					
						
							|  |  |  |     if (op->type->idname == tmode->idname) { | 
					
						
							|  |  |  |       return tmode->mode; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   return RNA_enum_get(op->ptr, "mode"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  |   int retval = 1; | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (op->customdata == NULL) { | 
					
						
							| 
									
										
										
										
											2020-12-04 10:35:26 -03:00
										 |  |  |     TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 11:29:28 -03:00
										 |  |  |     int mode = transformops_mode(op); | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  |     retval = initTransform(C, t, op, event, mode); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |     /* store data */ | 
					
						
							| 
									
										
										
										
											2012-03-24 06:38:07 +00:00
										 |  |  |     if (retval) { | 
					
						
							| 
									
										
										
										
											2013-06-24 22:41:37 +00:00
										 |  |  |       G.moving = special_transform_moving(t); | 
					
						
							| 
									
										
										
										
											2020-12-04 10:35:26 -03:00
										 |  |  |       op->customdata = t; | 
					
						
							| 
									
										
										
										
											2010-08-03 22:36:59 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |     else { | 
					
						
							|  |  |  |       MEM_freeN(t); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  |   return retval; /* return 0 on error */ | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |   int exit_code; | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   TransInfo *t = op->customdata; | 
					
						
							| 
									
										
										
										
											2021-02-08 14:36:20 +01:00
										 |  |  |   const eTfmMode mode_prev = t->mode; | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-18 00:21:55 -04:00
										 |  |  | #if defined(WITH_INPUT_NDOF) && 0
 | 
					
						
							| 
									
										
										
										
											2011-08-02 22:50:06 +00:00
										 |  |  |   /* Stable 2D mouse coords map to different 3D coords while the 3D mouse is active
 | 
					
						
							|  |  |  |    * in other words, 2D deltas are no longer good enough! | 
					
						
							|  |  |  |    * disable until individual 'transformers' behave better. */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   if (event->type == NDOF_MOTION) { | 
					
						
							| 
									
										
										
										
											2011-07-25 00:00:53 +00:00
										 |  |  |     return OPERATOR_PASS_THROUGH; | 
					
						
							| 
									
										
										
										
											2019-04-22 09:19:45 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-08-07 17:01:44 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2011-07-25 00:00:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-01-09 12:08:29 +00:00
										 |  |  |   /* XXX insert keys are called here, and require context */ | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   t->context = C; | 
					
						
							| 
									
										
										
										
											2009-11-29 16:49:26 +00:00
										 |  |  |   exit_code = transformEvent(t, event); | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   t->context = NULL; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-05-19 19:25:59 +10:00
										 |  |  |   /* XXX, workaround: active needs to be calculated before transforming,
 | 
					
						
							|  |  |  |    * since we're not reading from 'td->center' in this case. see: T40241 */ | 
					
						
							|  |  |  |   if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) { | 
					
						
							| 
									
										
										
										
											2019-01-15 23:24:20 +11:00
										 |  |  |     /* In camera view, tsnap callback is not set
 | 
					
						
							| 
									
										
										
										
											2021-02-05 16:23:34 +11:00
										 |  |  |      * (see #initSnappingMode() in transform_snap.c, and T40348). */ | 
					
						
							| 
									
										
										
										
											2014-05-25 11:06:32 +02:00
										 |  |  |     if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) { | 
					
						
							| 
									
										
										
										
											2014-05-19 19:25:59 +10:00
										 |  |  |       t->tsnap.targetSnap(t); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-07 16:52:18 +00:00
										 |  |  |   transformApply(C, t); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-29 16:49:26 +00:00
										 |  |  |   exit_code |= transformEnd(C, t); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) { | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |     transformops_exit(C, op); | 
					
						
							| 
									
										
										
										
											2021-02-05 16:23:34 +11:00
										 |  |  |     exit_code &= ~OPERATOR_PASS_THROUGH; /* Preventively remove pass-through. */ | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2013-04-30 03:44:03 +00:00
										 |  |  |   else { | 
					
						
							|  |  |  |     if (mode_prev != t->mode) { | 
					
						
							|  |  |  |       /* WARNING: this is not normal to switch operator types
 | 
					
						
							|  |  |  |        * normally it would not be supported but transform happens | 
					
						
							| 
									
										
										
										
											2014-03-15 20:08:29 +11:00
										 |  |  |        * to share callbacks between different operators. */ | 
					
						
							| 
									
										
										
										
											2013-04-30 03:44:03 +00:00
										 |  |  |       wmOperatorType *ot_new = NULL; | 
					
						
							|  |  |  |       TransformModeItem *item = transform_modes; | 
					
						
							|  |  |  |       while (item->idname) { | 
					
						
							|  |  |  |         if (item->mode == t->mode) { | 
					
						
							|  |  |  |           ot_new = WM_operatortype_find(item->idname, false); | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         item++; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-30 03:44:03 +00:00
										 |  |  |       BLI_assert(ot_new != NULL); | 
					
						
							|  |  |  |       if (ot_new) { | 
					
						
							|  |  |  |         WM_operator_type_set(op, ot_new); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       /* end suspicious code */ | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |   return exit_code; | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-30 23:08:53 +00:00
										 |  |  | static void transform_cancel(bContext *C, wmOperator *op) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   TransInfo *t = op->customdata; | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  |   t->state = TRANS_CANCEL; | 
					
						
							|  |  |  |   transformEnd(C, t); | 
					
						
							|  |  |  |   transformops_exit(C, op); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static int transform_exec(bContext *C, wmOperator *op) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   TransInfo *t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (!transformops_data(C, op, NULL)) { | 
					
						
							| 
									
										
										
										
											2009-11-21 17:21:46 +00:00
										 |  |  |     G.moving = 0; | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  |     return OPERATOR_CANCELLED; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-01-03 22:15:59 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   t = op->customdata; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   t->options |= CTX_AUTOCONFIRM; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-07 16:52:18 +00:00
										 |  |  |   transformApply(C, t); | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-31 17:11:42 +00:00
										 |  |  |   transformEnd(C, t); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   transformops_exit(C, op); | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   return OPERATOR_FINISHED; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 09:03:46 +00:00
										 |  |  | static int transform_invoke(bContext *C, wmOperator *op, const wmEvent *event) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (!transformops_data(C, op, event)) { | 
					
						
							| 
									
										
										
										
											2009-11-21 17:21:46 +00:00
										 |  |  |     G.moving = 0; | 
					
						
							| 
									
										
										
										
											2009-03-28 20:46:38 +00:00
										 |  |  |     return OPERATOR_CANCELLED; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-06 09:52:12 +02:00
										 |  |  |   /* When modal, allow 'value' to set initial offset. */ | 
					
						
							|  |  |  |   if ((event == NULL) && RNA_struct_property_is_set(op->ptr, "value")) { | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |     return transform_exec(C, op); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 17:25:04 +02:00
										 |  |  |   /* add temp handler */ | 
					
						
							|  |  |  |   WM_event_add_modal_handler(C, op); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-03 17:25:04 +02:00
										 |  |  |   /* Use when modal input has some transformation to begin with. */ | 
					
						
							|  |  |  |   TransInfo *t = op->customdata; | 
					
						
							| 
									
										
										
										
											2021-06-16 18:17:07 +01:00
										 |  |  |   if ((t->flag & T_NO_CURSOR_WRAP) == 0) { | 
					
						
							|  |  |  |     op->flag |= OP_IS_MODAL_GRAB_CURSOR; /* XXX maybe we want this with the gizmo only? */ | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-07-03 17:25:04 +02:00
										 |  |  |   if (UNLIKELY(!is_zero_v4(t->values_modal_offset))) { | 
					
						
							|  |  |  |     transformApply(C, t); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-07-03 17:25:04 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   return OPERATOR_RUNNING_MODAL; | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  | static bool transform_poll_property(const bContext *UNUSED(C), | 
					
						
							|  |  |  |                                     wmOperator *op, | 
					
						
							|  |  |  |                                     const PropertyRNA *prop) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   const char *prop_id = RNA_property_identifier(prop); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 15:44:27 +10:00
										 |  |  |   /* Orientation/Constraints. */ | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2021-06-22 10:42:32 -07:00
										 |  |  |     /* Hide orientation axis if no constraints are set, since it won't be used. */ | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |     PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type"); | 
					
						
							| 
									
										
										
										
											2020-11-06 12:30:59 +11:00
										 |  |  |     if (!ELEM(prop_con, NULL, prop)) { | 
					
						
							| 
									
										
										
										
											2018-07-26 15:44:27 +10:00
										 |  |  |       if (STRPREFIX(prop_id, "constraint")) { | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-20 16:41:00 +11:00
										 |  |  |         /* Special case: show constraint axis if we don't have values,
 | 
					
						
							|  |  |  |          * needed for mirror operator. */ | 
					
						
							|  |  |  |         if (STREQ(prop_id, "constraint_axis") && | 
					
						
							|  |  |  |             (RNA_struct_find_property(op->ptr, "value") == NULL)) { | 
					
						
							|  |  |  |           return true; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 15:44:27 +10:00
										 |  |  |         return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-03 11:29:28 -03:00
										 |  |  |   /* Orientation Axis. */ | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     if (STREQ(prop_id, "orient_axis")) { | 
					
						
							|  |  |  |       eTfmMode mode = (eTfmMode)transformops_mode(op); | 
					
						
							|  |  |  |       if (mode == TFM_ALIGN) { | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   /* Proportional Editing. */ | 
					
						
							|  |  |  |   { | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |     PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit"); | 
					
						
							|  |  |  |     if (prop_pet && (prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) { | 
					
						
							|  |  |  |       if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) { | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |         return false; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   return true; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  | void Transform_Properties(struct wmOperatorType *ot, int flags) | 
					
						
							| 
									
										
										
										
											2010-01-04 20:49:42 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-26 20:22:54 +11:00
										 |  |  |   if (flags & P_ORIENT_AXIS) { | 
					
						
							|  |  |  |     prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE); | 
					
						
							|  |  |  |     RNA_def_property_ui_text(prop, "Axis", ""); | 
					
						
							|  |  |  |     RNA_def_property_enum_default(prop, 2); | 
					
						
							|  |  |  |     RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items); | 
					
						
							| 
									
										
										
										
											2019-03-01 13:05:24 +11:00
										 |  |  |     RNA_def_property_flag(prop, PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2019-02-26 20:22:54 +11:00
										 |  |  |   } | 
					
						
							|  |  |  |   if (flags & P_ORIENT_AXIS_ORTHO) { | 
					
						
							|  |  |  |     prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE); | 
					
						
							|  |  |  |     RNA_def_property_ui_text(prop, "Axis Ortho", ""); | 
					
						
							| 
									
										
										
										
											2019-09-03 20:32:15 +10:00
										 |  |  |     RNA_def_property_enum_default(prop, 0); | 
					
						
							| 
									
										
										
										
											2019-02-26 20:22:54 +11:00
										 |  |  |     RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items); | 
					
						
							| 
									
										
										
										
											2019-03-01 13:05:24 +11:00
										 |  |  |     RNA_def_property_flag(prop, PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2018-10-16 21:52:30 +11:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   if (flags & P_ORIENT_MATRIX) { | 
					
						
							|  |  |  |     prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE); | 
					
						
							|  |  |  |     RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation"); | 
					
						
							|  |  |  |     RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |     /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */ | 
					
						
							|  |  |  |     prop = RNA_def_float_matrix( | 
					
						
							|  |  |  |         ot->srna, "orient_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f); | 
					
						
							| 
									
										
										
										
											2018-11-01 07:24:10 +11:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |     /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
 | 
					
						
							| 
									
										
										
										
											2019-02-21 21:52:56 +11:00
										 |  |  |      * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability | 
					
						
							|  |  |  |      * to switch over to other orientations. */ | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |     prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE); | 
					
						
							| 
									
										
										
										
											2019-02-21 21:52:56 +11:00
										 |  |  |     RNA_def_property_ui_text(prop, "Matrix Orientation", ""); | 
					
						
							|  |  |  |     RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   if (flags & P_CONSTRAINT) { | 
					
						
							|  |  |  |     RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", ""); | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (flags & P_MIRROR) { | 
					
						
							| 
									
										
										
										
											2013-06-16 05:35:44 +00:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", ""); | 
					
						
							|  |  |  |     if (flags & P_MIRROR_DUMMY) { | 
					
						
							|  |  |  |       /* only used so macros can disable this option */ | 
					
						
							|  |  |  |       RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-06-16 05:35:44 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (flags & P_PROPORTIONAL) { | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  |     RNA_def_boolean(ot->srna, "use_proportional_edit", 0, "Proportional Editing", ""); | 
					
						
							| 
									
										
										
										
											2015-11-23 13:49:52 +11:00
										 |  |  |     prop = RNA_def_enum(ot->srna, | 
					
						
							|  |  |  |                         "proportional_edit_falloff", | 
					
						
							|  |  |  |                         rna_enum_proportional_falloff_items, | 
					
						
							|  |  |  |                         0, | 
					
						
							| 
									
										
										
										
											2018-06-13 09:16:26 +02:00
										 |  |  |                         "Proportional Falloff", | 
					
						
							|  |  |  |                         "Falloff type for proportional editing mode"); | 
					
						
							| 
									
										
										
										
											2019-01-15 23:24:20 +11:00
										 |  |  |     /* Abusing id_curve :/ */ | 
					
						
							| 
									
										
										
										
											2022-02-18 09:50:29 -06:00
										 |  |  |     RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE_LEGACY); | 
					
						
							| 
									
										
										
										
											2016-06-23 16:43:12 +02:00
										 |  |  |     RNA_def_float(ot->srna, | 
					
						
							|  |  |  |                   "proportional_size", | 
					
						
							|  |  |  |                   1, | 
					
						
							|  |  |  |                   T_PROP_SIZE_MIN, | 
					
						
							|  |  |  |                   T_PROP_SIZE_MAX, | 
					
						
							|  |  |  |                   "Proportional Size", | 
					
						
							|  |  |  |                   "", | 
					
						
							|  |  |  |                   0.001f, | 
					
						
							|  |  |  |                   100.0f); | 
					
						
							| 
									
										
										
										
											2019-04-30 13:42:18 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |     RNA_def_boolean(ot->srna, "use_proportional_connected", 0, "Connected", ""); | 
					
						
							|  |  |  |     RNA_def_boolean(ot->srna, "use_proportional_projected", 0, "Projected (2D)", ""); | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (flags & P_SNAP) { | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", ""); | 
					
						
							| 
									
										
										
										
											2010-06-06 15:38:50 +00:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |     if (flags & P_GEO_SNAP) { | 
					
						
							| 
									
										
										
										
											2015-11-23 13:49:52 +11:00
										 |  |  |       prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 0, "Target", ""); | 
					
						
							| 
									
										
										
										
											2010-06-06 15:38:50 +00:00
										 |  |  |       RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |       prop = RNA_def_float_vector( | 
					
						
							|  |  |  |           ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2010-06-06 15:38:50 +00:00
										 |  |  |       RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |       if (flags & P_ALIGN_SNAP) { | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |         prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", ""); | 
					
						
							| 
									
										
										
										
											2010-06-06 15:38:50 +00:00
										 |  |  |         RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |         prop = RNA_def_float_vector( | 
					
						
							|  |  |  |             ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2010-06-06 15:38:50 +00:00
										 |  |  |         RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
											  
											
												Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
   - Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
     to enter "Stroke Edit Mode". In this mode, many common editing tools will
     operate on Grease Pencil stroke points instead.
   - Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
     Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
   - Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
   NOTE: Currently drivers don't work, but if time allows, this may still be
         added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
   colour/opacity settings to the ones used for the lines themselves.
   This makes use of OpenGL filled polys, which has the limitation of only
   being able to fill convex shapes. Some artifacts may be visible on concave
   shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
   has been added which draws strokes as a series of screen-aligned discs.
   While this was originally a partial experimental technique at getting better
   quality 3D lines, the effects possible using this technique were interesting
   enough to warrant making this a dedicated feature. Best results when partial
   opacity and large stroke widths are used.
5) Improved Onion Skinning Support
   - Different colours can be selected for the before/after ghosts. To do so,
     enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
     the colours accordingly.
   - Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
   the active object.
   - For a long time, the object-attachment has proved to be quite problematic
     for users to keep track of. Now that this is done at scene level, it is
     easier for most users to use.
   - An exception for old files (and for any addons which may benefit from object
     attachment instead), is that if the active object has a Grease Pencil datablock,
     that will be used instead.
   - It is not currently possible to choose object-attachment from the UI, but
     it is simple to do this from the console instead, by doing:
     context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
   - The layers UI has been cleaned up to use a list instead of the nested-panels
     design. Apart from saving space, this is also much nicer to look at now.
   - The UI code is now all defined in Python. To support this, it has been necessary
     to add some new context properties to make it easier to access these settings.
     e.g. "gpencil_data" for the datablock
          "active_gpencil_layer" and "active_gpencil_frame" for active data,
          "editable_gpencil_strokes" for the strokes that can be edited
   - The "stroke placement/alignment" settings (previously "Drawing Settings" at the
     bottom of the Grease Pencil panel in the Properties Region) is now located in
     the toolbar. These were more toolsettings than properties for how GPencil got drawn.
   - "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
     suggestion for an earlier discussion on developer.blender.org
   - By default, the painting operator will wait for a mouse button to be pressed
     before it starts creating the stroke. This is to make it easier to include
     this operator in various toolbars/menus/etc.   To get it immediately starting
     (as when you hold down DKEy to draw), set "wait_for_input" to False.
   - GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
   - Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
   A set of experimental pie menus has been included for quick access to many
   tools and settings. It is not necessary to use these to get things done,
   but they have been designed to help make certain common tasks easier.
   - Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
              spatially stable manner.
   - D Q    = "Quick Settings" pie. This allows quick access to the active
              layer's settings. Notably, colours, thickness, and turning
              onion skinning on/off.
											
										 
											2014-12-01 01:52:06 +13:00
										 |  |  |   if (flags & P_GPENCIL_EDIT) { | 
					
						
							| 
									
										
										
										
											2018-06-12 22:00:22 +02:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                            "gpencil_strokes", | 
					
						
							|  |  |  |                            0, | 
					
						
							|  |  |  |                            "Edit Grease Pencil", | 
					
						
							|  |  |  |                            "Edit selected Grease Pencil strokes"); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
											  
											
												Grease Pencil - Storyboarding Features (merge from GPencil_EditStrokes branch)
This merge-commit brings in a number of new features and workflow/UI improvements for
working with Grease Pencil. While these were originally targetted at improving
the workflow for creating 3D storyboards in Blender using the Grease Pencil,
many of these changes should also prove useful in other workflows too.
The main highlights here are:
1) It is now possible to edit Grease Pencil strokes
   - Use D Tab, or toggle the "Enable Editing" toggles in the Toolbar/Properties regions
     to enter "Stroke Edit Mode". In this mode, many common editing tools will
     operate on Grease Pencil stroke points instead.
   - Tools implemented include Select, Select All/Border/Circle/Linked/More/Less,
     Grab, Rotate, Scale, Bend, Shear, To Sphere, Mirror, Duplicate, Delete.
   - Proportional Editing works when using the transform tools
2) Grease Pencil stroke settings can now be animated
   NOTE: Currently drivers don't work, but if time allows, this may still be
         added before the release.
3) Strokes can be drawn with "filled" interiors, using a separate set of
   colour/opacity settings to the ones used for the lines themselves.
   This makes use of OpenGL filled polys, which has the limitation of only
   being able to fill convex shapes. Some artifacts may be visible on concave
   shapes (e.g. pacman's mouth will be overdrawn)
4) "Volumetric Strokes" - An alternative drawing technique for stroke drawing
   has been added which draws strokes as a series of screen-aligned discs.
   While this was originally a partial experimental technique at getting better
   quality 3D lines, the effects possible using this technique were interesting
   enough to warrant making this a dedicated feature. Best results when partial
   opacity and large stroke widths are used.
5) Improved Onion Skinning Support
   - Different colours can be selected for the before/after ghosts. To do so,
     enable the "colour wheel" toggle beside the Onion Skinning toggle, and set
     the colours accordingly.
   - Different numbers of ghosts can be shown before/after the current frame
6) Grease Pencil datablocks are now attached to the scene by default instead of
   the active object.
   - For a long time, the object-attachment has proved to be quite problematic
     for users to keep track of. Now that this is done at scene level, it is
     easier for most users to use.
   - An exception for old files (and for any addons which may benefit from object
     attachment instead), is that if the active object has a Grease Pencil datablock,
     that will be used instead.
   - It is not currently possible to choose object-attachment from the UI, but
     it is simple to do this from the console instead, by doing:
     context.active_object.grease_pencil = bpy.data.grease_pencil["blah"]
7) Various UI Cleanups
   - The layers UI has been cleaned up to use a list instead of the nested-panels
     design. Apart from saving space, this is also much nicer to look at now.
   - The UI code is now all defined in Python. To support this, it has been necessary
     to add some new context properties to make it easier to access these settings.
     e.g. "gpencil_data" for the datablock
          "active_gpencil_layer" and "active_gpencil_frame" for active data,
          "editable_gpencil_strokes" for the strokes that can be edited
   - The "stroke placement/alignment" settings (previously "Drawing Settings" at the
     bottom of the Grease Pencil panel in the Properties Region) is now located in
     the toolbar. These were more toolsettings than properties for how GPencil got drawn.
   - "Use Sketching Sessions" has been renamed "Continuous Drawing", as per a
     suggestion for an earlier discussion on developer.blender.org
   - By default, the painting operator will wait for a mouse button to be pressed
     before it starts creating the stroke. This is to make it easier to include
     this operator in various toolbars/menus/etc.   To get it immediately starting
     (as when you hold down DKEy to draw), set "wait_for_input" to False.
   - GPencil Layers can be rearranged in the "Grease Pencil" mode of the Action Editor
   - Toolbar panels have been added to all the other editors which support these.
8) Pie menus for quick-access to tools
   A set of experimental pie menus has been included for quick access to many
   tools and settings. It is not necessary to use these to get things done,
   but they have been designed to help make certain common tasks easier.
   - Ctrl-D = The main pie menu. Reveals tools in a context sensitive and
              spatially stable manner.
   - D Q    = "Quick Settings" pie. This allows quick access to the active
              layer's settings. Notably, colours, thickness, and turning
              onion skinning on/off.
											
										 
											2014-12-01 01:52:06 +13:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 19:43:23 +02:00
										 |  |  |   if (flags & P_CURSOR_EDIT) { | 
					
						
							| 
									
										
										
										
											2018-06-12 22:00:22 +02:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, "cursor_transform", 0, "Transform Cursor", ""); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2018-05-25 19:43:23 +02:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-02 18:04:46 +06:00
										 |  |  |   if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) { | 
					
						
							| 
									
										
										
										
											2018-06-12 22:00:22 +02:00
										 |  |  |     prop = RNA_def_boolean( | 
					
						
							| 
									
										
										
										
											2020-12-24 11:07:32 -06:00
										 |  |  |         ot->srna, "texture_space", 0, "Edit Texture Space", "Edit object data texture space"); | 
					
						
							| 
									
										
										
										
											2018-06-12 22:00:22 +02:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2013-09-17 16:12:05 +00:00
										 |  |  |     prop = RNA_def_boolean( | 
					
						
							|  |  |  |         ot->srna, "remove_on_cancel", 0, "Remove on Cancel", "Remove elements on cancel"); | 
					
						
							| 
									
										
										
										
											2018-06-12 22:00:22 +02:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2011-01-05 17:27:26 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   if (flags & P_CORRECT_UV) { | 
					
						
							| 
									
										
										
										
											2018-05-24 21:19:38 +02:00
										 |  |  |     RNA_def_boolean( | 
					
						
							|  |  |  |         ot->srna, "correct_uv", true, "Correct UVs", "Correct UV coordinates when transforming"); | 
					
						
							| 
									
										
										
										
											2011-08-03 08:02:32 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   if (flags & P_CENTER) { | 
					
						
							| 
									
										
										
										
											2018-07-14 23:49:00 +02:00
										 |  |  |     /* For gizmos that define their own center. */ | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |     prop = RNA_def_property(ot->srna, "center_override", PROP_FLOAT, PROP_XYZ); | 
					
						
							|  |  |  |     RNA_def_property_array(prop, 3); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2017-08-29 16:01:16 +10:00
										 |  |  |     RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)"); | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-08-24 17:45:40 +01:00
										 |  |  |   if (flags & P_VIEW2D_EDGE_PAN) { | 
					
						
							| 
									
										
										
										
											2021-08-25 13:30:00 -07:00
										 |  |  |     prop = RNA_def_boolean( | 
					
						
							|  |  |  |         ot->srna, "view2d_edge_pan", false, "Edge Pan", "Enable edge panning in 2D view"); | 
					
						
							| 
									
										
										
										
											2021-08-24 17:45:40 +01:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-16 05:35:44 +00:00
										 |  |  |   if ((flags & P_NO_DEFAULTS) == 0) { | 
					
						
							| 
									
										
										
										
											2017-10-14 01:07:31 +02:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                            "release_confirm", | 
					
						
							|  |  |  |                            0, | 
					
						
							|  |  |  |                            "Confirm on Release", | 
					
						
							|  |  |  |                            "Always confirm operation when releasing button"); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-02 12:18:07 +01:00
										 |  |  |     prop = RNA_def_boolean(ot->srna, "use_accurate", 0, "Accurate", "Use accurate transformation"); | 
					
						
							|  |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2013-06-16 05:35:44 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2020-04-15 11:55:22 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  |   if (flags & P_POST_TRANSFORM) { | 
					
						
							|  |  |  |     prop = RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                            "use_automerge_and_split", | 
					
						
							|  |  |  |                            0, | 
					
						
							|  |  |  |                            "Auto Merge & Split", | 
					
						
							| 
									
										
										
										
											2020-12-10 18:22:16 -08:00
										 |  |  |                            "Forces the use of Auto Merge and Split"); | 
					
						
							| 
									
										
										
										
											2020-04-15 11:55:22 -03:00
										 |  |  |     RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_translate(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2018-09-06 12:13:01 +02:00
										 |  |  |   ot->name = "Move"; | 
					
						
							|  |  |  |   ot->description = "Move selected items"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_TRANSLATION; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-16 12:08:17 +01:00
										 |  |  |   RNA_def_float_translation( | 
					
						
							| 
									
										
										
										
											2018-08-16 07:59:49 +10:00
										 |  |  |       ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 19:43:23 +02:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |                        P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | | 
					
						
							| 
									
										
										
										
											2021-08-24 17:45:40 +01:00
										 |  |  |                            P_OPTIONS | P_GPENCIL_EDIT | P_CURSOR_EDIT | P_VIEW2D_EDGE_PAN | | 
					
						
							|  |  |  |                            P_POST_TRANSFORM); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_resize(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Resize"; | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  |   ot->description = "Scale (resize) selected items"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_RESIZE; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 07:59:49 +10:00
										 |  |  |   RNA_def_float_vector( | 
					
						
							|  |  |  |       ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-08 12:09:27 +02:00
										 |  |  |   PropertyRNA *prop; | 
					
						
							|  |  |  |   prop = RNA_def_float_vector(ot->srna, | 
					
						
							|  |  |  |                               "mouse_dir_constraint", | 
					
						
							|  |  |  |                               3, | 
					
						
							|  |  |  |                               VecZero, | 
					
						
							|  |  |  |                               -FLT_MAX, | 
					
						
							|  |  |  |                               FLT_MAX, | 
					
						
							|  |  |  |                               "Mouse Directional Constraint", | 
					
						
							|  |  |  |                               "", | 
					
						
							|  |  |  |                               -FLT_MAX, | 
					
						
							|  |  |  |                               FLT_MAX); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |                        P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | | 
					
						
							|  |  |  |                            P_OPTIONS | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  | static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Skin Resize"; | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  |   ot->description = "Scale selected vertices' skin radii"; | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  |   ot->idname = OP_SKIN_RESIZE; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2019-07-04 17:24:16 +02:00
										 |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 07:59:49 +10:00
										 |  |  |   RNA_def_float_vector( | 
					
						
							|  |  |  |       ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							|  |  |  |                        P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | | 
					
						
							|  |  |  |                            P_OPTIONS | P_NO_TEXSPACE); | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_trackball(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Trackball"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Trackball style rotation of selected items"; | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  |   ot->idname = OP_TRACKBALL; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-13 12:12:13 +00:00
										 |  |  |   /* Maybe we could use float_vector_xyz here too? */ | 
					
						
							| 
									
										
										
										
											2015-09-17 21:50:40 +10:00
										 |  |  |   RNA_def_float_rotation( | 
					
						
							|  |  |  |       ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 20:13:05 -03:00
										 |  |  | /* Similar to #transform_shear_poll. */ | 
					
						
							|  |  |  | static bool transform_rotate_poll(bContext *C) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if (!ED_operator_screenactive(C)) { | 
					
						
							|  |  |  |     return false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ScrArea *area = CTX_wm_area(C); | 
					
						
							|  |  |  |   return area && !ELEM(area->spacetype, SPACE_ACTION); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_rotate(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2012-10-08 20:01:36 +00:00
										 |  |  |   ot->name = "Rotate"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Rotate selected items"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_ROTATION; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2020-10-30 20:13:05 -03:00
										 |  |  |   ot->poll = transform_rotate_poll; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-17 21:50:40 +10:00
										 |  |  |   RNA_def_float_rotation( | 
					
						
							|  |  |  |       ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |                        P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | | 
					
						
							|  |  |  |                            P_GEO_SNAP | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_tilt(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2012-10-08 20:01:36 +00:00
										 |  |  |   ot->name = "Tilt"; | 
					
						
							| 
									
										
										
										
											2016-06-08 22:30:53 +10:00
										 |  |  |   /* optional -
 | 
					
						
							| 
									
										
										
										
											2012-03-03 16:31:46 +00:00
										 |  |  |    * "Tilt selected vertices" | 
					
						
							| 
									
										
										
										
											2012-10-08 21:03:35 +00:00
										 |  |  |    * "Specify an extra axis rotation for selected vertices of 3D curve" */ | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  |   ot->description = "Tilt selected control vertices of 3D curve"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_TILT; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-11-01 11:00:08 +00:00
										 |  |  |   ot->poll = ED_operator_editcurve_3d; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-19 16:58:30 +01:00
										 |  |  |   RNA_def_float_rotation( | 
					
						
							|  |  |  |       ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-10-08 20:01:36 +00:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-11-20 12:14:10 +11:00
										 |  |  | static void TRANSFORM_OT_bend(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2013-11-20 12:14:10 +11:00
										 |  |  |   ot->name = "Bend"; | 
					
						
							|  |  |  |   ot->description = "Bend selected items between the 3D cursor and the mouse"; | 
					
						
							|  |  |  |   ot->idname = OP_BEND; | 
					
						
							| 
									
										
										
										
											2021-09-17 12:09:26 +10:00
										 |  |  |   /* Depend on cursor location because the cursor location is used to define the region to bend. */ | 
					
						
							|  |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_DEPENDS_ON_CURSOR; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							| 
									
										
										
										
											2013-11-27 18:36:04 +11:00
										 |  |  |   // ot->exec = transform_exec; /* unsupported */
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2013-11-05 16:20:06 +00:00
										 |  |  |   ot->poll = ED_operator_region_view3d_active; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   RNA_def_float_rotation( | 
					
						
							|  |  |  |       ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-10-30 20:13:05 -03:00
										 |  |  | /* Similar to #transform_rotate_poll. */ | 
					
						
							| 
									
										
										
										
											2019-08-08 18:21:40 +02:00
										 |  |  | static bool transform_shear_poll(bContext *C) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   if (!ED_operator_screenactive(C)) { | 
					
						
							|  |  |  |     return false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-03 13:25:03 +02:00
										 |  |  |   ScrArea *area = CTX_wm_area(C); | 
					
						
							|  |  |  |   return area && !ELEM(area->spacetype, SPACE_ACTION); | 
					
						
							| 
									
										
										
										
											2019-08-08 18:21:40 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_shear(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Shear"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Shear selected items along the horizontal screen axis"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_SHEAR; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2019-08-08 18:21:40 +02:00
										 |  |  |   ot->poll = transform_shear_poll; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-10 18:10:24 +00:00
										 |  |  |   RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							|  |  |  |                        P_ORIENT_AXIS | P_ORIENT_AXIS_ORTHO | P_ORIENT_MATRIX | P_PROPORTIONAL | | 
					
						
							|  |  |  |                            P_MIRROR | P_SNAP | P_GPENCIL_EDIT); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Push/Pull"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Push/Pull selected items"; | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  |   ot->idname = OP_PUSH_PULL; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_CENTER); | 
					
						
							| 
									
										
										
										
											2010-04-11 16:04:11 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Shrink/Fatten"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Shrink/fatten selected vertices along normals"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_SHRINK_FATTEN; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-20 21:10:32 +01:00
										 |  |  |   RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-03 15:13:46 +11:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "use_even_offset", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "Offset Even", | 
					
						
							|  |  |  |                   "Scale the offset to give more even thickness"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "To Sphere"; | 
					
						
							| 
									
										
										
										
											2020-08-31 23:24:50 -04:00
										 |  |  |   ot->description = "Move selected items outward in a spherical shape around geometric center"; | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   ot->idname = OP_TOSPHERE; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2013-03-26 10:28:19 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-21 21:19:58 +00:00
										 |  |  |   RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_mirror(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-09-10 11:04:53 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Mirror"; | 
					
						
							| 
									
										
										
										
											2016-02-10 21:08:44 +01:00
										 |  |  |   ot->description = "Mirror selected items around one or more axes"; | 
					
						
							| 
									
										
										
										
											2009-09-10 11:04:53 +00:00
										 |  |  |   ot->idname = OP_MIRROR; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-10 11:04:53 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 09:09:26 -03:00
										 |  |  |   Transform_Properties(ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2009-09-10 11:04:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  | static void TRANSFORM_OT_bbone_resize(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Scale B-Bone"; | 
					
						
							|  |  |  |   ot->description = "Scale selected bendy bones display size"; | 
					
						
							|  |  |  |   ot->idname = OP_BONE_SIZE; | 
					
						
							|  |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2020-06-22 19:06:04 -03:00
										 |  |  |   ot->poll = ED_operator_object_active; | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_float_translation( | 
					
						
							| 
									
										
										
										
											2020-06-22 19:06:04 -03:00
										 |  |  |       ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Display Size", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2020-02-14 11:51:29 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Transform_Properties(ot, P_ORIENT_MATRIX | P_CONSTRAINT | P_MIRROR); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-09-22 20:16:56 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2015-06-15 10:58:07 +10:00
										 |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-22 20:16:56 +00:00
										 |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2009-09-28 03:28:28 +00:00
										 |  |  |   ot->name = "Edge Slide"; | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  |   ot->description = "Slide an edge loop along a mesh"; | 
					
						
							| 
									
										
										
										
											2009-09-22 20:16:56 +00:00
										 |  |  |   ot->idname = OP_EDGE_SLIDE; | 
					
						
							| 
									
										
										
										
											2021-09-17 12:09:26 +10:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_DEPENDS_ON_CURSOR; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-22 20:16:56 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2015-06-03 13:41:30 +10:00
										 |  |  |   ot->poll = ED_operator_editmesh_region_view3d; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-07 21:28:03 +10:00
										 |  |  |   RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-15 10:58:07 +10:00
										 |  |  |   prop = RNA_def_boolean(ot->srna, "single_side", false, "Single Side", ""); | 
					
						
							|  |  |  |   RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); | 
					
						
							| 
									
										
										
										
											2015-10-12 21:34:14 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "use_even", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "Even", | 
					
						
							|  |  |  |                   "Make the edge loop match the shape of the adjacent edge loop"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-12 21:34:14 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "flipped", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "Flipped", | 
					
						
							|  |  |  |                   "When Even mode is active, flips between the two adjacent edge loops"); | 
					
						
							| 
									
										
										
										
											2015-10-15 01:46:28 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV); | 
					
						
							| 
									
										
										
										
											2009-09-22 20:16:56 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  | static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2013-01-15 03:48:13 +00:00
										 |  |  |   ot->name = "Vertex Slide"; | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  |   ot->description = "Slide a vertex along a mesh"; | 
					
						
							|  |  |  |   ot->idname = OP_VERT_SLIDE; | 
					
						
							| 
									
										
										
										
											2021-09-17 12:09:26 +10:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING | OPTYPE_DEPENDS_ON_CURSOR; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2015-06-03 13:41:30 +10:00
										 |  |  |   ot->poll = ED_operator_editmesh_region_view3d; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  |   RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f); | 
					
						
							| 
									
										
										
										
											2015-10-12 21:34:14 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "use_even", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "Even", | 
					
						
							|  |  |  |                   "Make the edge loop match the shape of the adjacent edge loop"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-12 21:34:14 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, | 
					
						
							|  |  |  |                   "flipped", | 
					
						
							|  |  |  |                   false, | 
					
						
							|  |  |  |                   "Flipped", | 
					
						
							|  |  |  |                   "When Even mode is active, flips between the two adjacent edge loops"); | 
					
						
							| 
									
										
										
										
											2015-10-15 01:46:28 +02:00
										 |  |  |   RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents"); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-12 02:18:20 +11:00
										 |  |  |   Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV); | 
					
						
							| 
									
										
										
										
											2013-01-13 14:08:53 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Edge Crease"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Change the crease of edges"; | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  |   ot->idname = OP_EDGE_CREASE; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
											  
											
												Subdivision: add support for vertex creasing
This adds vertex creasing support for OpenSubDiv for modeling, rendering,
Alembic and USD I/O.
For modeling, vertex creasing follows the edge creasing implementation with an
operator accessible through the Vertex menu in Edit Mode, and some parameter in
the properties panel. The option in the Subsurf and Multires to use edge
creasing also affects vertex creasing.
The vertex crease data is stored as a CustomData layer, unlike edge creases
which for now are stored in `MEdge`, but will in the future also be moved to
a `CustomData` layer. See comments for details on the difference in behavior
for the `CD_CREASE` layer between egdes and vertices.
For Cycles this adds sockets on the Mesh node to hold data about which vertices
are creased (one socket for the indices, one for the weigths).
Viewport rendering of vertex creasing reuses the same color scheme as for edges
and creased vertices are drawn bigger than uncreased vertices.
For Alembic and USD, vertex crease support follows the edge crease
implementation, they are always read, but only exported if a `Subsurf` modifier
is present on the Mesh.
Reviewed By: brecht, fclem, sergey, sybren, campbellbarton
Differential Revision: https://developer.blender.org/D10145
											
										 
											2022-01-20 12:20:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							|  |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							|  |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   Transform_Properties(ot, P_SNAP); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void TRANSFORM_OT_vert_crease(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Vertex Crease"; | 
					
						
							|  |  |  |   ot->description = "Change the crease of vertices"; | 
					
						
							|  |  |  |   ot->idname = OP_VERT_CREASE; | 
					
						
							|  |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |   Transform_Properties(ot, P_SNAP); | 
					
						
							| 
									
										
										
										
											2010-01-09 20:42:35 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2012-05-12 23:07:52 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Edge Bevel Weight"; | 
					
						
							|  |  |  |   ot->description = "Change the bevel weight of edges"; | 
					
						
							|  |  |  |   ot->idname = OP_EDGE_BWEIGHT; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2012-05-12 23:07:52 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							| 
									
										
										
										
											2018-09-24 23:18:02 +02:00
										 |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							| 
									
										
										
										
											2012-05-12 23:07:52 +00:00
										 |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							|  |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:07:52 +00:00
										 |  |  |   Transform_Properties(ot, P_SNAP); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Sequence Slide"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Slide a sequence strip in time"; | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |   ot->idname = OP_SEQ_SLIDE; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |   ot->poll = ED_operator_sequencer_active; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-02 01:49:41 -03:00
										 |  |  |   /* properties */ | 
					
						
							|  |  |  |   PropertyRNA *prop; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   prop = RNA_def_float_vector( | 
					
						
							| 
									
										
										
										
											2018-08-16 07:59:49 +10:00
										 |  |  |       ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-08-02 01:49:41 -03:00
										 |  |  |   RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 0); | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 19:40:51 +00:00
										 |  |  |   Transform_Properties(ot, P_SNAP); | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  | static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2019-05-01 15:44:26 +02:00
										 |  |  |   ot->name = "Rotate Normals"; | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  |   ot->description = "Rotate split normal of selected items"; | 
					
						
							|  |  |  |   ot->idname = OP_NORMAL_ROTATION; | 
					
						
							|  |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							|  |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2019-05-20 12:15:52 -04:00
										 |  |  |   ot->poll = ED_operator_editmesh; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  |   RNA_def_float_rotation( | 
					
						
							|  |  |  |       ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |   Transform_Properties(ot, P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_MIRROR); | 
					
						
							| 
									
										
										
										
											2018-05-25 22:24:24 +05:30
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-12 23:18:14 +00:00
										 |  |  | static void TRANSFORM_OT_transform(struct wmOperatorType *ot) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2011-03-27 22:15:37 +00:00
										 |  |  |   PropertyRNA *prop; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   /* identifiers */ | 
					
						
							|  |  |  |   ot->name = "Transform"; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->description = "Transform selected items by mode type"; | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   ot->idname = "TRANSFORM_OT_transform"; | 
					
						
							| 
									
										
										
										
											2012-06-10 19:59:02 +00:00
										 |  |  |   ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_invoke; | 
					
						
							|  |  |  |   ot->exec = transform_exec; | 
					
						
							|  |  |  |   ot->modal = transform_modal; | 
					
						
							| 
									
										
										
										
											2012-03-22 07:26:09 +00:00
										 |  |  |   ot->cancel = transform_cancel; | 
					
						
							| 
									
										
										
										
											2011-05-18 08:36:06 +00:00
										 |  |  |   ot->poll = ED_operator_screenactive; | 
					
						
							| 
									
										
										
										
											2018-07-26 11:13:38 +10:00
										 |  |  |   ot->poll_property = transform_poll_property; | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-23 13:49:52 +11:00
										 |  |  |   prop = RNA_def_enum( | 
					
						
							|  |  |  |       ot->srna, "mode", rna_enum_transform_mode_types, TFM_TRANSLATION, "Mode", ""); | 
					
						
							| 
									
										
										
										
											2011-03-27 22:15:37 +00:00
										 |  |  |   RNA_def_property_flag(prop, PROP_HIDDEN); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  |   RNA_def_float_vector( | 
					
						
							|  |  |  |       ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-23 14:21:40 +01:00
										 |  |  |   WM_operatortype_props_advanced_begin(ot); | 
					
						
							| 
									
										
										
										
											2019-04-17 06:17:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-28 16:00:28 +10:00
										 |  |  |   Transform_Properties(ot, | 
					
						
							| 
									
										
										
										
											2019-02-27 17:25:45 +11:00
										 |  |  |                        P_ORIENT_AXIS | P_ORIENT_MATRIX | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | | 
					
						
							| 
									
										
										
										
											2020-02-27 16:42:34 -03:00
										 |  |  |                            P_ALIGN_SNAP | P_GPENCIL_EDIT | P_CENTER); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-05-24 01:35:48 +10:00
										 |  |  | static int transform_from_gizmo_invoke(bContext *C, | 
					
						
							|  |  |  |                                        wmOperator *UNUSED(op), | 
					
						
							|  |  |  |                                        const wmEvent *UNUSED(event)) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   bToolRef *tref = WM_toolsystem_ref_from_context(C); | 
					
						
							|  |  |  |   if (tref) { | 
					
						
							| 
									
										
										
										
											2020-03-06 16:56:42 +01:00
										 |  |  |     ARegion *region = CTX_wm_region(C); | 
					
						
							|  |  |  |     wmGizmoMap *gzmap = region->gizmo_map; | 
					
						
							| 
									
										
										
										
											2019-05-24 01:35:48 +10:00
										 |  |  |     wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") : NULL; | 
					
						
							|  |  |  |     if (gzgroup != NULL) { | 
					
						
							|  |  |  |       PointerRNA gzg_ptr; | 
					
						
							|  |  |  |       WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup->type, &gzg_ptr); | 
					
						
							|  |  |  |       const int drag_action = RNA_enum_get(&gzg_ptr, "drag_action"); | 
					
						
							|  |  |  |       const char *op_id = NULL; | 
					
						
							|  |  |  |       switch (drag_action) { | 
					
						
							|  |  |  |         case V3D_GIZMO_SHOW_OBJECT_TRANSLATE: | 
					
						
							|  |  |  |           op_id = "TRANSFORM_OT_translate"; | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         case V3D_GIZMO_SHOW_OBJECT_ROTATE: | 
					
						
							|  |  |  |           op_id = "TRANSFORM_OT_rotate"; | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         case V3D_GIZMO_SHOW_OBJECT_SCALE: | 
					
						
							|  |  |  |           op_id = "TRANSFORM_OT_resize"; | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |         default: | 
					
						
							|  |  |  |           break; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       if (op_id) { | 
					
						
							|  |  |  |         wmOperatorType *ot = WM_operatortype_find(op_id, true); | 
					
						
							|  |  |  |         PointerRNA op_ptr; | 
					
						
							|  |  |  |         WM_operator_properties_create_ptr(&op_ptr, ot); | 
					
						
							|  |  |  |         RNA_boolean_set(&op_ptr, "release_confirm", true); | 
					
						
							|  |  |  |         WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &op_ptr); | 
					
						
							|  |  |  |         WM_operator_properties_free(&op_ptr); | 
					
						
							|  |  |  |         return OPERATOR_FINISHED; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return OPERATOR_PASS_THROUGH; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Use with 'TRANSFORM_GGT_gizmo'. */ | 
					
						
							|  |  |  | static void TRANSFORM_OT_from_gizmo(struct wmOperatorType *ot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   /* identifiers */ | 
					
						
							| 
									
										
										
										
											2020-10-07 08:04:53 -05:00
										 |  |  |   ot->name = "Transform from Gizmo"; | 
					
						
							| 
									
										
										
										
											2019-05-24 01:35:48 +10:00
										 |  |  |   ot->description = "Transform selected items by mode type"; | 
					
						
							|  |  |  |   ot->idname = "TRANSFORM_OT_from_gizmo"; | 
					
						
							|  |  |  |   ot->flag = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /* api callbacks */ | 
					
						
							|  |  |  |   ot->invoke = transform_from_gizmo_invoke; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | void transform_operatortypes(void) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |   TransformModeItem *tmode; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-28 06:31:57 +00:00
										 |  |  |   for (tmode = transform_modes; tmode->idname; tmode++) { | 
					
						
							| 
									
										
										
										
											2009-12-21 17:23:44 +00:00
										 |  |  |     WM_operatortype_append(tmode->opfunc); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   WM_operatortype_append(TRANSFORM_OT_transform); | 
					
						
							| 
									
										
										
										
											2009-03-06 15:50:15 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-12-10 10:36:32 +00:00
										 |  |  |   WM_operatortype_append(TRANSFORM_OT_select_orientation); | 
					
						
							|  |  |  |   WM_operatortype_append(TRANSFORM_OT_create_orientation); | 
					
						
							|  |  |  |   WM_operatortype_append(TRANSFORM_OT_delete_orientation); | 
					
						
							| 
									
										
										
										
											2019-05-24 01:35:48 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  |   WM_operatortype_append(TRANSFORM_OT_from_gizmo); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-07-09 02:45:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-08 15:59:51 +11:00
										 |  |  | void ED_keymap_transform(wmKeyConfig *keyconf) | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2018-11-08 15:59:51 +11:00
										 |  |  |   wmKeyMap *modalmap = transform_modal_keymap(keyconf); | 
					
						
							| 
									
										
										
										
											2018-05-13 06:44:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-08 15:59:51 +11:00
										 |  |  |   TransformModeItem *tmode; | 
					
						
							| 
									
										
										
										
											2012-05-22 15:30:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-08 15:59:51 +11:00
										 |  |  |   for (tmode = transform_modes; tmode->idname; tmode++) { | 
					
						
							|  |  |  |     WM_modalkeymap_assign(modalmap, tmode->idname); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-11-08 15:59:51 +11:00
										 |  |  |   WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform"); | 
					
						
							| 
									
										
										
										
											2008-12-29 04:14:27 +00:00
										 |  |  | } |