2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file ED_transform.h
32 #ifndef __ED_TRANSFORM_H__
33 #define __ED_TRANSFORM_H__
35 /* ******************* Registration Function ********************** */
45 struct wmOperatorType;
48 struct SnapObjectContext;
49 struct SnapObjectParams;
51 void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid);
52 void transform_operatortypes(void);
54 /* ******************** Macros & Prototypes *********************** */
56 /* MODE AND NUMINPUT FLAGS */
75 TFM_CURVE_SHRINKFATTEN,
76 TFM_MASK_SHRINKFATTEN,
77 TFM_GPENCIL_SHRINKFATTEN,
85 TFM_DEPRECATED, /* was BEVEL */
91 TFM_BONE_ENVELOPE_DIST,
94 /* TRANSFORM CONTEXTS */
96 #define CTX_TEXTURE (1 << 0)
97 #define CTX_EDGE (1 << 1)
98 #define CTX_NO_PET (1 << 2)
99 #define CTX_NO_MIRROR (1 << 3)
100 #define CTX_AUTOCONFIRM (1 << 4)
101 #define CTX_MOVIECLIP (1 << 6)
102 #define CTX_MASK (1 << 7)
103 #define CTX_PAINT_CURVE (1 << 8)
104 #define CTX_GPENCIL_STROKES (1 << 9)
106 /* Standalone call to get the transformation center corresponding to the current situation
107 * returns 1 if successful, 0 otherwise (usually means there's no selection)
108 * (if 0 is returns, *vec is unmodified)
110 bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2]);
115 struct wmManipulatorGroup;
116 struct wmManipulatorGroupType;
120 // int BIF_snappingSupported(struct Object *obedit);
122 struct TransformOrientation;
126 void BIF_clearTransformOrientation(struct bContext *C);
127 void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
128 void BIF_removeTransformOrientationIndex(struct bContext *C, int index);
129 void BIF_createTransformOrientation(struct bContext *C, struct ReportList *reports,
130 const char *name, const bool use_view,
131 const bool activate, const bool overwrite);
132 void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
133 void BIF_selectTransformOrientationValue(struct View3D *v3d, int orientation);
135 void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[3][3], const short around);
137 int BIF_countTransformOrientation(const struct bContext *C);
139 /* to be able to add operator properties to other operators */
141 #define P_MIRROR (1 << 0)
142 #define P_MIRROR_DUMMY (P_MIRROR | (1 << 9))
143 #define P_PROPORTIONAL (1 << 1)
144 #define P_AXIS (1 << 2)
145 #define P_SNAP (1 << 3)
146 #define P_GEO_SNAP (P_SNAP | (1 << 4))
147 #define P_ALIGN_SNAP (P_GEO_SNAP | (1 << 5))
148 #define P_CONSTRAINT (1 << 6)
149 #define P_OPTIONS (1 << 7)
150 #define P_CORRECT_UV (1 << 8)
151 #define P_NO_DEFAULTS (1 << 10)
152 #define P_NO_TEXSPACE (1 << 11)
153 #define P_CENTER (1 << 12)
154 #define P_GPENCIL_EDIT (1 << 13)
156 void Transform_Properties(struct wmOperatorType *ot, int flags);
158 /* transform manipulators */
160 void TRANSFORM_WGT_manipulator(struct wmManipulatorGroupType *wgt);
161 void VIEW3D_WGT_xform_cage(struct wmManipulatorGroupType *wgt);
163 bool ED_widgetgroup_manipulator2d_poll(const struct bContext *C, struct wmManipulatorGroupType *wgt);
164 void ED_widgetgroup_manipulator2d_setup(const struct bContext *C, struct wmManipulatorGroup *mgroup);
165 void ED_widgetgroup_manipulator2d_refresh(const struct bContext *C, struct wmManipulatorGroup *mgroup);
166 void ED_widgetgroup_manipulator2d_draw_prepare(const struct bContext *C, struct wmManipulatorGroup *mgroup);
171 #define SNAP_MIN_DISTANCE 30
173 bool peelObjectsTransform(
176 const bool use_peel_object,
178 float r_loc[3], float r_no[3], float *r_thickness);
179 bool peelObjectsSnapContext(
180 struct SnapObjectContext *sctx,
182 const struct SnapObjectParams *params,
183 const bool use_peel_object,
185 float r_loc[3], float r_no[3], float *r_thickness);
187 bool snapObjectsTransform(
188 struct TransInfo *t, const float mval[2],
191 float r_loc[3], float r_no[3]);
192 bool snapNodesTransform(
193 struct TransInfo *t, const int mval[2],
195 float r_loc[2], float *r_dist_px, char *r_node_border);
197 #endif /* __ED_TRANSFORM_H__ */