diff --git a/spine-godot/convert.py b/spine-godot/convert.py deleted file mode 100755 index 38c56a506..000000000 --- a/spine-godot/convert.py +++ /dev/null @@ -1,83 +0,0 @@ -# -# Python script to convert a Godot project using Spine .json skeleton files to use the new -# extension .spine-json instead. -# -# Usage: python convert.py path/to/godot/project -# -# Note: ensure you have created a backup of your Godot project before running this script. -# -# The script will traverse all .json, .tscn, and .tres files in the directory recursively. -# -# For each .json file, it will rename the file to .spine-json and remove the .json.import file. -# Upon reloading the the project in Godot, the file will be re-imported and the a .spine-json.import -# file will be created in place of the .json.import file. -# -# For each .tscn or .tres file, it will replace the .json suffix in external resources of type -# SpineSkeletonFileResource with the new suffix .spine-json. -# -import sys -import os -import pathlib -import codecs - -def convert_json(filename): - file = codecs.open(filename, "r", "utf-8") - content = file.read() - file.close() - - if "skeleton" in content and "hash" in content and "spine" in content: - path = pathlib.Path(filename) - new_path = path.with_suffix('.spine-json') - print("Renaming " + str(path) + " to " + str(new_path)) - path.rename(new_path) - if os.path.exists(filename + ".import"): - print("Removing " + str(filename) + ".import") - os.remove(filename + ".import") - -def convert_tscn_or_tres(filename): - file = codecs.open(filename, "r", "utf-8") - content = file.read() - file.close() - - new_content = "" - is_converted = False - for line in content.splitlines(True): - if line.startswith("[ext_resource") and 'type="SpineSkeletonFileResource"' in line and '.json"' in line: - if not is_converted: - print("Converting TSCN file " + str(filename)) - is_converted = True - print("Replacing .json with .spine-json in \n" + line) - line = line.replace('.json"', '.spine-json"') - new_content += line - - file = codecs.open(filename, "w", "utf-8") - file.write(new_content) - file.close() - -def convert_tres(filename): - print("Converting TRES file " + str(filename)) - with open(filename) as file: - content = file.read() - -def convert(path): - for dirpath, dirs, files in os.walk(path): - for filename in files: - file = os.path.join(dirpath,filename) - if file.endswith(".json"): - convert_json(file) - elif file.endswith(".tscn") or file.endswith(".tres"): - convert_tscn_or_tres(file) - -if __name__ == "__main__": - if len(sys.argv) == 1: - print("Please provide the path to your Godot project, e.g. python convert.py path/to/my/project.") - sys.exit(-1) - path = os.path.abspath(sys.argv[1]) - if not os.path.exists(path): - print("Directory " + str(path) + " does not exist.") - sys.exit(-1) - if not os.path.isdir(path): - print(str(path) + " is not a directory.") - sys.exit(-1) - print("Converting " + str(path)) - convert(path) \ No newline at end of file diff --git a/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation.meta b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation.meta new file mode 100644 index 000000000..21cc971ad --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 38ed300e2ddd57841ab636ca4a49fc18 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md new file mode 100644 index 000000000..c09d3074f --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md @@ -0,0 +1,9 @@ +## Spine UI Toolkit Extension [Experimental] + +This experimental plugin provides integration of UI Toolkit for the spine-unity runtime. Please be sure to test this package first and create backups of your project before using. +The plugin adds a `SpineVisualElement` control element to be used with UI Toolkit, providing functionality similar to `SkeletonGraphic` to add your Spine skeletons to a Visual Tree Asset via UI Toolkit's UI Builder. + +### Usage + +For usage of the `SpineVisualElement` control element, you can check out the included `UI Toolkit Example.unity` example scene and `SpineUIToolkit.uxml` file which can be installed via the `Samples` tab in the Unity Package Manager window. +The new `SpineVisualElement` can be found in the Unity `UI Builder` window under `Library - Project - Custom Controls` `Spine - Unity - SpineVisualElement`. It can be added to your hierarchy and configured as normal UI Toolkit elements while providing Spine skeleton attributes as well. diff --git a/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md.meta b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md.meta new file mode 100644 index 000000000..604ff2468 --- /dev/null +++ b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Documentation/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e57aa0442e306ce44b13d22c2c749753 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Runtime/SpineVisualElement.cs b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Runtime/SpineVisualElement.cs index 982d3411f..04116f32a 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Runtime/SpineVisualElement.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.ui-toolkit/Runtime/SpineVisualElement.cs @@ -39,7 +39,6 @@ namespace Spine.Unity { [UxmlElement] public partial class SpineVisualElement : VisualElement { - public new class UxmlFactory : UxmlFactory { } [SpineAnimation(dataField: "SkeletonDataAsset", avoidGenericMenu: true)] [UxmlAttribute]