[Bf-blender-cvs] [3c1115ef7fe] master: Depsgraph: Fix wrong access to animated properties

Sergey Sharybin noreply at git.blender.org
Mon Jan 13 12:18:34 CET 2020


Commit: 3c1115ef7fe7cd5b26e457b6c676f845ec63544f
Author: Sergey Sharybin
Date:   Mon Jan 13 12:03:01 2020 +0100
Branches: master
https://developer.blender.org/rB3c1115ef7fe7cd5b26e457b6c676f845ec63544f

Depsgraph: Fix wrong access to animated properties

Copy-on-write backuyp was trying to read float from an array property,
which is wrong.

This is part of T73029.

===================================================================

M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h

===================================================================

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
index 0a6f0641fcf..ec3ab6edc17 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
@@ -59,11 +59,8 @@ void animated_property_store_cb(ID *id, FCurve *fcurve, void *data_v)
 
   /* Resolve path to the property. */
   PathResolvedRNA resolved_rna;
-  if (!RNA_path_resolve_property_full(&data->id_pointer_rna,
-                                      fcurve->rna_path,
-                                      &resolved_rna.ptr,
-                                      &resolved_rna.prop,
-                                      &resolved_rna.prop_index)) {
+  if (!BKE_animsys_store_rna_setting(
+          &data->id_pointer_rna, fcurve->rna_path, fcurve->array_index, &resolved_rna)) {
     return;
   }
 
@@ -73,7 +70,7 @@ void animated_property_store_cb(ID *id, FCurve *fcurve, void *data_v)
     return;
   }
 
-  data->backup->values_backup.emplace_back(fcurve->rna_path, value);
+  data->backup->values_backup.emplace_back(fcurve->rna_path, fcurve->array_index, value);
 }
 
 }  // namespace
@@ -82,8 +79,8 @@ AnimationValueBackup::AnimationValueBackup()
 {
 }
 
-AnimationValueBackup::AnimationValueBackup(const string &rna_path, float value)
-    : rna_path(rna_path), value(value)
+AnimationValueBackup::AnimationValueBackup(const string &rna_path, int array_index, float value)
+    : rna_path(rna_path), array_index(array_index), value(value)
 {
 }
 
@@ -121,11 +118,10 @@ void AnimationBackup::restore_to_id(ID *id)
      * changed after copy-on-write.
      */
     PathResolvedRNA resolved_rna;
-    if (!RNA_path_resolve_property_full(&id_pointer_rna,
-                                        value_backup.rna_path.c_str(),
-                                        &resolved_rna.ptr,
-                                        &resolved_rna.prop,
-                                        &resolved_rna.prop_index)) {
+    if (!BKE_animsys_store_rna_setting(&id_pointer_rna,
+                                       value_backup.rna_path.c_str(),
+                                       value_backup.array_index,
+                                       &resolved_rna)) {
       return;
     }
 
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
index 8c111107f36..d97ee2b0556 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
@@ -34,7 +34,7 @@ struct Depsgraph;
 class AnimationValueBackup {
  public:
   AnimationValueBackup();
-  AnimationValueBackup(const string &rna_path, float value);
+  AnimationValueBackup(const string &rna_path, int array_index, float value);
   ~AnimationValueBackup();
 
   AnimationValueBackup(const AnimationValueBackup &other) = default;
@@ -44,6 +44,7 @@ class AnimationValueBackup {
   AnimationValueBackup &operator=(AnimationValueBackup &&other) = default;
 
   string rna_path;
+  int array_index;
   float value;
 };



More information about the Bf-blender-cvs mailing list