mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-09 16:48:43 +08:00
[godot] Fixes for latest Godot 4.0, VS Code settings, tasks, and launch configs.
This commit is contained in:
parent
ca09a57c21
commit
35c4294a9c
2
.gitignore
vendored
2
.gitignore
vendored
@ -181,3 +181,5 @@ spine-ts/spine-ts.zip
|
||||
spine-godot/.clang-format
|
||||
|
||||
spine-ts/spine-phaser/dist
|
||||
spine-godot/.cache
|
||||
spine-godot/build/compile_commands.json
|
||||
|
||||
47
spine-godot/.vscode/launch.json
vendored
Normal file
47
spine-godot/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug scene v4",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
"args": [
|
||||
"--path",
|
||||
"example-v4",
|
||||
"examples/01-helloworld/helloworld.tscn"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v4"
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug editor v4",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
"args": [
|
||||
"-e",
|
||||
"--path",
|
||||
"example-v4",
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v4"
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
"args": [
|
||||
"--path",
|
||||
"example",
|
||||
"examples/01-helloworld/helloworld.tscn"
|
||||
],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v3"
|
||||
}
|
||||
]
|
||||
}
|
||||
4
spine-godot/.vscode/settings.json
vendored
Normal file
4
spine-godot/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"cmake.configureOnOpen": false,
|
||||
"C_Cpp.intelliSenseEngine": "disabled",
|
||||
}
|
||||
35
spine-godot/.vscode/tasks.json
vendored
Normal file
35
spine-godot/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build-v4",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "scons",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/godot"
|
||||
},
|
||||
"args": [
|
||||
"-j 8",
|
||||
"dev_build=yes",
|
||||
"custom_modules=\"${workspaceFolder}/spine_godot"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "build-v3",
|
||||
"group": "build",
|
||||
"type": "shell",
|
||||
"command": "scons",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}/godot"
|
||||
},
|
||||
"args": [
|
||||
"-j 8",
|
||||
"debug",
|
||||
"custom_modules=\"${workspaceFolder}/spine_godot"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -61,6 +61,7 @@ else
|
||||
target="$target vsproj=yes livepp=$LIVEPP"
|
||||
fi
|
||||
scons $target compiledb=yes custom_modules="../spine_godot" --jobs=$cpus
|
||||
cp compile_commands.json ../build
|
||||
if [ -f "bin/godot.x11.opt.tools.64" ]; then
|
||||
strip bin/godot.x11.opt.tools.64
|
||||
chmod a+x bin/godot.x11.opt.tools.64
|
||||
|
||||
@ -61,7 +61,11 @@ void GodotSpineExtension::_free(void *mem, const char *file, int line) {
|
||||
|
||||
char *GodotSpineExtension::_readFile(const spine::String &path, int *length) {
|
||||
Error error;
|
||||
#if VERSION_MAJOR > 3
|
||||
auto res = FileAccess::get_file_as_bytes(String(path.buffer()), &error);
|
||||
#else
|
||||
auto res = FileAccess::get_file_as_array(String(path.buffer()), &error);
|
||||
#endif
|
||||
if (error != OK) {
|
||||
if (length) *length = 0;
|
||||
return NULL;
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "SpineEditorPlugin.h"
|
||||
#include "SpineAtlasResource.h"
|
||||
#include "SpineSkeletonFileResource.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
Error SpineAtlasResourceImportPlugin::import(const String &source_file, const String &save_path, const HashMap<StringName, Variant> &options, List<String> *platform_variants, List<String> *gen_files, Variant *metadata) {
|
||||
@ -253,7 +254,11 @@ void SpineEditorPropertyAnimationMix::_bind_methods() {
|
||||
void SpineEditorPropertyAnimationMix::data_changed(const String &property, const Variant &value, const String &name, bool changing) {
|
||||
auto mix = Object::cast_to<SpineAnimationMix>(get_edited_object()->get(get_edited_property()));
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
auto undo_redo = EditorUndoRedoManager::get_singleton();
|
||||
#else
|
||||
auto undo_redo = EditorNode::get_undo_redo();
|
||||
#endif
|
||||
undo_redo->create_action("Set mix property " + property);
|
||||
undo_redo->add_do_property(mix, property, value);
|
||||
undo_redo->add_undo_property(mix, property, mix->get(property));
|
||||
@ -273,7 +278,11 @@ void SpineEditorPropertyAnimationMix::update_property() {
|
||||
|
||||
if (container) {
|
||||
memdelete(container);
|
||||
#if VERSION_MAJOR > 3
|
||||
SceneTree::get_singleton()->queue_delete(container);
|
||||
#else
|
||||
container->queue_delete();
|
||||
#endif
|
||||
container = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -32,6 +32,9 @@
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "SpineCommon.h"
|
||||
#include "SpineSprite.h"
|
||||
#if VERSION_MAJOR > 3
|
||||
#include "editor/import/editor_import_plugin.h"
|
||||
#endif
|
||||
#include "editor/editor_node.h"
|
||||
#include "editor/editor_properties.h"
|
||||
#include "editor/editor_properties_array_dict.h"
|
||||
|
||||
@ -122,7 +122,11 @@ Error SpineSkeletonFileResource::load_from_file(const String &path) {
|
||||
if (error != OK) return error;
|
||||
if (!checkJson(json.utf8())) return ERR_INVALID_DATA;
|
||||
} else {
|
||||
#if VERSION_MAJOR > 3
|
||||
binary = FileAccess::get_file_as_bytes(path, &error);
|
||||
#else
|
||||
binary = FileAccess::get_file_as_array(path, &error);
|
||||
#endif
|
||||
if (error != OK) return error;
|
||||
if (!checkBinary((const char *) binary.ptr(), binary.size())) return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "SpineCommon.h"
|
||||
#include "modules/register_module_types.h"
|
||||
#include "register_types.h"
|
||||
#include "SpineAtlasResource.h"
|
||||
#include "SpineSkeletonFileResource.h"
|
||||
@ -70,12 +71,20 @@ static void editor_init_callback() {
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
void initialize_spine_godot_module(ModuleInitializationLevel level) {
|
||||
if (level == MODULE_INITIALIZATION_LEVEL_EDITOR) {
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorNode::add_init_callback(editor_init_callback);
|
||||
GDREGISTER_CLASS(SpineEditorPropertyAnimationMixes);
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
if (level != MODULE_INITIALIZATION_LEVEL_CORE) return;
|
||||
#else
|
||||
void register_spine_godot_types() {
|
||||
#endif
|
||||
#ifdef TOOLS_ENABLED
|
||||
EditorNode::add_init_callback(editor_init_callback);
|
||||
GDREGISTER_CLASS(SpineEditorPropertyAnimationMixes);
|
||||
#endif
|
||||
#endif
|
||||
spine::Bone::setYDown(true);
|
||||
GDREGISTER_CLASS(SpineObjectWrapper);
|
||||
@ -140,13 +149,14 @@ void register_spine_godot_types() {
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
void uninitialize_spine_godot_module(ModuleInitializationLevel level) {
|
||||
if (level != MODULE_INITIALIZATION_LEVEL_CORE) return;
|
||||
#else
|
||||
void unregister_spine_godot_types() {
|
||||
#endif
|
||||
ResourceLoader::remove_resource_format_loader(atlas_loader);
|
||||
/*ResourceLoader::remove_resource_format_loader(atlas_loader);
|
||||
ResourceSaver::remove_resource_format_saver(atlas_saver);
|
||||
ResourceLoader::remove_resource_format_loader(skeleton_file_loader);
|
||||
ResourceSaver::remove_resource_format_saver(skeleton_file_saver);
|
||||
ResourceSaver::remove_resource_format_saver(skeleton_file_saver);*/
|
||||
|
||||
/*memdelete(atlas_loader);
|
||||
memdelete(atlas_saver);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user