Merge branch '4.1' into 4.2-beta

This commit is contained in:
badlogic 2023-02-14 15:38:07 +01:00
commit 89412eeada
2 changed files with 29 additions and 15 deletions

View File

@ -33,14 +33,14 @@
#include "SpineSkeleton.h"
#include "SpineRendererObject.h"
#include "SpineSlotNode.h"
#include "core/math/transform_2d.h"
#include "core/variant/array.h"
#include "scene/resources/mesh.h"
#include "servers/rendering_server.h"
#if VERSION_MAJOR > 3
#include "core/config/engine.h"
#include "core/math/geometry_2d.h"
#include "core/math/transform_2d.h"
#include "core/variant/array.h"
#include "scene/resources/mesh.h"
#include "servers/rendering_server.h"
#else
#include "core/engine.h"
#endif
@ -708,7 +708,9 @@ void SpineSprite::update_meshes(Ref<SpineSkeleton> skeleton_ref) {
}
mesh_instance->renderer_object = renderer_object;
mesh_instance->indices_id = (uint64_t)indices;
#if VERSION > 3
mesh_instance->indices_id = (uint64_t) indices;
#endif
spine::BlendMode blend_mode = slot->getData().getBlendMode();
Ref<Material> custom_material;
@ -766,7 +768,12 @@ void SpineSprite::draw() {
if (!animation_state.is_valid() && !skeleton.is_valid()) return;
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint()) return;
#if VERSION > 3
RS::get_singleton()->canvas_item_clear(this->get_canvas_item());
#else
VisualServer::get_singleton()->canvas_item_clear(this->get_canvas_item());
#endif
auto mouse_position = get_local_mouse_position();
spine::Slot *hovered_slot = nullptr;
@ -973,7 +980,6 @@ void SpineSprite::draw() {
#endif
}
#endif
}
void SpineSprite::draw_bone(spine::Bone *bone, const Color &color) {

View File

@ -55,6 +55,8 @@ protected:
Vector<Color> colors;
Vector<int> indices;
SpineRendererObject *renderer_object;
#if VERSION > 3
uint64_t last_indices_id;
uint64_t indices_id;
RID mesh;
@ -65,14 +67,20 @@ protected:
PackedByteArray attribute_buffer;
uint32_t vertex_stride;
uint32_t attribute_stride;
#endif
public:
SpineMesh2D() : renderer_object(nullptr), last_indices_id(0), indices_id(0), num_vertices(0), num_indices(0), vertex_stride(0), attribute_stride(0) {};
#if VERSION > 3
SpineMesh2D() : renderer_object(nullptr), last_indices_id(0), indices_id(0), num_vertices(0), num_indices(0), vertex_stride(0), attribute_stride(0){};
~SpineMesh2D() {
if (mesh.is_valid()) {
RS::get_singleton()->free(mesh);
}
}
#else
SpineMesh2D() : renderer_object(nullptr){};
~SpineMesh2D() {}
#endif
void update_mesh(const Vector<Point2> &vertices,
const Vector<Point2> &uvs,