mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Merge branch '4.1' into 4.2-beta
This commit is contained in:
commit
961a865343
62
spine-godot/.vscode/launch.json
vendored
62
spine-godot/.vscode/launch.json
vendored
@ -9,75 +9,63 @@
|
||||
"request": "launch",
|
||||
"name": "debug scene v4",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
"args": [
|
||||
"--path",
|
||||
"example-v4",
|
||||
"examples/01-helloworld/helloworld.tscn"
|
||||
],
|
||||
"args": ["--path", "example-v4", "examples/07-slot-node/slot-node.tscn"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v4",
|
||||
"linux": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64"
|
||||
},
|
||||
"osx": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64",
|
||||
},
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug editor v4",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.exe",
|
||||
"args": [
|
||||
"-e",
|
||||
"--path",
|
||||
"example-v4",
|
||||
],
|
||||
"args": ["-e", "--path", "example-v4"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v4",
|
||||
"linux": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64"
|
||||
},
|
||||
"osx": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64",
|
||||
},
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug editor v4 c#",
|
||||
"program": "godot/bin/godot.windows.editor.dev.x86_64.mono.exe",
|
||||
"args": [
|
||||
"-e",
|
||||
"--path",
|
||||
"example-v4",
|
||||
],
|
||||
"args": ["-e", "--path", "example-v4"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v4",
|
||||
"linux": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug editor v4",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.editor.dev.x86_64"
|
||||
},
|
||||
"osx": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug editor v4",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64.mono",
|
||||
},
|
||||
"program": "${workspaceFolder}/godot/bin/godot.macos.editor.dev.arm64.mono"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
@ -85,49 +73,41 @@
|
||||
"name": "debug scene v3",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.windows.tools.64.exe",
|
||||
"args": [
|
||||
"--path",
|
||||
"example",
|
||||
"examples/01-helloworld/helloworld.tscn"
|
||||
],
|
||||
"args": ["--path", "example", "examples/01-helloworld/helloworld.tscn"],
|
||||
"preLaunchTask": "build-v3",
|
||||
"linux": {
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.tools.64",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.tools.64"
|
||||
},
|
||||
"osx": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug scene v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.osx.tools.64",
|
||||
},
|
||||
"program": "${workspaceFolder}/godot/bin/godot.osx.tools.64"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"name": "debug editor v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.windows.tools.64.exe",
|
||||
"args": [
|
||||
"-e",
|
||||
"--path",
|
||||
"example",
|
||||
],
|
||||
"args": ["-e", "--path", "example"],
|
||||
"cwd": "${workspaceFolder}",
|
||||
"preLaunchTask": "build-v3",
|
||||
"linux": {
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"name": "debug editor v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.tools.64",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.linux.tools.64"
|
||||
},
|
||||
"osx": {
|
||||
"type": "lldb",
|
||||
"request": "launch",
|
||||
"name": "debug editor v3",
|
||||
"program": "${workspaceFolder}/godot/bin/godot.osx.tools.64",
|
||||
},
|
||||
},
|
||||
"program": "${workspaceFolder}/godot/bin/godot.osx.tools.64"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -194,7 +194,8 @@ Error SpineAtlasResource::load_from_file(const String &path) {
|
||||
|
||||
clear();
|
||||
texture_loader = new GodotSpineTextureLoader(&textures, &normal_maps, normal_map_prefix);
|
||||
atlas = new spine::Atlas(atlas_data.utf8(), atlas_data.size(), source_path.get_base_dir().utf8(), texture_loader);
|
||||
auto utf8 = atlas_data.utf8();
|
||||
atlas = new spine::Atlas(utf8.ptr(), utf8.size(), source_path.get_base_dir().utf8(), texture_loader);
|
||||
if (atlas) return OK;
|
||||
|
||||
clear();
|
||||
|
||||
@ -73,7 +73,7 @@ Ref<SpineSlotData> SpineSlot::get_data() {
|
||||
Ref<SpineBone> SpineSlot::get_bone() {
|
||||
SPINE_CHECK(get_spine_object(), nullptr)
|
||||
if (_bone.is_valid()) {
|
||||
return _data;
|
||||
return _bone;
|
||||
} else {
|
||||
auto &bone = get_spine_object()->getBone();
|
||||
Ref<SpineBone> bone_ref(memnew(SpineBone));
|
||||
|
||||
@ -131,7 +131,7 @@ void SpineMesh2D::update_mesh(const Vector<Point2> &vertices,
|
||||
const Vector<int> &indices,
|
||||
SpineRendererObject *renderer_object) {
|
||||
#if VERSION_MAJOR > 3
|
||||
if (!mesh.is_valid() || vertices.size() != num_vertices || indices.size() != num_indices || last_indices_id != indices_id) {
|
||||
if (!mesh.is_valid() || vertices.size() != num_vertices || indices.size() != num_indices || indices_changed) {
|
||||
if (mesh.is_valid()) {
|
||||
RS::get_singleton()->free(mesh);
|
||||
}
|
||||
@ -151,7 +151,7 @@ void SpineMesh2D::update_mesh(const Vector<Point2> &vertices,
|
||||
num_indices = indices.size();
|
||||
vertex_buffer = surface.vertex_data;
|
||||
attribute_buffer = surface.attribute_data;
|
||||
last_indices_id = indices_id;
|
||||
indices_changed = false;
|
||||
} else {
|
||||
AABB aabb_new;
|
||||
uint8_t *vertex_write_buffer = vertex_buffer.ptrw();
|
||||
@ -183,7 +183,7 @@ void SpineMesh2D::update_mesh(const Vector<Point2> &vertices,
|
||||
|
||||
RenderingServer::get_singleton()->canvas_item_add_mesh(this->get_canvas_item(), mesh, Transform2D(), Color(1, 1, 1, 1), renderer_object->canvas_texture->get_rid());
|
||||
#else
|
||||
if (!mesh.is_valid() || vertices.size() != num_vertices || indices.size() != num_indices || last_indices_id != indices_id) {
|
||||
if (!mesh.is_valid() || vertices.size() != num_vertices || indices.size() != num_indices || indices_changed) {
|
||||
if (mesh.is_valid()) {
|
||||
VS::get_singleton()->free(mesh);
|
||||
}
|
||||
@ -203,7 +203,7 @@ void SpineMesh2D::update_mesh(const Vector<Point2> &vertices,
|
||||
VS::get_singleton()->mesh_surface_make_offsets_from_format(mesh_surface_format, surface_vertex_len, surface_index_len, mesh_surface_offsets, mesh_stride);
|
||||
num_vertices = vertices.size();
|
||||
num_indices = indices.size();
|
||||
last_indices_id = indices_id;
|
||||
indices_changed = false;
|
||||
} else {
|
||||
AABB aabb_new;
|
||||
PoolVector<uint8_t>::Write write_buffer = mesh_buffer.write();
|
||||
@ -769,15 +769,29 @@ void SpineSprite::update_meshes(Ref<SpineSkeleton> skeleton_ref) {
|
||||
for (int j = 0; j < (int) num_vertices; j++) {
|
||||
mesh_instance->colors.set(j, Color(tint.r, tint.g, tint.b, tint.a));
|
||||
}
|
||||
|
||||
auto indices_changed = true;
|
||||
if (mesh_instance->indices.size() == indices->size()) {
|
||||
auto old_indices = mesh_instance->indices.ptr();
|
||||
auto new_indices = indices->buffer();
|
||||
for (int j = 0; j < (int) indices->size(); j++) {
|
||||
if (old_indices[j] != new_indices[j]) {
|
||||
indices_changed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (indices_changed) {
|
||||
mesh_instance->indices.resize((int) indices->size());
|
||||
for (int j = 0; j < (int) indices->size(); ++j) {
|
||||
mesh_instance->indices.set(j, indices->buffer()[j]);
|
||||
}
|
||||
mesh_instance->indices_changed = true;
|
||||
}
|
||||
|
||||
mesh_instance->renderer_object = renderer_object;
|
||||
#if VERSION_MAJOR > 3
|
||||
mesh_instance->indices_id = (uint64_t) indices;
|
||||
#endif
|
||||
|
||||
spine::BlendMode blend_mode = slot->getData().getBlendMode();
|
||||
Ref<Material> custom_material;
|
||||
|
||||
|
||||
@ -56,9 +56,9 @@ protected:
|
||||
Vector<int> indices;
|
||||
SpineRendererObject *renderer_object;
|
||||
|
||||
bool indices_changed;
|
||||
|
||||
#if VERSION_MAJOR > 3
|
||||
uint64_t last_indices_id;
|
||||
uint64_t indices_id;
|
||||
RID mesh;
|
||||
uint32_t surface_offsets[RS::ARRAY_MAX];
|
||||
int num_vertices;
|
||||
@ -68,8 +68,6 @@ protected:
|
||||
uint32_t vertex_stride;
|
||||
uint32_t attribute_stride;
|
||||
#else
|
||||
uint64_t last_indices_id;
|
||||
uint64_t indices_id;
|
||||
RID mesh;
|
||||
uint32_t surface_offsets[VS::ARRAY_MAX];
|
||||
int num_vertices;
|
||||
@ -82,14 +80,14 @@ protected:
|
||||
|
||||
public:
|
||||
#if VERSION_MAJOR > 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() : renderer_object(nullptr), indices_changed(true), 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), last_indices_id(0), indices_id(0), num_vertices(0), num_indices(0){};
|
||||
SpineMesh2D() : renderer_object(nullptr), indices_changed(true), num_vertices(0), num_indices(0){};
|
||||
~SpineMesh2D() {
|
||||
if (mesh.is_valid()) {
|
||||
VS::get_singleton()->free(mesh);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user