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 = {}
sorted_modifiers = sorted(PlasmaModifierProperties.__subclasses__(), key=lambda x: x.bl_label)
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", "")
tup = (mod.pl_id, mod.bl_label, mod.bl_description, icon, i)
if mod.bl_category not in d:
d[mod.bl_category] = [tup]
# The modifier might include the cateogry name in its name, so we'll strip that.
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:
d[mod.bl_category].append(tup)
d[category].append(tup)
return d

Loading…
Cancel
Save