diff options
Diffstat (limited to 'source/blender/editors/transform/transform.h')
-rw-r--r-- | source/blender/editors/transform/transform.h | 138 |
1 files changed, 70 insertions, 68 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 31e8f262557..227330e8524 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -36,7 +36,9 @@ #include "transform_data.h" -/* ************************** Types ***************************** */ +/* -------------------------------------------------------------------- */ +/** \name Types/ + * \{ */ struct ARegion; struct Depsgraph; @@ -58,7 +60,7 @@ struct wmKeyConfig; struct wmKeyMap; struct wmTimer; -/* transinfo->redraw */ +/** #TransInfo.redraw */ typedef enum { TREDRAW_NOTHING = 0, TREDRAW_HARD = 1, @@ -264,8 +266,8 @@ typedef struct TransInfo { TransDataContainer *data_container; int data_container_len; - /** eTransConvertType - * TODO: It should be a member of TransDataContainer. */ + /** #eTransConvertType + * TODO: It should be a member of #TransDataContainer. */ int data_type; /** Combine length of all #TransDataContainer.data_len @@ -282,8 +284,6 @@ typedef struct TransInfo { short state; /** Current context/options for transform. */ int options; - /** Initial value for some transformations (and rotation angle). */ - float val; void (*transform)(struct TransInfo *, const int[2]); /** Transform function pointer. */ eRedrawFlag (*handleEvent)(struct TransInfo *, const struct wmEvent *); @@ -316,9 +316,9 @@ typedef struct TransInfo { /** maximum index on the input vector. */ short idx_max; /** Snapping Gears. */ - float snap[3]; + float snap[2]; /** Spatial snapping gears(even when rotating, scaling... etc). */ - float snap_spatial[3]; + float snap_spatial[2]; /** Mouse side of the current frame, 'L', 'R' or 'B' */ char frame_side; @@ -331,16 +331,16 @@ typedef struct TransInfo { float persinv[4][4]; short persp; short around; - /** spacetype where transforming is. */ + /** space-type where transforming is. */ char spacetype; /** Choice of custom cursor with or without a help line from the gizmo to the mouse position. */ char helpline; - /** Avoid looking inside TransDataContainer obedit. */ + /** Avoid looking inside #TransDataContainer.obedit. */ short obedit_type; /** translation, to show for widget. */ float vec[3]; - /** rot/rescale, to show for widget. */ + /** Rotate/re-scale, to show for widget. */ float mat[3][3]; /** orientation matrix of the current space. */ @@ -370,7 +370,7 @@ typedef struct TransInfo { /** Value taken as input, either through mouse coordinates or entered as a parameter. */ float values[4]; - /** Offset applied ontop of modal input. */ + /** Offset applied on top of modal input. */ float values_modal_offset[4]; /** Final value of the transformation (displayed in the redo panel). @@ -399,7 +399,7 @@ typedef struct TransInfo { struct ViewLayer *view_layer; struct ToolSettings *settings; struct wmTimer *animtimer; - /** so we can do lookups for header text. */ + /** Needed so we can perform a look up for header text. */ struct wmKeyMap *keymap; /** assign from the operator, or can be NULL. */ struct ReportList *reports; @@ -419,9 +419,13 @@ typedef struct TransInfo { TransCustomDataContainer custom; } TransInfo; -/* ******************** Macros & Prototypes *********************** */ +/** \} */ -/* transinfo->state */ +/* -------------------------------------------------------------------- */ +/** \name Flags + * \{ */ + +/** #TransInfo.state */ enum { TRANS_STARTING = 0, TRANS_RUNNING = 1, @@ -429,7 +433,7 @@ enum { TRANS_CANCEL = 3, }; -/* transinfo->flag */ +/** #TransInfo.flag */ enum { T_OBJECT = 1 << 0, /** \note We could remove 'T_EDIT' and use 'obedit_type', for now ensure they're in sync. */ @@ -454,11 +458,11 @@ enum { T_PROP_EDIT_ALL = T_PROP_EDIT | T_PROP_CONNECTED | T_PROP_PROJECTED, T_V3D_ALIGN = 1 << 13, - /** For 2d views like uv or fcurve. */ + /** For 2D views such as UV or f-curve. */ T_2D_EDIT = 1 << 14, T_CLIP_UV = 1 << 15, - /** Auto-ik is on. */ + /** Auto-IK is on. */ T_AUTOIK = 1 << 16, /** Don't use mirror even if the data-block option is set. */ @@ -471,7 +475,7 @@ enum { /** To specify if we save back settings at the end. */ T_MODAL = 1 << 19, - /** No retopo. */ + /** No re-topology (projection). */ T_NO_PROJECT = 1 << 20, T_RELEASE_CONFIRM = 1 << 21, @@ -486,8 +490,9 @@ enum { T_CLNOR_REBUILD = 1 << 25, - /* Special Aftertrans. */ + /** Merges unselected into selected after transforming (runs after transforming). */ T_AUTOMERGE = 1 << 26, + /** Runs auto-merge & splits. */ T_AUTOSPLIT = 1 << 27, }; @@ -497,6 +502,7 @@ enum { MOD_PRECISION = 1 << 1, MOD_SNAP = 1 << 2, MOD_SNAP_INVERT = 1 << 3, + MOD_CONSTRAINT_PLANE = 1 << 4, }; /* use node center for transform instead of upper-left corner. @@ -504,8 +510,6 @@ enum { */ // #define USE_NODE_CENTER -/* ******************************************************************************** */ - /** #TransInfo.helpline */ enum { HLP_NONE = 0, @@ -539,8 +543,14 @@ enum { MULTI_POINTS = 1 << 3, }; -/** keymap modal items */ -/* NOTE: these values are saved in keymap files, do not change then but just add new ones. */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Keymap Modal Items + * + * \note these values are saved in key-map files, do not change then but just add new ones. + * \{ */ + enum { TFM_MODAL_CANCEL = 1, TFM_MODAL_CONFIRM = 2, @@ -560,7 +570,9 @@ enum { TFM_MODAL_ADD_SNAP = 16, TFM_MODAL_REMOVE_SNAP = 17, - /* 18 and 19 used by numinput, defined in transform.h */ + /* 18 and 19 used by number-input, defined in `ED_numinput.h`. */ + // NUM_MODAL_INCREMENT_UP = 18, + // NUM_MODAL_INCREMENT_DOWN = 19, TFM_MODAL_PROPSIZE_UP = 20, TFM_MODAL_PROPSIZE_DOWN = 21, @@ -570,14 +582,21 @@ enum { TFM_MODAL_EDGESLIDE_UP = 24, TFM_MODAL_EDGESLIDE_DOWN = 25, - /* for analog input, like trackpad */ + /** For analog input, like track-pad. */ TFM_MODAL_PROPSIZE = 26, - /* node editor insert offset (aka auto-offset) direction toggle */ + /** Node editor insert offset (also called auto-offset) direction toggle. */ TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27, TFM_MODAL_AUTOCONSTRAINT = 28, + TFM_MODAL_AUTOCONSTRAINTPLANE = 29, }; +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Public Transform API + * \{ */ + bool initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, @@ -601,18 +620,31 @@ void removeAspectRatio(TransInfo *t, float vec[2]); struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf); -/*********************** transform_gizmo.c ********** */ +/** \} */ +/* -------------------------------------------------------------------- */ +/** \name Gizmo + * \{ */ + +/* transform_gizmo.c */ #define GIZMO_AXIS_LINE_WIDTH 2.0f -/* return 0 when no gimbal for selection */ bool gimbal_axis(struct Object *ob, float gmat[3][3]); void drawDial3d(const TransInfo *t); -/*********************** TransData Creation and General Handling *********** */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name TransData Creation and General Handling + * \{ */ + bool transdata_check_local_islands(TransInfo *t, short around); -/********************** Mouse Input ******************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Mouse Input + * \{ */ typedef enum { INPUT_NONE, @@ -646,7 +678,11 @@ void setCustomPoints(TransInfo *t, MouseInput *mi, const int start[2], const int void setCustomPointsFromDirection(TransInfo *t, MouseInput *mi, const float dir[2]); void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float values[3])); -/*********************** Generics ********************************/ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Generics + * \{ */ void initTransDataContainers_FromObjectData(TransInfo *t, struct Object *obact, @@ -690,42 +726,6 @@ void getViewVector(const TransInfo *t, const float coord[3], float vec[3]); void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot); -/*********************** Transform Orientations ******************************/ -short transform_orientation_matrix_get(struct bContext *C, - TransInfo *t, - const short orientation, - const float custom[3][3], - float r_spacemtx[3][3]); -const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type); -void transform_orientations_current_set(struct TransInfo *t, const short orient_index); - -/* Those two fill in mat and return non-zero on success */ -bool createSpaceNormal(float mat[3][3], const float normal[3]); -bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]); - -struct TransformOrientation *addMatrixSpace(struct bContext *C, - float mat[3][3], - const char *name, - const bool overwrite); -void applyTransformOrientation(const struct TransformOrientation *ts, - float r_mat[3][3], - char r_name[64]); - -enum { - ORIENTATION_NONE = 0, - ORIENTATION_NORMAL = 1, - ORIENTATION_VERT = 2, - ORIENTATION_EDGE = 3, - ORIENTATION_FACE = 4, -}; -#define ORIENTATION_USE_PLANE(ty) ELEM(ty, ORIENTATION_NORMAL, ORIENTATION_EDGE, ORIENTATION_FACE) - -int getTransformOrientation_ex(const struct bContext *C, - float normal[3], - float plane[3], - const short around); -int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); - void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); /* TODO. transform_query.c */ @@ -752,3 +752,5 @@ bool checkUseAxisMatrix(TransInfo *t); *tc_end = (t)->data_container + (t)->data_container_len; \ th != tc_end; \ th++, i++) + +/** \} */ |