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>2015-07-14 12:19:27 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-07-14 12:21:04 +0300
commit82740cd282636fe318c3e4c7c3b1c2033857350d (patch)
tree6e904ad999a48b4ab3c1428641a482d7955cce57 /source/blender/makesrna
parent9c80e52a89ca1d514c57700e4916ee890c53c4c7 (diff)
Fix T45423: depsgraph: crash in IDDepsNode::tag_update
Two issues fixed in this commit: - Clearing or adding animation via python should ensure relations are valid. - Animation component animation data might be null caused by removing animation from python.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_ID.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index b87b455b36f..f3bd5fc5cef 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -85,6 +85,8 @@ EnumPropertyItem id_type_items[] = {
#ifdef RNA_RUNTIME
+#include "DNA_anim_types.h"
+
#include "BKE_font.h"
#include "BKE_idprop.h"
#include "BKE_library.h"
@@ -331,6 +333,19 @@ static void rna_ID_user_clear(ID *id)
id->flag &= ~LIB_FAKEUSER;
}
+static AnimData * rna_ID_animation_data_create(ID *id, Main *bmain)
+{
+ AnimData *adt = BKE_animdata_add_id(id);
+ DAG_relations_tag_update(bmain);
+ return adt;
+}
+
+static void rna_ID_animation_data_free(ID *id, Main *bmain)
+{
+ BKE_animdata_free(id);
+ DAG_relations_tag_update(bmain);
+}
+
static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
IDProperty *prop = (IDProperty *)ptr->data;
@@ -835,12 +850,14 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_function_ui_description(func, "Clear the user count of a datablock so its not saved, "
"on reload the data will be removed");
- func = RNA_def_function(srna, "animation_data_create", "BKE_animdata_add_id");
+ func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this");
parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "animation_data_clear", "BKE_animdata_free");
+ func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
RNA_def_function_ui_description(func, "Clear animation on this this ID");
func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");