Revision: 20139
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20139
Author:   aligorith
Date:     2009-05-11 04:07:40 +0200 (Mon, 11 May 2009)

Log Message:
-----------
RNA Bugfix: (Brecht, please check over these fixes...)

Fixed one of the causes of keyframes not being able to be inserted. For 
ID-types where inheritence of the basic wrapping of the struct (i.e. for Lamp 
blocks, shadow and other lamp-type specific settings were only defined in 
subclasses of the Lamp struct), the RNA_id_pointer_create() function now 
performs additional refinement of the PointerRNA so that the pointer will be 
resolved correctly to allow access to these settings.

The other case which is unresolved for now is nestled structs. The 
RNA_path_from_ID_to_property() needs modification for this, but dunno how yet. 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframing.c   
2009-05-11 00:56:48 UTC (rev 20138)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframing.c   
2009-05-11 02:07:40 UTC (rev 20139)
@@ -68,6 +68,7 @@
                adt= BKE_id_add_animdata(id);
        if (adt == NULL) { 
                /* if still none (as not allowed to add, or ID doesn't have 
animdata for some reason) */
+               printf("ERROR: Couldn't add AnimData (ID = %s) \n", (id) ? 
(id->name) : "<None>");
                return NULL;
        }
                
@@ -793,6 +794,9 @@
                }
        }
        
+       /* no F-Curve to add keyframes to */
+       printf("ERROR: no F-Curve to add keyframes to \n");
+       
        /* return failure */
        return 0;
 }
@@ -1203,11 +1207,11 @@
        memset(&ptr, 0, sizeof(PointerRNA));
        uiAnimContextProperty(C, &ptr, &prop, &index);
        
-       if(ptr.data && prop && RNA_property_animateable(&ptr, prop)) {
+       if ((ptr.data && prop) && RNA_property_animateable(&ptr, prop)) {
                path= RNA_path_from_ID_to_property(&ptr, prop);
                
-               if(path) {
-                       if(all) {
+               if (path) {
+                       if (all) {
                                length= RNA_property_array_length(prop);
                                
                                if(length) index= 0;
@@ -1216,14 +1220,20 @@
                        else
                                length= 1;
                        
-                       for(a=0; a<length; a++)
+                       for (a=0; a<length; a++)
                                success+= insert_keyframe(ptr.id.data, NULL, 
NULL, path, index+a, cfra, 0);
                        
                        MEM_freeN(path);
                }
+               else if (G.f & G_DEBUG)
+                       printf("Button Insert-Key: no path to property \n");
        }
+       else if (G.f & G_DEBUG) {
+               printf("ptr.data = %p, prop = %p,", ptr.data, prop);
+               printf("animateable = %d \n", RNA_property_animateable(&ptr, 
prop));
+       }
        
-       if(success) {
+       if (success) {
                /* send updates */
                ED_anim_dag_flush_update(C);    
                
@@ -1267,11 +1277,11 @@
        memset(&ptr, 0, sizeof(PointerRNA));
        uiAnimContextProperty(C, &ptr, &prop, &index);
 
-       if(ptr.data && prop) {
+       if (ptr.data && prop) {
                path= RNA_path_from_ID_to_property(&ptr, prop);
                
-               if(path) {
-                       if(all) {
+               if (path) {
+                       if (all) {
                                length= RNA_property_array_length(prop);
                                
                                if(length) index= 0;
@@ -1280,12 +1290,17 @@
                        else
                                length= 1;
                        
-                       for(a=0; a<length; a++)
+                       for (a=0; a<length; a++)
                                success+= delete_keyframe(ptr.id.data, NULL, 
NULL, path, index+a, cfra, 0);
                        
                        MEM_freeN(path);
                }
+               else if (G.f & G_DEBUG)
+                       printf("Button Delete-Key: no path to property \n");
        }
+       else if (G.f & G_DEBUG) {
+               printf("ptr.data = %p, prop = %p \n", ptr.data, prop);
+       }
        
        
        if(success) {

Modified: 
branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c     
2009-05-11 00:56:48 UTC (rev 20138)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_access.c     
2009-05-11 02:07:40 UTC (rev 20139)
@@ -69,8 +69,11 @@
                memset(&tmp, 0, sizeof(tmp));
                tmp.data= id;
                idtype= rna_ID_refine(&tmp);
+               
+               if(idtype->refine)
+                       idtype= idtype->refine(&tmp);
        }
-
+       
        r_ptr->id.data= id;
        r_ptr->type= idtype;
        r_ptr->data= id;
@@ -2533,9 +2536,9 @@
        PropertyRNA *pret, *parm;
        PropertyType type;
        int i, ofs, flen, flag, len, alen, err= 0;
-       const char *tid, *fid, *pid;
+       const char *tid, *fid, *pid=NULL;
        char ftype;
-       void **retdata;
+       void **retdata=NULL;
 
        RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
 


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to