Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-10-06 19:03:19 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-10-06 19:08:24 +0400
commit8cb1b35bee80f52e8957ee8855f0a4624b8ad333 (patch)
treeb313dc79c10b77d56443229393d374d12a44f59c /source/blender/blenkernel/intern/fcurve.c
parent0e7d4a828afc65cf69132f5812bb736ad5e6c0b1 (diff)
Fix T40350: Some texture prop did not have visual feedback they were driven.
This is only a (hacky) partial fix, actually, since `RNA_property_animated()` will still not work in those cases... Better that than nothing, though. Thanks to Campbell for review.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index 09c1dcf701d..de6e6c53353 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -55,6 +55,7 @@
#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
+#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_global.h"
#include "BKE_object.h"
@@ -310,19 +311,35 @@ int list_find_data_fcurves(ListBase *dst, ListBase *src, const char *dataPrefix,
FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction **action, bool *r_driven)
{
+ return rna_get_fcurve_context_ui(NULL, ptr, prop, rnaindex, action, r_driven);
+}
+
+FCurve *rna_get_fcurve_context_ui(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int rnaindex,
+ bAction **action, bool *r_driven)
+{
FCurve *fcu = NULL;
+ PointerRNA tptr = *ptr;
*r_driven = false;
/* there must be some RNA-pointer + property combon */
- if (prop && ptr->id.data && RNA_property_animateable(ptr, prop)) {
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- char *path;
+ if (prop && tptr.id.data && RNA_property_animateable(&tptr, prop)) {
+ AnimData *adt = BKE_animdata_from_id(tptr.id.data);
+ int step = 2;
+ char *path = NULL;
- if (adt) {
+ if (adt == NULL) {
+ path = BKE_animdata_driver_path_hack(C, &tptr, prop, NULL);
+ adt = BKE_animdata_from_id(tptr.id.data);
+ step--;
+ }
+
+ while (adt && step--) {
if ((adt->action && adt->action->curves.first) || (adt->drivers.first)) {
/* XXX this function call can become a performance bottleneck */
- path = RNA_path_from_ID_to_property(ptr, prop);
+ if (step) {
+ path = RNA_path_from_ID_to_property(&tptr, prop);
+ }
if (path) {
/* animation takes priority over drivers */
@@ -337,13 +354,25 @@ FCurve *rna_get_fcurve(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, bAction
*r_driven = true;
}
- if (fcu && action)
+ if (fcu && action) {
*action = adt->action;
-
- MEM_freeN(path);
+ break;
+ }
+ else if (step) {
+ char *tpath = BKE_animdata_driver_path_hack(C, &tptr, prop, path);
+ if (tpath && tpath != path) {
+ MEM_freeN(path);
+ path = tpath;
+ adt = BKE_animdata_from_id(tptr.id.data);
+ }
+ else {
+ adt = NULL;
+ }
+ }
}
}
}
+ MEM_SAFE_FREE(path);
}
return fcu;