Browse Source

Remove redundancy from modifier names

pull/85/head
Adam Johnson 7 years ago
parent
commit
7018add7f9
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 17
      korman/properties/modifiers/__init__.py

17
korman/properties/modifiers/__init__.py

@ -77,10 +77,19 @@ def modifier_mapping():
d = {} d = {}
sorted_modifiers = sorted(PlasmaModifierProperties.__subclasses__(), key=lambda x: x.bl_label) sorted_modifiers = sorted(PlasmaModifierProperties.__subclasses__(), key=lambda x: x.bl_label)
for i, mod in enumerate(sorted_modifiers): for i, mod in enumerate(sorted_modifiers):
pl_id, category, label, description = mod.pl_id, mod.bl_category, mod.bl_label, mod.bl_description
icon = getattr(mod, "bl_icon", "") icon = getattr(mod, "bl_icon", "")
tup = (mod.pl_id, mod.bl_label, mod.bl_description, icon, i)
if mod.bl_category not in d: # The modifier might include the cateogry name in its name, so we'll strip that.
d[mod.bl_category] = [tup] if label != category:
if label.startswith(category):
label = label[len(category)+1:]
if label.endswith(category):
label = label[:-len(category)-1]
tup = (pl_id, label, description, icon, i)
if category not in d:
d[category] = [tup]
else: else:
d[mod.bl_category].append(tup) d[category].append(tup)
return d return d

Loading…
Cancel
Save