Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2019-07-09 16:43:42 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2019-07-09 16:46:29 +0300
commit32f591c0a344e2e02e7740f487a55c154281501f (patch)
treea492e95e5b0df45f8f4d93c71477b9e1a7b20dfa /source/blender/depsgraph
parentfd48ef25a02e61b47798e5272913a7f52f2d1121 (diff)
Fix T66610: Planar Track extremely laggy when 3D View is open
The issue was caused by modifications to planar track tagging clip for copy-on-write, which was invalidating its cache and forcing current frame in 3D viewport to be re-load. Ideal solution would be to share movie cache across original and evaluated movie clips which will reduce memory usage. However, doing such ownership changes so close to the code freeze is not something comfortable to do.
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 3fef7fc9c02..453e9e06a6a 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -1334,6 +1334,50 @@ void ObjectRuntimeBackup::restore_pose_channel_runtime_data(Object *object)
}
}
+/* Backup of movie clip runtime data. */
+
+class MovieClipBackup {
+ public:
+ MovieClipBackup();
+
+ void reset();
+
+ void init_from_movieclip(MovieClip *movieclip);
+ void restore_to_movieclip(MovieClip *movieclip);
+
+ struct anim *anim;
+ struct MovieClipCache *cache;
+};
+
+MovieClipBackup::MovieClipBackup()
+{
+ reset();
+}
+
+void MovieClipBackup::reset()
+{
+ anim = NULL;
+ cache = NULL;
+}
+
+void MovieClipBackup::init_from_movieclip(MovieClip *movieclip)
+{
+ anim = movieclip->anim;
+ cache = movieclip->cache;
+ /* Clear pointers stored in the movie clip, so they are not freed when copied-on-written
+ * datablock is freed for re-allocation. */
+ movieclip->anim = NULL;
+ movieclip->cache = NULL;
+}
+
+void MovieClipBackup::restore_to_movieclip(MovieClip *movieclip)
+{
+ movieclip->anim = anim;
+ movieclip->cache = cache;
+
+ reset();
+}
+
class RuntimeBackup {
public:
RuntimeBackup() : drawdata_ptr(NULL)
@@ -1352,6 +1396,7 @@ class RuntimeBackup {
ObjectRuntimeBackup object_backup;
DrawDataList drawdata_backup;
DrawDataList *drawdata_ptr;
+ MovieClipBackup movieclip_backup;
};
void RuntimeBackup::init_from_id(ID *id)
@@ -1370,6 +1415,9 @@ void RuntimeBackup::init_from_id(ID *id)
case ID_SO:
sound_backup.init_from_sound(reinterpret_cast<bSound *>(id));
break;
+ case ID_MC:
+ movieclip_backup.init_from_movieclip(reinterpret_cast<MovieClip *>(id));
+ break;
default:
break;
}
@@ -1395,6 +1443,9 @@ void RuntimeBackup::restore_to_id(ID *id)
case ID_SO:
sound_backup.restore_to_sound(reinterpret_cast<bSound *>(id));
break;
+ case ID_MC:
+ movieclip_backup.restore_to_movieclip(reinterpret_cast<MovieClip *>(id));
+ break;
default:
break;
}