diff --git a/korman/properties/modifiers/gui.py b/korman/properties/modifiers/gui.py index cefeef5..37cc377 100644 --- a/korman/properties/modifiers/gui.py +++ b/korman/properties/modifiers/gui.py @@ -86,6 +86,56 @@ class ImageLibraryItem(bpy.types.PropertyGroup): options=set()) +class PlasmaGUIDialogModifier(PlasmaModifierProperties): + pl_id = "guidialogmod" + + bl_category = "GUI" + bl_label = "GUI Dialog" + bl_description = "Brings up a custom GUI dialog" + bl_icon = "VIEWZOOM" + + versions = EnumProperty(name="Export Targets", + description="Plasma versions for which this journal exports", + items=game_versions, + options={"ENUM_FLAG"}, + default={"pvMoul", "pvPots", "pvPrime"}) + + clickable = PointerProperty(name="GUI Clickable", + description="Object to click to initiate GUI", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects, + options=set()) + region = PointerProperty(name="GUI Click Region", + description="GUI clickable region", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects, + options=set()) + gui_object = PointerProperty(name="GUI Object", + description="Object that will be viewed when GUI is active", + type=bpy.types.Object, + poll=idprops.poll_mesh_objects, + options=set()) + button = PointerProperty(name="GUI Button", + description="Object to click to deactivate GUI (optional)", + 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) + elif self.click is None: + raise ExportError("{}: GUI Dialog modifier requires a clickable!", self.id_data.name) + + def pre_export(self, exporter, bo): + our_versions = (globals()[j] for j in self.versions) + version = exporter.mgr.getVer() + if version not in our_versions: + exporter.report.port("Object '{}' has a GUI Dialog not enabled for export to the selected engine. Skipping.", + bo.name, version, indent=2) + return + + class PlasmaImageLibraryModifier(PlasmaModifierProperties): pl_id = "imagelibmod" diff --git a/korman/ui/modifiers/gui.py b/korman/ui/modifiers/gui.py index cf462c3..cfa2d26 100644 --- a/korman/ui/modifiers/gui.py +++ b/korman/ui/modifiers/gui.py @@ -27,6 +27,24 @@ class ImageListUI(bpy.types.UIList): layout.prop(item, "enabled", text="") +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, "clickable", text="Clickable") + col.prop(modifier, "gui_object", text="GUI Object") + main_col.separator() + main_col.label("Optional:") + col = main_col.column(align=True) + col.prop(modifier, "region", text="Click Region") + col.prop(modifier, "button", text="GUI Button") + def imagelibmod(modifier, layout, context): ui_list.draw_modifier_list(layout, "ImageListUI", modifier, "images", "active_image_index", rows=3, maxrows=6)