mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[godot] Fix importers for extension settings
This commit is contained in:
parent
14992a57c3
commit
6dbed6044f
1
spine-godot/.vscode/settings.json
vendored
1
spine-godot/.vscode/settings.json
vendored
@ -4,6 +4,7 @@
|
|||||||
"C_Cpp.default.browse.path": [
|
"C_Cpp.default.browse.path": [
|
||||||
"${workspaceFolder}"
|
"${workspaceFolder}"
|
||||||
],
|
],
|
||||||
|
"C_Cpp.default.defines": ["TOOLS_ENABLED", "SPINE_GODOT_EXTENSION"],
|
||||||
"dotnet.defaultSolution": "disable",
|
"dotnet.defaultSolution": "disable",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.inc": "cpp"
|
"*.inc": "cpp"
|
||||||
|
|||||||
@ -287,10 +287,14 @@ Error SpineAtlasResource::load_from_file(const String &path) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
JSON json;
|
JSON *json = memnew(JSON);
|
||||||
error = json.parse(json_string);
|
error = json->parse(json_string);
|
||||||
if (error != OK) return error;
|
if (error != OK) {
|
||||||
Variant result = json.get_data();
|
memdelete(json);
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
Variant result = json->get_data();
|
||||||
|
memdelete(json);
|
||||||
#else
|
#else
|
||||||
String error_string;
|
String error_string;
|
||||||
int error_line;
|
int error_line;
|
||||||
@ -337,9 +341,10 @@ Error SpineAtlasResource::save_to_file(const String &path) {
|
|||||||
content["atlas_data"] = atlas_data;
|
content["atlas_data"] = atlas_data;
|
||||||
content["normal_texture_prefix"] = normal_map_prefix;
|
content["normal_texture_prefix"] = normal_map_prefix;
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
JSON json;
|
JSON *json = memnew(JSON);
|
||||||
file->store_string(json.stringify(content));
|
file->store_string(json->stringify(content));
|
||||||
file->flush();
|
file->flush();
|
||||||
|
memdelete(json);
|
||||||
#else
|
#else
|
||||||
file->store_string(JSON::print(content));
|
file->store_string(JSON::print(content));
|
||||||
file->close();
|
file->close();
|
||||||
|
|||||||
@ -64,8 +64,18 @@ Error SpineAtlasResourceImportPlugin::import(const String &source_file, const St
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME get_import_options is not available in godot-cpp
|
#ifdef SPINE_GODOT_EXTENSION
|
||||||
#ifndef SPINE_GODOT_EXTENSION
|
TypedArray<Dictionary> SpineAtlasResourceImportPlugin::_get_import_options(const String &p_path, int32_t p_preset_index) const {
|
||||||
|
TypedArray<Dictionary> options;
|
||||||
|
Dictionary dictionary;
|
||||||
|
dictionary["name"] = "normal_map_prefix";
|
||||||
|
dictionary["type"] = Variant::STRING;
|
||||||
|
dictionary["hint_string"] = "String";
|
||||||
|
dictionary["default_value"] = String("n");
|
||||||
|
options.push_back(dictionary);
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
#else
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
void SpineAtlasResourceImportPlugin::get_import_options(const String &path, List<ImportOption> *options, int preset) const {
|
void SpineAtlasResourceImportPlugin::get_import_options(const String &path, List<ImportOption> *options, int preset) const {
|
||||||
#else
|
#else
|
||||||
|
|||||||
@ -94,6 +94,8 @@ public:
|
|||||||
|
|
||||||
virtual float _get_priority() const override { return 1; }
|
virtual float _get_priority() const override { return 1; }
|
||||||
|
|
||||||
|
TypedArray<Dictionary> _get_import_options(const String &p_path, int32_t p_preset_index) const override;
|
||||||
|
|
||||||
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
||||||
|
|
||||||
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
||||||
@ -163,6 +165,11 @@ public:
|
|||||||
|
|
||||||
float _get_priority() const override { return 1; }
|
float _get_priority() const override { return 1; }
|
||||||
|
|
||||||
|
TypedArray<Dictionary> _get_import_options(const String &p_path, int32_t p_preset_index) const override {
|
||||||
|
TypedArray<Dictionary> options;
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
||||||
|
|
||||||
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
||||||
@ -232,6 +239,11 @@ public:
|
|||||||
|
|
||||||
float _get_priority() const override { return 1; }
|
float _get_priority() const override { return 1; }
|
||||||
|
|
||||||
|
TypedArray<Dictionary> _get_import_options(const String &p_path, int32_t p_preset_index) const override {
|
||||||
|
TypedArray<Dictionary> options;
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
virtual bool _get_option_visibility(const String &p_path, const StringName &p_option_name, const Dictionary &p_options) const override { return true; };
|
||||||
|
|
||||||
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
virtual Error _import(const String &p_source_file, const String &p_save_path, const Dictionary &p_options, const TypedArray<String> &p_platform_variants, const TypedArray<String> &p_gen_files) const override;
|
||||||
|
|||||||
@ -192,7 +192,6 @@ void register_spine_godot_types() {
|
|||||||
ResourceSaver::add_resource_format_saver(skeleton_file_saver);
|
ResourceSaver::add_resource_format_saver(skeleton_file_saver);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
printf(">>>>>>>>>>>>>>>>>>>> fuck\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VERSION_MAJOR > 3
|
#if VERSION_MAJOR > 3
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user