diff options
author | Campbell Barton <ideasman42@gmail.com> | 2022-07-22 08:58:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2022-07-22 08:59:27 +0300 |
commit | b364669bd7ec08f1c5c8b9f063f3a421a32a5f7b (patch) | |
tree | 492465e6565f2baf26a8d311696d6000647a8795 | |
parent | 563ea27eb1a8843fdc05b2fe3944dfbdcd4d5a1f (diff) |
system_property_chart: support custom properties
Based on suggestion from D13223, but applied a different fix.
-rw-r--r-- | system_property_chart.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/system_property_chart.py b/system_property_chart.py index b1fa54c2..bb6d4682 100644 --- a/system_property_chart.py +++ b/system_property_chart.py @@ -219,16 +219,26 @@ def _property_chart_copy(self, context): data_path = self.data_path - # quick & nasty method! + data_path_with_dot = data_path + if not data_path_with_dot.startswith("["): + data_path_with_dot = "." + data_path_with_dot + + code = compile( + "obj_iter%s = obj%s" % (data_path_with_dot, data_path_with_dot), + "<property_chart>", + 'exec', + ) + for obj_iter in selected_objects: if obj != obj_iter: try: - exec("obj_iter.%s = obj.%s" % (data_path, data_path)) + exec(code, {}, {"obj": obj, "obj_iter": obj_iter}) except: # just in case we need to know what went wrong! import traceback traceback.print_exc() + from bpy.props import StringProperty @@ -252,6 +262,7 @@ class CopyPropertyChart(Operator): # List The Classes # + classes = ( AddPresetProperties, SCENE_MT_properties_presets, @@ -260,6 +271,7 @@ classes = ( CopyPropertyChart ) + def register(): for cls in classes: bpy.utils.register_class(cls) |