Browse Source

Adjustments 4-5-22

pull/294/head
Patrick Dulebohn 3 years ago
parent
commit
508f39b6c7
  1. 2
      korman/exporter/manager.py
  2. 34
      korman/properties/modifiers/gui.py
  3. 6
      korman/ui/modifiers/gui.py

2
korman/exporter/manager.py

@ -27,6 +27,8 @@ from ..plasma_magic import *
# NOTE: We are using Factory indices because I doubt all of these classes are implemented.
_pool_types = (
plFactory.ClassIndex("plPostEffectMod"),
plFactory.ClassIndex("plSingleModifier"),
plFactory.ClassIndex("pfGUIControlMod"),
plFactory.ClassIndex("pfGUIDialogMod"),
plFactory.ClassIndex("pfGUIButtonMod"),
plFactory.ClassIndex("plMsgForwarder"),

34
korman/properties/modifiers/gui.py

@ -97,7 +97,7 @@ gui_pfms = {
class PlasmaGUIDialogModifier(PlasmaModifierProperties):
pl_id = "guidialogmod"
bl_category = "GUI"
bl_label = "Custom GUI Dialog"
bl_description = "Brings up a custom GUI dialog modifier"
@ -108,7 +108,7 @@ class PlasmaGUIDialogModifier(PlasmaModifierProperties):
items=game_versions,
options={"ENUM_FLAG"},
default={"pvMoul", "pvPots", "pvPrime"})
gui_clickable = PointerProperty(name="GUI Clickable",
description="Object to click to initiate GUI",
type=bpy.types.Object,
@ -129,7 +129,7 @@ class PlasmaGUIDialogModifier(PlasmaModifierProperties):
type=bpy.types.Object,
poll=idprops.poll_mesh_objects,
options=set())
def sanity_check(self):
if self.gui_object is None:
raise ExportError("{}: GUI Dialog modifier requires a GUI Object!", self.id_data.name)
@ -161,24 +161,24 @@ class PlasmaGUIDialogModifier(PlasmaModifierProperties):
guinode = self._create_python_file_node(tree, gui_pfms["filename"], gui_pfms["attribs"])
self._create_python_nodes(bo, tree.nodes, guinode, age_name, gui_rgn_obj)
def export(self, exporter, bo):
def export(self, exporter, bo, so):
# create post effect mod
guiposteffect = exporter.mgr.find_create_object(plPostEffectMod, "{}_PostEffectMod".format(self.key_name))
guiposteffect.hither = plPostEffectMod.GetHither("0.5")
guiposteffect.yon = plPostEffectMod.GetYon("1000")
guiposteffect.fov_x = plPostEffectMod.GetFovX("45")
guiposteffect.fov_y = plPostEffectMod.GetFovY("33.75")
guiposteffect = exporter.mgr.find_create_object(plPostEffectMod, so=so, name="{}_PostEffectMod".format(self.key_name))
guiposteffect.hither = 0.5
guiposteffect.yon = 1000.0
guiposteffect.fovX = 45.0
guiposteffect.fovY = 33.75
# create GUI Dialog
guidialog = exporter.mgr.find_create_object(pfGUIDialogMod, "{}_GUIDialogMod".format(self.key_name))
guidialog.mode |= pfGUIDialogMod.kModal
guidialog.posteffect = pfGUIDialogMod.GetRenderMod(guiposteffect)
guidialog = exporter.mgr.find_create_object(pfGUIDialogMod, so=so, name="{}_GUIDialogMod".format(self.key_name))
guidialog.setModFlags(pfGUIDialogMod.kModal, True)
guidialog.renderMod = guiposteffect
guidialog.sceneNode = exporter.mgr.get_scene_node(so.key.location)
# do we have a clickoff button?
if self.gui_button:
buttonmod = exporter.mgr.find_create_object(pfGUIButtonMod, "{}_GUIButtonMod".format(self.key_name))
buttonmod.flags = pfGUIButtonMod.kWantsInterest | pfGUIButtonMod.kInheritProcFromDlg
buttonmod.tagid = pfGUIButtonMod.GetTagID("99")
guidialog.button = pfGUIDialogMod.GetControlFromTag(buttonmod)
if self.gui_button is not None:
buttonmod = exporter.mgr.find_create_object(pfGUIButtonMod, so=so, name="{}_GUIButtonMod".format(self.key_name))
buttonmod.setFlags((pfGUIButtonMod.kWantsInterest, True), (pfGUIButtonMod.kInheritProcFromDlg, True))
buttonmod.TagID = 99
guidialog.Controls = buttonmod
def _create_python_nodes(self, gui_clickable, nodes, guinode, age_name, gui_region):
clickable_region = nodes.new("PlasmaClickableRegionNode")

6
korman/ui/modifiers/gui.py

@ -29,12 +29,10 @@ class ImageListUI(bpy.types.UIList):
def guidialogmod(modifier, layout, context):
layout.prop_menu_enum(modifier, "versions")
layout.separator()
split = layout.split()
main_col = split.column()
layout.label("GUI Objects:")
main_col.label("Required:")
col = main_col.column()
col.prop(modifier, "gui_clickable", text="Clickable")

Loading…
Cancel
Save