Blender  V2.59
ED_transform.h
Go to the documentation of this file.
00001 /*
00002  * $Id: ED_transform.h 38972 2011-08-03 08:02:32Z campbellbarton $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 
00034 #ifndef ED_TRANSFORM_H
00035 #define ED_TRANSFORM_H
00036 
00037 /* ******************* Registration Function ********************** */
00038 
00039 struct wmWindowManager;
00040 struct wmOperatorType;
00041 struct ListBase;
00042 struct wmEvent;
00043 struct bContext;
00044 struct Object;
00045 struct uiLayout;
00046 struct EnumPropertyItem;
00047 struct wmOperatorType;
00048 struct wmKeyMap;
00049 struct wmKeyConfig;
00050 
00051 void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid);
00052 void transform_operatortypes(void);
00053 
00054 /* ******************** Macros & Prototypes *********************** */
00055 
00056 /* MODE AND NUMINPUT FLAGS */
00057 enum {
00058         TFM_INIT = -1,
00059         TFM_DUMMY,
00060         TFM_TRANSLATION,
00061         TFM_ROTATION,
00062         TFM_RESIZE,
00063         TFM_TOSPHERE,
00064         TFM_SHEAR,
00065         TFM_WARP,
00066         TFM_SHRINKFATTEN,
00067         TFM_TILT,
00068         TFM_TRACKBALL,
00069         TFM_PUSHPULL,
00070         TFM_CREASE,
00071         TFM_MIRROR,
00072         TFM_BONESIZE,
00073         TFM_BONE_ENVELOPE,
00074         TFM_CURVE_SHRINKFATTEN,
00075         TFM_BONE_ROLL,
00076         TFM_TIME_TRANSLATE,
00077         TFM_TIME_SLIDE,
00078         TFM_TIME_SCALE,
00079         TFM_TIME_EXTEND,
00080         TFM_TIME_DUPLICATE,
00081         TFM_BAKE_TIME,
00082         TFM_BEVEL,
00083         TFM_BWEIGHT,
00084         TFM_ALIGN,
00085         TFM_EDGE_SLIDE,
00086         TFM_SEQ_SLIDE
00087 } TfmMode;
00088 
00089 /* TRANSFORM CONTEXTS */
00090 #define CTX_NONE                        0
00091 #define CTX_TEXTURE                     1
00092 #define CTX_EDGE                        2
00093 #define CTX_NO_PET                      4
00094 #define CTX_TWEAK                       8
00095 #define CTX_NO_MIRROR           16
00096 #define CTX_AUTOCONFIRM         32
00097 #define CTX_BMESH                       64
00098 #define CTX_NDOF                        128
00099 
00100 /* Standalone call to get the transformation center corresponding to the current situation
00101  * returns 1 if successful, 0 otherwise (usually means there's no selection)
00102  * (if 0 is returns, *vec is unmodified)
00103  * */
00104 int calculateTransformCenter(struct bContext *C, int centerMode, float *vec);
00105 
00106 struct TransInfo;
00107 struct ScrArea;
00108 struct Base;
00109 struct Scene;
00110 struct Object;
00111 
00112 void BIF_setSingleAxisConstraint(float vec[3], char *text);
00113 void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text);
00114 void BIF_setLocalAxisConstraint(char axis, char *text);
00115 void BIF_setLocalLockConstraint(char axis, char *text);
00116 
00117 int BIF_snappingSupported(struct Object *obedit);
00118 
00119 struct TransformOrientation;
00120 struct bContext;
00121 struct ReportList;
00122 
00123 void BIF_clearTransformOrientation(struct bContext *C);
00124 void BIF_removeTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
00125 void BIF_removeTransformOrientationIndex(struct bContext *C, int index);
00126 void BIF_createTransformOrientation(struct bContext *C, struct ReportList *reports, char *name, int use, int overwrite);
00127 int BIF_menuselectTransformOrientation(void);
00128 void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *ts);
00129 void BIF_selectTransformOrientationValue(struct bContext *C, int orientation);
00130 
00131 void ED_getTransformOrientationMatrix(const struct bContext *C, float orientation_mat[][3], int activeOnly);
00132 
00133 struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C);
00134 const char * BIF_menustringTransformOrientation(const struct bContext *C, const char *title); /* the returned value was allocated and needs to be freed after use */
00135 int BIF_countTransformOrientation(const struct bContext *C);
00136 
00137 void BIF_TransformSetUndo(char *str);
00138 
00139 void BIF_selectOrientation(void);
00140 
00141 /* to be able to add operator properties to other operators */
00142 
00143 #define P_MIRROR                (1 << 0)
00144 #define P_PROPORTIONAL  (1 << 1)
00145 #define P_AXIS                  (1 << 2)
00146 #define P_SNAP                  (1 << 3)
00147 #define P_GEO_SNAP              (P_SNAP|(1 << 4))
00148 #define P_ALIGN_SNAP    (P_GEO_SNAP|(1 << 5))
00149 #define P_CONSTRAINT    (1 << 6)
00150 #define P_OPTIONS               (1 << 7)
00151 #define P_CORRECT_UV    (1 << 8)
00152 
00153 void Transform_Properties(struct wmOperatorType *ot, int flags);
00154 
00155 /* view3d manipulators */
00156 
00157 int BIF_do_manipulator(struct bContext *C, struct wmEvent *event, struct wmOperator *op);
00158 void BIF_draw_manipulator(const struct bContext *C);
00159 
00160 /* Snapping */
00161 
00162 
00163 typedef struct DepthPeel
00164 {
00165         struct DepthPeel *next, *prev;
00166 
00167         float depth;
00168         float p[3];
00169         float no[3];
00170         struct Object *ob;
00171         int flag;
00172 } DepthPeel;
00173 
00174 struct ListBase;
00175 
00176 typedef enum SnapMode
00177 {
00178         SNAP_ALL = 0,
00179         SNAP_NOT_SELECTED = 1,
00180         SNAP_NOT_OBEDIT = 2
00181 } SnapMode;
00182 
00183 #define SNAP_MIN_DISTANCE 30
00184 
00185 int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, float mval[2]);
00186 int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, float mval[2]);
00187 int snapObjectsTransform(struct TransInfo *t, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
00188 int snapObjectsContext(struct bContext *C, float mval[2], int *dist, float *loc, float *no, SnapMode mode);
00189 
00190 #endif
00191