Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform.h
| Show First 20 Lines • Show All 288 Lines • ▼ Show 20 Lines | typedef struct TransDataEdgeSlideVert { | ||||
| struct BMVert *v_side[2]; | struct BMVert *v_side[2]; | ||||
| /* add origvert.co to get the original locations */ | /* add origvert.co to get the original locations */ | ||||
| float dir_side[2][3]; | float dir_side[2][3]; | ||||
| int loop_nr; | int loop_nr; | ||||
| } TransDataEdgeSlideVert; | } TransDataEdgeSlideVert; | ||||
| /* store original data so we can correct UV's and similar when sliding */ | |||||
| typedef struct SlideOrigData { | |||||
| /** Set when #origfaces is initialized. */ | |||||
| bool use_origfaces; | |||||
| int cd_loop_mdisp_offset; | |||||
| /** map {BMVert: TransDataGenericSlideVert} */ | |||||
| struct GHash *origverts; | |||||
| struct GHash *origfaces; | |||||
| struct BMesh *bm_origfaces; | |||||
| struct MemArena *arena; | |||||
| /** Number of math BMLoop layers. */ | |||||
| int layer_math_map_num; | |||||
| /** Array size of 'layer_math_map_num' | |||||
| * maps TransDataVertSlideVert.cd_group index to absolute CustomData layer index */ | |||||
| int *layer_math_map; | |||||
| /** Array of slide vert data especially for mirror verts. */ | |||||
| TransDataGenericSlideVert *sv_mirror; | |||||
| int totsv_mirror; | |||||
| } SlideOrigData; | |||||
| typedef struct EdgeSlideData { | typedef struct EdgeSlideData { | ||||
| TransDataEdgeSlideVert *sv; | TransDataEdgeSlideVert *sv; | ||||
| int totsv; | int totsv; | ||||
| int mval_start[2], mval_end[2]; | int mval_start[2], mval_end[2]; | ||||
| struct BMEditMesh *em; | |||||
| SlideOrigData orig_data; | |||||
| int curr_sv_index; | int curr_sv_index; | ||||
| /** when un-clamped - use this index: #TransDataEdgeSlideVert.dir_side */ | /** when un-clamped - use this index: #TransDataEdgeSlideVert.dir_side */ | ||||
| int curr_side_unclamp; | int curr_side_unclamp; | ||||
| } EdgeSlideData; | } EdgeSlideData; | ||||
| typedef struct EdgeSlideParams { | typedef struct EdgeSlideParams { | ||||
| float perc; | float perc; | ||||
| Show All 12 Lines | typedef struct TransDataVertSlideVert { | ||||
| float (*co_link_orig_3d)[3]; | float (*co_link_orig_3d)[3]; | ||||
| int co_link_tot; | int co_link_tot; | ||||
| int co_link_curr; | int co_link_curr; | ||||
| } TransDataVertSlideVert; | } TransDataVertSlideVert; | ||||
| typedef struct VertSlideData { | typedef struct VertSlideData { | ||||
| TransDataVertSlideVert *sv; | TransDataVertSlideVert *sv; | ||||
| int totsv; | int totsv; | ||||
| struct BMEditMesh *em; | |||||
| SlideOrigData orig_data; | |||||
| int curr_sv_index; | int curr_sv_index; | ||||
| /* result of ED_view3d_ob_project_mat_get */ | /* result of ED_view3d_ob_project_mat_get */ | ||||
| float proj_mat[4][4]; | float proj_mat[4][4]; | ||||
| } VertSlideData; | } VertSlideData; | ||||
| typedef struct VertSlideParams { | typedef struct VertSlideParams { | ||||
| float perc; | float perc; | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | typedef struct TransData { | ||||
| */ | */ | ||||
| void *extra; | void *extra; | ||||
| /** Various flags. */ | /** Various flags. */ | ||||
| int flag; | int flag; | ||||
| /** If set, copy of Object or PoseChannel protection. */ | /** If set, copy of Object or PoseChannel protection. */ | ||||
| short protectflag; | short protectflag; | ||||
| } TransData; | } TransData; | ||||
| typedef struct TransDataMirror { | |||||
| /** location of mirrored reference data. */ | |||||
| float *loc_src; | |||||
campbellbarton: Could be a `const` to prevent accidents. | |||||
| /** Location of the data to transform. */ | |||||
| float *loc_dst; | |||||
Done Inline ActionsThink it would be more clear to call loc_src, loc_dst. campbellbarton: Think it would be more clear to call `loc_src`, `loc_dst`. | |||||
| void *extra; | |||||
Done Inline ActionsWould store this as a flag, since multiplying a float by a short isn't all that efficient. campbellbarton: Would store this as a flag, since multiplying a float by a short isn't all that efficient. | |||||
Done Inline ActionsUsed bit-fields mano-wii: Used bit-fields | |||||
| /* `sign` can be -2, -1, 0 or 1. */ | |||||
| int sign_x : 2; | |||||
| int sign_y : 2; | |||||
| int sign_z : 2; | |||||
| } TransDataMirror; | |||||
| typedef struct MouseInput { | typedef struct MouseInput { | ||||
| void (*apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3]); | void (*apply)(struct TransInfo *t, struct MouseInput *mi, const double mval[2], float output[3]); | ||||
| void (*post)(struct TransInfo *t, float values[3]); | void (*post)(struct TransInfo *t, float values[3]); | ||||
| /** Initial mouse position. */ | /** Initial mouse position. */ | ||||
| int imval[2]; | int imval[2]; | ||||
| bool precision; | bool precision; | ||||
| float precision_factor; | float precision_factor; | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | typedef struct TransDataContainer { | ||||
| /** 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 { | ||||
| /* Currently for mesh X mirror only. */ | union { | ||||
| int axis_flag; | struct { | ||||
| /** Set to -1.0f or 1.0 when use_mirror is set. */ | /* For easy access. */ | ||||
| float sign; | uint axis_x : 1; | ||||
| uint axis_y : 1; | |||||
| uint axis_z : 1; | |||||
| }; | |||||
| short axis_flag; | |||||
Done Inline ActionsCan see how this reads nicely but think this could be a flag too. campbellbarton: Can see how this reads nicely but think this could be a flag too.
Since it fits better in a… | |||||
Done Inline Actionsaxis_flag is being used only as a bool. I could rename it to is_mirror_enabled if preferable. mano-wii: `axis_flag` is being used only as a bool. I could rename it to `is_mirror_enabled` if… | |||||
| }; | |||||
| /** Mirror data array. */ | |||||
| TransDataMirror *data; | |||||
| int data_len; | |||||
| } mirror; | } mirror; | ||||
| TransCustomDataContainer custom; | TransCustomDataContainer custom; | ||||
| } TransDataContainer; | } TransDataContainer; | ||||
| typedef struct TransInfo { | typedef struct TransInfo { | ||||
| TransDataContainer *data_container; | TransDataContainer *data_container; | ||||
| int data_container_len; | int data_container_len; | ||||
| ▲ Show 20 Lines • Show All 291 Lines • ▼ Show 20 Lines | enum { | ||||
| TD_BEZTRIPLE = 1 << 12, | TD_BEZTRIPLE = 1 << 12, | ||||
| /** when this is set, don't apply translation changes to this element */ | /** when this is set, don't apply translation changes to this element */ | ||||
| TD_NO_LOC = 1 << 13, | TD_NO_LOC = 1 << 13, | ||||
| /** For Graph Editor autosnap, indicates that point should not undergo autosnapping */ | /** For Graph Editor autosnap, indicates that point should not undergo autosnapping */ | ||||
| TD_NOTIMESNAP = 1 << 14, | TD_NOTIMESNAP = 1 << 14, | ||||
| /** For Graph Editor - curves that can only have int-values | /** For Graph Editor - curves that can only have int-values | ||||
| * need their keyframes tagged with this. */ | * need their keyframes tagged with this. */ | ||||
| TD_INTVALUES = 1 << 15, | TD_INTVALUES = 1 << 15, | ||||
| /** For editmode mirror, clamp to x = 0 */ | /** For editmode mirror, clamp axis to 0 */ | ||||
| TD_MIRROR_EDGE = 1 << 16, | TD_MIRROR_EDGE_X = 1 << 16, | ||||
| TD_MIRROR_EDGE_Y = 1 << 17, | |||||
| TD_MIRROR_EDGE_Z = 1 << 18, | |||||
| /** For fcurve handles, move them along with their keyframes */ | /** For fcurve handles, move them along with their keyframes */ | ||||
| TD_MOVEHANDLE1 = 1 << 17, | TD_MOVEHANDLE1 = 1 << 19, | ||||
| TD_MOVEHANDLE2 = 1 << 18, | TD_MOVEHANDLE2 = 1 << 20, | ||||
| /** Exceptional case with pose bone rotating when a parent bone has 'Local Location' | /** Exceptional case with pose bone rotating when a parent bone has 'Local Location' | ||||
| * option enabled and rotating also transforms it. */ | * option enabled and rotating also transforms it. */ | ||||
| TD_PBONE_LOCAL_MTX_P = 1 << 19, | TD_PBONE_LOCAL_MTX_P = 1 << 21, | ||||
| /** Same as above but for a child bone. */ | /** Same as above but for a child bone. */ | ||||
| TD_PBONE_LOCAL_MTX_C = 1 << 20, | TD_PBONE_LOCAL_MTX_C = 1 << 22, | ||||
| }; | }; | ||||
| /** #TransSnap.status */ | /** #TransSnap.status */ | ||||
| enum { | enum { | ||||
| SNAP_FORCED = 1 << 0, | SNAP_FORCED = 1 << 0, | ||||
| TARGET_INIT = 1 << 1, | TARGET_INIT = 1 << 1, | ||||
| POINT_INIT = 1 << 2, | POINT_INIT = 1 << 2, | ||||
| MULTI_POINTS = 1 << 3, | MULTI_POINTS = 1 << 3, | ||||
| ▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | |||||
| int getTransformOrientation_ex(const struct bContext *C, | int getTransformOrientation_ex(const struct bContext *C, | ||||
| float normal[3], | float normal[3], | ||||
| float plane[3], | float plane[3], | ||||
| const short around); | const short around); | ||||
| int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); | int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); | ||||
| void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | ||||
| void freeEdgeSlideTempFaces(EdgeSlideData *sld); | |||||
| void freeEdgeSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | void freeEdgeSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | ||||
| void projectEdgeSlideData(TransInfo *t, bool is_final); | void projectEdgeSlideData(TransInfo *t, bool is_final); | ||||
| void freeVertSlideTempFaces(VertSlideData *sld); | |||||
| void freeVertSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | void freeVertSlideVerts(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); | ||||
| void projectVertSlideData(TransInfo *t, bool is_final); | void projectVertSlideData(TransInfo *t, bool is_final); | ||||
| /* TODO. transform_query.c */ | /* TODO. transform_query.c */ | ||||
| bool checkUseAxisMatrix(TransInfo *t); | bool checkUseAxisMatrix(TransInfo *t); | ||||
| #define TRANSFORM_SNAP_MAX_PX 100.0f | #define TRANSFORM_SNAP_MAX_PX 100.0f | ||||
| #define TRANSFORM_DIST_INVALID -FLT_MAX | #define TRANSFORM_DIST_INVALID -FLT_MAX | ||||
| Show All 21 Lines | |||||
Could be a const to prevent accidents.