diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-03-25 16:10:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-03-25 16:12:28 +0300 |
commit | 1c329af74cb2720fbb2e24a58ae15046d5c5c957 (patch) | |
tree | da34fb8304500ff21d5be65dd9b93430c1141175 /release | |
parent | 0ef9f61410b8a22905daa38feb49a2f5d1b845e4 (diff) |
Fix T44026: ID prop delete leaves names in _RNA_UI
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/rna_prop_ui.py | 13 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index f4649453b46..44722fa7162 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -32,6 +32,13 @@ def rna_idprop_ui_get(item, create=True): return None +def rna_idprop_ui_del(item): + try: + del item['_RNA_UI'] + except KeyError: + pass + + def rna_idprop_ui_prop_get(item, prop, create=True): rna_ui = rna_idprop_ui_get(item, create) @@ -46,7 +53,7 @@ def rna_idprop_ui_prop_get(item, prop, create=True): return rna_ui[prop] -def rna_idprop_ui_prop_clear(item, prop): +def rna_idprop_ui_prop_clear(item, prop, remove=True): rna_ui = rna_idprop_ui_get(item, False) if rna_ui is None: @@ -54,8 +61,10 @@ def rna_idprop_ui_prop_clear(item, prop): try: del rna_ui[prop] - except: + except KeyError: pass + if remove and len(item.keys()) == 1: + rna_idprop_ui_del(item) def rna_idprop_context_value(context, context_member, property_type): diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index a48415caa9b..7ac9fa4a036 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -1296,9 +1296,13 @@ class WM_OT_properties_remove(Operator): property = rna_property def execute(self, context): + from rna_prop_ui import rna_idprop_ui_prop_clear data_path = self.data_path item = eval("context.%s" % data_path) - del item[self.property] + prop = self.property + del item[prop] + rna_idprop_ui_prop_clear(item, prop) + return {'FINISHED'} |