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:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2016-10-29 13:23:09 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2016-10-29 13:23:09 +0300
commit753edafcb77d9aaf07fe869372319b841dd80681 (patch)
tree676445ce05cf2a8a53ced9deedf5bcba37fd9653 /source/blender/makesrna/intern/rna_constraint.c
parent0c13792437b3e501c06605876a0396e187c0f7da (diff)
Alembic: store a pointer to the object reader in the cache modifiers and
constraints. This avoids traversing the archive everytime object data is needed and gives an overall consistent ~2x speedup here with files containing between 136 and 500 Alembic objects. Also this somewhat nicely de- duplicates code between data creation (upon import) and data streaming (modifiers and constraints). The only worying part is what happens when a CacheFile is deleted and/or has its path changed. For now, we traverse the whole scene and for each object using the CacheFile we free the pointer and NULL-ify it (see BKE_cachefile_clean), but at some point this should be re-considered and make use of the dependency graph.
Diffstat (limited to 'source/blender/makesrna/intern/rna_constraint.c')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index db3f76f3cfc..ad037af943d 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -148,12 +148,17 @@ static EnumPropertyItem space_object_items[] = {
{0, NULL, 0, NULL, NULL}
};
+#include "DNA_cachefile_types.h"
+
#include "BKE_animsys.h"
#include "BKE_action.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#ifdef WITH_ALEMBIC
+# include "ABC_alembic.h"
+#endif
static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
{
@@ -471,6 +476,20 @@ static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA v
}
}
+static void rna_Constraint_transformCache_object_path_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ bConstraint *con = (bConstraint *)ptr->data;
+ bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data;
+ Object *ob = (Object *)ptr->id.data;
+
+ data->reader = CacheReader_open_alembic_object(data->cache_file->handle,
+ data->reader,
+ ob,
+ data->object_path);
+
+ rna_Constraint_update(bmain, scene, ptr);
+}
+
#else
static EnumPropertyItem constraint_distance_items[] = {
@@ -2593,7 +2612,7 @@ static void rna_def_constraint_transform_cache(BlenderRNA *brna)
prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive used to lookup the transform matrix");
- RNA_def_property_update(prop, 0, "rna_Constraint_update");
+ RNA_def_property_update(prop, 0, "rna_Constraint_transformCache_object_path_update");
}
/* base struct for constraints */