diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-21 04:43:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-21 04:43:17 +0300 |
commit | b66728d63deee0fc9ef517405466d1139871251d (patch) | |
tree | 03b92d528c53e48434d4e6361ecfc1b7607d2f56 /source | |
parent | a8553c9fa2482ca1a19bcf96edec2e8a3d261d86 (diff) | |
parent | ebb29200d3bf9460ff32100cc1ed6c436e206829 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_nla.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fcurve.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/nla.c | 34 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 6 | ||||
-rw-r--r-- | source/blender/nodes/intern/node_socket.c | 7 |
5 files changed, 50 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_nla.h b/source/blender/blenkernel/BKE_nla.h index 3bf8bba47f5..8d9fc8ff6cf 100644 --- a/source/blender/blenkernel/BKE_nla.h +++ b/source/blender/blenkernel/BKE_nla.h @@ -40,6 +40,9 @@ struct bAction; struct Scene; struct Speaker; +struct PointerRNA; +struct PropertyRNA; + /* ----------------------------- */ /* Data Management */ @@ -103,6 +106,8 @@ bool BKE_nlatrack_has_animated_strips(struct NlaTrack *nlt); bool BKE_nlatracks_have_animated_strips(ListBase *tracks); void BKE_nlastrip_validate_fcurves(struct NlaStrip *strip); +bool BKE_nlastrip_has_curves_for_property(const struct PointerRNA *ptr, const struct PropertyRNA *prop); + void BKE_nla_validate_state(struct AnimData *adt); /* ............ */ diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 103f23a2c18..1a93031034b 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -61,6 +61,7 @@ #include "BKE_curve.h" #include "BKE_global.h" #include "BKE_object.h" +#include "BKE_nla.h" #include "RNA_access.h" @@ -335,7 +336,7 @@ FCurve *rna_get_fcurve_context_ui( if (r_action) *r_action = NULL; /* Special case for NLA Control Curves... */ - if (ptr->type == &RNA_NlaStrip) { + if (BKE_nlastrip_has_curves_for_property(ptr, prop)) { NlaStrip *strip = (NlaStrip *)ptr->data; /* Set the special flag, since it cannot be a normal action/driver diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 478b854c4df..d4943b1b566 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) diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 66872c77b04..93ce45e1e8f 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1791,6 +1791,10 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) if (fcu) { success = insert_keyframe_direct(op->reports, ptr, prop, fcu, cfra, ts->keyframe_type, 0); } + else { + BKE_report(op->reports, RPT_ERROR, + "This property cannot be animated as it will not get updated correctly"); + } } else if (UI_but_flag_is_set(but, UI_BUT_DRIVEN)) { /* Driven property - Find driver */ @@ -1886,7 +1890,7 @@ static int delete_key_button_exec(bContext *C, wmOperator *op) } if (ptr.id.data && ptr.data && prop) { - if (ptr.type == &RNA_NlaStrip) { + if (BKE_nlastrip_has_curves_for_property(&ptr, prop)) { /* Handle special properties for NLA Strips, whose F-Curves are stored on the * strips themselves. These are stored separately or else the properties will * not have any effect. diff --git a/source/blender/nodes/intern/node_socket.c b/source/blender/nodes/intern/node_socket.c index ddd25b237a0..382492707ce 100644 --- a/source/blender/nodes/intern/node_socket.c +++ b/source/blender/nodes/intern/node_socket.c @@ -183,13 +183,14 @@ void node_verify_socket_templates(bNodeTree *ntree, bNode *node) { bNodeType *ntype = node->typeinfo; /* Don't try to match socket lists when there are no templates. - * This prevents group node sockets from being removed, without the need to explicitly - * check the node type here. + * This prevents dynamically generated sockets to be removed, like for + * group, image or render layer nodes. We have an explicit check for the + * render layer node since it still has fixed sockets too. */ if (ntype) { if (ntype->inputs && ntype->inputs[0].type >= 0) verify_socket_template_list(ntree, node, SOCK_IN, &node->inputs, ntype->inputs); - if (ntype->outputs && ntype->outputs[0].type >= 0) + if (ntype->outputs && ntype->outputs[0].type >= 0 && node->type != CMP_NODE_R_LAYERS) verify_socket_template_list(ntree, node, SOCK_OUT, &node->outputs, ntype->outputs); } } |