[Bf-blender-cvs] [5e84fda] alembic_basic_io: Only draw the caches' keyframes for the objects in the current scene.
Kévin Dietrich
noreply at git.blender.org
Thu Jul 21 00:33:40 CEST 2016
Commit: 5e84fda28773775f18f5f91113104a61100407f3
Author: Kévin Dietrich
Date: Wed Jul 20 22:57:39 2016 +0200
Branches: alembic_basic_io
https://developer.blender.org/rB5e84fda28773775f18f5f91113104a61100407f3
Only draw the caches' keyframes for the objects in the current scene.
===================================================================
M source/blender/editors/space_time/space_time.c
M source/blender/makesdna/DNA_cachefile_types.h
===================================================================
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index 91a4012..56cddba 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -33,7 +33,9 @@
#include <stdio.h>
#include "DNA_cachefile_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_gpencil_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -43,8 +45,10 @@
#include "BLI_dlrbTree.h"
#include "BLI_utildefines.h"
+#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_main.h"
+#include "BKE_modifier.h"
#include "BKE_screen.h"
#include "BKE_pointcache.h"
@@ -349,6 +353,56 @@ static void time_draw_idblock_keyframes(View2D *v2d, ID *id, short onlysel)
BLI_dlrbTree_free(&keys);
}
+static void time_draw_caches_keyframes(Main *bmain, Scene *scene, View2D *v2d, bool onlysel)
+{
+ CacheFile *cache_file;
+
+ for (cache_file = bmain->cachefiles.first;
+ cache_file;
+ cache_file = cache_file->id.next)
+ {
+ cache_file->draw_flag &= ~CACHEFILE_KEYFRAME_DRAWN;
+ }
+
+ for (Base *base = scene->base.first; base; base = base->next) {
+ Object *ob = base->object;
+
+ ModifierData *md = modifiers_findByType(ob, eModifierType_MeshSequenceCache);
+
+ if (md) {
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)md;
+
+ cache_file = mcmd->cache_file;
+
+ if (!cache_file || (cache_file->draw_flag & CACHEFILE_KEYFRAME_DRAWN) != 0) {
+ continue;
+ }
+
+ cache_file->draw_flag |= CACHEFILE_KEYFRAME_DRAWN;
+
+ time_draw_idblock_keyframes(v2d, (ID *)cache_file, onlysel);
+ }
+
+ for (bConstraint *con = ob->constraints.first; con; con = con->next) {
+ if (con->type != CONSTRAINT_TYPE_TRANSFORM_CACHE) {
+ continue;
+ }
+
+ bTransformCacheConstraint *data = con->data;
+
+ cache_file = data->cache_file;
+
+ if (!cache_file || (cache_file->draw_flag & CACHEFILE_KEYFRAME_DRAWN) != 0) {
+ continue;
+ }
+
+ cache_file->draw_flag |= CACHEFILE_KEYFRAME_DRAWN;
+
+ time_draw_idblock_keyframes(v2d, (ID *)cache_file, onlysel);
+ }
+ }
+}
+
/* draw keyframe lines for timeline */
static void time_draw_keyframes(const bContext *C, ARegion *ar)
{
@@ -361,15 +415,8 @@ static void time_draw_keyframes(const bContext *C, ARegion *ar)
glLineWidth(1.0);
/* draw cache files keyframes (if available) */
- Main *bmain = CTX_data_main(C);
- CacheFile *cache_file;
-
- /* Draw cachefile keyframes. */
UI_ThemeColor(TH_TIME_KEYFRAME);
-
- for (cache_file = bmain->cachefiles.first; cache_file; cache_file = cache_file->id.next) {
- time_draw_idblock_keyframes(v2d, (ID *)cache_file, onlysel);
- }
+ time_draw_caches_keyframes(CTX_data_main(C), scene, v2d, onlysel);
/* draw grease pencil keyframes (if available) */
UI_ThemeColor(TH_TIME_GP_KEYFRAME);
diff --git a/source/blender/makesdna/DNA_cachefile_types.h b/source/blender/makesdna/DNA_cachefile_types.h
index 5768a19..1cda023 100644
--- a/source/blender/makesdna/DNA_cachefile_types.h
+++ b/source/blender/makesdna/DNA_cachefile_types.h
@@ -42,6 +42,11 @@ enum {
CACHEFILE_DS_EXPAND = (1 << 0),
};
+/* CacheFile::draw_flag */
+enum {
+ CACHEFILE_KEYFRAME_DRAWN = (1 << 0),
+};
+
typedef struct AlembicObjectPath {
struct AlembicObjectPath *next, *prev;
@@ -69,7 +74,7 @@ typedef struct CacheFile {
float frame; /* The frame/time to lookup in the cache file. */
short flag; /* Animation flag. */
- short pad;
+ short draw_flag;
} CacheFile;
#ifdef __cplusplus
More information about the Bf-blender-cvs
mailing list