diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-31 20:19:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-01-31 20:19:44 +0400 |
commit | 7b6e78e48a63952a699b2af346d7ac6a131b15ad (patch) | |
tree | 33229a7a452c06b0313868da0252b9c36694883b /source/blender/editors/interface/interface_anim.c | |
parent | 757546036c0c67e2c345547a68d95e17d7e1a0ac (diff) |
Fix #34034: keyframe display of color/curve buttons was broken after revision
53132 which changed the RNA index to -1 for these. Also made it so that these
buttons no longer display "Insert Single Keyframe" and only "Insert Keyframe"
as you can't edit individual components here so it's only confusing.
Diffstat (limited to 'source/blender/editors/interface/interface_anim.c')
-rw-r--r-- | source/blender/editors/interface/interface_anim.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c index 5d62ef768d2..0fc99fbfbe1 100644 --- a/source/blender/editors/interface/interface_anim.c +++ b/source/blender/editors/interface/interface_anim.c @@ -57,7 +57,11 @@ static FCurve *ui_but_get_fcurve(uiBut *but, bAction **action, int *driven) { - return rna_get_fcurve(&but->rnapoin, but->rnaprop, but->rnaindex, action, driven); + /* for entire array buttons we check the first component, it's not perfect + * but works well enough in typical cases */ + int rnaindex = (but->rnaindex == -1)? 0: but->rnaindex; + + return rna_get_fcurve(&but->rnapoin, but->rnaprop, rnaindex, action, driven); } void ui_but_anim_flag(uiBut *but, float cfra) @@ -131,6 +135,7 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) ID *id; FCurve *fcu; char *path; + int rnaindex; short ok = 0; /* button must have RNA-pointer to a numeric-capable property */ @@ -140,6 +145,14 @@ int ui_but_anim_expression_create(uiBut *but, const char *str) return 0; } + if (RNA_property_array_length(&but->rnapoin, but->rnaprop) != 0) { + if (but->rnaindex == -1) { + if (G.debug & G_DEBUG) + printf("ERROR: create expression failed - can't create expression for entire array\n"); + return 0; + } + } + /* make sure we have animdata for this */ /* FIXME: until materials can be handled by depsgraph, don't allow drivers to be created for them */ id = (ID *)but->rnapoin.id.data; |