[Bf-blender-cvs] [e277e8d0850] master: Cleanup: Split transform.c in multiple files

mano-wii noreply at git.blender.org
Fri Feb 14 12:43:08 CET 2020


Commit: e277e8d085037414f34b27f9c1a26cbbf2507c3e
Author: mano-wii
Date:   Fri Feb 14 08:42:17 2020 -0300
Branches: master
https://developer.blender.org/rBe277e8d085037414f34b27f9c1a26cbbf2507c3e

Cleanup: Split transform.c in multiple files

Differential Revision: https://developer.blender.org/D5819

===================================================================

M	source/blender/editors/transform/CMakeLists.txt
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_convert.c
M	source/blender/editors/transform/transform_generics.c
A	source/blender/editors/transform/transform_mode.c
A	source/blender/editors/transform/transform_mode.h
A	source/blender/editors/transform/transform_mode_align.c
A	source/blender/editors/transform/transform_mode_baketime.c
A	source/blender/editors/transform/transform_mode_bend.c
A	source/blender/editors/transform/transform_mode_boneenvelope.c
A	source/blender/editors/transform/transform_mode_boneroll.c
A	source/blender/editors/transform/transform_mode_bonesize.c
A	source/blender/editors/transform/transform_mode_curveshrinkfatten.c
A	source/blender/editors/transform/transform_mode_edge_bevelweight.c
A	source/blender/editors/transform/transform_mode_edge_crease.c
A	source/blender/editors/transform/transform_mode_edge_rotate_normal.c
A	source/blender/editors/transform/transform_mode_edge_seq_slide.c
A	source/blender/editors/transform/transform_mode_edge_slide.c
A	source/blender/editors/transform/transform_mode_gpopacity.c
A	source/blender/editors/transform/transform_mode_gpshrinkfatten.c
A	source/blender/editors/transform/transform_mode_maskshrinkfatten.c
A	source/blender/editors/transform/transform_mode_mirror.c
A	source/blender/editors/transform/transform_mode_push_pull.c
A	source/blender/editors/transform/transform_mode_resize.c
A	source/blender/editors/transform/transform_mode_rotate.c
A	source/blender/editors/transform/transform_mode_shear.c
A	source/blender/editors/transform/transform_mode_shrink_fatten.c
A	source/blender/editors/transform/transform_mode_skin_resize.c
A	source/blender/editors/transform/transform_mode_tilt.c
A	source/blender/editors/transform/transform_mode_timescale.c
A	source/blender/editors/transform/transform_mode_timeslide.c
A	source/blender/editors/transform/transform_mode_timetranslate.c
A	source/blender/editors/transform/transform_mode_tosphere.c
A	source/blender/editors/transform/transform_mode_trackball.c
A	source/blender/editors/transform/transform_mode_translate.c
A	source/blender/editors/transform/transform_mode_vert_slide.c

===================================================================

diff --git a/source/blender/editors/transform/CMakeLists.txt b/source/blender/editors/transform/CMakeLists.txt
index 6f39a8c3b9c..cd831256d83 100644
--- a/source/blender/editors/transform/CMakeLists.txt
+++ b/source/blender/editors/transform/CMakeLists.txt
@@ -67,12 +67,44 @@ set(SRC
   transform_input.c
   transform_ops.c
   transform_orientations.c
+  transform_mode.c
+  transform_mode_align.c
+  transform_mode_baketime.c
+  transform_mode_bend.c
+  transform_mode_boneenvelope.c
+  transform_mode_boneroll.c
+  transform_mode_bonesize.c
+  transform_mode_curveshrinkfatten.c
+  transform_mode_edge_bevelweight.c
+  transform_mode_edge_crease.c
+  transform_mode_edge_rotate_normal.c
+  transform_mode_edge_seq_slide.c
+  transform_mode_edge_slide.c
+  transform_mode_gpopacity.c
+  transform_mode_gpshrinkfatten.c
+  transform_mode_maskshrinkfatten.c
+  transform_mode_mirror.c
+  transform_mode_push_pull.c
+  transform_mode_resize.c
+  transform_mode_rotate.c
+  transform_mode_shear.c
+  transform_mode_shrink_fatten.c
+  transform_mode_skin_resize.c
+  transform_mode_tilt.c
+  transform_mode_timescale.c
+  transform_mode_timeslide.c
+  transform_mode_timetranslate.c
+  transform_mode_tosphere.c
+  transform_mode_trackball.c
+  transform_mode_translate.c
+  transform_mode_vert_slide.c
   transform_snap.c
   transform_snap_object.c
 
   transform.h
   transform_convert.h
   transform_draw_cursors.h
+  transform_mode.h
   transform_snap.h
 )
 
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 24efa33bdfa..e00af488f46 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -22,73 +22,41 @@
  */
 
 #include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-#include <float.h>
 
 #include "MEM_guardedalloc.h"
 
-#include "DNA_anim_types.h"
 #include "DNA_armature_types.h"
-#include "DNA_constraint_types.h"
+#include "DNA_gpencil_types.h"
 #include "DNA_mask_types.h"
 #include "DNA_mesh_types.h"
-#include "DNA_movieclip_types.h"
-#include "DNA_scene_types.h" /* PET modes */
-#include "DNA_workspace_types.h"
-#include "DNA_gpencil_types.h"
 
-#include "BLI_alloca.h"
-#include "BLI_utildefines.h"
 #include "BLI_math.h"
 #include "BLI_rect.h"
-#include "BLI_listbase.h"
-#include "BLI_string.h"
-#include "BLI_ghash.h"
-#include "BLI_utildefines_stack.h"
-#include "BLI_memarena.h"
 
-#include "BKE_nla.h"
 #include "BKE_editmesh.h"
-#include "BKE_editmesh_bvh.h"
 #include "BKE_context.h"
-#include "BKE_constraint.h"
-#include "BKE_particle.h"
-#include "BKE_unit.h"
-#include "BKE_scene.h"
 #include "BKE_mask.h"
-#include "BKE_mesh.h"
-#include "BKE_report.h"
-#include "BKE_workspace.h"
-
-#include "DEG_depsgraph.h"
+#include "BKE_scene.h"
 
-#include "GPU_immediate.h"
-#include "GPU_matrix.h"
 #include "GPU_state.h"
 
+#include "ED_clip.h"
+#include "ED_gpencil.h"
 #include "ED_image.h"
 #include "ED_keyframing.h"
 #include "ED_screen.h"
+#include "ED_sculpt.h"
 #include "ED_space_api.h"
-#include "ED_view3d.h"
-#include "ED_mesh.h"
-#include "ED_clip.h"
 #include "ED_node.h"
-#include "ED_gpencil.h"
-#include "ED_sculpt.h"
 
-#include "WM_types.h"
 #include "WM_api.h"
+#include "WM_types.h"
 
-#include "UI_view2d.h"
-#include "UI_interface.h"
 #include "UI_interface_icons.h"
 #include "UI_resources.h"
+#include "UI_view2d.h"
 
 #include "RNA_access.h"
-#include "RNA_define.h"
 
 #include "BLF_api.h"
 #include "BLT_translation.h"
@@ -96,6 +64,7 @@
 #include "transform.h"
 #include "transform_convert.h"
 #include "transform_draw_cursors.h"
+#include "transform_mode.h"
 #include "transform_snap.h"
 
 /* Disabling, since when you type you know what you are doing,
@@ -103,128 +72,11 @@
 // #define USE_NUM_NO_ZERO
 
 static void drawTransformApply(const struct bContext *C, ARegion *ar, void *arg);
-static void doEdgeSlide(TransInfo *t, float perc);
-static void doVertSlide(TransInfo *t, float perc);
-
-static void drawEdgeSlide(TransInfo *t);
-static void drawVertSlide(TransInfo *t);
-static void postInputRotation(TransInfo *t, float values[3]);
 
-static void ElementRotation(
-    TransInfo *t, TransDataContainer *tc, TransData *td, float mat[3][3], const short around);
 static void initSnapSpatial(TransInfo *t, float r_snap[3]);
 
 static void storeCustomLNorValue(TransDataContainer *t, BMesh *bm);
 
-/* Transform Callbacks */
-static void initBend(TransInfo *t);
-static eRedrawFlag handleEventBend(TransInfo *t, const struct wmEvent *event);
-static void Bend(TransInfo *t, const int mval[2]);
-
-static void initShear(TransInfo *t);
-static eRedrawFlag handleEventShear(TransInfo *t, const struct wmEvent *event);
-static void applyShear(TransInfo *t, const int mval[2]);
-
-static void initResize(TransInfo *t);
-static void applyResize(TransInfo *t, const int mval[2]);
-
-static void initSkinResize(TransInfo *t);
-static void applySkinResize(TransInfo *t, const int mval[2]);
-
-static void initTranslation(TransInfo *t);
-static void applyTranslation(TransInfo *t, const int mval[2]);
-
-static void initToSphere(TransInfo *t);
-static void applyToSphere(TransInfo *t, const int mval[2]);
-
-static void initRotation(TransInfo *t);
-static void applyRotation(TransInfo *t, const int mval[2]);
-
-static void initNormalRotation(TransInfo *t);
-static void applyNormalRotation(TransInfo *t, const int mval[2]);
-
-static void initShrinkFatten(TransInfo *t);
-static void applyShrinkFatten(TransInfo *t, const int mval[2]);
-
-static void initTilt(TransInfo *t);
-static void applyTilt(TransInfo *t, const int mval[2]);
-
-static void initCurveShrinkFatten(TransInfo *t);
-static void applyCurveShrinkFatten(TransInfo *t, const int mval[2]);
-
-static void initMaskShrinkFatten(TransInfo *t);
-static void applyMaskShrinkFatten(TransInfo *t, const int mval[2]);
-
-static void initGPShrinkFatten(TransInfo *t);
-static void applyGPShrinkFatten(TransInfo *t, const int mval[2]);
-
-static void initTrackball(TransInfo *t);
-static void applyTrackball(TransInfo *t, const int mval[2]);
-
-static void initPushPull(TransInfo *t);
-static void applyPushPull(TransInfo *t, const int mval[2]);
-
-static void initBevelWeight(TransInfo *t);
-static void applyBevelWeight(TransInfo *t, const int mval[2]);
-
-static void initCrease(TransInfo *t);
-static void applyCrease(TransInfo *t, const int mval[2]);
-
-static void initBoneSize(TransInfo *t);
-static void applyBoneSize(TransInfo *t, const int mval[2]);
-
-static void initBoneEnvelope(TransInfo *t);
-static void applyBoneEnvelope(TransInfo *t, const int mval[2]);
-
-static void initBoneRoll(TransInfo *t);
-static void applyBoneRoll(TransInfo *t, const int mval[2]);
-
-static void initEdgeSlide_ex(
-    TransInfo *t, bool use_double_side, bool use_even, bool flipped, bool use_clamp);
-static void initEdgeSlide(TransInfo *t);
-static eRedrawFlag handleEventEdgeSlide(TransInfo *t, const struct wmEvent *event);
-static void applyEdgeSlide(TransInfo *t, const int mval[2]);
-
-static void initVertSlide_ex(TransInfo *t, bool use_even, bool flipped, bool use_clamp);
-static void initVertSlide(TransInfo *t);
-static eRedrawFlag handleEventVertSlide(TransInfo *t, const struct wmEvent *event);
-static void applyVertSlide(TransInfo *t, const int mval[2]);
-
-static void initTimeTranslate(TransInfo *t);
-static void applyTimeTranslate(TransInfo *t, const int mval[2]);
-
-static void initTimeSlide(TransInfo *t);
-static void applyTimeSlide(TransInfo *t, const int mval[2]);
-
-static void initTimeScale(TransInfo *t);
-static void applyTimeScale(TransInfo *t, const int mval[2]);
-
-static void initBakeTime(TransInfo *t);
-static void applyBakeTime(TransInfo *t, const int mval[2]);
-
-static void initMirror(TransInfo *t);
-static void applyMirror(TransInfo *t, const int mval[2]);
-
-static void initAlign(TransInfo *t);
-static void applyAlign(TransInfo *t, const int mval[2]);
-
-static void initSeqSlide(TransInfo *t);
-static void applySeqSlide(TransInfo *t, const int mval[2]);
-
-static void initGPOpacity(TransInfo *t);
-static void applyGPOpacity(TransInfo *t, const int mval[2]);
-/* end transform callbacks */
-
-static bool transdata_check_local_center(TransInfo *t, short around)
-{
-  return ((around == V3D_AROUND_LOCAL_ORIGINS) &&
-          ((t->flag & (T_OBJECT | T_POSE)) ||
-           /* implicit: (t->flag & T_EDIT) */
-           (ELEM(t->obedit_type, OB_MESH, OB_CURVE, OB_MBALL, OB_ARMATURE, OB_GPENCIL)) ||
-           (t->spacetype == SPACE_GRAPH) ||
-           (t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE))));
-}
-
 bool transdata_check_local_islands(TransInfo *t, short around)
 {
   return ((around == V3D_AROUND_LOCAL_ORIGINS) && ((ELEM(t->obedit_type, OB_MESH))));
@@ -797,42 +649,6 @@ static void view_editmove(unsigned short UNUSED(event))
 
 /* ************************************************* */
 
-/* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
-enum {
-  TFM_MODAL_CANCEL = 1,
-  TFM_MODAL_CONFIRM = 2,
-  TFM_MODAL_TRANSLATE = 3,
-  TFM_MODAL_ROTATE = 4,
-  TFM_MODAL_RESIZE = 5,
-  TFM_MODAL_SNAP_INV_ON = 6,
-  TFM_MODAL_SNAP_INV_OFF = 7,
-  TFM_MODAL_SNAP_TOGGLE = 8,
-  TFM_MODAL_AXIS_X = 9,
-  TFM_MODAL_AXIS_Y = 10,
-  TFM_MODAL_AXIS_Z = 11,
-  TFM_MODAL_PLANE_X = 12,
-  TFM_MODAL_PLANE_Y = 13,
-  TFM_MODAL_PLANE_Z = 14,
-  TFM_MODAL_CONS_OFF = 15,
-  TFM_MODAL_ADD_SNAP = 16,
-  TFM_MODAL_REMOVE_SNAP = 17,
-
-  /* 18 and 19 used by numinput, defined in transform.h */
-
-  TFM_MODAL_PROPSIZE_UP = 20,
-  TFM_MODAL_PROPSIZE_DOWN = 21,
-  TFM_MODAL_AUTOIK_LEN_INC = 22,
-  TFM_MODAL_AUTOIK_LEN_DEC = 23,
-
-  TFM_MODAL_EDGESLIDE_UP = 24,
-  TFM_MODAL_EDGESLIDE_DOWN = 25,
-
-  /* for analog input, like trackpad */
-  TFM_MODAL_PROPSIZE = 26,
-  /* node editor insert offset (aka auto-offset) direction toggle */
-  TFM_MODAL_INSERTOFS_TOGGLE_DIR = 27,
-};
-
 static bool transform_modal_item_poll(const wmOperator *op, int value)
 {
   const TransInfo *t = op->customdata;
@@ -2031,6 +1847,43 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
   }
 }
 
+static void initSnapSpatial(TransInfo *t, float r_snap[3])
+{
+  if (t->spacetype == SPACE_VIEW3D) {

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list