From 3f37b58292f8d790b0baddd022f9f983e3fc8cc0 Mon Sep 17 00:00:00 2001 From: makc Date: Sun, 14 Dec 2014 04:14:33 +0100 Subject: [PATCH] an attempt to fix goblins problem this only addresses bad attachment.uvs, there are still more problems :( --- spine-threejs/example/index.html | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spine-threejs/example/index.html b/spine-threejs/example/index.html index 61712e0d0..a51dd90f0 100644 --- a/spine-threejs/example/index.html +++ b/spine-threejs/example/index.html @@ -92,6 +92,21 @@ atlas.updateUVs (page); + // propagate new UVs to attachments, if they were already created + if (self.skeleton) { + var skins = self.skeleton.data.skins; + for (var s = 0, n = skins.length; s < n; s++) { + var attachments = skins[s].attachments; + for (var k in attachments) { + var attachment = attachments[k]; + if (attachment instanceof spine.RegionAttachment) { + var region = attachment.rendererObject; + attachment.setUVs (region.u, region.v, region.u2, region.v2, region.rotate); + } + } + } + } + // create basic material for the page var texture = new THREE.Texture (image); texture.needsUpdate = true; @@ -164,7 +179,7 @@ continue; } - if (slot.data.additiveBlending && (materials.length < 2)) { + if (slot.data.additiveBlending && (materials.length == 1)) { // create separate material for additive blending materials.push (new THREE.MeshBasicMaterial ({ map : materials[0].map, @@ -305,7 +320,7 @@ test.skeleton.setSlotsToSetupPose(); test.state.setAnimationByName(0, 'walk', true); canvas.onmousedown = function () { - test.skeleton.setSkinByName(skeleton.skin.name == 'goblin' ? 'goblingirl' : 'goblin'); + test.skeleton.setSkinByName(test.skeleton.skin.name == 'goblin' ? 'goblingirl' : 'goblin'); test.skeleton.setSlotsToSetupPose(); } break;