From b5253159b6113e1f54297ebe06322191b483996e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 3 Apr 2020 11:35:04 +0200 Subject: 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. --- source/blender/blenkernel/BKE_anim.h | 101 ---- source/blender/blenkernel/BKE_anim_path.h | 51 ++ source/blender/blenkernel/BKE_anim_visualization.h | 56 ++ source/blender/blenkernel/BKE_duplilist.h | 68 +++ source/blender/blenkernel/CMakeLists.txt | 7 +- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/anim.c | 561 --------------------- source/blender/blenkernel/intern/anim_path.c | 347 +++++++++++++ .../blender/blenkernel/intern/anim_visualization.c | 228 +++++++++ source/blender/blenkernel/intern/armature.c | 2 +- source/blender/blenkernel/intern/armature_update.c | 2 +- source/blender/blenkernel/intern/constraint.c | 2 +- source/blender/blenkernel/intern/displist.c | 2 +- source/blender/blenkernel/intern/effect.c | 2 +- source/blender/blenkernel/intern/font.c | 2 +- source/blender/blenkernel/intern/lattice.c | 2 +- source/blender/blenkernel/intern/object.c | 4 +- source/blender/blenkernel/intern/object_dupli.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/pointcache.c | 1 - source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenloader/intern/versioning_250.c | 2 +- source/blender/blenloader/intern/versioning_260.c | 2 +- .../depsgraph/intern/depsgraph_query_iter.cc | 2 +- .../blender/draw/engines/overlay/overlay_extra.c | 2 +- source/blender/draw/intern/draw_hair.c | 2 +- source/blender/draw/intern/draw_manager.c | 2 +- source/blender/draw/intern/draw_manager_data.c | 2 +- source/blender/editors/armature/pose_edit.c | 2 +- source/blender/editors/object/object_add.c | 2 +- source/blender/editors/object/object_edit.c | 2 +- source/blender/editors/space_info/info_stats.c | 1 - source/blender/editors/transform/transform_snap.c | 2 +- .../editors/transform/transform_snap_object.c | 2 +- source/blender/io/alembic/intern/abc_exporter.cc | 2 +- .../io/usd/intern/abstract_hierarchy_iterator.cc | 2 +- .../io/usd/intern/usd_hierarchy_iterator.cc | 2 +- source/blender/io/usd/intern/usd_writer_mesh.cc | 1 - source/blender/makesrna/intern/rna_depsgraph.c | 2 +- source/blender/makesrna/intern/rna_object_api.c | 1 - 40 files changed, 785 insertions(+), 696 deletions(-) delete mode 100644 source/blender/blenkernel/BKE_anim.h create mode 100644 source/blender/blenkernel/BKE_anim_path.h create mode 100644 source/blender/blenkernel/BKE_anim_visualization.h create mode 100644 source/blender/blenkernel/BKE_duplilist.h delete mode 100644 source/blender/blenkernel/intern/anim.c create mode 100644 source/blender/blenkernel/intern/anim_path.c create mode 100644 source/blender/blenkernel/intern/anim_visualization.c diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h deleted file mode 100644 index 38af96c2ff0..00000000000 --- a/source/blender/blenkernel/BKE_anim.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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_H__ -#define __BKE_ANIM_H__ - -/** \file - * \ingroup bke - */ - -#ifdef __cplusplus -extern "C" { -#endif - -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 */ - -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 - -#endif 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_visualization.h b/source/blender/blenkernel/BKE_anim_visualization.h new file mode 100644 index 00000000000..5dcbfa0919e --- /dev/null +++ b/source/blender/blenkernel/BKE_anim_visualization.h @@ -0,0 +1,56 @@ +/* + * 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_VISUALIZATION_H__ +#define __BKE_ANIM_VISUALIZATION_H__ + +/** \file + * \ingroup bke + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct Object; +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); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/blenkernel/BKE_duplilist.h b/source/blender/blenkernel/BKE_duplilist.h new file mode 100644 index 00000000000..71b6d06b450 --- /dev/null +++ b/source/blender/blenkernel/BKE_duplilist.h @@ -0,0 +1,68 @@ +/* + * 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_DUPLILIST_H__ +#define __BKE_DUPLILIST_H__ + +/** \file + * \ingroup bke + */ + +#ifdef __cplusplus +extern "C" { +#endif + +struct Depsgraph; +struct ListBase; +struct Object; +struct ParticleSystem; +struct Scene; + +/* ---------------------------------------------------- */ +/* 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 + +#endif 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.c deleted file mode 100644 index 8804e7ae26c..00000000000 --- a/source/blender/blenkernel/intern/anim.c +++ /dev/null @@ -1,561 +0,0 @@ -/* - * 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. - */ - -/** \file - * \ingroup bke - */ - -#include "MEM_guardedalloc.h" - -#include - -#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_key_types.h" -#include "DNA_scene_types.h" - -#include "BKE_action.h" -#include "BKE_anim.h" -#include "BKE_animsys.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 a copy of motionpath data, so that viewing with copy on write works */ -bMotionPath *animviz_copy_motionpath(const bMotionPath *mpath_src) -{ - bMotionPath *mpath_dst; - - if (mpath_src == NULL) { - return NULL; - } - - mpath_dst = MEM_dupallocN(mpath_src); - mpath_dst->points = MEM_dupallocN(mpath_src->points); - - /* should get recreated on draw... */ - mpath_dst->points_vbo = NULL; - mpath_dst->batch_line = NULL; - mpath_dst->batch_points = NULL; - - return mpath_dst; -} - -/* ------------------- */ - -/** - * Setup motion paths for the given data. - * \note Only used when explicitly calculating paths on bones which may/may not be consider already - * - * \param scene: Current scene (for frame ranges, etc.) - * \param ob: Object to add paths for (must be provided) - * \param pchan: Posechannel to add paths for (optional; if not provided, object-paths are assumed) - */ -bMotionPath *animviz_verify_motionpaths(ReportList *reports, - Scene *scene, - Object *ob, - bPoseChannel *pchan) -{ - bAnimVizSettings *avs; - bMotionPath *mpath, **dst; - - /* sanity checks */ - if (ELEM(NULL, scene, ob)) { - return NULL; - } - - /* get destination data */ - if (pchan) { - /* paths for posechannel - assume that posechannel belongs to the object */ - avs = &ob->pose->avs; - dst = &pchan->mpath; - } - else { - /* paths for object */ - avs = &ob->avs; - dst = &ob->mpath; - } - - /* avoid 0 size allocs */ - if (avs->path_sf >= avs->path_ef) { - BKE_reportf(reports, - RPT_ERROR, - "Motion path frame extents invalid for %s (%d to %d)%s", - (pchan) ? pchan->name : ob->id.name, - avs->path_sf, - avs->path_ef, - (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : ""); - return NULL; - } - - /* if there is already a motionpath, just return that, - * provided it's settings are ok (saves extra free+alloc) - */ - if (*dst != NULL) { - int expected_length = avs->path_ef - avs->path_sf; - - mpath = *dst; - - /* Path is "valid" if length is valid, - * but must also be of the same length as is being requested. */ - if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { - /* outer check ensures that we have some curve data for this path */ - if (mpath->length == expected_length) { - /* return/use this as it is already valid length */ - return mpath; - } - else { - /* clear the existing path (as the range has changed), and reallocate below */ - animviz_free_motionpath_cache(mpath); - } - } - } - else { - /* create a new motionpath, and assign it */ - mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath"); - *dst = mpath; - } - - /* set settings from the viz settings */ - mpath->start_frame = avs->path_sf; - mpath->end_frame = avs->path_ef; - - mpath->length = mpath->end_frame - mpath->start_frame; - - if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) { - mpath->flag |= MOTIONPATH_FLAG_BHEAD; - } - else { - mpath->flag &= ~MOTIONPATH_FLAG_BHEAD; - } - - /* set default custom values */ - mpath->color[0] = 1.0; /* Red */ - mpath->color[1] = 0.0; - mpath->color[2] = 0.0; - - mpath->line_thickness = 2; - mpath->flag |= MOTIONPATH_FLAG_LINES; /* draw lines by default */ - - /* allocate a cache */ - mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"); - - /* tag viz settings as currently having some path(s) which use it */ - avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; - - /* return it */ - return mpath; -} - -/* ******************************************************************** */ -/* Curve Paths - for curve deforms and/or curve following */ - -/* free curve path data - * NOTE: frees the path itself! - * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633] - */ -void free_path(Path *path) -{ - if (path->data) { - MEM_freeN(path->data); - } - MEM_freeN(path); -} - -/* calculate a curve-deform path for a curve - * - only called from displist.c -> do_makeDispListCurveTypes - */ -void calc_curvepath(Object *ob, ListBase *nurbs) -{ - BevList *bl; - BevPoint *bevp, *bevpn, *bevpfirst, *bevplast; - PathPoint *pp; - Nurb *nu; - Path *path; - float *fp, *dist, *maxdist, xyz[3]; - float fac, d = 0, fac1, fac2; - int a, tot, cycl = 0; - - /* in a path vertices are with equal differences: path->len = number of verts */ - /* NOW WITH BEVELCURVE!!! */ - - if (ob == NULL || ob->type != OB_CURVE) { - return; - } - - if (ob->runtime.curve_cache->path) { - free_path(ob->runtime.curve_cache->path); - } - ob->runtime.curve_cache->path = NULL; - - /* weak! can only use first curve */ - bl = ob->runtime.curve_cache->bev.first; - if (bl == NULL || !bl->nr) { - return; - } - - nu = nurbs->first; - - ob->runtime.curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath"); - - /* if POLY: last vertice != first vertice */ - cycl = (bl->poly != -1); - - tot = cycl ? bl->nr : bl->nr - 1; - - path->len = tot + 1; - /* Exception: vector handle paths and polygon paths should be subdivided - * at least a factor resolution. */ - if (path->len < nu->resolu * SEGMENTSU(nu)) { - path->len = nu->resolu * SEGMENTSU(nu); - } - - dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist"); - - /* all lengths in *dist */ - bevp = bevpfirst = bl->bevpoints; - fp = dist; - *fp = 0.0f; - for (a = 0; a < tot; a++) { - fp++; - if (cycl && a == tot - 1) { - sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec); - } - else { - sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec); - } - - *fp = *(fp - 1) + len_v3(xyz); - bevp++; - } - - path->totdist = *fp; - - /* the path verts in path->data */ - /* now also with TILT value */ - pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata"); - - bevp = bevpfirst; - bevpn = bevp + 1; - bevplast = bevpfirst + (bl->nr - 1); - if (UNLIKELY(bevpn > bevplast)) { - bevpn = cycl ? bevpfirst : bevplast; - } - fp = dist + 1; - maxdist = dist + tot; - fac = 1.0f / ((float)path->len - 1.0f); - fac = fac * path->totdist; - - for (a = 0; a < path->len; a++) { - - d = ((float)a) * fac; - - /* we're looking for location (distance) 'd' in the array */ - if (LIKELY(tot > 0)) { - while ((fp < maxdist) && (d >= *fp)) { - fp++; - if (bevp < bevplast) { - bevp++; - } - bevpn = bevp + 1; - if (UNLIKELY(bevpn > bevplast)) { - bevpn = cycl ? bevpfirst : bevplast; - } - } - - fac1 = (*(fp)-d) / (*(fp) - *(fp - 1)); - fac2 = 1.0f - fac1; - } - else { - fac1 = 1.0f; - fac2 = 0.0f; - } - - interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2); - pp->vec[3] = fac1 * bevp->tilt + fac2 * bevpn->tilt; - pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius; - pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight; - interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2); - normalize_qt(pp->quat); - - pp++; - } - - MEM_freeN(dist); -} - -static int interval_test(const int min, const int max, int p1, const int cycl) -{ - if (cycl) { - p1 = mod_i(p1 - min, (max - min + 1)) + min; - } - else { - if (p1 < min) { - p1 = min; - } - else if (p1 > max) { - p1 = max; - } - } - return p1; -} - -/* calculate the deformation implied by the curve path at a given parametric position, - * and returns whether this operation succeeded. - * - * note: ctime is normalized range <0-1> - * - * returns OK: 1/0 - */ -int where_on_path(Object *ob, - float ctime, - float vec[4], - float dir[3], - float quat[4], - float *radius, - float *weight) -{ - Curve *cu; - Nurb *nu; - BevList *bl; - Path *path; - PathPoint *pp, *p0, *p1, *p2, *p3; - float fac; - float data[4]; - int cycl = 0, s0, s1, s2, s3; - ListBase *nurbs; - - if (ob == NULL || ob->type != OB_CURVE) { - return 0; - } - cu = ob->data; - if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == NULL || - ob->runtime.curve_cache->path->data == NULL) { - CLOG_WARN(&LOG, "no path!"); - return 0; - } - path = ob->runtime.curve_cache->path; - pp = path->data; - - /* test for cyclic */ - bl = ob->runtime.curve_cache->bev.first; - if (!bl) { - return 0; - } - if (!bl->nr) { - return 0; - } - if (bl->poly > -1) { - cycl = 1; - } - - /* values below zero for non-cyclic curves give strange results */ - BLI_assert(cycl || ctime >= 0.0f); - - ctime *= (path->len - 1); - - s1 = (int)floor(ctime); - fac = (float)(s1 + 1) - ctime; - - /* path->len is corrected for cyclic */ - s0 = interval_test(0, path->len - 1 - cycl, s1 - 1, cycl); - s1 = interval_test(0, path->len - 1 - cycl, s1, cycl); - s2 = interval_test(0, path->len - 1 - cycl, s1 + 1, cycl); - s3 = interval_test(0, path->len - 1 - cycl, s1 + 2, cycl); - - p0 = pp + s0; - p1 = pp + s1; - p2 = pp + s2; - p3 = pp + s3; - - /* NOTE: commented out for follow constraint - * - * If it's ever be uncommented watch out for curve_deform_verts() - * which used to temporary set CU_FOLLOW flag for the curve and no - * longer does it (because of threading issues of such a thing. - */ - // if (cu->flag & CU_FOLLOW) { - - key_curve_tangent_weights(1.0f - fac, data, KEY_BSPLINE); - - interp_v3_v3v3v3v3(dir, p0->vec, p1->vec, p2->vec, p3->vec, data); - - /* make compatible with vectoquat */ - negate_v3(dir); - //} - - nurbs = BKE_curve_editNurbs_get(cu); - if (!nurbs) { - nurbs = &cu->nurb; - } - nu = nurbs->first; - - /* make sure that first and last frame are included in the vectors here */ - if (nu->type == CU_POLY) { - key_curve_position_weights(1.0f - fac, data, KEY_LINEAR); - } - else if (nu->type == CU_BEZIER) { - key_curve_position_weights(1.0f - fac, data, KEY_LINEAR); - } - else if (s0 == s1 || p2 == p3) { - key_curve_position_weights(1.0f - fac, data, KEY_CARDINAL); - } - else { - key_curve_position_weights(1.0f - fac, data, KEY_BSPLINE); - } - - vec[0] = data[0] * p0->vec[0] + data[1] * p1->vec[0] + data[2] * p2->vec[0] + - data[3] * p3->vec[0]; /* X */ - vec[1] = data[0] * p0->vec[1] + data[1] * p1->vec[1] + data[2] * p2->vec[1] + - data[3] * p3->vec[1]; /* Y */ - vec[2] = data[0] * p0->vec[2] + data[1] * p1->vec[2] + data[2] * p2->vec[2] + - data[3] * p3->vec[2]; /* Z */ - vec[3] = data[0] * p0->vec[3] + data[1] * p1->vec[3] + data[2] * p2->vec[3] + - data[3] * p3->vec[3]; /* Tilt, should not be needed since we have quat still used */ - - if (quat) { - float totfac, q1[4], q2[4]; - - totfac = data[0] + data[3]; - if (totfac > FLT_EPSILON) { - interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac); - } - else { - copy_qt_qt(q1, p1->quat); - } - - totfac = data[1] + data[2]; - if (totfac > FLT_EPSILON) { - interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac); - } - else { - copy_qt_qt(q2, p3->quat); - } - - totfac = data[0] + data[1] + data[2] + data[3]; - if (totfac > FLT_EPSILON) { - interp_qt_qtqt(quat, q1, q2, (data[1] + data[2]) / totfac); - } - else { - copy_qt_qt(quat, q2); - } - } - - if (radius) { - *radius = data[0] * p0->radius + data[1] * p1->radius + data[2] * p2->radius + - data[3] * p3->radius; - } - - if (weight) { - *weight = data[0] * p0->weight + data[1] * p1->weight + data[2] * p2->weight + - data[3] * p3->weight; - } - - return 1; -} diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c new file mode 100644 index 00000000000..e073bd6fc82 --- /dev/null +++ b/source/blender/blenkernel/intern/anim_path.c @@ -0,0 +1,347 @@ +/* + * 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. + */ + +/** \file + * \ingroup bke + */ + +#include "MEM_guardedalloc.h" + +#include + +#include "DNA_curve_types.h" +#include "DNA_key_types.h" +#include "DNA_object_types.h" + +#include "BLI_math_vector.h" + +#include "BKE_anim_path.h" +#include "BKE_curve.h" +#include "BKE_key.h" + +#include "CLG_log.h" + +static CLG_LogRef LOG = {"bke.anim"}; + +/* ******************************************************************** */ +/* Curve Paths - for curve deforms and/or curve following */ + +/* free curve path data + * NOTE: frees the path itself! + * NOTE: this is increasingly inaccurate with non-uniform BevPoint subdivisions [#24633] + */ +void free_path(Path *path) +{ + if (path->data) { + MEM_freeN(path->data); + } + MEM_freeN(path); +} + +/* calculate a curve-deform path for a curve + * - only called from displist.c -> do_makeDispListCurveTypes + */ +void calc_curvepath(Object *ob, ListBase *nurbs) +{ + BevList *bl; + BevPoint *bevp, *bevpn, *bevpfirst, *bevplast; + PathPoint *pp; + Nurb *nu; + Path *path; + float *fp, *dist, *maxdist, xyz[3]; + float fac, d = 0, fac1, fac2; + int a, tot, cycl = 0; + + /* in a path vertices are with equal differences: path->len = number of verts */ + /* NOW WITH BEVELCURVE!!! */ + + if (ob == NULL || ob->type != OB_CURVE) { + return; + } + + if (ob->runtime.curve_cache->path) { + free_path(ob->runtime.curve_cache->path); + } + ob->runtime.curve_cache->path = NULL; + + /* weak! can only use first curve */ + bl = ob->runtime.curve_cache->bev.first; + if (bl == NULL || !bl->nr) { + return; + } + + nu = nurbs->first; + + ob->runtime.curve_cache->path = path = MEM_callocN(sizeof(Path), "calc_curvepath"); + + /* if POLY: last vertice != first vertice */ + cycl = (bl->poly != -1); + + tot = cycl ? bl->nr : bl->nr - 1; + + path->len = tot + 1; + /* Exception: vector handle paths and polygon paths should be subdivided + * at least a factor resolution. */ + if (path->len < nu->resolu * SEGMENTSU(nu)) { + path->len = nu->resolu * SEGMENTSU(nu); + } + + dist = (float *)MEM_mallocN(sizeof(float) * (tot + 1), "calcpathdist"); + + /* all lengths in *dist */ + bevp = bevpfirst = bl->bevpoints; + fp = dist; + *fp = 0.0f; + for (a = 0; a < tot; a++) { + fp++; + if (cycl && a == tot - 1) { + sub_v3_v3v3(xyz, bevpfirst->vec, bevp->vec); + } + else { + sub_v3_v3v3(xyz, (bevp + 1)->vec, bevp->vec); + } + + *fp = *(fp - 1) + len_v3(xyz); + bevp++; + } + + path->totdist = *fp; + + /* the path verts in path->data */ + /* now also with TILT value */ + pp = path->data = (PathPoint *)MEM_callocN(sizeof(PathPoint) * path->len, "pathdata"); + + bevp = bevpfirst; + bevpn = bevp + 1; + bevplast = bevpfirst + (bl->nr - 1); + if (UNLIKELY(bevpn > bevplast)) { + bevpn = cycl ? bevpfirst : bevplast; + } + fp = dist + 1; + maxdist = dist + tot; + fac = 1.0f / ((float)path->len - 1.0f); + fac = fac * path->totdist; + + for (a = 0; a < path->len; a++) { + + d = ((float)a) * fac; + + /* we're looking for location (distance) 'd' in the array */ + if (LIKELY(tot > 0)) { + while ((fp < maxdist) && (d >= *fp)) { + fp++; + if (bevp < bevplast) { + bevp++; + } + bevpn = bevp + 1; + if (UNLIKELY(bevpn > bevplast)) { + bevpn = cycl ? bevpfirst : bevplast; + } + } + + fac1 = (*(fp)-d) / (*(fp) - *(fp - 1)); + fac2 = 1.0f - fac1; + } + else { + fac1 = 1.0f; + fac2 = 0.0f; + } + + interp_v3_v3v3(pp->vec, bevp->vec, bevpn->vec, fac2); + pp->vec[3] = fac1 * bevp->tilt + fac2 * bevpn->tilt; + pp->radius = fac1 * bevp->radius + fac2 * bevpn->radius; + pp->weight = fac1 * bevp->weight + fac2 * bevpn->weight; + interp_qt_qtqt(pp->quat, bevp->quat, bevpn->quat, fac2); + normalize_qt(pp->quat); + + pp++; + } + + MEM_freeN(dist); +} + +static int interval_test(const int min, const int max, int p1, const int cycl) +{ + if (cycl) { + p1 = mod_i(p1 - min, (max - min + 1)) + min; + } + else { + if (p1 < min) { + p1 = min; + } + else if (p1 > max) { + p1 = max; + } + } + return p1; +} + +/* calculate the deformation implied by the curve path at a given parametric position, + * and returns whether this operation succeeded. + * + * note: ctime is normalized range <0-1> + * + * returns OK: 1/0 + */ +int where_on_path(Object *ob, + float ctime, + float vec[4], + float dir[3], + float quat[4], + float *radius, + float *weight) +{ + Curve *cu; + Nurb *nu; + BevList *bl; + Path *path; + PathPoint *pp, *p0, *p1, *p2, *p3; + float fac; + float data[4]; + int cycl = 0, s0, s1, s2, s3; + ListBase *nurbs; + + if (ob == NULL || ob->type != OB_CURVE) { + return 0; + } + cu = ob->data; + if (ob->runtime.curve_cache == NULL || ob->runtime.curve_cache->path == NULL || + ob->runtime.curve_cache->path->data == NULL) { + CLOG_WARN(&LOG, "no path!"); + return 0; + } + path = ob->runtime.curve_cache->path; + pp = path->data; + + /* test for cyclic */ + bl = ob->runtime.curve_cache->bev.first; + if (!bl) { + return 0; + } + if (!bl->nr) { + return 0; + } + if (bl->poly > -1) { + cycl = 1; + } + + /* values below zero for non-cyclic curves give strange results */ + BLI_assert(cycl || ctime >= 0.0f); + + ctime *= (path->len - 1); + + s1 = (int)floor(ctime); + fac = (float)(s1 + 1) - ctime; + + /* path->len is corrected for cyclic */ + s0 = interval_test(0, path->len - 1 - cycl, s1 - 1, cycl); + s1 = interval_test(0, path->len - 1 - cycl, s1, cycl); + s2 = interval_test(0, path->len - 1 - cycl, s1 + 1, cycl); + s3 = interval_test(0, path->len - 1 - cycl, s1 + 2, cycl); + + p0 = pp + s0; + p1 = pp + s1; + p2 = pp + s2; + p3 = pp + s3; + + /* NOTE: commented out for follow constraint + * + * If it's ever be uncommented watch out for curve_deform_verts() + * which used to temporary set CU_FOLLOW flag for the curve and no + * longer does it (because of threading issues of such a thing. + */ + // if (cu->flag & CU_FOLLOW) { + + key_curve_tangent_weights(1.0f - fac, data, KEY_BSPLINE); + + interp_v3_v3v3v3v3(dir, p0->vec, p1->vec, p2->vec, p3->vec, data); + + /* make compatible with vectoquat */ + negate_v3(dir); + //} + + nurbs = BKE_curve_editNurbs_get(cu); + if (!nurbs) { + nurbs = &cu->nurb; + } + nu = nurbs->first; + + /* make sure that first and last frame are included in the vectors here */ + if (nu->type == CU_POLY) { + key_curve_position_weights(1.0f - fac, data, KEY_LINEAR); + } + else if (nu->type == CU_BEZIER) { + key_curve_position_weights(1.0f - fac, data, KEY_LINEAR); + } + else if (s0 == s1 || p2 == p3) { + key_curve_position_weights(1.0f - fac, data, KEY_CARDINAL); + } + else { + key_curve_position_weights(1.0f - fac, data, KEY_BSPLINE); + } + + vec[0] = data[0] * p0->vec[0] + data[1] * p1->vec[0] + data[2] * p2->vec[0] + + data[3] * p3->vec[0]; /* X */ + vec[1] = data[0] * p0->vec[1] + data[1] * p1->vec[1] + data[2] * p2->vec[1] + + data[3] * p3->vec[1]; /* Y */ + vec[2] = data[0] * p0->vec[2] + data[1] * p1->vec[2] + data[2] * p2->vec[2] + + data[3] * p3->vec[2]; /* Z */ + vec[3] = data[0] * p0->vec[3] + data[1] * p1->vec[3] + data[2] * p2->vec[3] + + data[3] * p3->vec[3]; /* Tilt, should not be needed since we have quat still used */ + + if (quat) { + float totfac, q1[4], q2[4]; + + totfac = data[0] + data[3]; + if (totfac > FLT_EPSILON) { + interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac); + } + else { + copy_qt_qt(q1, p1->quat); + } + + totfac = data[1] + data[2]; + if (totfac > FLT_EPSILON) { + interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac); + } + else { + copy_qt_qt(q2, p3->quat); + } + + totfac = data[0] + data[1] + data[2] + data[3]; + if (totfac > FLT_EPSILON) { + interp_qt_qtqt(quat, q1, q2, (data[1] + data[2]) / totfac); + } + else { + copy_qt_qt(quat, q2); + } + } + + if (radius) { + *radius = data[0] * p0->radius + data[1] * p1->radius + data[2] * p2->radius + + data[3] * p3->radius; + } + + if (weight) { + *weight = data[0] * p0->weight + data[1] * p1->weight + data[2] * p2->weight + + data[3] * p3->weight; + } + + return 1; +} diff --git a/source/blender/blenkernel/intern/anim_visualization.c b/source/blender/blenkernel/intern/anim_visualization.c new file mode 100644 index 00000000000..04dbe4102cc --- /dev/null +++ b/source/blender/blenkernel/intern/anim_visualization.c @@ -0,0 +1,228 @@ +/* + * 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. + */ + +/** \file + * \ingroup bke + */ +#include "MEM_guardedalloc.h" + +#include "DNA_action_types.h" +#include "DNA_anim_types.h" +#include "DNA_object_types.h" +#include "DNA_scene_types.h" + +#include "BLT_translation.h" + +#include "BKE_anim_visualization.h" +#include "BKE_report.h" + +#include "GPU_batch.h" + +/* ******************************************************************** */ +/* 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 a copy of motionpath data, so that viewing with copy on write works */ +bMotionPath *animviz_copy_motionpath(const bMotionPath *mpath_src) +{ + bMotionPath *mpath_dst; + + if (mpath_src == NULL) { + return NULL; + } + + mpath_dst = MEM_dupallocN(mpath_src); + mpath_dst->points = MEM_dupallocN(mpath_src->points); + + /* should get recreated on draw... */ + mpath_dst->points_vbo = NULL; + mpath_dst->batch_line = NULL; + mpath_dst->batch_points = NULL; + + return mpath_dst; +} + +/* ------------------- */ + +/** + * Setup motion paths for the given data. + * \note Only used when explicitly calculating paths on bones which may/may not be consider already + * + * \param scene: Current scene (for frame ranges, etc.) + * \param ob: Object to add paths for (must be provided) + * \param pchan: Posechannel to add paths for (optional; if not provided, object-paths are assumed) + */ +bMotionPath *animviz_verify_motionpaths(ReportList *reports, + Scene *scene, + Object *ob, + bPoseChannel *pchan) +{ + bAnimVizSettings *avs; + bMotionPath *mpath, **dst; + + /* sanity checks */ + if (ELEM(NULL, scene, ob)) { + return NULL; + } + + /* get destination data */ + if (pchan) { + /* paths for posechannel - assume that posechannel belongs to the object */ + avs = &ob->pose->avs; + dst = &pchan->mpath; + } + else { + /* paths for object */ + avs = &ob->avs; + dst = &ob->mpath; + } + + /* avoid 0 size allocs */ + if (avs->path_sf >= avs->path_ef) { + BKE_reportf(reports, + RPT_ERROR, + "Motion path frame extents invalid for %s (%d to %d)%s", + (pchan) ? pchan->name : ob->id.name, + avs->path_sf, + avs->path_ef, + (avs->path_sf == avs->path_ef) ? TIP_(", cannot have single-frame paths") : ""); + return NULL; + } + + /* if there is already a motionpath, just return that, + * provided it's settings are ok (saves extra free+alloc) + */ + if (*dst != NULL) { + int expected_length = avs->path_ef - avs->path_sf; + + mpath = *dst; + + /* Path is "valid" if length is valid, + * but must also be of the same length as is being requested. */ + if ((mpath->start_frame != mpath->end_frame) && (mpath->length > 0)) { + /* outer check ensures that we have some curve data for this path */ + if (mpath->length == expected_length) { + /* return/use this as it is already valid length */ + return mpath; + } + else { + /* clear the existing path (as the range has changed), and reallocate below */ + animviz_free_motionpath_cache(mpath); + } + } + } + else { + /* create a new motionpath, and assign it */ + mpath = MEM_callocN(sizeof(bMotionPath), "bMotionPath"); + *dst = mpath; + } + + /* set settings from the viz settings */ + mpath->start_frame = avs->path_sf; + mpath->end_frame = avs->path_ef; + + mpath->length = mpath->end_frame - mpath->start_frame; + + if (avs->path_bakeflag & MOTIONPATH_BAKE_HEADS) { + mpath->flag |= MOTIONPATH_FLAG_BHEAD; + } + else { + mpath->flag &= ~MOTIONPATH_FLAG_BHEAD; + } + + /* set default custom values */ + mpath->color[0] = 1.0; /* Red */ + mpath->color[1] = 0.0; + mpath->color[2] = 0.0; + + mpath->line_thickness = 2; + mpath->flag |= MOTIONPATH_FLAG_LINES; /* draw lines by default */ + + /* allocate a cache */ + mpath->points = MEM_callocN(sizeof(bMotionPathVert) * mpath->length, "bMotionPathVerts"); + + /* tag viz settings as currently having some path(s) which use it */ + avs->path_bakeflag |= MOTIONPATH_BAKE_HAS_PATHS; + + /* return it */ + return mpath; +} diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 444d63e33d0..38a9864fd36 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -51,7 +51,7 @@ #include "DNA_scene_types.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/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index e51b9ea85d1..d0a5e4348b9 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -35,7 +35,7 @@ #include "DNA_scene_types.h" #include "BKE_action.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_armature.h" #include "BKE_curve.h" #include "BKE_displist.h" diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 04adb642fc0..28ce62c3de2 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -52,7 +52,7 @@ #include "DNA_tracking_types.h" #include "BKE_action.h" -#include "BKE_anim.h" /* for the curve calculation part */ +#include "BKE_anim_path.h" #include "BKE_armature.h" #include "BKE_bvhutils.h" #include "BKE_cachefile.h" diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index dc2f603aa5c..907e7eb66ec 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -42,7 +42,7 @@ #include "BLI_string.h" #include "BLI_utildefines.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_curve.h" #include "BKE_displist.h" #include "BKE_font.h" diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index f7ddc4385ac..984a7a12b94 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -49,7 +49,7 @@ #include "PIL_time.h" -#include "BKE_anim.h" /* needed for where_on_path */ +#include "BKE_anim_path.h" /* needed for where_on_path */ #include "BKE_bvhutils.h" #include "BKE_collection.h" #include "BKE_collision.h" diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index a4da7ceb861..e8ff2ccc1af 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -48,7 +48,7 @@ #include "DNA_packedFile_types.h" #include "DNA_vfont_types.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_curve.h" #include "BKE_font.h" #include "BKE_global.h" diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c index 3f353d6d576..65412493049 100644 --- a/source/blender/blenkernel/intern/lattice.c +++ b/source/blender/blenkernel/intern/lattice.c @@ -45,7 +45,7 @@ #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_animsys.h" #include "BKE_curve.h" #include "BKE_displist.h" diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 7a2e9583aa1..3f94958c779 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -68,7 +68,8 @@ #include "BKE_DerivedMesh.h" #include "BKE_action.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" +#include "BKE_anim_visualization.h" #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_camera.h" @@ -77,6 +78,7 @@ #include "BKE_curve.h" #include "BKE_deform.h" #include "BKE_displist.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_effect.h" #include "BKE_fcurve.h" diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 1217d230d0d..f093b8c4211 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -40,9 +40,9 @@ #include "DNA_scene_types.h" #include "DNA_vfont_types.h" -#include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_collection.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_font.h" #include "BKE_global.h" diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index f110a2bd3ae..067eb6ab18e 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -50,7 +50,7 @@ #include "BLT_translation.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_animsys.h" #include "BKE_boids.h" diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 76088867997..b1cff53d399 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -51,7 +51,6 @@ #include "PIL_time.h" -#include "BKE_anim.h" #include "BKE_appdir.h" #include "BKE_cloth.h" #include "BKE_collection.h" diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index b12402d74fc..0011247fcd0 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -59,13 +59,13 @@ #include "BLT_translation.h" #include "BKE_action.h" -#include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_cachefile.h" #include "BKE_collection.h" #include "BKE_colortools.h" #include "BKE_curveprofile.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_fcurve.h" #include "BKE_freestyle.h" diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index fed0cbda466..bb80aaaaa5a 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -61,7 +61,7 @@ #include "BLI_math.h" #include "BLI_utildefines.h" -#include "BKE_anim.h" +#include "BKE_anim_visualization.h" #include "BKE_armature.h" #include "BKE_colortools.h" #include "BKE_global.h" // for G diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 26de003dc17..f1dcbba8e90 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -52,7 +52,7 @@ #include "BLT_translation.h" -#include "BKE_anim.h" +#include "BKE_anim_visualization.h" #include "BKE_image.h" #include "BKE_main.h" // for Main #include "BKE_mesh.h" // for ME_ defines (patching) diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index 427a16adfc4..fadd0beb636 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -29,7 +29,7 @@ #include "MEM_guardedalloc.h" extern "C" { -#include "BKE_anim.h" +#include "BKE_duplilist.h" #include "BKE_idprop.h" #include "BKE_layer.h" #include "BKE_node.h" diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index bc0797eff0d..80691a6c2ad 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -24,7 +24,7 @@ #include "UI_resources.h" -#include "BKE_anim.h" +#include "BKE_anim_path.h" #include "BKE_camera.h" #include "BKE_constraint.h" #include "BKE_curve.h" diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 048adccc4e6..0fe68950cde 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -32,7 +32,7 @@ #include "DNA_modifier_types.h" #include "DNA_particle_types.h" -#include "BKE_anim.h" +#include "BKE_duplilist.h" #include "GPU_batch.h" #include "GPU_shader.h" diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 1b169dbee1d..280e82ef473 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -31,10 +31,10 @@ #include "BLF_api.h" -#include "BKE_anim.h" #include "BKE_colortools.h" #include "BKE_context.h" #include "BKE_curve.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_global.h" #include "BKE_gpencil.h" diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index fd13e22ff4e..ae18636227d 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -22,8 +22,8 @@ #include "draw_manager.h" -#include "BKE_anim.h" #include "BKE_curve.h" +#include "BKE_duplilist.h" #include "BKE_global.h" #include "BKE_image.h" #include "BKE_mesh.h" diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 09b6cd9c8cc..5c75e8f6187 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -33,7 +33,7 @@ #include "DNA_scene_types.h" #include "BKE_action.h" -#include "BKE_anim.h" +#include "BKE_anim_visualization.h" #include "BKE_armature.h" #include "BKE_context.h" #include "BKE_deform.h" diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 65d3196d8c3..e800203ae79 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -53,7 +53,6 @@ #include "BLT_translation.h" #include "BKE_action.h" -#include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_armature.h" #include "BKE_camera.h" @@ -62,6 +61,7 @@ #include "BKE_context.h" #include "BKE_curve.h" #include "BKE_displist.h" +#include "BKE_duplilist.h" #include "BKE_effect.h" #include "BKE_font.h" #include "BKE_gpencil_geom.h" diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 7faad5cdd0e..80ee03ca860 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -54,7 +54,7 @@ #include "IMB_imbuf_types.h" -#include "BKE_anim.h" +#include "BKE_anim_visualization.h" #include "BKE_collection.h" #include "BKE_constraint.h" #include "BKE_context.h" diff --git a/source/blender/editors/space_info/info_stats.c b/source/blender/editors/space_info/info_stats.c index e0e6edda850..a91a11b2465 100644 --- a/source/blender/editors/space_info/info_stats.c +++ b/source/blender/editors/space_info/info_stats.c @@ -40,7 +40,6 @@ #include "BLT_translation.h" -#include "BKE_anim.h" #include "BKE_blender_version.h" #include "BKE_curve.h" #include "BKE_displist.h" diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 9adc15ccb61..dffe52745e4 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -44,8 +44,8 @@ #include "GPU_immediate.h" #include "GPU_state.h" -#include "BKE_anim.h" /* for duplis */ #include "BKE_context.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_layer.h" #include "BKE_main.h" diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 34c9e1f3273..8e7e36d7cb7 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -38,10 +38,10 @@ #include "DNA_screen_types.h" #include "DNA_view3d_types.h" -#include "BKE_anim.h" /* for duplis */ #include "BKE_armature.h" #include "BKE_bvhutils.h" #include "BKE_curve.h" +#include "BKE_duplilist.h" #include "BKE_editmesh.h" #include "BKE_layer.h" #include "BKE_main.h" diff --git a/source/blender/io/alembic/intern/abc_exporter.cc b/source/blender/io/alembic/intern/abc_exporter.cc index fb75fb1f6c7..e3e095463b4 100644 --- a/source/blender/io/alembic/intern/abc_exporter.cc +++ b/source/blender/io/alembic/intern/abc_exporter.cc @@ -51,7 +51,7 @@ extern "C" { # include "BLI_winstuff.h" #endif -#include "BKE_anim.h" +#include "BKE_duplilist.h" #include "BKE_global.h" #include "BKE_idprop.h" #include "BKE_layer.h" diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc index 50f81c2ffb1..89f75a6ad80 100644 --- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc +++ b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc @@ -24,8 +24,8 @@ #include extern "C" { -#include "BKE_anim.h" #include "BKE_animsys.h" +#include "BKE_duplilist.h" #include "BKE_key.h" #include "BKE_particle.h" diff --git a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc index fd888f39adc..47f09af7442 100644 --- a/source/blender/io/usd/intern/usd_hierarchy_iterator.cc +++ b/source/blender/io/usd/intern/usd_hierarchy_iterator.cc @@ -32,7 +32,7 @@ #include extern "C" { -#include "BKE_anim.h" +#include "BKE_duplilist.h" #include "BLI_assert.h" diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc index cbf51fc15b3..2e6696e12ca 100644 --- a/source/blender/io/usd/intern/usd_writer_mesh.cc +++ b/source/blender/io/usd/intern/usd_writer_mesh.cc @@ -27,7 +27,6 @@ extern "C" { #include "BLI_assert.h" #include "BLI_math_vector.h" -#include "BKE_anim.h" #include "BKE_customdata.h" #include "BKE_lib_id.h" #include "BKE_material.h" diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 66c8522c53a..41c107b8d04 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -43,7 +43,7 @@ # include "BLI_iterator.h" # include "BLI_math.h" -# include "BKE_anim.h" +# include "BKE_duplilist.h" # include "BKE_object.h" # include "BKE_scene.h" diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 5104f4a66a1..f4b64d2f812 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -63,7 +63,6 @@ static const EnumPropertyItem space_items[] = { # include "BLI_math.h" -# include "BKE_anim.h" # include "BKE_bvhutils.h" # include "BKE_constraint.h" # include "BKE_context.h" -- cgit v1.2.3