From 1f8d17c294033dca07eb095a59ba7abda5539d08 Mon Sep 17 00:00:00 2001 From: Greg Zaal Date: Wed, 17 Jul 2024 14:25:12 +0200 Subject: [PATCH] Extensionify! --- .gitignore | 2 +- _UPDATE.bat | 4 --- __init__.py | 13 -------- blender_manifest.toml | 73 +++++++++++++++++++++++++++++++++++++++++++ build.bat | 1 + index.json | 27 ++++++++++++++++ operators/check.py | 4 +-- 7 files changed, 104 insertions(+), 20 deletions(-) delete mode 100644 _UPDATE.bat create mode 100644 blender_manifest.toml create mode 100644 build.bat create mode 100644 index.json diff --git a/.gitignore b/.gitignore index 0e68019..c27d6c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -hat_updater +polyhaven_hat-*.zip # ------------------------ Pre-populated by GitHub template ------------------------ diff --git a/_UPDATE.bat b/_UPDATE.bat deleted file mode 100644 index 69b890f..0000000 --- a/_UPDATE.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -echo Checking for updates... -git pull -pause \ No newline at end of file diff --git a/__init__.py b/__init__.py index 7666511..8e53fa8 100644 --- a/__init__.py +++ b/__init__.py @@ -12,19 +12,6 @@ import bpy from bpy.app.handlers import persistent -bl_info = { - "name": "HAT: Haven Asset Tester", - "description": "Internal quality control tool for polyhaven.com", - "author": "Poly Haven: Greg Zaal, James Cock", - "version": (1, 0, 17), - "blender": (3, 2, 0), - "location": "Properties > Scene", - "warning": "", - "wiki_url": "https://github.com/Poly-Haven/HAT", - "tracker_url": "https://github.com/Poly-Haven/HAT/issues", - "category": "Scene", -} - class HATProperties(bpy.types.PropertyGroup): asset_type: bpy.props.EnumProperty( diff --git a/blender_manifest.toml b/blender_manifest.toml new file mode 100644 index 0000000..4b4d5f7 --- /dev/null +++ b/blender_manifest.toml @@ -0,0 +1,73 @@ +schema_version = "1.0.0" + +# Example of manifest file for a Blender extension +# Change the values according to your extension +id = "polyhaven_hat" +version = "1.0.18" +name = "HAT" +tagline = "Internal quality control tool for polyhaven.com" +maintainer = "Greg Zaal " +# Supported types: "add-on", "theme" +type = "add-on" + +# Optional link to documentation, support, source files, etc +website = "https://github.com/Poly-Haven/HAT" + +# Optional list defined by Blender and server, see: +# https://docs.blender.org/manual/en/dev/advanced/extensions/tags.html +tags = ["Scene", "Import-Export"] + +blender_version_min = "4.2.0" +# # Optional: Blender version that the extension does not support, earlier versions are supported. +# # This can be omitted and defined later on the extensions platform if an issue is found. +# blender_version_max = "5.1.0" + +# License conforming to https://spdx.org/licenses/ (use "SPDX: prefix) +# https://docs.blender.org/manual/en/dev/advanced/extensions/licenses.html +license = ["SPDX:GPL-2.0-or-later"] +# Optional: required by some licenses. +# copyright = [ +# "2002-2024 Developer Name", +# "1998 Company Name", +# ] + +# Optional list of supported platforms. If omitted, the extension will be available in all operating systems. +# platforms = ["windows-x64", "macos-arm64", "linux-x64"] +# Other supported platforms: "windows-arm64", "macos-x64" + +# Optional: bundle 3rd party Python modules. +# https://docs.blender.org/manual/en/dev/advanced/extensions/python_wheels.html +# wheels = [ +# "./wheels/hexdump-3.3-py3-none-any.whl", +# "./wheels/jsmin-3.0.1-py3-none-any.whl", +# ] + +# # Optional: add-ons can list which resources they will require: +# # * files (for access of any filesystem operations) +# # * network (for internet access) +# # * clipboard (to read and/or write the system clipboard) +# # * camera (to capture photos and videos) +# # * microphone (to capture audio) +# # +# # If using network, remember to also check `bpy.app.online_access` +# # https://docs.blender.org/manual/en/dev/advanced/extensions/addons.html#internet-access +# # +# # For each permission it is important to also specify the reason why it is required. +# # Keep this a single short sentence without a period (.) at the end. +# # For longer explanations use the documentation or detail page. +# +# [permissions] +# network = "Need to sync motion-capture data to server" +files = "Import/export" +# clipboard = "Copy and paste bone transforms" + +# Optional: build settings. +# https://docs.blender.org/manual/en/dev/advanced/extensions/command_line_arguments.html#command-line-args-extension-build +# [build] +paths_exclude_pattern = [ + "__pycache__/", + "/.git/", + "/*.zip", + "/*.bat", + ".gitignore", +] diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..cb689b9 --- /dev/null +++ b/build.bat @@ -0,0 +1 @@ +blender --factory-startup --command extension build \ No newline at end of file diff --git a/index.json b/index.json new file mode 100644 index 0000000..6956f8e --- /dev/null +++ b/index.json @@ -0,0 +1,27 @@ +{ + "version": "v1", + "blocklist": [], + "data": [ + { + "schema_version": "1.0.0", + "id": "polyhaven_hat", + "name": "HAT", + "tagline": "Internal quality control tool for polyhaven.com", + "version": "1.0.18", + "type": "add-on", + "maintainer": "Greg Zaal ", + "license": [ + "SPDX:GPL-2.0-or-later" + ], + "blender_version_min": "4.2.0", + "website": "https://github.com/Poly-Haven/HAT", + "tags": [ + "Scene", + "Import-Export" + ], + "archive_url": "./polyhaven_hat-1.0.18.zip", + "archive_size": 182269, + "archive_hash": "sha256:ad3b82d9cb9a0b73b4887e5856aeb2fd14ddbce436e426f744cd87f1a6c17693" + } + ] +} \ No newline at end of file diff --git a/operators/check.py b/operators/check.py index 49b1f0c..1d885c3 100644 --- a/operators/check.py +++ b/operators/check.py @@ -11,9 +11,9 @@ checks = {} for c in check_list: if "bpy" not in locals(): - m = importlib.import_module("." + c, "HAT.operators.checks") + m = importlib.import_module(".checks." + c, __package__) else: - m = sys.modules["HAT.operators.checks." + c] + m = sys.modules["bl_ext.user_default.polyhaven_hat.operators.checks." + c] importlib.reload(m) checks[c] = m