From f2c52aa0e1a5a6905849daa299ab907e60cab983 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 29 Jun 2021 20:13:55 +1000 Subject: Cleanup: use 'const' arguments in transform calculation Use const arguments to simplify further optimizations. Transforming elements shouldn't need to change their containers data-structures. ElementResize for grease pencil stroke thickness was modifying TransInfo.num & TransInfo.values_final. Now copies are operated on to preserve const correctness although it's worth investigating if this can be avoided altogether. --- source/blender/editors/transform/transform_mode.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/transform/transform_mode.h') diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index a2b95eb3de4..027fb6b6982 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -41,22 +41,28 @@ typedef struct TransDataGenericSlideVert { /* transform_mode.c */ int transform_mode_really_used(struct bContext *C, int mode); -bool transdata_check_local_center(TransInfo *t, short around); +bool transdata_check_local_center(const TransInfo *t, short around); bool transform_mode_is_changeable(const int mode); void protectedTransBits(short protectflag, float vec[3]); void protectedSizeBits(short protectflag, float size[3]); -void constraintTransLim(TransInfo *t, TransData *td); -void constraintSizeLim(TransInfo *t, TransData *td); +void constraintTransLim(const TransInfo *t, TransData *td); +void constraintSizeLim(const TransInfo *t, TransData *td); void headerRotation(TransInfo *t, char *str, int str_size, float final); -void ElementRotation_ex(TransInfo *t, - TransDataContainer *tc, +void ElementRotation_ex(const TransInfo *t, + const TransDataContainer *tc, TransData *td, const float mat[3][3], const float *center); -void ElementRotation( - TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const short around); +void ElementRotation(const TransInfo *t, + const TransDataContainer *tc, + TransData *td, + const float mat[3][3], + const short around); void headerResize(TransInfo *t, const float vec[3], char *str, int str_size); -void ElementResize(TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3]); +void ElementResize(const TransInfo *t, + const TransDataContainer *tc, + TransData *td, + const float mat[3][3]); short getAnimEdit_SnapMode(TransInfo *t); void doAnimEdit_SnapFrame( TransInfo *t, TransData *td, TransData2D *td2d, struct AnimData *adt, short autosnap); -- cgit v1.2.3