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:
authorJoshua Leung <aligorith@gmail.com>2018-05-18 21:36:48 +0300
committerJoshua Leung <aligorith@gmail.com>2018-05-19 20:54:47 +0300
commit6ba28ff8b1658d69e2f4c1c92a8eeec230f573ba (patch)
tree003c742d994f8a05d3dba96444d2aac0e7a9cdd5 /source/blender/python/intern
parent06737a82584c6be60a25b5f289e3fcd5c26b7aac (diff)
WIP COW Fix: Insert keyframe operators/api now queries depsgraph for evaluated data
When using copy on write, insert keyframe operators were reading from old bmain data instead of COW data. This meant that inserting keyframes would often read old/stale data, resulting in invalid keyframes getting created (e.g. from last transform operation, instead of actual current state). This commit makes it so that keyframing operators will ask depsgraph for the evaluated copy of the data, so that it can read values from that. It introduces a new function - `DEG_get_evaluated_rna_pointer()`, which when working correctly/fully, should work just like the other `DEG_get_evaluated_*()` functions, except it lets you pass in an RNA Pointer. However, currently, this is only done for Pose Bones (as a dirty hack, since this is an important/pivotal requirement for production) and/or datablock properties directly (since we can just use the DEG_get_evaluated_id() directly). on the datablock. Committing to a branch for now as this all needs more testing. More work to come later at a more sane time of day!
Diffstat (limited to 'source/blender/python/intern')
-rw-r--r--source/blender/python/intern/bpy_rna_anim.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna_anim.c b/source/blender/python/intern/bpy_rna_anim.c
index 9f9bb46c8bb..3bbeaea2674 100644
--- a/source/blender/python/intern/bpy_rna_anim.c
+++ b/source/blender/python/intern/bpy_rna_anim.c
@@ -231,6 +231,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
* strips themselves. These are stored separately or else the properties will
* not have any effect.
*/
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext());
ReportList reports;
short result = 0;
@@ -252,7 +253,7 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
NlaStrip *strip = (NlaStrip *)ptr.data;
FCurve *fcu = list_find_fcurve(&strip->fcurves, RNA_property_identifier(prop), index);
- result = insert_keyframe_direct(&reports, ptr, prop, fcu, cfra, keytype, options);
+ result = insert_keyframe_direct(depsgraph, &reports, ptr, prop, fcu, cfra, keytype, options);
}
else {
BKE_reportf(&reports, RPT_ERROR, "Could not resolve path (%s)", path_full);
@@ -265,12 +266,13 @@ PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args, PyOb
return PyBool_FromLong(result);
}
else {
+ struct Depsgraph *depsgraph = CTX_data_depsgraph(BPy_GetContext());
ReportList reports;
short result;
BKE_reports_init(&reports, RPT_STORE);
- result = insert_keyframe(&reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
+ result = insert_keyframe(depsgraph, &reports, (ID *)self->ptr.id.data, NULL, group_name, path_full, index, cfra, keytype, options);
MEM_freeN((void *)path_full);
if (BPy_reports_to_error(&reports, PyExc_RuntimeError, true) == -1)