[godot] Formatting fixes per latest format.sh

This commit is contained in:
Luke Ingram 2025-10-01 11:35:20 -04:00
parent 666b136a37
commit 2f48bf16e2
14 changed files with 98 additions and 96 deletions

View File

@ -49,11 +49,11 @@ void SpineAnimation::_bind_methods() {
String SpineAnimation::get_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -40,7 +40,7 @@
#ifdef TOOLS_ENABLED
#include "editor/editor_node.h"
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#include "editor/animation/animation_player_editor_plugin.h"
#include "editor/animation/animation_tree_editor_plugin.h"
#else
@ -248,11 +248,11 @@ Ref<Animation> SpineAnimationTrack::create_animation(spine::Animation *animation
Ref<Animation> animation_ref;
INSTANTIATE(animation_ref);
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(animation->getName().buffer());
#else
name.parse_utf8(animation->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(animation->getName().buffer());
#else
name.parse_utf8(animation->getName().buffer());
#endif
animation_ref->set_name(name + (loop ? "" : "_looped"));
#if VERSION_MAJOR > 3
// animation_ref->set_loop(!loop);
@ -302,11 +302,11 @@ void SpineAnimationTrack::update_animation_state(const Variant &variant_sprite)
auto current_entry = animation_state->getCurrent(track_index);
bool should_set_mix = mix_duration >= 0;
String other_name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
if (current_entry) other_name = String::utf8(current_entry->getAnimation().getName().buffer());
#else
if (current_entry) other_name.parse_utf8(current_entry->getAnimation().getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
if (current_entry) other_name = String::utf8(current_entry->getAnimation().getName().buffer());
#else
if (current_entry) other_name.parse_utf8(current_entry->getAnimation().getName().buffer());
#endif
bool should_set_animation = !current_entry || (animation_name != other_name || current_entry->getLoop() != loop);
if (should_set_animation) {
@ -441,11 +441,11 @@ void SpineAnimationTrack::update_animation_state(const Variant &variant_sprite)
auto current_entry = animation_state->getCurrent(track_index);
bool should_set_mix = mix_duration >= 0;
String other_name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
if (current_entry) other_name = String::utf8(current_entry->getAnimation().getName().buffer());
#else
#else
if (current_entry) other_name.parse_utf8(current_entry->getAnimation().getName().buffer());
#endif
#endif
bool should_set_animation = !current_entry || (animation_name != other_name || current_entry->getLoop() != loop) || animation_changed;
animation_changed = false;

View File

@ -51,7 +51,7 @@
#ifdef SPINE_GODOT_EXTENSION
#include <godot_cpp/classes/editor_file_system.hpp>
#else
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#include "editor/file_system/editor_file_system.h"
#else
#include "editor/editor_file_system.h"
@ -150,11 +150,11 @@ public:
void load(spine::AtlasPage &page, const spine::String &path) override {
String fixed_path;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
fixed_path = String::utf8(path.buffer());
#else
fixed_path.parse_utf8(path.buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
fixed_path = String::utf8(path.buffer());
#else
fixed_path.parse_utf8(path.buffer());
#endif
bool is_resource = fix_path(fixed_path);
import_image_resource(fixed_path);

View File

@ -42,11 +42,11 @@ SpineAttachment::~SpineAttachment() {
String SpineAttachment::get_attachment_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -223,5 +223,5 @@ void SpineBone::set_global_transform(Transform2D transform) {
void SpineBone::update(Ref<SpineSkeleton> skeleton, SpineConstant::Physics physics) {
SPINE_CHECK(get_spine_object(), )
SPINE_CHECK(skeleton.is_valid() && skeleton->get_spine_object(), )
get_spine_object()->update(*skeleton->get_spine_object(), (spine::Physics)physics);
get_spine_object()->update(*skeleton->get_spine_object(), (spine::Physics) physics);
}

View File

@ -54,11 +54,11 @@ int SpineBoneData::get_index() {
String SpineBoneData::get_bone_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -39,11 +39,11 @@ void SpineConstraintData::_bind_methods() {
String SpineConstraintData::get_constraint_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -44,7 +44,7 @@
#include <godot_cpp/classes/editor_property.hpp>
#else
#include "editor/editor_node.h"
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#include "editor/inspector/editor_properties.h"
#include "editor/inspector/editor_properties_array_dict.h"
#else

View File

@ -49,11 +49,11 @@ void SpineEventData::_bind_methods() {
String SpineEventData::get_event_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -378,7 +378,7 @@ Array SpineSkeleton::get_sliders() {
auto constraint = constraints[i];
if (!constraint->getRTTI().isExactly(spine::Slider::rtti) == false) continue;
Ref<SpineSlider> slider_ref(memnew(SpineSlider));
slider_ref->set_spine_object(sprite, (spine::Slider *)constraint);
slider_ref->set_spine_object(sprite, (spine::Slider *) constraint);
result.append(slider_ref);
}
return result;

View File

@ -48,7 +48,7 @@
#ifdef SPINE_GODOT_EXTENSION
#include <godot_cpp/classes/editor_file_system.hpp>
#else
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
#include "editor/file_system/editor_file_system.h"
#else
#include "editor/editor_file_system.h"
@ -347,11 +347,11 @@ void SpineSkeletonDataResource::get_animation_names(Vector<String> &animation_na
for (size_t i = 0; i < animations.size(); ++i) {
auto animation = animations[i];
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(animation->getName().buffer());
#else
name.parse_utf8(animation->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(animation->getName().buffer());
#else
name.parse_utf8(animation->getName().buffer());
#endif
animation_names.push_back(name);
}
}
@ -367,11 +367,11 @@ void SpineSkeletonDataResource::get_skin_names(Vector<String> &skin_names) const
for (size_t i = 0; i < skins.size(); ++i) {
auto skin = skins[i];
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(skin->getName().buffer());
#else
name.parse_utf8(skin->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(skin->getName().buffer());
#else
name.parse_utf8(skin->getName().buffer());
#endif
skin_names.push_back(name);
}
}
@ -387,11 +387,11 @@ void SpineSkeletonDataResource::get_slot_names(Vector<String> &slot_names) {
for (size_t i = 0; i < slots.size(); ++i) {
auto slot = slots[i];
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(slot->getName().buffer());
#else
name.parse_utf8(slot->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(slot->getName().buffer());
#else
name.parse_utf8(slot->getName().buffer());
#endif
slot_names.push_back(name);
}
}
@ -407,11 +407,11 @@ void SpineSkeletonDataResource::get_bone_names(Vector<String> &bone_names) {
for (size_t i = 0; i < bones.size(); ++i) {
auto bone = bones[i];
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(bone->getName().buffer());
#else
name.parse_utf8(bone->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(bone->getName().buffer());
#else
name.parse_utf8(bone->getName().buffer());
#endif
bone_names.push_back(name);
}
}
@ -559,11 +559,11 @@ Ref<SpinePhysicsConstraintData> SpineSkeletonDataResource::find_physics_constrai
String SpineSkeletonDataResource::get_skeleton_name() const {
SPINE_CHECK(skeleton_data, "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(skeleton_data->getName().buffer());
#else
name.parse_utf8(skeleton_data->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(skeleton_data->getName().buffer());
#else
name.parse_utf8(skeleton_data->getName().buffer());
#endif
return name;
}

View File

@ -125,11 +125,11 @@ Array SpineSkin::find_attachments_for_slot(int slot_index) {
String SpineSkin::get_name() {
SPINE_CHECK(get_spine_object(), "")
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -54,11 +54,11 @@ int SpineSlotData::get_index() {
String SpineSlotData::get_name() {
SPINE_CHECK(get_spine_object(), String(""))
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(get_spine_object()->getName().buffer());
#else
name.parse_utf8(get_spine_object()->getName().buffer());
#endif
return name;
}

View File

@ -1124,7 +1124,8 @@ void SpineSprite::draw() {
auto bounding_box = (spine::BoundingBoxAttachment *) attachment;
auto vertices = &statics.scratch_vertices;
vertices->setSize(bounding_box->getWorldVerticesLength(), 0);
bounding_box->computeWorldVertices(*skeleton->get_spine_object(), *slot, 0, bounding_box->getWorldVerticesLength(), vertices->buffer(), 0, 2);
bounding_box->computeWorldVertices(*skeleton->get_spine_object(), *slot, 0, bounding_box->getWorldVerticesLength(), vertices->buffer(), 0,
2);
size_t num_vertices = vertices->size() / 2;
statics.scratch_points.resize((int) num_vertices);
memcpy(statics.scratch_points.ptrw(), vertices->buffer(), num_vertices * 2 * sizeof(float));
@ -1220,11 +1221,11 @@ void SpineSprite::draw() {
Vector<String> hover_text_lines;
if (hovered_slot) {
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(hovered_slot->getData().getName().buffer());
#else
name.parse_utf8(hovered_slot->getData().getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(hovered_slot->getData().getName().buffer());
#else
name.parse_utf8(hovered_slot->getData().getName().buffer());
#endif
hover_text_lines.push_back(String("Slot: ") + name);
}
@ -1234,11 +1235,11 @@ void SpineSprite::draw() {
draw_bone(hovered_bone, Color(debug_bones_color.r, debug_bones_color.g, debug_bones_color.b, 1));
debug_bones_thickness = thickness;
String name;
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(hovered_bone->getData().getName().buffer());
#else
name.parse_utf8(hovered_bone->getData().getName().buffer());
#endif
#if (VERSION_MAJOR >= 4 && VERSION_MINOR >= 5)
name = String::utf8(hovered_bone->getData().getName().buffer());
#else
name.parse_utf8(hovered_bone->getData().getName().buffer());
#endif
hover_text_lines.push_back(String("Bone: ") + name);
}
@ -1297,7 +1298,8 @@ void SpineSprite::draw() {
}
void SpineSprite::draw_bone(spine::Bone *bone, const Color &color) {
draw_set_transform(Vector2(bone->getAppliedPose().getWorldX(), bone->getAppliedPose().getWorldY()), spine::MathUtil::Deg_Rad * bone->getAppliedPose().getWorldRotationX(),
draw_set_transform(Vector2(bone->getAppliedPose().getWorldX(), bone->getAppliedPose().getWorldY()),
spine::MathUtil::Deg_Rad * bone->getAppliedPose().getWorldRotationX(),
Vector2(bone->getAppliedPose().getWorldScaleX(), bone->getAppliedPose().getWorldScaleY()));
float bone_length = bone->getData().getLength();
if (bone_length == 0) bone_length = debug_bones_thickness * 2;