diff options
author | Joshua Leung <aligorith@gmail.com> | 2010-01-27 13:43:14 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2010-01-27 13:43:14 +0300 |
commit | 2cb23d03efb432ba67bd2b8ccc9e59b3e69c59a2 (patch) | |
tree | 30b7c3d383645192ec6ec6b5413c51a51873d6b1 /source | |
parent | f268ab1eba490e5df61e7074610c056c258cb426 (diff) |
Bugfix #20752: Background Image Panel Properties Keyframing?
Added a check in RNA_property_animateable() which checks if the base ID-block can have animation data or not. Screen data currently cannot have animation data, so this solves that problem (where there were non-functional entries there in the menu).
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_animsys.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim_sys.c | 10 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 5 |
3 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index ad89d3bbd53..a36845b38a2 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -43,7 +43,10 @@ struct AnimMapper; /* ************************************* */ /* AnimData API */ -/* Get AnimData from the given ID-block. */ +/* Check if the given ID-block can have AnimData */ +short id_type_can_have_animdata(struct ID *id); + +/* Get AnimData from the given ID-block */ struct AnimData *BKE_animdata_from_id(struct ID *id); /* Add AnimData to the given ID-block */ diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index c617ca33e8a..e6a429e4b5f 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -60,8 +60,8 @@ /* Getter/Setter -------------------------------------------- */ -/* Internal utility to check if ID can have AnimData */ -static short id_has_animdata (ID *id) +/* Check if ID can have AnimData */ +short id_type_can_have_animdata (ID *id) { /* sanity check */ if (id == NULL) @@ -99,7 +99,7 @@ AnimData *BKE_animdata_from_id (ID *id) * types that do to be of type IdAdtTemplate, and extract the * AnimData that way */ - if (id_has_animdata(id)) { + if (id_type_can_have_animdata(id)) { IdAdtTemplate *iat= (IdAdtTemplate *)id; return iat->adt; } @@ -117,7 +117,7 @@ AnimData *BKE_id_add_animdata (ID *id) * types that do to be of type IdAdtTemplate, and add the AnimData * to it using the template */ - if (id_has_animdata(id)) { + if (id_type_can_have_animdata(id)) { IdAdtTemplate *iat= (IdAdtTemplate *)id; /* check if there's already AnimData, in which case, don't add */ @@ -145,7 +145,7 @@ void BKE_free_animdata (ID *id) /* Only some ID-blocks have this info for now, so we cast the * types that do to be of type IdAdtTemplate */ - if (id_has_animdata(id)) { + if (id_type_can_have_animdata(id)) { IdAdtTemplate *iat= (IdAdtTemplate *)id; AnimData *adt= iat->adt; diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index cb3911b6423..d7517f6661c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -36,6 +36,7 @@ #include "BLI_dynstr.h" #include "BLI_ghash.h" +#include "BKE_animsys.h" #include "BKE_context.h" #include "BKE_idprop.h" #include "BKE_main.h" @@ -1110,6 +1111,10 @@ int RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index) int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop) { + /* check that base ID-block can support animation data */ + if (!id_type_can_have_animdata(ptr->id.data)) + return 0; + prop= rna_ensure_property(prop); if(!(prop->flag & PROP_ANIMATEABLE)) |