Browse Source

Merge pull request #298 from Deledrius/build_menus

Use class methods to build menus.
pull/301/head
Adam Johnson 3 years ago committed by GitHub
parent
commit
9613b79e48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      korman/ui/ui_menus.py

24
korman/ui/ui_menus.py

@ -33,12 +33,11 @@ class PlasmaAddMenu(PlasmaMenu, bpy.types.Menu):
layout.operator("mesh.plasma_ladder_add", text="Ladder", icon="COLLAPSEMENU")
layout.operator("mesh.plasma_linkingbook_add", text="Linking Book", icon="FILE_IMAGE")
def build_plasma_menu(self, context):
if context.scene.render.engine != "PLASMA_GAME":
return
self.layout.separator()
self.layout.menu("menu.plasma_add", icon="URL")
def build_menu(self, context):
if context.scene.render.engine != "PLASMA_GAME":
return
self.layout.separator()
self.layout.menu("menu.plasma_add", icon="URL")
class PlasmaHelpMenu(PlasmaMenu, bpy.types.Menu):
@ -51,14 +50,13 @@ class PlasmaHelpMenu(PlasmaMenu, bpy.types.Menu):
layout.operator("wm.url_open", text="Getting Started", icon="URL").url = "https://guildofwriters.org/wiki/Korman:Getting_Started"
layout.operator("wm.url_open", text="Tutorials", icon="URL").url = "https://guildofwriters.org/wiki/Category:Korman_Tutorials"
def build_plasma_help_menu(self, context):
self.layout.menu("menu.plasma_help", text="Korman", icon="URL")
def build_menu(self, context):
self.layout.menu("menu.plasma_help", text="Korman", icon="URL")
def register():
bpy.types.INFO_MT_add.append(build_plasma_menu)
bpy.types.INFO_MT_help.prepend(build_plasma_help_menu)
bpy.types.INFO_MT_add.append(PlasmaAddMenu.build_menu)
bpy.types.INFO_MT_help.prepend(PlasmaHelpMenu.build_menu)
def unregister():
bpy.types.INFO_MT_add.remove(build_plasma_menu)
bpy.types.INFO_MT_help.remove(build_plasma_help_menu)
bpy.types.INFO_MT_add.remove(PlasmaAddMenu.build_menu)
bpy.types.INFO_MT_help.remove(PlasmaHelpMenu.build_menu)

Loading…
Cancel
Save