Formatting

This commit is contained in:
Mario Zechner 2023-09-05 22:36:04 +02:00
parent 7b98021228
commit 3acbc2ab7a
4 changed files with 9 additions and 11 deletions

View File

@ -115,7 +115,7 @@ Ref<SpineBone> SpineSkeleton::find_bone(const String &name) {
if (EMPTY(name)) return nullptr; if (EMPTY(name)) return nullptr;
auto bone = skeleton->findBone(SPINE_STRING_TMP(name)); auto bone = skeleton->findBone(SPINE_STRING_TMP(name));
if (!bone) return nullptr; if (!bone) return nullptr;
if (_cached_bones.count(bone) > 0 ) { if (_cached_bones.count(bone) > 0) {
return _cached_bones[bone]; return _cached_bones[bone];
} }
Ref<SpineBone> bone_ref(memnew(SpineBone)); Ref<SpineBone> bone_ref(memnew(SpineBone));
@ -129,7 +129,7 @@ Ref<SpineSlot> SpineSkeleton::find_slot(const String &name) {
if (EMPTY(name)) return nullptr; if (EMPTY(name)) return nullptr;
auto slot = skeleton->findSlot(SPINE_STRING_TMP(name)); auto slot = skeleton->findSlot(SPINE_STRING_TMP(name));
if (!slot) return nullptr; if (!slot) return nullptr;
if (_cached_slots.count(slot) > 0 ) { if (_cached_slots.count(slot) > 0) {
return _cached_slots[slot]; return _cached_slots[slot];
} }
Ref<SpineSlot> slot_ref(memnew(SpineSlot)); Ref<SpineSlot> slot_ref(memnew(SpineSlot));

View File

@ -68,8 +68,8 @@ private:
spine::Vector<float> bounds_vertex_buffer; spine::Vector<float> bounds_vertex_buffer;
Ref<SpineSkin> last_skin; Ref<SpineSkin> last_skin;
std::unordered_map<spine::Bone*, Ref<SpineBone>> _cached_bones; std::unordered_map<spine::Bone *, Ref<SpineBone>> _cached_bones;
std::unordered_map<spine::Slot*, Ref<SpineSlot>> _cached_slots; std::unordered_map<spine::Slot *, Ref<SpineSlot>> _cached_slots;
public: public:
SpineSkeleton(); SpineSkeleton();

View File

@ -59,10 +59,9 @@ void SpineSlot::set_to_setup_pose() {
Ref<SpineSlotData> SpineSlot::get_data() { Ref<SpineSlotData> SpineSlot::get_data() {
SPINE_CHECK(get_spine_object(), nullptr) SPINE_CHECK(get_spine_object(), nullptr)
if(_data.is_valid()) { if (_data.is_valid()) {
return _data; return _data;
} } else {
else {
auto &slot_data = get_spine_object()->getData(); auto &slot_data = get_spine_object()->getData();
Ref<SpineSlotData> slot_data_ref(memnew(SpineSlotData)); Ref<SpineSlotData> slot_data_ref(memnew(SpineSlotData));
slot_data_ref->set_spine_object(*get_spine_owner()->get_skeleton_data_res(), &slot_data); slot_data_ref->set_spine_object(*get_spine_owner()->get_skeleton_data_res(), &slot_data);
@ -73,10 +72,9 @@ Ref<SpineSlotData> SpineSlot::get_data() {
Ref<SpineBone> SpineSlot::get_bone() { Ref<SpineBone> SpineSlot::get_bone() {
SPINE_CHECK(get_spine_object(), nullptr) SPINE_CHECK(get_spine_object(), nullptr)
if(_bone.is_valid()) { if (_bone.is_valid()) {
return _data; return _data;
} } else {
else {
auto &bone = get_spine_object()->getBone(); auto &bone = get_spine_object()->getBone();
Ref<SpineBone> bone_ref(memnew(SpineBone)); Ref<SpineBone> bone_ref(memnew(SpineBone));
bone_ref->set_spine_object(get_spine_owner(), &bone); bone_ref->set_spine_object(get_spine_owner(), &bone);

View File

@ -76,7 +76,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
private isWebGL: boolean; private isWebGL: boolean;
gl: WebGLRenderingContext | null; gl: WebGLRenderingContext | null;
static gameWebGLRenderer: SceneRenderer | null = null; static gameWebGLRenderer: SceneRenderer | null = null;
get webGLRenderer(): SceneRenderer | null { get webGLRenderer (): SceneRenderer | null {
return SpinePlugin.gameWebGLRenderer; return SpinePlugin.gameWebGLRenderer;
} }
canvasRenderer: SkeletonRenderer | null; canvasRenderer: SkeletonRenderer | null;