diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-05-11 06:07:40 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-05-11 06:07:40 +0400 |
commit | 5c96cd0319c759555175e37be5c3dcd162fe01d8 (patch) | |
tree | 47b60e725209824bd39f96b3446f1156b96a35ab /source/blender | |
parent | c32a3bd73bd038f443864eccdb830ff15e8f70d2 (diff) |
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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 33 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 9 |
2 files changed, 30 insertions, 12 deletions
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index b09cc3b78e1..f7a16f63691 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -68,6 +68,7 @@ bAction *verify_adt_action (ID *id, short add) 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 @@ short insert_keyframe (ID *id, bAction *act, const char group[], const char rna_ } } + /* 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 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) 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 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) 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 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) 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,11 +1290,16 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) 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); } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 5532ab90e42..4d2302f1c06 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -69,8 +69,11 @@ void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr) 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 @@ int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char * 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); |