diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..904532c --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,20 @@ +Copyright (c) 2012-2024 Scott Chacon and others + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index a49ea56..2c84774 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # VTF Exporter for Substance 3D Designer +![Static Badge](https://img.shields.io/badge/Compatible_Versions-%3E2022.2-blue?style=flat-square&logo=adobe) +![GitHub License](https://img.shields.io/github/license/p-hennessy/Substance-VTF-Exporter-Plugin?style=flat-square) + + > [!WARNING] -> This plugin is still in very early alpha / active development. I made no gaurentees of stability or reverse compatibility. +> This plugin is still in very early alpha / active development. I make no gaurentees of stability or reverse compatibility. A plugin for Substance 3D Designer that allows one to do bulk exporting of materials into the Source Engine's VTF format diff --git a/pluginInfo.json b/pluginInfo.json index b33188f..29f2032 100755 --- a/pluginInfo.json +++ b/pluginInfo.json @@ -1,9 +1,9 @@ { "metadata_format_version": "1", "name": "vtf_exporter", - "version": "0.2.0", + "version": "0.2.1", "author": "Patrick 'Zeus' Hennessy", "email": "https://tf2maps.net/members/zeus.28272/", - "min_designer_version": "2019.2", - "platform": "windows" + "min_designer_version": "2022.2", + "platform": "any" } diff --git a/vtf_exporter/actions/export_presets.py b/vtf_exporter/actions/export_presets.py index 8050ca0..e0d8d88 100644 --- a/vtf_exporter/actions/export_presets.py +++ b/vtf_exporter/actions/export_presets.py @@ -25,36 +25,36 @@ def export_presets(): logger.info("Running error checking before export...") if not global_config.get("vtex_location"): - dialogs.notify("You need to configure your VTEX location to run this function.") + dialogs.critical("You need to configure your VTEX location to run this function.") return vtex_location = Path(global_config.get("vtex_location")) vtex_exe = vtex_location / "vtex.exe" if not vtex_exe.exists(): - dialogs.notify(f"vtex.exe could not be found at {vtex_location}") + dialogs.critical(f"vtex.exe could not be found at {vtex_location}") return if not graph: - dialogs.notify("Please select a graph to run this function on") + dialogs.critical("Please select a graph to run this function on") return graph_uuid = get_graph_uuid() graph_config = config.get_graph_config(graph_uuid) if not graph_config: - dialogs.notify("You must setup and / or save your graph configuration to run this function") + dialogs.critical("You must setup and / or save your graph configuration to run this function") return if not graph_config.get("export_location"): - dialogs.notify("You must have a valid export location") + dialogs.critical("You must have a valid export location") retur if len(graph.getOutputNodes()) == 0: - dialogs.notify("You need graph outputs to run this function") + dialogs.critical("You need graph outputs to run this function") return if len(graph.getPresets()) == 0: - dialogs.notify("You need to set up graph presets to run this function") + dialogs.critical("You need to set up graph presets to run this function") return logger.info("Saving current graph input settings...") diff --git a/vtf_exporter/constants.py b/vtf_exporter/constants.py index 3fe69ca..22d082a 100644 --- a/vtf_exporter/constants.py +++ b/vtf_exporter/constants.py @@ -18,4 +18,4 @@ def get_config_base_path(): CONFIG_DIR = SUBSTANCE_DIR / "vtf_exporter" GLOBAL_CONFIG_FILE = CONFIG_DIR / "global_configuration.json" -PLUGIN_VERSION = "0.2.0" \ No newline at end of file +PLUGIN_VERSION = "0.2.1" \ No newline at end of file diff --git a/vtf_exporter/ui/__init__.py b/vtf_exporter/ui/__init__.py index b485724..30ca87f 100644 --- a/vtf_exporter/ui/__init__.py +++ b/vtf_exporter/ui/__init__.py @@ -1,5 +1,4 @@ import sd -from PySide2 import QtWidgets from PySide2 import QtCore, QtWidgets, QtUiTools from PySide2.QtWidgets import QApplication, QFileDialog @@ -16,11 +15,15 @@ def create_panel(): ui_manager = app.getQtForPythonUIMgr() DOCK = ui_manager.newDockWidget(identifier="vtf_exporter", title="VTF Exporter") + layout = QtWidgets.QVBoxLayout() + DOCK.setLayout(layout) + widget = load_ui_file("panel.ui", parent=DOCK) load_global_settings(widget) setup_event_handlers(ui_manager, widget) + layout.addWidget(widget) widget.show() - + def destroy_panel(): global DOCK @@ -34,7 +37,7 @@ def load_ui_file(filename, parent=None): path = os.path.join(current_directory, filename) loader = QtUiTools.QUiLoader() - uifile = QtCore.QFile(path) + uifile = QtCore.QFile(filename) uifile.open(QtCore.QFile.ReadOnly) ui = loader.load(uifile, parent) uifile.close() diff --git a/vtf_exporter/ui/dialogs.py b/vtf_exporter/ui/dialogs.py index b621703..6602db4 100644 --- a/vtf_exporter/ui/dialogs.py +++ b/vtf_exporter/ui/dialogs.py @@ -9,12 +9,22 @@ def get_directory(prompt="Select a folder"): return directory -def notify(message): +def notify(msgbox_type, message): app = sd.getContext().getSDApplication() uiMgr = app.getQtForPythonUIMgr() mainWindow = uiMgr.getMainWindow() - dialog = QtWidgets.QMessageBox(parent=mainWindow) - dialog.setWindowTitle("VTF Exporter") - dialog.setText(message) - dialog.show() \ No newline at end of file + dialog = msgbox_type(mainWindow, "VTF Exporter", message) + dialog.show() + + +def critical(message): + notify(QtWidgets.QMessageBox.critical, message) + + +def informational(message): + notify(QtWidgets.QMessageBox.informational, message) + + +def warning(message): + notify(QtWidgets.QMessageBox.warning, message) diff --git a/vtf_exporter/ui/event_handlers.py b/vtf_exporter/ui/event_handlers.py index d830caf..49fa907 100644 --- a/vtf_exporter/ui/event_handlers.py +++ b/vtf_exporter/ui/event_handlers.py @@ -32,7 +32,7 @@ def on_btn_save_global_config(widget): vtex_location_path = pathlib.Path(vtex_location) / "vtex.exe" if not vtex_location_path.exists(): - dialogs.notify(f"vtex.exe could not be found at {vtex_location}") + dialogs.critical(f"vtex.exe could not be found at {vtex_location}") return config_data = { @@ -42,7 +42,7 @@ def on_btn_save_global_config(widget): try: config.save_global_config(config_data) except Exception as e: - dialogs.notify(f"Failed to save global config.\n {e}") + dialogs.critical(f"Failed to save global config.\n {e}") set_saved(widget.lbl_global_config) @@ -76,7 +76,7 @@ def on_btn_save_graph_config(widget): try: config.save_graph_config(graph_uuid, config_data) except Exception as e: - dialogs.notify(f"Failed to graph config.\n {e}") + dialogs.critical(f"Failed to save graph config.\n {e}") set_saved(widget.lbl_graph_config) diff --git a/vtf_exporter/ui/panel.ui b/vtf_exporter/ui/panel.ui index 57e1a8e..d0dc5ce 100644 --- a/vtf_exporter/ui/panel.ui +++ b/vtf_exporter/ui/panel.ui @@ -2,56 +2,12 @@ Form - - Qt::NonModal - - - true - - - - 0 - 0 - 410 - 651 - - - - - 0 - 0 - - - - - 0 - 0 - - Form - - 10 - - - QLayout::SetDefaultConstraint - - - 10 - - - 10 - - - 10 - - - 10 - @@ -509,6 +465,19 @@ + + + + Qt::Vertical + + + + 20 + 40 + + + +