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. # NOTE: We are using Factory indices because I doubt all of these classes are implemented.
_pool_types = ( _pool_types = (
plFactory.ClassIndex("plPostEffectMod"), plFactory.ClassIndex("plPostEffectMod"),
plFactory.ClassIndex("plSingleModifier"),
plFactory.ClassIndex("pfGUIControlMod"),
plFactory.ClassIndex("pfGUIDialogMod"), plFactory.ClassIndex("pfGUIDialogMod"),
plFactory.ClassIndex("pfGUIButtonMod"), plFactory.ClassIndex("pfGUIButtonMod"),
plFactory.ClassIndex("plMsgForwarder"), plFactory.ClassIndex("plMsgForwarder"),

34
korman/properties/modifiers/gui.py

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

Loading…
Cancel
Save