Blender V2.61 - r43446

ED_transform.h

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