[Bf-blender-cvs] [b5253159b61] master: Cleanup: split `BKE_anim.h` and `anim.c` into smaller pieces

Sybren A. Stüvel noreply at git.blender.org
Fri Apr 3 12:16:00 CEST 2020


Commit: b5253159b6113e1f54297ebe06322191b483996e
Author: Sybren A. Stüvel
Date:   Fri Apr 3 11:35:04 2020 +0200
Branches: master
https://developer.blender.org/rBb5253159b6113e1f54297ebe06322191b483996e

Cleanup: split `BKE_anim.h` and `anim.c` into smaller pieces

The files are now split up into the following sections:
- `BKE_anim_path.h` and `anim_path.c` for path/curve functions.
- `BKE_anim_visualization.h` and `anim_visualizationanim_path.c` for
  animation visualization (mostly motion paths).
- `BKE_duplilist.h` for DupliList function declarations. These were
  already implemented in `object_dupli.c`, so they were rather out of
  place being declared in `BKE_anim.h` in the first place.

No functional changes.

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

A	source/blender/blenkernel/BKE_anim_path.h
A	source/blender/blenkernel/BKE_anim_visualization.h
R060	source/blender/blenkernel/BKE_anim.h	source/blender/blenkernel/BKE_duplilist.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/action.c
R060	source/blender/blenkernel/intern/anim.c	source/blender/blenkernel/intern/anim_path.c
A	source/blender/blenkernel/intern/anim_visualization.c
M	source/blender/blenkernel/intern/armature.c
M	source/blender/blenkernel/intern/armature_update.c
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenkernel/intern/displist.c
M	source/blender/blenkernel/intern/effect.c
M	source/blender/blenkernel/intern/font.c
M	source/blender/blenkernel/intern/lattice.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/blenkernel/intern/particle.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/depsgraph/intern/depsgraph_query_iter.cc
M	source/blender/draw/engines/overlay/overlay_extra.c
M	source/blender/draw/intern/draw_hair.c
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/editors/armature/pose_edit.c
M	source/blender/editors/object/object_add.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/space_info/info_stats.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/transform/transform_snap_object.c
M	source/blender/io/alembic/intern/abc_exporter.cc
M	source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
M	source/blender/io/usd/intern/usd_hierarchy_iterator.cc
M	source/blender/io/usd/intern/usd_writer_mesh.cc
M	source/blender/makesrna/intern/rna_depsgraph.c
M	source/blender/makesrna/intern/rna_object_api.c

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

diff --git a/source/blender/blenkernel/BKE_anim_path.h b/source/blender/blenkernel/BKE_anim_path.h
new file mode 100644
index 00000000000..64bcedefa58
--- /dev/null
+++ b/source/blender/blenkernel/BKE_anim_path.h
@@ -0,0 +1,51 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ */
+#ifndef __BKE_ANIM_PATH_H__
+#define __BKE_ANIM_PATH_H__
+
+/** \file
+ * \ingroup bke
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ListBase;
+struct Object;
+struct Path;
+
+/* ---------------------------------------------------- */
+/* Curve Paths */
+
+void free_path(struct Path *path);
+void calc_curvepath(struct Object *ob, struct ListBase *nurbs);
+int where_on_path(struct Object *ob,
+                  float ctime,
+                  float vec[4],
+                  float dir[3],
+                  float quat[4],
+                  float *radius,
+                  float *weight);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim_visualization.h
similarity index 54%
copy from source/blender/blenkernel/BKE_anim.h
copy to source/blender/blenkernel/BKE_anim_visualization.h
index 38af96c2ff0..5dcbfa0919e 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim_visualization.h
@@ -16,8 +16,8 @@
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  */
-#ifndef __BKE_ANIM_H__
-#define __BKE_ANIM_H__
+#ifndef __BKE_ANIM_VISUALIZATION_H__
+#define __BKE_ANIM_VISUALIZATION_H__
 
 /** \file
  * \ingroup bke
@@ -27,11 +27,7 @@
 extern "C" {
 #endif
 
-struct Depsgraph;
-struct ListBase;
 struct Object;
-struct ParticleSystem;
-struct Path;
 struct ReportList;
 struct Scene;
 struct bAnimVizSettings;
@@ -53,47 +49,6 @@ struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports,
                                                struct Object *ob,
                                                struct bPoseChannel *pchan);
 
-/* ---------------------------------------------------- */
-/* Curve Paths */
-
-void free_path(struct Path *path);
-void calc_curvepath(struct Object *ob, struct ListBase *nurbs);
-int where_on_path(struct Object *ob,
-                  float ctime,
-                  float vec[4],
-                  float dir[3],
-                  float quat[4],
-                  float *radius,
-                  float *weight);
-
-/* ---------------------------------------------------- */
-/* Dupli-Geometry */
-
-struct ListBase *object_duplilist(struct Depsgraph *depsgraph,
-                                  struct Scene *sce,
-                                  struct Object *ob);
-void free_object_duplilist(struct ListBase *lb);
-
-typedef struct DupliObject {
-  struct DupliObject *next, *prev;
-  struct Object *ob;
-  float mat[4][4];
-  float orco[3], uv[2];
-
-  short type; /* from Object.transflag */
-  char no_draw;
-
-  /* Persistent identifier for a dupli object, for inter-frame matching of
-   * objects with motion blur, or inter-update matching for syncing. */
-  int persistent_id[16]; /* 2*MAX_DUPLI_RECUR */
-
-  /* Particle this dupli was generated from. */
-  struct ParticleSystem *particle_system;
-
-  /* Random ID for shading */
-  unsigned int random_id;
-} DupliObject;
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_duplilist.h
similarity index 60%
rename from source/blender/blenkernel/BKE_anim.h
rename to source/blender/blenkernel/BKE_duplilist.h
index 38af96c2ff0..71b6d06b450 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_duplilist.h
@@ -16,8 +16,8 @@
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  */
-#ifndef __BKE_ANIM_H__
-#define __BKE_ANIM_H__
+#ifndef __BKE_DUPLILIST_H__
+#define __BKE_DUPLILIST_H__
 
 /** \file
  * \ingroup bke
@@ -31,40 +31,7 @@ struct Depsgraph;
 struct ListBase;
 struct Object;
 struct ParticleSystem;
-struct Path;
-struct ReportList;
 struct Scene;
-struct bAnimVizSettings;
-struct bMotionPath;
-struct bPoseChannel;
-
-/* ---------------------------------------------------- */
-/* Animation Visualization */
-
-void animviz_settings_init(struct bAnimVizSettings *avs);
-
-struct bMotionPath *animviz_copy_motionpath(const struct bMotionPath *mpath_src);
-
-void animviz_free_motionpath_cache(struct bMotionPath *mpath);
-void animviz_free_motionpath(struct bMotionPath *mpath);
-
-struct bMotionPath *animviz_verify_motionpaths(struct ReportList *reports,
-                                               struct Scene *scene,
-                                               struct Object *ob,
-                                               struct bPoseChannel *pchan);
-
-/* ---------------------------------------------------- */
-/* Curve Paths */
-
-void free_path(struct Path *path);
-void calc_curvepath(struct Object *ob, struct ListBase *nurbs);
-int where_on_path(struct Object *ob,
-                  float ctime,
-                  float vec[4],
-                  float dir[3],
-                  float quat[4],
-                  float *radius,
-                  float *weight);
 
 /* ---------------------------------------------------- */
 /* Dupli-Geometry */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 1e230e5af3a..ba4339f56ac 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -70,8 +70,9 @@ set(SRC
   intern/DerivedMesh.c
   intern/action.c
   intern/addon.c
-  intern/anim.c
+  intern/anim_path.c
   intern/anim_sys.c
+  intern/anim_visualization.c
   intern/appdir.c
   intern/armature.c
   intern/armature_update.c
@@ -250,7 +251,8 @@ set(SRC
   BKE_DerivedMesh.h
   BKE_action.h
   BKE_addon.h
-  BKE_anim.h
+  BKE_anim_path.h
+  BKE_anim_visualization.h
   BKE_animsys.h
   BKE_appdir.h
   BKE_armature.h
@@ -286,6 +288,7 @@ set(SRC
   BKE_deform.h
   BKE_displist.h
   BKE_displist_tangent.h
+  BKE_duplilist.h
   BKE_dynamicpaint.h
   BKE_editlattice.h
   BKE_editmesh.h
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index c332939e906..478609f2f3f 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -43,7 +43,7 @@
 #include "BLT_translation.h"
 
 #include "BKE_action.h"
-#include "BKE_anim.h"
+#include "BKE_anim_visualization.h"
 #include "BKE_animsys.h"
 #include "BKE_armature.h"
 #include "BKE_constraint.h"
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim_path.c
similarity index 60%
rename from source/blender/blenkernel/intern/anim.c
rename to source/blender/blenkernel/intern/anim_path.c
index 8804e7ae26c..e073bd6fc82 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim_path.c
@@ -23,236 +23,22 @@
 
 #include "MEM_guardedalloc.h"
 
-#include <stdlib.h>
+#include <float.h>
 
-#include "BLI_dlrbTree.h"
-#include "BLI_listbase.h"
-#include "BLI_math.h"
-
-#include "BLT_translation.h"
-
-#include "DNA_anim_types.h"
-#include "DNA_armature_types.h"
+#include "DNA_curve_types.h"
 #include "DNA_key_types.h"
-#include "DNA_scene_types.h"
+#include "DNA_object_types.h"
+
+#include "BLI_math_vector.h"
 
-#include "BKE_action.h"
-#include "BKE_anim.h"
-#include "BKE_animsys.h"
+#include "BKE_anim_path.h"
 #include "BKE_curve.h"
 #include "BKE_key.h"
-#include "BKE_main.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
-
-#include "GPU_batch.h"
 
 #include "CLG_log.h"
 
 static CLG_LogRef LOG = {"bke.anim"};
 
-/* --------------------- */
-/* forward declarations */
-
-/* ******************************************************************** */
-/* Animation Visualization */
-
-/* Initialize the default settings for animation visualization */
-void animviz_settings_init(bAnimVizSettings *avs)
-{
-  /* sanity check */
-  if (avs == NULL) {
-    return;
-  }
-
-  /* path settings */
-  avs->path_bc = avs->path_ac = 10;
-
-  avs->path_sf = 1;   /* xxx - take from scene instead? */
-  avs->path_ef = 250; /* xxx - take from scene instead? */
-
-  avs->path_viewflag = (MOTIONPATH_VIEW_KFRAS | MOTIONPATH_VIEW_KFNOS);
-
-  avs->path_step = 1;
-
-  avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
-}
-
-/* ------------------- */
-
-/* Free the given motion path's cache */
-void animviz_free_motionpath_cache(bMotionPath *mpath)
-{
-  /* sanity check */
-  if (mpath == NULL) {
-    return;
-  }
-
-  /* free the path if necessary */
-  if (mpath->points) {
-    MEM_freeN(mpath->points);
-  }
-
-  GPU_VERTBUF_DISCARD_SAFE(mpath->points_vbo);
-  GPU_BATCH_DISCARD_SAFE(mpath->batch_line);
-  GPU_BATCH_DISCARD_SAFE(mpath->batch_points);
-
-  /* reset the relevant parameters */
-  mpath->points = NULL;
-  mpath->length = 0;
-}
-
-/* Free the given motion path instance and its data
- * NOTE: this frees the motion path given!
- */
-void animviz_free_motionpath(bMotionPath *mpath)
-{
-  /* sanity check */
-  if (mpath == NULL) {
-    return;
-  }
-
-  /* free the cache first */
-  animviz_free_motionpath_cache(mpath);
-
-  /* now the instance itself */
-  MEM_freeN(mpath);
-}
-
-/* ------------------- */
-
-/* Make

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list