diff --git a/formatters/build.gradle b/formatters/build.gradle index b343aca11..a9730210a 100644 --- a/formatters/build.gradle +++ b/formatters/build.gradle @@ -25,7 +25,9 @@ spotless { 'spine-sfml/**/*.cpp', 'spine-sfml/**/*.h', 'spine-ue4/**/*.cpp', - 'spine-ue4/**/*.h' + 'spine-ue4/**/*.h', + 'spine-godot/godot/modules/spine_godot/*.cpp', + 'spine-godot/godot/modules/spine_godot/*.h' clangFormat("13.0.1").pathToExe("$System.env.CLANGFORMAT").style('file') } diff --git a/spine-c/spine-c/src/spine/SkeletonJson.c b/spine-c/spine-c/src/spine/SkeletonJson.c index 458d80c73..bb75cca90 100644 --- a/spine-c/spine-c/src/spine/SkeletonJson.c +++ b/spine-c/spine-c/src/spine/SkeletonJson.c @@ -953,8 +953,8 @@ spSkeletonData *spSkeletonJson_readSkeletonDataFile(spSkeletonJson *self, const static int string_starts_with(const char *str, const char *needle) { int lenStr, lenNeedle, i; if (!str) return 0; - lenStr = (int)strlen(str); - lenNeedle = (int)strlen(needle); + lenStr = (int) strlen(str); + lenNeedle = (int) strlen(needle); if (lenStr < lenNeedle) return 0; for (i = 0; i < lenNeedle; i++) { if (str[i] != needle[i]) return 0; diff --git a/spine-godot/godot/modules/spine_godot/SpineAtlasResource.h b/spine-godot/godot/modules/spine_godot/SpineAtlasResource.h index 84c7cc9ca..1c03d0868 100644 --- a/spine-godot/godot/modules/spine_godot/SpineAtlasResource.h +++ b/spine-godot/godot/modules/spine_godot/SpineAtlasResource.h @@ -78,7 +78,7 @@ public: }; class SpineAtlasResourceFormatLoader : public ResourceFormatLoader { -GDCLASS(SpineAtlasResourceFormatLoader, ResourceFormatLoader); + GDCLASS(SpineAtlasResourceFormatLoader, ResourceFormatLoader); public: virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL); @@ -88,7 +88,7 @@ public: }; class SpineAtlasResourceFormatSaver : public ResourceFormatSaver { -GDCLASS(SpineAtlasResourceFormatSaver, ResourceFormatSaver); + GDCLASS(SpineAtlasResourceFormatSaver, ResourceFormatSaver); public: Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0) override; diff --git a/spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.h b/spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.h index b608da6f0..745d838cb 100644 --- a/spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.h +++ b/spine-godot/godot/modules/spine_godot/SpineRuntimeEditorPlugin.h @@ -74,7 +74,7 @@ public: }; class SpineBinaryResourceImportPlugin : public EditorImportPlugin { -GDCLASS(SpineBinaryResourceImportPlugin, EditorImportPlugin); + GDCLASS(SpineBinaryResourceImportPlugin, EditorImportPlugin); public: String get_importer_name() const override { return "spine.skel"; } diff --git a/spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp b/spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp index 73523bece..d913fcfb2 100644 --- a/spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp +++ b/spine-godot/godot/modules/spine_godot/SpineSkeletonDataResource.cpp @@ -99,7 +99,7 @@ void SpineSkeletonDataResource::load_res(spine::Atlas *atlas, const String &json spine::SkeletonData *skeletonData = NULL; if (!json.empty()) { spine::SkeletonJson skeletonJson(atlas); - skeletonData = skeletonJson.readSkeletonData(json.utf8()); + skeletonData = skeletonJson.readSkeletonData(json.utf8()); if (!skeletonData) { print_error(String("Error while loading skeleton data: ") + get_path()); print_error(String("Error message: ") + skeletonJson.getError().buffer()); diff --git a/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.cpp b/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.cpp index 3dd9fff1a..6109ec651 100644 --- a/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.cpp +++ b/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.cpp @@ -33,67 +33,67 @@ void SpineSkeletonFileResource::_bind_methods() { } Error SpineSkeletonFileResource::load_from_file(const String &p_path) { - Error err; + Error err; - if(p_path.ends_with("spjson")) - json = FileAccess::get_file_as_string(p_path, &err); - else - binary = FileAccess::get_file_as_array(p_path, &err); - return err; + if (p_path.ends_with("spjson")) + json = FileAccess::get_file_as_string(p_path, &err); + else + binary = FileAccess::get_file_as_array(p_path, &err); + return err; } Error SpineSkeletonFileResource::save_to_file(const String &p_path) { - Error err; - FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err); - if (err != OK) { - if (file) file->close(); - return err; - } + Error err; + FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err); + if (err != OK) { + if (file) file->close(); + return err; + } - if (!is_binary()) - file->store_string(json); - else - file->store_buffer(binary.ptr(), binary.size()); - file->close(); + if (!is_binary()) + file->store_string(json); + else + file->store_buffer(binary.ptr(), binary.size()); + file->close(); - return OK; + return OK; } RES SpineSkeletonFileResourceFormatLoader::load(const String &p_path, const String &p_original_path, Error *r_error) { - Ref skeleton = memnew(SpineSkeletonFileResource); - skeleton->load_from_file(p_path); + Ref skeleton = memnew(SpineSkeletonFileResource); + skeleton->load_from_file(p_path); - if (r_error) { - *r_error = OK; - } - return skeleton; + if (r_error) { + *r_error = OK; + } + return skeleton; } void SpineSkeletonFileResourceFormatLoader::get_recognized_extensions(List *r_extensions) const { - r_extensions->push_back("spjson"); - r_extensions->push_back("spskel"); + r_extensions->push_back("spjson"); + r_extensions->push_back("spskel"); } String SpineSkeletonFileResourceFormatLoader::get_resource_type(const String &p_path) const { - return "SpineSkeletonFileResource"; + return "SpineSkeletonFileResource"; } bool SpineSkeletonFileResourceFormatLoader::handles_type(const String &p_type) const { - return p_type == "SpineSkeletonFileResource" || ClassDB::is_parent_class(p_type, "SpineSkeletonFileResource"); + return p_type == "SpineSkeletonFileResource" || ClassDB::is_parent_class(p_type, "SpineSkeletonFileResource"); } Error SpineSkeletonFileResourceFormatSaver::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { - Ref res = p_resource.get_ref_ptr(); - Error error = res->save_to_file(p_path); - return error; + Ref res = p_resource.get_ref_ptr(); + Error error = res->save_to_file(p_path); + return error; } void SpineSkeletonFileResourceFormatSaver::get_recognized_extensions(const RES &p_resource, List *p_extensions) const { - if (Object::cast_to(*p_resource)) { - p_extensions->push_back("spjson"); - p_extensions->push_back("spskel"); - } + if (Object::cast_to(*p_resource)) { + p_extensions->push_back("spjson"); + p_extensions->push_back("spskel"); + } } bool SpineSkeletonFileResourceFormatSaver::recognize(const RES &p_resource) const { - return Object::cast_to(*p_resource) != nullptr; + return Object::cast_to(*p_resource) != nullptr; } diff --git a/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.h b/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.h index 3dca01abe..56e162ef2 100644 --- a/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.h +++ b/spine-godot/godot/modules/spine_godot/SpineSkeletonFileResource.h @@ -35,40 +35,40 @@ #include "core/io/resource_saver.h" class SpineSkeletonFileResource : public Resource { - GDCLASS(SpineSkeletonFileResource, Resource); + GDCLASS(SpineSkeletonFileResource, Resource); protected: - static void _bind_methods(); + static void _bind_methods(); - String json; - Vector binary; + String json; + Vector binary; public: - inline const bool is_binary() { return !binary.empty(); } - inline const Vector &get_binary() { return binary; } - inline const String &get_json() { return json; } + inline const bool is_binary() { return !binary.empty(); } + inline const Vector &get_binary() { return binary; } + inline const String &get_json() { return json; } - Error load_from_file(const String &p_path); - Error save_to_file(const String &p_path); + Error load_from_file(const String &p_path); + Error save_to_file(const String &p_path); }; class SpineSkeletonFileResourceFormatLoader : public ResourceFormatLoader { - GDCLASS(SpineSkeletonFileResourceFormatLoader, ResourceFormatLoader); + GDCLASS(SpineSkeletonFileResourceFormatLoader, ResourceFormatLoader); public: - virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL); - virtual void get_recognized_extensions(List *r_extensions) const; - virtual bool handles_type(const String &p_type) const; - virtual String get_resource_type(const String &p_path) const; + virtual RES load(const String &p_path, const String &p_original_path, Error *r_error = NULL); + virtual void get_recognized_extensions(List *r_extensions) const; + virtual bool handles_type(const String &p_type) const; + virtual String get_resource_type(const String &p_path) const; }; class SpineSkeletonFileResourceFormatSaver : public ResourceFormatSaver { - GDCLASS(SpineSkeletonFileResourceFormatSaver, ResourceFormatSaver); + GDCLASS(SpineSkeletonFileResourceFormatSaver, ResourceFormatSaver); public: - Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0) override; - void get_recognized_extensions(const RES &p_resource, List *p_extensions) const override; - bool recognize(const RES &p_resource) const override; + Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0) override; + void get_recognized_extensions(const RES &p_resource, List *p_extensions) const override; + bool recognize(const RES &p_resource) const override; }; -#endif //GODOT_SPINESKELETONFILERESOURCE_H +#endif//GODOT_SPINESKELETONFILERESOURCE_H