[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26328] trunk/blender/source/blender: Bugfix #20752: Background Image Panel Properties Keyframing?

Joshua Leung aligorith at gmail.com
Wed Jan 27 11:43:15 CET 2010


Revision: 26328
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26328
Author:   aligorith
Date:     2010-01-27 11:43:14 +0100 (Wed, 27 Jan 2010)

Log Message:
-----------
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).

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_animsys.h
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/makesrna/intern/rna_access.c

Modified: trunk/blender/source/blender/blenkernel/BKE_animsys.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_animsys.h	2010-01-27 10:30:10 UTC (rev 26327)
+++ trunk/blender/source/blender/blenkernel/BKE_animsys.h	2010-01-27 10:43:14 UTC (rev 26328)
@@ -43,7 +43,10 @@
 /* ************************************* */
 /* 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 */

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2010-01-27 10:30:10 UTC (rev 26327)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2010-01-27 10:43:14 UTC (rev 26328)
@@ -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 @@
 	 * 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 @@
 	 * 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 @@
 	/* 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;
 		

Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-01-27 10:30:10 UTC (rev 26327)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-01-27 10:43:14 UTC (rev 26328)
@@ -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_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))





More information about the Bf-blender-cvs mailing list