2011-02-21 07:25:24 +00:00
/*
2008-01-01 18:29:19 +00:00
* * * * * * BEGIN GPL LICENSE BLOCK * * * * *
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
2009-07-08 16:17:47 +00:00
* of the License , or ( at your option ) any later version .
2008-01-01 18:29:19 +00:00
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software Foundation ,
2010-02-12 13:34:04 +00:00
* Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 , USA .
2008-01-01 18:29:19 +00:00
*
2009-07-08 16:17:47 +00:00
* The Original Code is Copyright ( C ) 2001 - 2002 by NaN Holding BV .
2008-01-01 18:29:19 +00:00
* All rights reserved .
*
2009-07-08 16:17:47 +00:00
* The Original Code is : all of this file .
*
* Contributor ( s ) : none yet .
2008-01-01 18:29:19 +00:00
*
* * * * * * END GPL LICENSE BLOCK * * * * *
*/
2009-07-08 16:17:47 +00:00
2011-02-21 07:25:24 +00:00
/** \file ED_transform.h
* \ ingroup editors
*/
2012-02-17 18:59:41 +00:00
# ifndef __ED_TRANSFORM_H__
# define __ED_TRANSFORM_H__
2008-01-01 18:29:19 +00:00
2009-07-08 16:17:47 +00:00
/* ******************* Registration Function ********************** */
2013-04-03 09:48:21 +00:00
struct ARegion ;
struct EnumPropertyItem ;
2009-07-08 16:17:47 +00:00
struct ListBase ;
struct Object ;
2013-04-03 09:48:21 +00:00
struct View3D ;
struct bContext ;
2009-07-08 16:17:47 +00:00
struct uiLayout ;
2013-04-03 09:48:21 +00:00
struct wmEvent ;
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
struct wmKeyConfig ;
2013-04-03 09:48:21 +00:00
struct wmKeyMap ;
struct wmOperatorType ;
struct wmWindowManager ;
2009-07-08 16:17:47 +00:00
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
void transform_keymap_for_space ( struct wmKeyConfig * keyconf , struct wmKeyMap * keymap , int spaceid ) ;
2009-07-08 16:17:47 +00:00
void transform_operatortypes ( void ) ;
/* ******************** Macros & Prototypes *********************** */
/* MODE AND NUMINPUT FLAGS */
2013-03-22 05:46:39 +00:00
enum TfmMode {
2009-07-08 16:17:47 +00:00
TFM_INIT = - 1 ,
TFM_DUMMY ,
TFM_TRANSLATION ,
TFM_ROTATION ,
TFM_RESIZE ,
2012-05-22 15:30:14 +00:00
TFM_SKIN_RESIZE ,
2009-07-08 16:17:47 +00:00
TFM_TOSPHERE ,
TFM_SHEAR ,
TFM_WARP ,
TFM_SHRINKFATTEN ,
TFM_TILT ,
TFM_TRACKBALL ,
TFM_PUSHPULL ,
TFM_CREASE ,
TFM_MIRROR ,
TFM_BONESIZE ,
TFM_BONE_ENVELOPE ,
TFM_CURVE_SHRINKFATTEN ,
2012-06-05 14:13:14 +00:00
TFM_MASK_SHRINKFATTEN ,
2009-07-08 16:17:47 +00:00
TFM_BONE_ROLL ,
TFM_TIME_TRANSLATE ,
TFM_TIME_SLIDE ,
TFM_TIME_SCALE ,
TFM_TIME_EXTEND ,
2011-03-02 23:39:08 +00:00
TFM_TIME_DUPLICATE ,
2009-07-08 16:17:47 +00:00
TFM_BAKE_TIME ,
TFM_BEVEL ,
TFM_BWEIGHT ,
2009-09-22 08:41:03 +00:00
TFM_ALIGN ,
2009-12-21 18:56:00 +00:00
TFM_EDGE_SLIDE ,
2013-01-13 14:08:53 +00:00
TFM_VERT_SLIDE ,
2009-12-21 18:56:00 +00:00
TFM_SEQ_SLIDE
2013-03-22 05:46:39 +00:00
} ;
2009-07-08 16:17:47 +00:00
/* TRANSFORM CONTEXTS */
2012-05-12 20:39:39 +00:00
# define CTX_NONE 0
# define CTX_TEXTURE 1
# define CTX_EDGE 2
# define CTX_NO_PET 4
# define CTX_TWEAK 8
# define CTX_NO_MIRROR 16
# define CTX_AUTOCONFIRM 32
# define CTX_BMESH 64
# define CTX_NDOF 128
# define CTX_MOVIECLIP 256
2012-06-04 16:42:58 +00:00
# define CTX_MASK 512
2009-07-08 16:17:47 +00:00
/* Standalone call to get the transformation center corresponding to the current situation
* returns 1 if successful , 0 otherwise ( usually means there ' s no selection )
2009-07-09 02:45:48 +00:00
* ( if 0 is returns , * vec is unmodified )
2009-07-08 16:17:47 +00:00
* */
2012-06-10 09:05:49 +00:00
int calculateTransformCenter ( struct bContext * C , int centerMode , float cent3d [ 3 ] , int cent2d [ 2 ] ) ;
2009-07-08 16:17:47 +00:00
struct TransInfo ;
struct ScrArea ;
struct Base ;
struct Scene ;
struct Object ;
2013-04-03 15:04:24 +00:00
/* UNUSED */
// int BIF_snappingSupported(struct Object *obedit);
2009-07-08 16:17:47 +00:00
struct TransformOrientation ;
struct bContext ;
2009-09-28 19:49:36 +00:00
struct ReportList ;
2009-07-08 16:17:47 +00:00
void BIF_clearTransformOrientation ( struct bContext * C ) ;
void BIF_removeTransformOrientation ( struct bContext * C , struct TransformOrientation * ts ) ;
2009-09-28 19:49:36 +00:00
void BIF_removeTransformOrientationIndex ( struct bContext * C , int index ) ;
void BIF_createTransformOrientation ( struct bContext * C , struct ReportList * reports , char * name , int use , int overwrite ) ;
2009-07-08 16:17:47 +00:00
void BIF_selectTransformOrientation ( struct bContext * C , struct TransformOrientation * ts ) ;
void BIF_selectTransformOrientationValue ( struct bContext * C , int orientation ) ;
2013-03-20 23:14:18 +00:00
void ED_getTransformOrientationMatrix ( const struct bContext * C , float orientation_mat [ 3 ] [ 3 ] , const bool activeOnly ) ;
2009-11-06 21:31:14 +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
struct EnumPropertyItem * BIF_enumTransformOrientation ( struct bContext * C ) ;
2012-05-12 20:39:39 +00:00
const char * BIF_menustringTransformOrientation ( const struct bContext * C , const char * title ) ; /* the returned value was allocated and needs to be freed after use */
2009-07-08 16:17:47 +00:00
int BIF_countTransformOrientation ( const struct bContext * C ) ;
2011-11-05 11:04:28 +00:00
void BIF_TransformSetUndo ( const char * str ) ;
2009-07-08 16:17:47 +00:00
void BIF_selectOrientation ( void ) ;
2009-07-12 02:01:13 +00:00
/* to be able to add operator properties to other operators */
2012-05-12 20:39:39 +00:00
# define P_MIRROR (1 << 0)
# define P_PROPORTIONAL (1 << 1)
# define P_AXIS (1 << 2)
# define P_SNAP (1 << 3)
# define P_GEO_SNAP (P_SNAP | (1 << 4))
# define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5))
# define P_CONSTRAINT (1 << 6)
# define P_OPTIONS (1 << 7)
# define P_CORRECT_UV (1 << 8)
2010-04-02 19:40:51 +00:00
void Transform_Properties ( struct wmOperatorType * ot , int flags ) ;
2009-07-12 02:01:13 +00:00
2009-07-08 16:17:47 +00:00
/* view3d manipulators */
2013-03-13 09:03:46 +00:00
int BIF_do_manipulator ( struct bContext * C , const struct wmEvent * event , struct wmOperator * op ) ;
2009-07-08 16:17:47 +00:00
void BIF_draw_manipulator ( const struct bContext * C ) ;
/* Snapping */
2012-05-12 20:39:39 +00:00
typedef struct DepthPeel {
2009-07-08 16:17:47 +00:00
struct DepthPeel * next , * prev ;
2009-07-09 02:45:48 +00:00
2009-07-08 16:17:47 +00:00
float depth ;
float p [ 3 ] ;
float no [ 3 ] ;
struct Object * ob ;
int flag ;
} DepthPeel ;
struct ListBase ;
2012-06-06 22:38:39 +00:00
typedef enum SnapMode {
2009-07-08 16:17:47 +00:00
SNAP_ALL = 0 ,
SNAP_NOT_SELECTED = 1 ,
SNAP_NOT_OBEDIT = 2
} SnapMode ;
# define SNAP_MIN_DISTANCE 30
2013-04-14 05:37:43 +00:00
# define TRANSFORM_DIST_MAX_RAY (FLT_MAX / 2.0f)
2009-07-08 16:17:47 +00:00
2013-03-08 18:28:26 +00:00
bool peelObjectsTransForm ( struct TransInfo * t , struct ListBase * depth_peels , const float mval [ 2 ] , SnapMode mode ) ;
bool peelObjectsContext ( struct bContext * C , struct ListBase * depth_peels , const float mval [ 2 ] , SnapMode mode ) ;
2013-04-03 07:36:37 +00:00
bool snapObjectsTransform ( struct TransInfo * t , const float mval [ 2 ] , float * r_dist_px , float r_loc [ 3 ] , float r_no [ 3 ] , SnapMode mode ) ;
bool snapObjectsContext ( struct bContext * C , const float mval [ 2 ] , float * r_dist_px , float r_loc [ 3 ] , float r_no [ 3 ] , SnapMode mode ) ;
2013-04-03 09:48:21 +00:00
/* taks args for all settings */
bool snapObjectsEx ( struct Scene * scene , struct Base * base_act , struct View3D * v3d , struct ARegion * ar , struct Object * obedit , short snap_mode ,
const float mval [ 2 ] , float * r_dist_px , float r_loc [ 3 ] , float r_no [ 3 ] , SnapMode mode ) ;
bool snapObjectsRayEx ( struct Scene * scene , struct Base * base_act , struct View3D * v3d , struct ARegion * ar , struct Object * obedit , short snap_mode ,
2013-04-24 17:49:13 +00:00
struct Object * * r_ob , float r_obmat [ 4 ] [ 4 ] ,
2013-04-14 05:37:43 +00:00
const float ray_start [ 3 ] , const float ray_normal [ 3 ] , float * r_ray_dist ,
2013-04-03 09:48:21 +00:00
const float mval [ 2 ] , float * r_dist_px , float r_loc [ 3 ] , float r_no [ 3 ] , SnapMode mode ) ;
2013-04-03 07:36:37 +00:00
bool snapNodesTransform ( struct TransInfo * t , const int mval [ 2 ] , float * r_dist_px , float r_loc [ 2 ] , char * r_node_border , SnapMode mode ) ;
bool snapNodesContext ( struct bContext * C , const int mval [ 2 ] , float * r_dist_px , float r_loc [ 2 ] , char * r_node_border , SnapMode mode ) ;
2008-01-01 18:29:19 +00:00
2009-07-08 16:17:47 +00:00
# endif
2008-01-01 18:29:19 +00:00