Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.h
| Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | typedef struct TransCon { | ||||
| /* Note: if 'tc' is NULL, 'td' must also be NULL. | /* Note: if 'tc' is NULL, 'td' must also be NULL. | ||||
| * For constraints that needs to draw differently from the other | * For constraints that needs to draw differently from the other | ||||
| * uses this instead of the generic draw function. */ | * uses this instead of the generic draw function. */ | ||||
| /** Apply function pointer for linear vectorial transformation | /** Apply function pointer for linear vectorial transformation | ||||
| * The last three parameters are pointers to the in/out/printable vectors. */ | * The last three parameters are pointers to the in/out/printable vectors. */ | ||||
| void (*applyVec)(struct TransInfo *t, | void (*applyVec)(struct TransInfo *t, | ||||
| struct TransDataContainer *tc, | struct TransDataContainer *tc, | ||||
| struct TransData *td, | const int tdi, | ||||
| const float in[3], | const float in[3], | ||||
| float out[3]); | float out[3]); | ||||
| /** Apply function pointer for size transformation. */ | /** Apply function pointer for size transformation. */ | ||||
| void (*applySize)(struct TransInfo *t, | void (*applySize)(struct TransInfo *t, | ||||
| struct TransDataContainer *tc, | struct TransDataContainer *tc, | ||||
| struct TransData *td, | const int tdi, | ||||
| float smat[3][3]); | float smat[3][3]); | ||||
| /** Apply function pointer for rotation transformation */ | /** Apply function pointer for rotation transformation */ | ||||
| void (*applyRot)(struct TransInfo *t, | void (*applyRot)(struct TransInfo *t, | ||||
| struct TransDataContainer *tc, | struct TransDataContainer *tc, | ||||
| struct TransData *td, | const int tdi, | ||||
| float vec[3], | float vec[3], | ||||
| float *angle); | float *angle); | ||||
| } TransCon; | } TransCon; | ||||
| typedef struct TransDataExtension { | |||||
| /** Initial object drot. */ | |||||
| float drot[3]; | |||||
| // /* Initial object drotAngle, TODO: not yet implemented */ | |||||
| // float drotAngle; | |||||
| // /* Initial object drotAxis, TODO: not yet implemented */ | |||||
| // float drotAxis[3]; | |||||
| /** Initial object delta quat. */ | |||||
| float dquat[4]; | |||||
| /** Initial object delta scale. */ | |||||
| float dscale[3]; | |||||
| /** Rotation of the data to transform. */ | |||||
| float *rot; | |||||
| /** Initial rotation. */ | |||||
| float irot[3]; | |||||
| /** Rotation quaternion of the data to transform. */ | |||||
| float *quat; | |||||
| /** Initial rotation quaternion. */ | |||||
| float iquat[4]; | |||||
| /** Rotation angle of the data to transform. */ | |||||
| float *rotAngle; | |||||
| /** Initial rotation angle. */ | |||||
| float irotAngle; | |||||
| /** Rotation axis of the data to transform. */ | |||||
| float *rotAxis; | |||||
| /** Initial rotation axis. */ | |||||
| float irotAxis[4]; | |||||
| /** Size of the data to transform. */ | |||||
| float *size; | |||||
| /** Initial size. */ | |||||
| float isize[3]; | |||||
| /** Object matrix. */ | |||||
| float obmat[4][4]; | |||||
| /** Use instead of #TransData.smtx, | |||||
| * It is the same but without the #Bone.bone_mat, see #TD_PBONE_LOCAL_MTX_C. */ | |||||
| float l_smtx[3][3]; | |||||
| /** The rotscale matrix of pose bone, to allow using snap-align in translation mode, | |||||
| * when td->mtx is the loc pose bone matrix (and hence can't be used to apply | |||||
| * rotation in some cases, namely when a bone is in "NoLocal" or "Hinge" mode)... */ | |||||
| float r_mtx[3][3]; | |||||
| /** Inverse of previous one. */ | |||||
| float r_smtx[3][3]; | |||||
| /** Rotation mode, as defined in #eRotationModes (DNA_action_types.h). */ | |||||
| int rotOrder; | |||||
| /** Original object transformation used for rigid bodies. */ | |||||
| float oloc[3], orot[3], oquat[4], orotAxis[3], orotAngle; | |||||
| } TransDataExtension; | |||||
| typedef struct TransData2D { | typedef struct TransData2D { | ||||
| /** Location of data used to transform (x,y,0). */ | /** Location of data used to transform (x,y,0). */ | ||||
| float loc[3]; | float loc[3]; | ||||
| /** Pointer to real 2d location of data. */ | /** Pointer to real 2d location of data. */ | ||||
| float *loc2d; | float *loc2d; | ||||
| /** Pointer to handle locations, if handles aren't being moved independently. */ | /** Pointer to handle locations, if handles aren't being moved independently. */ | ||||
| float *h1, *h2; | float *h1, *h2; | ||||
| float ih1[2], ih2[2]; | float ih1[2], ih2[2]; | ||||
| } TransData2D; | } TransData2D; | ||||
| /** | |||||
| * Used to store 2 handles for each #TransData in case the other handle wasn't selected. | |||||
| * Also to unset temporary flags. | |||||
| */ | |||||
| typedef struct TransDataCurveHandleFlags { | |||||
| char ih1, ih2; | |||||
| char *h1, *h2; | |||||
| } TransDataCurveHandleFlags; | |||||
| /** Used for sequencer transform. */ | /** Used for sequencer transform. */ | ||||
| typedef struct TransDataSeq { | typedef struct TransDataSeq { | ||||
| struct Sequence *seq; | struct Sequence *seq; | ||||
| /** A copy of #Sequence.flag that may be modified for nested strips. */ | /** A copy of #Sequence.flag that may be modified for nested strips. */ | ||||
| int flag; | int flag; | ||||
| /** Use this so we can have transform data at the strips start, | /** Use this so we can have transform data at the strips start, | ||||
| * but apply correctly to the start frame. */ | * but apply correctly to the start frame. */ | ||||
| int start_offset; | int start_offset; | ||||
| Show All 32 Lines | typedef struct TransDataNla { | ||||
| float h2[3]; | float h2[3]; | ||||
| /** index of track that strip is currently in. */ | /** index of track that strip is currently in. */ | ||||
| int trackIndex; | int trackIndex; | ||||
| /** handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends. */ | /** handle-index: 0 for dummy entry, -1 for start, 1 for end, 2 for both ends. */ | ||||
| int handle; | int handle; | ||||
| } TransDataNla; | } TransDataNla; | ||||
| typedef struct TransData { | |||||
| /** Distance needed to affect element (for Proportionnal Editing). */ | |||||
| float dist; | |||||
| /** Distance to the nearest element (for Proportionnal Editing). */ | |||||
| float rdist; | |||||
| /** Factor of the transformation (for Proportionnal Editing). */ | |||||
| float factor; | |||||
| /** Location of the data to transform. */ | |||||
| float *loc; | |||||
| /** Initial location. */ | |||||
| float iloc[3]; | |||||
| /** Value pointer for special transforms. */ | |||||
| float *val; | |||||
| /** Old value. */ | |||||
| float ival; | |||||
| /** Individual data center. */ | |||||
| float center[3]; | |||||
| /** Transformation matrix from data space to global space. */ | |||||
| float mtx[3][3]; | |||||
| /** Transformation matrix from global space to data space. */ | |||||
| float smtx[3][3]; | |||||
| /** Axis orientation matrix of the data. */ | |||||
| float axismtx[3][3]; | |||||
| struct Object *ob; | |||||
| /** For objects/bones, the first constraint in its constraint stack. */ | |||||
| struct bConstraint *con; | |||||
| /** For objects, poses. 1 single malloc per TransInfo! */ | |||||
| TransDataExtension *ext; | |||||
| /** for curves, stores handle flags for modification/cancel. */ | |||||
| TransDataCurveHandleFlags *hdata; | |||||
| /** | |||||
| * Extra data (mirrored element pointer, in editmode mesh to BMVert) | |||||
| * (editbone for roll fixing) (...). | |||||
| */ | |||||
| void *extra; | |||||
| /** Various flags. */ | |||||
| int flag; | |||||
| /** If set, copy of Object or PoseChannel protection. */ | |||||
| short protectflag; | |||||
| } TransData; | |||||
| typedef struct TransDataMirror { | typedef struct TransDataMirror { | ||||
| /** location of mirrored reference data. */ | /** location of mirrored reference data. */ | ||||
| const float *loc_src; | const float *loc_src; | ||||
| /** Location of the data to transform. */ | /** Location of the data to transform. */ | ||||
| float *loc_dst; | float *loc_dst; | ||||
| void *extra; | void *extra; | ||||
| /* `sign` can be -2, -1, 0 or 1. */ | /* `sign` can be -2, -1, 0 or 1. */ | ||||
| int sign_x : 2; | int sign_x : 2; | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | typedef struct TransCustomDataContainer { | ||||
| union { | union { | ||||
| TransCustomData mode, first_elem; | TransCustomData mode, first_elem; | ||||
| }; | }; | ||||
| TransCustomData type; | TransCustomData type; | ||||
| } TransCustomDataContainer; | } TransCustomDataContainer; | ||||
| #define TRANS_CUSTOM_DATA_ELEM_MAX (sizeof(TransCustomDataContainer) / sizeof(TransCustomData)) | #define TRANS_CUSTOM_DATA_ELEM_MAX (sizeof(TransCustomDataContainer) / sizeof(TransCustomData)) | ||||
| typedef struct TransDataContainer { | typedef struct TransDataContainer { | ||||
| /** | /** Transformed data. */ | ||||
| * Use for cases we care about the active, eg: active vert of active mesh. | struct TransData *data; | ||||
| * if set this will _always_ be the first item in the array. | |||||
| */ | |||||
| bool is_active; | |||||
| /** Transformed data (array). */ | |||||
| TransData *data; | |||||
| /** Total number of transformed data. */ | |||||
| int data_len; | |||||
| /** Transformed data extension (array). */ | |||||
| TransDataExtension *data_ext; | |||||
| /** Transformed data for 2d (array). */ | /** Transformed data for 2d (array). */ | ||||
| TransData2D *data_2d; | TransData2D *data_2d; | ||||
| /* Same as TransData->elem_len. */ | |||||
| int data_len; | |||||
| struct Object *obedit; | struct Object *obedit; | ||||
| /** If 't->flag & T_POSE', this denotes pose object. */ | |||||
| struct Object *poseobj; | |||||
| TransCustomDataContainer custom; | |||||
| /** | |||||
| * Store matrix, this avoids having to have duplicate check all over | |||||
| * Typically: 'obedit->obmat' or 'poseobj->obmat', but may be used elsewhere too. | |||||
| */ | |||||
| bool use_local_mat; | |||||
| float mat[4][4]; | float mat[4][4]; | ||||
| float imat[4][4]; | float imat[4][4]; | ||||
| /** 3x3 copies of matrices above. */ | /** 3x3 copies of matrices above. */ | ||||
| float mat3[3][3]; | float mat3[3][3]; | ||||
| float imat3[3][3]; | float imat3[3][3]; | ||||
| /** Normalized 'mat3' */ | /** Normalized 'mat3'. */ | ||||
| float mat3_unit[3][3]; | float mat3_unit[3][3]; | ||||
| /** if 't->flag & T_POSE', this denotes pose object */ | |||||
| struct Object *poseobj; | |||||
| /** Center of transformation (in local-space), Calculated from #TransInfo.center_global. */ | /** Center of transformation (in local-space), Calculated from #TransInfo.center_global. */ | ||||
| float center_local[3]; | float center_local[3]; | ||||
| /** | /** Mirror option. */ | ||||
| * Mirror option | |||||
| */ | |||||
| struct { | struct { | ||||
| /** Mirror data array. */ | |||||
| TransDataMirror *data; | |||||
| int data_len; | |||||
| union { | union { | ||||
| struct { | struct { | ||||
| uint axis_x : 1; | uint axis_x : 1; | ||||
| uint axis_y : 1; | uint axis_y : 1; | ||||
| uint axis_z : 1; | uint axis_z : 1; | ||||
| }; | }; | ||||
| /* For easy checking. */ | /* For easy checking. */ | ||||
| char use_mirror_any; | char use_mirror_any; | ||||
| }; | }; | ||||
| /** Mirror data array. */ | |||||
| TransDataMirror *data; | |||||
| int data_len; | |||||
| } mirror; | } mirror; | ||||
| TransCustomDataContainer custom; | /** Use for cases we care about the active, eg: active vert of active mesh. | ||||
| * if set this will _always_ be the first item in the array. */ | |||||
| bool is_active; | |||||
| /** Store matrix, this avoids having to have duplicate check all over | |||||
| * Typically: 'obedit->obmat' or 'poseobj->obmat', but may be used elsewhere too. */ | |||||
| bool use_local_mat; | |||||
| } TransDataContainer; | } TransDataContainer; | ||||
| typedef struct TransInfo { | typedef struct TransInfo { | ||||
| TransDataContainer *data_container; | TransDataContainer *data_container; | ||||
| int data_container_len; | int data_container_len; | ||||
| /** Combine length of all #TransDataContainer.data_len | /** Combine length of all #TransDataContainer.data_len | ||||
| * Use to check if nothing is selected or if we have a single selection. */ | * Use to check if nothing is selected or if we have a single selection. */ | ||||
| int data_len_all; | int data_len_all; | ||||
| ▲ Show 20 Lines • Show All 450 Lines • ▼ Show 20 Lines | |||||
| void calculateCenterCursor2D(TransInfo *t, float r_center[2]); | void calculateCenterCursor2D(TransInfo *t, float r_center[2]); | ||||
| void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]); | void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]); | ||||
| bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]); | bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]); | ||||
| void calculatePropRatio(TransInfo *t); | void calculatePropRatio(TransInfo *t); | ||||
| void getViewVector(const TransInfo *t, const float coord[3], float vec[3]); | 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 ******************************/ | /*********************** Transform Orientations ******************************/ | ||||
| short transform_orientation_matrix_get(struct bContext *C, | short transform_orientation_matrix_get(struct bContext *C, | ||||
| TransInfo *t, | TransInfo *t, | ||||
| const short orientation, | const short orientation, | ||||
| const float custom[3][3], | const float custom[3][3], | ||||
| float r_spacemtx[3][3]); | float r_spacemtx[3][3]); | ||||
| const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type); | const char *transform_orientations_spacename_get(TransInfo *t, const short orient_type); | ||||
| void transform_orientations_current_set(struct TransInfo *t, const short orient_index); | void transform_orientations_current_set(struct TransInfo *t, const short orient_index); | ||||
| ▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines | |||||