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:
authorJoshua Leung <aligorith@gmail.com>2017-10-20 07:04:57 +0300
committerJoshua Leung <aligorith@gmail.com>2017-10-20 07:05:50 +0300
commitae72a9206e988a3f4ef5d35393ce490b23db2629 (patch)
treea5528870d687b0f9381963abbb131d9925b94d6f /source/blender/blenkernel/intern/nla.c
parent959a58da9e4d23be2738b6979ec208f05468f50c (diff)
Fix T46163: NLA properties with drivers aren't displayed as having drivers
While such drivers will generally get evaluated too late to be of much use during animations, it can still be useful to allow using drivers to control a whole bunch of NLA strip properties (i.e. syncing NLA strip timings via a single property/control). Keyframe insertion however is still not allowed on these properties (and an error message will now be displayed when trying to do so, instead of silently failing), as it is useless.
Diffstat (limited to 'source/blender/blenkernel/intern/nla.c')
-rw-r--r--source/blender/blenkernel/intern/nla.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c
index 148fc3827e0..9a923b643ac 100644
--- a/source/blender/blenkernel/intern/nla.c
+++ b/source/blender/blenkernel/intern/nla.c
@@ -1417,6 +1417,40 @@ void BKE_nlastrip_validate_fcurves(NlaStrip *strip)
}
}
+/* Check if the given RNA pointer + property combo should be handled by
+ * NLA strip curves or not.
+ */
+bool BKE_nlastrip_has_curves_for_property(const PointerRNA *ptr, const PropertyRNA *prop)
+{
+ /* sanity checks */
+ if (ELEM(NULL, ptr, prop))
+ return false;
+
+ /* 1) Must be NLA strip */
+ if (ptr->type == &RNA_NlaStrip) {
+ /* 2) Must be one of the predefined properties */
+ static PropertyRNA *prop_influence = NULL;
+ static PropertyRNA *prop_time = NULL;
+ static bool needs_init = true;
+
+ /* Init the properties on first use */
+ if (needs_init) {
+ prop_influence = RNA_struct_type_find_property(&RNA_NlaStrip, "influence");
+ prop_time = RNA_struct_type_find_property(&RNA_NlaStrip, "strip_time");
+
+ needs_init = false;
+ }
+
+ /* Check if match */
+ if (ELEM(prop, prop_influence, prop_time)) {
+ return true;
+ }
+ }
+
+ /* No criteria met */
+ return false;
+}
+
/* Sanity Validation ------------------------------------ */
static bool nla_editbone_name_check(void *arg, const char *name)