From 51f5c994e9f03ec2c488ac3a2af02b43c34d7ca6 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 17 Dec 2013 09:40:52 +0100 Subject: Fix T37103: Keyframing custom properties issue (FCurve would not reflect Custom props type changes). Add an helper func to re-compute integer-only fcurve flags, and call it when editing custom props. Reviewed by aligorith, thanks! Summary: Proposal fix for "keyframing custom properties issue" (T37103). Reviewers: aligorith Maniphest Tasks: T37103 Differential Revision: http://developer.blender.org/D111 --- release/scripts/startup/bl_operators/wm.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'release') diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 4b954e81ee1..6a54a1ea15c 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1045,6 +1045,7 @@ class WM_OT_properties_edit(Operator): # First remove item = eval("context.%s" % data_path) + prop_type_old = type(item[prop_old]) rna_idprop_ui_prop_clear(item, prop_old) exec_str = "del item['%s']" % prop_old @@ -1067,6 +1068,33 @@ class WM_OT_properties_edit(Operator): prop_ui["description"] = self.description + # If we have changed the type of the property, update its potential anim curves! + if prop_type_old != prop_type: + data_path = '["%s"]' % prop + done = set() + def _update(fcurves): + for fcu in fcurves: + if fcu not in done and fcu.data_path == data_path: + fcu.update_autoflags(item) + done.add(fcu) + + def _update_strips(strips): + for st in strips: + if st.type in {'CLIP'} and st.action: + _update(st.action.fcurves) + elif st.type in {'META'}: + _update_strips(st.strips) + + adt = getattr(item, "animation_data", None) + if adt is not None: + if adt.action: + _update(adt.action.fcurves) + if adt.drivers: + _update(adt.drivers) + if adt.nla_tracks: + for nt in adt.nla_tracks: + _update_strips(nt.strips) + # otherwise existing buttons which reference freed # memory may crash blender [#26510] # context.area.tag_redraw() -- cgit v1.2.3