Merge branch '4.1' into 4.2-beta

# Conflicts:
#	spine-ts/package-lock.json
#	spine-ts/package.json
#	spine-ts/spine-canvas/package.json
#	spine-ts/spine-core/package.json
#	spine-ts/spine-phaser/package.json
#	spine-ts/spine-pixi/package.json
#	spine-ts/spine-player/package.json
#	spine-ts/spine-threejs/package.json
#	spine-ts/spine-webgl/package.json
This commit is contained in:
Mario Zechner 2023-09-05 22:45:21 +02:00
commit db914b023f
21 changed files with 36 additions and 38 deletions

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="https://unpkg.com/@esotericsoftware/spine-phaser@4.1.*/dist/iife/spine-phaser.min.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,14 +5,14 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>
<body>
<h1>Control bones</h1>
<script>
<script>
class ControlBonesExample extends Phaser.Scene {
preload() {
this.load.spineBinary("stretchyman-data", "assets/stretchyman-pro.skel");
@ -20,7 +20,7 @@
}
create() {
const stretchyman = this.add.spine(400, 580, 'stretchyman-data', "stretchyman-atlas");
const stretchyman = this.add.spine(400, 580, 'stretchyman-data', "stretchyman-atlas");
stretchyman.animationState.setAnimation(0, "idle", true);
stretchyman.updatePose(0);
@ -38,12 +38,12 @@
this.input.setDraggable(control);
this.input.on('drag', function (pointer, gameObject, dragX, dragY) {
gameObject.x = dragX;
gameObject.y = dragY;
gameObject.y = dragY;
}, this);
}
stretchyman.beforeUpdateWorldTransforms = () => {
for (let controlBone of controlBones) {
for (let controlBone of controlBones) {
const bone = controlBone.getData('bone');
const point = { x: controlBone.x, y: controlBone.y};
stretchyman.phaserWorldCoordinatesToBone(point, bone);
@ -65,7 +65,7 @@
{ key: "spine.SpinePlugin", plugin: spine.SpinePlugin, mapping: "spine" }
]
}
});
});
</script>
</body>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>
@ -17,7 +17,7 @@
<textarea id="log" style="height: 10em;"></textarea>
</div>
</body>
<script>
<script>
function log(message) {
let log = document.querySelector("#log");
log.textContent += message + "\n";
@ -40,7 +40,7 @@
interrupt: (entry) => log(`Interrupted animation ${entry.animation.name}`),
end: (entry) => log(`Ended animation ${entry.animation.name}`),
dispose: (entry) => log(`Disposed animation ${entry.animation.name}`),
complete: (entry) => log(`Completed animation ${entry.animation.name}`),
complete: (entry) => log(`Completed animation ${entry.animation.name}`),
})
spineboy.animationState.setAnimation(0, "walk", true);
@ -51,7 +51,7 @@
}
}
const config = {
const config = {
canvas: document.querySelector("#game"),
width: 800,
height: 600,

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<title>Spine Phaser Example</title>
</head>
@ -37,7 +37,7 @@
}
function create() {
const renderTexture = this.add.renderTexture(0, 0, 800, 600);
const renderTexture = this.add.renderTexture(400, 300, 800, 600);
const spineboy = this.add.spine(400, 300, 'spineboy-data', "spineboy-atlas");
spineboy.scale = 0.5;
spineboy.animationState.setAnimation(0, "walk", true);

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="//cdn.jsdelivr.net/npm/phaser@3.55.2/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.60.0/dist/phaser.js"></script>
<script src="../dist/iife/spine-phaser.js"></script>
<title>Spine Phaser Example</title>
</head>

View File

@ -76,7 +76,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
private isWebGL: boolean;
gl: WebGLRenderingContext | null;
static gameWebGLRenderer: SceneRenderer | null = null;
get webGLRenderer(): SceneRenderer | null {
get webGLRenderer (): SceneRenderer | null {
return SpinePlugin.gameWebGLRenderer;
}
canvasRenderer: SkeletonRenderer | null;
@ -124,7 +124,7 @@ export class SpinePlugin extends Phaser.Plugins.ScenePlugin {
let self = this;
let addSpineGameObject = function (this: Phaser.GameObjects.GameObjectFactory, x: number, y: number, dataKey: string, atlasKey: string, boundsProvider: SpineGameObjectBoundsProvider) {
let gameObject = new SpineGameObject(scene, self, x, y, dataKey, atlasKey, boundsProvider);
let gameObject = new SpineGameObject(this.scene, self, x, y, dataKey, atlasKey, boundsProvider);
this.displayList.add(gameObject);
this.updateList.add(gameObject);
return gameObject;