From a9abc59a2049385daef25f63b9db02499c11025d Mon Sep 17 00:00:00 2001 From: Naruto TAKAHASHI Date: Wed, 22 Jul 2026 21:02:00 +0900 Subject: [PATCH] feat: Support Godot 4.7 Migrate project, GDExtension, custom module, CI, and documentation to support Godot 4.7 --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/workflows/release.yml | 5 +- README.ja.md | 2 +- README.md | 2 +- docs/en/index.md | 4 +- docs/en/setup/build.md | 4 +- docs/en/setup/install.md | 2 +- docs/ja/index.md | 4 +- docs/ja/setup/build.md | 4 +- docs/ja/setup/install.md | 2 +- examples/Override_Ringo/project.godot | 2 +- examples/ParticleEffect/project.godot | 2 +- examples/Ringo/project.godot | 2 +- examples/Scripting/project.godot | 2 +- examples/allAttributeV7/project.godot | 2 +- examples/allPartsV7/project.godot | 2 +- examples/dev_gdextension/project.godot | 2 +- examples/dev_module/node_2d.tscn | 3 + examples/dev_module/project.godot | 6 +- examples/overall/project.godot | 2 +- examples/overall_gdextension/project.godot | 2 +- misc/spritestudio.gdextension | 2 +- scripts/build-extension.ps1 | 2 +- scripts/build-extension.sh | 2 +- scripts/build.ps1 | 2 +- scripts/build.sh | 2 +- ss_player/SpriteStudio-SDK | 2 +- ss_player/register_types.cpp | 77 +++++++++------------- ss_player/ss_import_dock.h | 1 + ss_player/ss_internal_player.cpp | 8 +-- ss_player/ss_macros.h | 8 +++ ss_player/ss_part_attachment_2d.h | 2 + ss_player/ss_playback_panel.h | 2 + 33 files changed, 85 insertions(+), 83 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f1d91f6..6889108 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -42,7 +42,7 @@ body: attributes: label: Godot Version / Godotのバージョン description: What version of Godot are you using? / ご利用のGodotのバージョンを記載してください。 - placeholder: e.g. 4.6.0-stable + placeholder: e.g. 4.7.0-stable validations: required: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fbfbc0..5de714b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,9 +10,8 @@ on: required: true type: choice options: - - "4.6" - "4.7" - default: "4.6" + default: "4.7" description: "Target Godot API version" upload_release: # 既定でビルドのみ行い、true を指定した場合だけ Release を作成する @@ -23,7 +22,7 @@ on: type: boolean env: - GODOT_VERSION: ${{ inputs.godot_version || '4.6' }} + GODOT_VERSION: ${{ inputs.godot_version || '4.7' }} LANG: en_US.UTF-8 LC_ALL: en_US.UTF-8 PYTHONIOENCODING: utf8 diff --git a/README.ja.md b/README.ja.md index 9c0d8ee..051d20a 100644 --- a/README.ja.md +++ b/README.ja.md @@ -44,7 +44,7 @@ ### 1. サンプルで動作確認する -1. **Godot Engine の準備**: [公式サイト](https://godotengine.org/download/) から 4.6 系のエディタをダウンロードします。 +1. **Godot Engine の準備**: [公式サイト](https://godotengine.org/download/) から 4.7 系のエディタをダウンロードします。 2. **GDExtension の取得**: [Releases](https://github.com/cri-middleware/SSPlayerForGodot/releases) から最新パッケージをダウンロードし、展開します。 3. **サンプルの準備**: 取得した `addons` フォルダを、本リポジトリの [examples/Ringo](./examples/Ringo) フォルダ内にコピーします。 4. **確認**: Godot Engine で [examples/Ringo](./examples/Ringo) プロジェクトを開き、`Ringo.tscn` を開くことですぐにアニメーションの動作を確認できます。 diff --git a/README.md b/README.md index 50a30b4..3998bd5 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ We provide two Quick Starts: one for quickly checking the operation using a samp ### 1. Check Operation with Sample -1. **Get Godot Engine**: Download a 4.6-series editor from the [official site](https://godotengine.org/download/). +1. **Get Godot Engine**: Download a 4.7-series editor from the [official site](https://godotengine.org/download/). 2. **Download GDExtension**: Get the latest package from [Releases](https://github.com/cri-middleware/SSPlayerForGodot/releases) and extract it. 3. **Prepare Sample**: Copy the extracted `addons` folder into the [examples/Ringo](./examples/Ringo) folder of this repository. 4. **Check**: Open the [examples/Ringo](./examples/Ringo) project in Godot Engine and open `Ringo.tscn` to immediately see the animation working. diff --git a/docs/en/index.md b/docs/en/index.md index 1543a47..39525c4 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -73,11 +73,11 @@ graph LR ## Supported Versions -- **Godot Engine**: [4.6 branch](https://github.com/godotengine/godot/tree/4.6) +- **Godot Engine**: [4.7 branch](https://github.com/godotengine/godot/tree/4.7) - **godot-cpp**: [master branch](https://github.com/godotengine/godot-cpp/tree/master) > [!NOTE] -> GDExtension is officially supported starting from Godot 4.6. +> GDExtension is officially supported starting from Godot 4.7. Build and execution have been verified on Windows / macOS. diff --git a/docs/en/setup/build.md b/docs/en/setup/build.md index 097c812..60ffafe 100644 --- a/docs/en/setup/build.md +++ b/docs/en/setup/build.md @@ -16,7 +16,7 @@ Clone this repository, and clone Godot Engine / godot-cpp depending on your buil ```bash git clone https://github.com/cri-middleware/SSPlayerForGodot.git cd SSPlayerForGodot -git clone https://github.com/godotengine/godot.git -b 4.6 +git clone https://github.com/godotengine/godot.git -b 4.7 git clone https://github.com/godotengine/godot-cpp.git -b master ``` @@ -81,7 +81,7 @@ Output is placed under `bin//`, and the GDExtension package (including ## 2-B. Build the Custom-Module Godot Engine -Requires `godot` to be cloned at the `4.6` branch. +Requires `godot` to be cloned at the `4.7` branch. `build.sh` / `build.ps1` invoke `scons` with `custom_modules=../ss_player`. **macOS / Linux** diff --git a/docs/en/setup/install.md b/docs/en/setup/install.md index 64e6dac..708a72c 100644 --- a/docs/en/setup/install.md +++ b/docs/en/setup/install.md @@ -6,7 +6,7 @@ Steps for getting started with SpriteStudioPlayer for Godot. The shortest path to using the plugin without any build work. -1. Download a 4.6-series Godot Engine from the [official site](https://godotengine.org/download/). +1. Download a 4.7-series Godot Engine from the [official site](https://godotengine.org/download/). 2. Download the GDExtension bundle for your platform from the [SSPlayerForGodot Releases](https://github.com/cri-middleware/SSPlayerForGodot/releases). 3. Extract the ZIP and copy the `addons` folder it contains into your Godot project root directory. * If placed correctly, `res://addons/spritestudio/spritestudio.gdextension` should exist. diff --git a/docs/ja/index.md b/docs/ja/index.md index 5ca77f5..686233d 100644 --- a/docs/ja/index.md +++ b/docs/ja/index.md @@ -73,11 +73,11 @@ graph LR ## 対応バージョン -- **Godot Engine**: [4.6 ブランチ](https://github.com/godotengine/godot/tree/4.6) +- **Godot Engine**: [4.7 ブランチ](https://github.com/godotengine/godot/tree/4.7) - **godot-cpp**: [master ブランチ](https://github.com/godotengine/godot-cpp/tree/master) > [!NOTE] -> GDExtension は Godot 4.6 以降から正式サポートされます。 +> GDExtension は Godot 4.7 以降から正式サポートされます。 Windows / macOS でのビルドおよび実行を確認しています。 diff --git a/docs/ja/setup/build.md b/docs/ja/setup/build.md index 3268263..65d977a 100644 --- a/docs/ja/setup/build.md +++ b/docs/ja/setup/build.md @@ -16,7 +16,7 @@ GDExtension またはカスタムモジュール組み込み Godot Engine を自 ```bash git clone https://github.com/cri-middleware/SSPlayerForGodot.git cd SSPlayerForGodot -git clone https://github.com/godotengine/godot.git -b 4.6 +git clone https://github.com/godotengine/godot.git -b 4.7 git clone https://github.com/godotengine/godot-cpp.git -b master ``` @@ -81,7 +81,7 @@ $env:PYTHONUTF8=1 ## 2-B. カスタムモジュール組み込み Godot Engine のビルド -`godot` を `4.6` ブランチで clone 済みであることが前提です。 +`godot` を `4.7` ブランチで clone 済みであることが前提です。 `build.sh` / `build.ps1` は `custom_modules=../ss_player` を指定して `scons` を実行します。 **macOS / Linux** diff --git a/docs/ja/setup/install.md b/docs/ja/setup/install.md index 1990db7..fd9fbce 100644 --- a/docs/ja/setup/install.md +++ b/docs/ja/setup/install.md @@ -6,7 +6,7 @@ SpriteStudioPlayer for Godot を使い始めるための手順です。 ビルド作業なしでプラグインを利用できる最短の手順です。 -1. [公式サイト](https://godotengine.org/download/) より 4.6 系の Godot Engine をダウンロードします。 +1. [公式サイト](https://godotengine.org/download/) より 4.7 系の Godot Engine をダウンロードします。 2. [SSPlayerForGodot の Releases](https://github.com/cri-middleware/SSPlayerForGodot/releases) から該当プラットフォーム向けの GDExtension 一式をダウンロードします。 3. ダウンロードした ZIP を解凍し、中にある `addons` フォルダをそのまま Godot プロジェクトのルートディレクトリにコピーします。 * 正しく配置されると、`res://addons/spritestudio/spritestudio.gdextension` が存在する状態になります。 diff --git a/examples/Override_Ringo/project.godot b/examples/Override_Ringo/project.godot index 73b969e..74cc7d5 100644 --- a/examples/Override_Ringo/project.godot +++ b/examples/Override_Ringo/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="Override_Ringo" run/main_scene="res://Ringo.tscn" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/ParticleEffect/project.godot b/examples/ParticleEffect/project.godot index cff90c9..59ac050 100644 --- a/examples/ParticleEffect/project.godot +++ b/examples/ParticleEffect/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="ParticleEffect" run/main_scene="uid://cty11r2qfs3we" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/Ringo/project.godot b/examples/Ringo/project.godot index e8fbd17..04cf1c4 100644 --- a/examples/Ringo/project.godot +++ b/examples/Ringo/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="Ringo" run/main_scene="res://Ringo.tscn" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/Scripting/project.godot b/examples/Scripting/project.godot index e8fbd17..04cf1c4 100644 --- a/examples/Scripting/project.godot +++ b/examples/Scripting/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="Ringo" run/main_scene="res://Ringo.tscn" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/allAttributeV7/project.godot b/examples/allAttributeV7/project.godot index be51f71..9833a48 100644 --- a/examples/allAttributeV7/project.godot +++ b/examples/allAttributeV7/project.godot @@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] config/name="allAttributeV7" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/allPartsV7/project.godot b/examples/allPartsV7/project.godot index dd54af1..75ea631 100644 --- a/examples/allPartsV7/project.godot +++ b/examples/allPartsV7/project.godot @@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] config/name="allPartsV7" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/dev_gdextension/project.godot b/examples/dev_gdextension/project.godot index a901139..82da617 100644 --- a/examples/dev_gdextension/project.godot +++ b/examples/dev_gdextension/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="dev_gdextension" run/main_scene="uid://41tstw2esic" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [physics] diff --git a/examples/dev_module/node_2d.tscn b/examples/dev_module/node_2d.tscn index 0dac34a..d16a03a 100644 --- a/examples/dev_module/node_2d.tscn +++ b/examples/dev_module/node_2d.tscn @@ -9,6 +9,7 @@ position = Vector2(145, 333) ssab = ExtResource("1_wtcfe") animation = "00_action_01_left" autoplay = true +sub_frame_enabled = true animation_section_end = 373 cellmaps/spr_00_00_1 = null cellmaps/spr_00_00_0 = null @@ -18,6 +19,7 @@ position = Vector2(365, 337) ssab = ExtResource("1_wtcfe") animation = "00_action_01_left" autoplay = true +sub_frame_enabled = true animation_section_end = 373 cellmaps/spr_00_00_1 = null cellmaps/spr_00_00_0 = null @@ -27,6 +29,7 @@ position = Vector2(605, 350) ssab = ExtResource("1_wtcfe") animation = "00_action_01_left" autoplay = true +sub_frame_enabled = true animation_section_end = 373 cellmaps/spr_00_00_1 = null cellmaps/spr_00_00_0 = null diff --git a/examples/dev_module/project.godot b/examples/dev_module/project.godot index 1e895d0..da4c9aa 100644 --- a/examples/dev_module/project.godot +++ b/examples/dev_module/project.godot @@ -16,9 +16,13 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="dev_module" run/main_scene="res://node_2d.tscn" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" +[display] + +window/vsync/vsync_mode=0 + [rendering] textures/vram_compression/import_etc2_astc=true diff --git a/examples/overall/project.godot b/examples/overall/project.godot index eedb0f6..ccb36a0 100644 --- a/examples/overall/project.godot +++ b/examples/overall/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="overall" run/main_scene="uid://dnijei7f6aclq" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [rendering] diff --git a/examples/overall_gdextension/project.godot b/examples/overall_gdextension/project.godot index 8b5c709..4a86de6 100644 --- a/examples/overall_gdextension/project.godot +++ b/examples/overall_gdextension/project.godot @@ -16,7 +16,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true config/name="overall_gdextension" run/main_scene="uid://brj1ki824pka4" -config/features=PackedStringArray("4.6", "GL Compatibility") +config/features=PackedStringArray("4.7", "GL Compatibility") config/icon="res://icon.svg" [physics] diff --git a/misc/spritestudio.gdextension b/misc/spritestudio.gdextension index 09a1575..a545855 100644 --- a/misc/spritestudio.gdextension +++ b/misc/spritestudio.gdextension @@ -1,7 +1,7 @@ [configuration] entry_symbol = "ss_player_library_init" -compatibility_minimum = "4.6" +compatibility_minimum = "4.7" [libraries] diff --git a/scripts/build-extension.ps1 b/scripts/build-extension.ps1 index f47d91f..d638fb7 100755 --- a/scripts/build-extension.ps1 +++ b/scripts/build-extension.ps1 @@ -17,7 +17,7 @@ $scons_default_opts = @{ target = "editor" compiledb = "yes" use_static_cpp = "no" - api_version = "4.6" + api_version = "4.7" } # winbuild default options diff --git a/scripts/build-extension.sh b/scripts/build-extension.sh index 27d56a6..7142659 100755 --- a/scripts/build-extension.sh +++ b/scripts/build-extension.sh @@ -26,7 +26,7 @@ declare -A scons_default_opts=( [platform]=${PLATFORM} [target]="editor" [compiledb]="yes" - [api_version]="4.6" + [api_version]="4.7" ) # macbuild default options diff --git a/scripts/build.ps1 b/scripts/build.ps1 index da972bb..350302e 100755 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -37,7 +37,7 @@ $scons_default_opts = @{ $winbuild_default_opts = @{ cpus = $cpus ccache = "no" - version = "4.6" + version = "4.7" } $opts = @{} diff --git a/scripts/build.sh b/scripts/build.sh index 4fb20c7..3f7042a 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -37,7 +37,7 @@ declare -A scons_default_opts=( declare -A build_default_opts=( [cpus]=${CPUS} [ccache]="no" - [version]="4.6" + [version]="4.7" [strip]="no" ) diff --git a/ss_player/SpriteStudio-SDK b/ss_player/SpriteStudio-SDK index 842c666..f47fe8d 160000 --- a/ss_player/SpriteStudio-SDK +++ b/ss_player/SpriteStudio-SDK @@ -1 +1 @@ -Subproject commit 842c66621bcf9bbdeaacbc0246f34e0391c9e614 +Subproject commit f47fe8d14f8d3fd4261b248f995d0cb0b7d020db diff --git a/ss_player/register_types.cpp b/ss_player/register_types.cpp index 05279b8..5cc79e0 100644 --- a/ss_player/register_types.cpp +++ b/ss_player/register_types.cpp @@ -38,10 +38,10 @@ static void editor_init_callback() { #include "ssqb_resource.h" #include "ss_translation.h" -static SSABResourceFormatLoader *ssab_loader = nullptr; -static SSABResourceFormatSaver *ssab_saver = nullptr; -static SSQBResourceFormatLoader *ssqb_loader = nullptr; -static SSQBResourceFormatSaver *ssqb_saver = nullptr; +static Ref ssab_loader; +static Ref ssab_saver; +static Ref ssqb_loader; +static Ref ssqb_saver; void register_ss_player_types() { @@ -52,32 +52,21 @@ void register_ss_player_types() { GDREGISTER_CLASS(SSQBResourceFormatLoader); GDREGISTER_CLASS(SSQBResourceFormatSaver); -#ifdef SPRITESTUDIO_GODOT_EXTENSION ssab_loader = memnew(SSABResourceFormatLoader); - ResourceLoader::get_singleton()->add_resource_format_loader(ssab_loader); - ssab_saver = memnew(SSABResourceFormatSaver); - ResourceSaver::get_singleton()->add_resource_format_saver(ssab_saver); - ssqb_loader = memnew(SSQBResourceFormatLoader); - ResourceLoader::get_singleton()->add_resource_format_loader(ssqb_loader); - ssqb_saver = memnew(SSQBResourceFormatSaver); - ResourceSaver::get_singleton()->add_resource_format_saver(ssqb_saver); +#ifdef SPRITESTUDIO_GODOT_EXTENSION + ResourceLoader::get_singleton()->add_resource_format_loader(ssab_loader); + ResourceSaver::get_singleton()->add_resource_format_saver(ssab_saver); + ResourceLoader::get_singleton()->add_resource_format_loader(ssqb_loader); + ResourceSaver::get_singleton()->add_resource_format_saver(ssqb_saver); #else - ssab_loader = memnew(SSABResourceFormatLoader); ResourceLoader::add_resource_format_loader(ssab_loader); - - ssab_saver = memnew(SSABResourceFormatSaver); ResourceSaver::add_resource_format_saver(ssab_saver); - - ssqb_loader = memnew(SSQBResourceFormatLoader); ResourceLoader::add_resource_format_loader(ssqb_loader); - - ssqb_saver = memnew(SSQBResourceFormatSaver); ResourceSaver::add_resource_format_saver(ssqb_saver); - #endif GDREGISTER_CLASS(SpriteStudioAudioBackend); @@ -86,45 +75,39 @@ void register_ss_player_types() { } void unregister_ss_player_types() { + if (ssab_loader.is_valid()) { #ifdef SPRITESTUDIO_GODOT_EXTENSION - if (ssab_loader) { ResourceLoader::get_singleton()->remove_resource_format_loader(ssab_loader); - ssab_loader = nullptr; - } - if (ssab_saver) { - ResourceSaver::get_singleton()->remove_resource_format_saver(ssab_saver); - ssab_saver = nullptr; - } - - if (ssqb_loader) { - ResourceLoader::get_singleton()->remove_resource_format_loader(ssqb_loader); - ssqb_loader = nullptr; - } - if (ssqb_saver) { - ResourceSaver::get_singleton()->remove_resource_format_saver(ssqb_saver); - ssqb_saver = nullptr; - } - #else - if (ssab_loader) { ResourceLoader::remove_resource_format_loader(ssab_loader); - ssab_loader = nullptr; +#endif + ssab_loader.unref(); } - if (ssab_saver) { + if (ssab_saver.is_valid()) { +#ifdef SPRITESTUDIO_GODOT_EXTENSION + ResourceSaver::get_singleton()->remove_resource_format_saver(ssab_saver); +#else ResourceSaver::remove_resource_format_saver(ssab_saver); - ssab_saver = nullptr; +#endif + ssab_saver.unref(); } - if (ssqb_loader) { + if (ssqb_loader.is_valid()) { +#ifdef SPRITESTUDIO_GODOT_EXTENSION + ResourceLoader::get_singleton()->remove_resource_format_loader(ssqb_loader); +#else ResourceLoader::remove_resource_format_loader(ssqb_loader); - ssqb_loader = nullptr; +#endif + ssqb_loader.unref(); } - if (ssqb_saver) { + if (ssqb_saver.is_valid()) { +#ifdef SPRITESTUDIO_GODOT_EXTENSION + ResourceSaver::get_singleton()->remove_resource_format_saver(ssqb_saver); +#else ResourceSaver::remove_resource_format_saver(ssqb_saver); - ssqb_saver = nullptr; - } - #endif + ssqb_saver.unref(); + } } void initialize_ss_player_module(ModuleInitializationLevel level) { diff --git a/ss_player/ss_import_dock.h b/ss_player/ss_import_dock.h index 272a72f..7d2be78 100644 --- a/ss_player/ss_import_dock.h +++ b/ss_player/ss_import_dock.h @@ -23,6 +23,7 @@ using namespace godot; #else #include "core/config/project_settings.h" +#include "servers/display/display_server.h" #include "core/input/input_event.h" #include "editor/gui/editor_file_dialog.h" #include "scene/gui/box_container.h" diff --git a/ss_player/ss_internal_player.cpp b/ss_player/ss_internal_player.cpp index 9023a63..2fae113 100644 --- a/ss_player/ss_internal_player.cpp +++ b/ss_player/ss_internal_player.cpp @@ -119,8 +119,8 @@ class SsMaskCoveragePool { // UPDATE_ONCE: re-requested each frame the target is rendered. Maskable // parts sample the previous frame's result (one-frame latency), which // sidesteps inter-viewport render ordering. - rs->viewport_set_update_mode(t->viewport, RenderingServer::VIEWPORT_UPDATE_ONCE); - rs->viewport_set_clear_mode(t->viewport, RenderingServer::VIEWPORT_CLEAR_ALWAYS); + rs->viewport_set_update_mode(t->viewport, RS_VIEWPORT_UPDATE_ONCE); + rs->viewport_set_clear_mode(t->viewport, RS_VIEWPORT_CLEAR_ALWAYS); rs->viewport_set_transparent_background(t->viewport, true); rs->viewport_set_disable_3d(t->viewport, true); rs->viewport_set_active(t->viewport, true); @@ -944,7 +944,7 @@ void SsInternalPlayer::_render_mask_coverage(const DrawFrame& f) { // to quantization), then re-request its one-shot render this frame. _acquire_mask_target(_mask_next_w, _mask_next_h); RenderingServer* rs = f.rs; - rs->viewport_set_update_mode(_mask_target->viewport, RenderingServer::VIEWPORT_UPDATE_ONCE); + rs->viewport_set_update_mode(_mask_target->viewport, RS_VIEWPORT_UPDATE_ONCE); auto draw_batches = f.frameData->draw_batches(); auto draw_order = f.frameData->draw_order(); @@ -2097,7 +2097,7 @@ void SsInternalPlayer::_emit_partcolor_mesh(RenderingServer* rs, RID ci, const uint64_t flags = (uint64_t)Mesh::ARRAY_CUSTOM_RGBA_FLOAT << Mesh::ARRAY_FORMAT_CUSTOM0_SHIFT; RID mesh_rid = _acquire_mesh_rid(rs); - rs->mesh_add_surface_from_arrays(mesh_rid, RenderingServer::PRIMITIVE_TRIANGLES, _surface_arrays, + rs->mesh_add_surface_from_arrays(mesh_rid, RS_PRIMITIVE_TRIANGLES, _surface_arrays, _surface_empty_blend_shapes, _surface_empty_lods, flags); rs->canvas_item_add_mesh(ci, mesh_rid, Transform2D(), Color(1, 1, 1, 1), texture_rid); diff --git a/ss_player/ss_macros.h b/ss_player/ss_macros.h index 0290edf..42024d9 100644 --- a/ss_player/ss_macros.h +++ b/ss_player/ss_macros.h @@ -15,9 +15,17 @@ #define VARIANT_FLOAT Variant::FLOAT #define NOTIFY_PROPERTY_LIST_CHANGED() notify_property_list_changed() #define SS_FILE_EXISTS(x) FileAccess::file_exists(x) + #define RS_VIEWPORT_UPDATE_ONCE RenderingServer::VIEWPORT_UPDATE_ONCE + #define RS_VIEWPORT_CLEAR_ALWAYS RenderingServer::VIEWPORT_CLEAR_ALWAYS + #define RS_PRIMITIVE_TRIANGLES RenderingServer::PRIMITIVE_TRIANGLES #else #include "core/version.h" #include "core/string/string_name.h" + #include "core/object/class_db.h" + #include "core/object/callable_mp.h" + #define RS_VIEWPORT_UPDATE_ONCE RSE::VIEWPORT_UPDATE_ONCE + #define RS_VIEWPORT_CLEAR_ALWAYS RSE::VIEWPORT_CLEAR_ALWAYS + #define RS_PRIMITIVE_TRIANGLES RSE::PRIMITIVE_TRIANGLES #if VERSION_MAJOR>=4 #define GD_V4 #ifndef SNAME diff --git a/ss_player/ss_part_attachment_2d.h b/ss_player/ss_part_attachment_2d.h index be12cbf..77c97d3 100644 --- a/ss_player/ss_part_attachment_2d.h +++ b/ss_player/ss_part_attachment_2d.h @@ -1,5 +1,7 @@ #pragma once +#include "ss_macros.h" + #ifdef SPRITESTUDIO_GODOT_EXTENSION #include #include diff --git a/ss_player/ss_playback_panel.h b/ss_player/ss_playback_panel.h index 51d0049..e3522ff 100644 --- a/ss_player/ss_playback_panel.h +++ b/ss_player/ss_playback_panel.h @@ -1,5 +1,7 @@ #pragma once +#include "ss_macros.h" + #ifdef TOOLS_ENABLED #ifdef SPRITESTUDIO_GODOT_EXTENSION