Merge branch 'master' into 3.6-beta

This commit is contained in:
NathanSweet 2016-11-30 17:44:25 +01:00
commit e8296ebc52
30 changed files with 1688 additions and 1513 deletions

View File

@ -25,7 +25,7 @@ spine-as3 does not yet support loading the binary format.
The Spine AS3 example works on Windows, Linux and Mac OS X. This guide assumes you are using [FDT Free](http://fdt.powerflasher.com/) as your development environment.
1. Download [FDT free](http://fdt.powerflasher.com/buy-download/) for your operating system.
3. Download and install Adobe Flash Player 22 with debugging support](https://www.adobe.com/support/flashplayer/debug_downloads.html#fp15)
3. Download and install [Adobe Flash Player 23 with debugging support](https://www.adobe.com/support/flashplayer/debug_downloads.html#fp15)
2. Download the latest [Flex SDK](http://www.adobe.com/devnet/flex/flex-sdk-download.html). We assume it will be installed to some folder on your disk called `flex_sdk`.
3. Download the latest [Adobe AIR SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)
4. Extract the AIR SDK contents, and copy them to your `flex_sdk` folder. This will replace the Adobe AIR version shipped with Flex.

View File

@ -226,6 +226,9 @@ public class AnimationState {
private function applyRotateTimeline (timeline:Timeline, skeleton:Skeleton, time:Number, alpha:Number, setupPose:Boolean,
timelinesRotation:Vector.<Number>, i:int, firstFrame:Boolean):void {
if (firstFrame) timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -260,11 +263,7 @@ public class AnimationState {
var r1:Number = setupPose ? bone.data.rotation : bone.rotation;
var total:Number, diff:Number = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
} else
total = timelinesRotation[i];
total = timelinesRotation[i];
} else {
diff -= (16384 - int((16384.499999999996 - diff / 360))) * 360;
var lastTotal:Number, lastDiff:Number;

View File

@ -179,4 +179,44 @@ void MemoryTestFixture::reproduceIssue_777()
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
}
spSkeleton* skeleton = nullptr;
static void spineAnimStateHandler(spAnimationState* state, int type, spTrackEntry* entry, spEvent* event)
{
if (type == SP_ANIMATION_COMPLETE)
{
spAnimationState_setAnimationByName(state, 0, "walk", false);
spAnimationState_update(state, 0);
spAnimationState_apply(state, skeleton);
}
}
void MemoryTestFixture::reproduceIssue_Loop()
{
spAtlas* atlas = nullptr;
spSkeletonData* skeletonData = nullptr;
spAnimationStateData* stateData = nullptr;
spAnimationState* state = nullptr;
//////////////////////////////////////////////////////////////////////////
// Initialize Animations
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
///////////////////////////////////////////////////////////////////////////
if (state)
state->listener = (spAnimationStateListener)&spineAnimStateHandler;
spAnimationState_setAnimationByName(state, 0, "walk", false);
// run normal update
for (int i = 0; i < 50; ++i) {
const float timeSlice = 1.0f / 60.0f;
spSkeleton_update(skeleton, timeSlice);
spAnimationState_update(state, timeSlice);
spAnimationState_apply(state, skeleton);
}
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
}

View File

@ -17,6 +17,7 @@ public:
// Comment out here to disable individual test cases
TEST_CASE(reproduceIssue_776);
TEST_CASE(reproduceIssue_777);
TEST_CASE(reproduceIssue_Loop);
initialize();
}
@ -29,6 +30,7 @@ public:
public:
void reproduceIssue_776();
void reproduceIssue_777();
void reproduceIssue_Loop(); // http://esotericsoftware.com/forum/spine-c-3-5-animation-jerking-7451
//////////////////////////////////////////////////////////////////////////
// test fixture setup

View File

@ -433,6 +433,8 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
float total, diff;
int /*boolean*/ current, dir;
if (firstFrame) timelinesRotation[i] = 0;
if (alpha == 1) {
spTimeline_apply(timeline, skeleton, 0, time, 0, 0, 1, setupPose, 0);
return;
@ -468,11 +470,7 @@ void _spAnimationState_applyRotateTimeline (spAnimationState* self, spTimeline*
r1 = setupPose ? bone->data->rotation : bone->rotation;
diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
} else
total = timelinesRotation[i];
total = timelinesRotation[i];
} else {
float lastTotal, lastDiff;
diff -= (16384 - (int)(16384.499999999996 - diff / 360)) * 360;
@ -581,6 +579,8 @@ void _spAnimationState_setCurrent (spAnimationState* self, int index, spTrackEnt
current->mixingFrom = from;
current->mixTime = 0;
from->timelinesRotationCount = 0;
/* If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero. */
if (from->mixingFrom) current->mixAlpha *= MIN(from->mixTime / from->mixDuration, 1);
}

View File

@ -216,6 +216,9 @@ public class SkeletonViewer extends ApplicationAdapter {
if (ui.skinList.getSelected() != null) skeleton.setSkin(ui.skinList.getSelected());
setAnimation();
// ui.animationList.clearListeners();
// state.setAnimation(0, "walk", true);
}
void setAnimation () {

View File

@ -382,6 +382,8 @@ function AnimationState:applyMixingFrom (entry, skeleton)
end
function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame)
if firstFrame then timelinesRotation[i] = 0 end
if alpha == 1 then
timeline:apply(skeleton, 0, time, nil, 1, setupPose, false)
return
@ -418,12 +420,7 @@ function AnimationState:applyRotateTimeline (timeline, skeleton, time, alpha, se
local total = 0
local diff = r2 - r1
if diff == 0 then
if firstFrame then
timelinesRotation[i] = 0
total = 0
else
total = timelinesRotation[i]
end
total = timelinesRotation[i]
else
diff = diff - (16384 - math_floor(16384.499999999996 - diff / 360)) * 360
local lastTotal = 0
@ -541,6 +538,8 @@ function AnimationState:setCurrent (index, current, interrupt)
current.mixingFrom = from
current.mixTime = 0
from.timelinesRotation = {};
-- If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
if from.mixingFrom then current.mixAlpha = current.mixAlpha * math_min(from.mixTime / from.mixDuration, 1) end
end

View File

@ -48,6 +48,7 @@ void callback (AnimationState* state, EventType type, TrackEntry* entry, Event*
break;
case ANIMATION_INTERRUPT:
printf("%d interrupt: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_END:
printf("%d end: %s\n", entry->trackIndex, animationName);
break;
@ -56,6 +57,7 @@ void callback (AnimationState* state, EventType type, TrackEntry* entry, Event*
break;
case ANIMATION_DISPOSE:
printf("%d dispose: %s\n", entry->trackIndex, animationName);
break;
case ANIMATION_EVENT:
printf("%d event: %s, %s: %d, %f, %s\n", entry->trackIndex, animationName, event->data->name, event->intValue, event->floatValue,
event->stringValue);

View File

@ -1447,6 +1447,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1475,12 +1477,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1570,6 +1567,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1447,6 +1447,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1475,12 +1477,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1570,6 +1567,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -1100,6 +1100,8 @@ var spine;
return mix;
};
AnimationState.prototype.applyRotateTimeline = function (timeline, skeleton, time, alpha, setupPose, timelinesRotation, i, firstFrame) {
if (firstFrame)
timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -1128,12 +1130,7 @@ var spine;
var r1 = setupPose ? bone.data.rotation : bone.rotation;
var total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
}
else
total = timelinesRotation[i];
total = timelinesRotation[i];
}
else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
@ -1223,6 +1220,7 @@ var spine;
this.queue.interrupt(from);
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
if (from.mixingFrom != null)
current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

File diff suppressed because one or more lines are too long

View File

@ -211,6 +211,9 @@ module spine {
applyRotateTimeline (timeline: Timeline, skeleton: Skeleton, time: number, alpha: number, setupPose: boolean,
timelinesRotation: Array<number>, i: number, firstFrame: boolean) {
if (firstFrame) timelinesRotation[i] = 0;
if (alpha == 1) {
timeline.apply(skeleton, 0, time, null, 1, setupPose, false);
return;
@ -245,11 +248,7 @@ module spine {
let r1 = setupPose ? bone.data.rotation : bone.rotation;
let total = 0, diff = r2 - r1;
if (diff == 0) {
if (firstFrame) {
timelinesRotation[i] = 0;
total = 0;
} else
total = timelinesRotation[i];
total = timelinesRotation[i];
} else {
diff -= (16384 - ((16384.499999999996 - diff / 360) | 0)) * 360;
let lastTotal = 0, lastDiff = 0;
@ -347,6 +346,8 @@ module spine {
current.mixingFrom = from;
current.mixTime = 0;
from.timelinesRotation.length = 0;
// If not completely mixed in, set mixAlpha so mixing out happens from current mix to zero.
if (from.mixingFrom != null) current.mixAlpha *= Math.min(from.mixTime / from.mixDuration, 1);
}

View File

@ -233,7 +233,7 @@ MonoBehaviour:
skeletonDataAsset: {fileID: 11400000, guid: 44691b56ed7d1f04da0cbc2a52a91b8d, type: 2}
initialSkinName: default
separatorSlotNames:
- front_foot
- --B
zSpacing: 0
renderMeshes: 1
immutableTriangles: 0
@ -402,7 +402,7 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 565117361}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -1.3629907, y: 3.7230203, z: 0}
m_LocalPosition: {x: -1.3626752, y: 3.7231483, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_Children: []
@ -2989,7 +2989,7 @@ MonoBehaviour:
skeletonDataAsset: {fileID: 11400000, guid: 44691b56ed7d1f04da0cbc2a52a91b8d, type: 2}
initialSkinName: default
separatorSlotNames:
- front_upper_arm
- --A
zSpacing: 0
renderMeshes: 1
immutableTriangles: 0

File diff suppressed because it is too large Load Diff

View File

@ -8,21 +8,123 @@ Material:
m_PrefabInternal: {fileID: 0}
m_Name: spineboy_Material
m_Shader: {fileID: 4800000, guid: 1e8a610c9e01c3648bac42585e5fc676, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_ShaderKeywords: _EMISSION
m_LightmapFlags: 1
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
- first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 49bb65eefe08e424bbf7a38bc98ec638, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _BumpScale
second: 1
- first:
name: _Cutoff
second: 0.1
m_Colors: []
- first:
name: _DetailNormalMapScale
second: 1
- first:
name: _DstBlend
second: 0
- first:
name: _GlossMapScale
second: 1
- first:
name: _Glossiness
second: 0.5
- first:
name: _GlossyReflections
second: 1
- first:
name: _Metallic
second: 0
- first:
name: _Mode
second: 0
- first:
name: _OcclusionStrength
second: 1
- first:
name: _Parallax
second: 0.02
- first:
name: _SmoothnessTextureChannel
second: 0
- first:
name: _SpecularHighlights
second: 1
- first:
name: _SrcBlend
second: 1
- first:
name: _UVSec
second: 0
- first:
name: _ZWrite
second: 1
m_Colors:
- first:
name: _Black
second: {r: 0, g: 0, b: 0, a: 0}
- first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
- first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 1}

View File

@ -12,7 +12,7 @@ Material:
m_LightmapFlags: 5
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
RenderType: Sprite
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:

View File

@ -55,7 +55,7 @@ namespace Spine.Unity.Modules {
MeshRenderer mainMeshRenderer;
public bool copyPropertyBlock = false;
[Tooltip("Copies MeshRenderer flags into ")]
[Tooltip("Copies MeshRenderer flags into each parts renderer")]
public bool copyMeshRendererFlags = false;
public List<Spine.Unity.Modules.SkeletonPartsRenderer> partsRenderers = new List<SkeletonPartsRenderer>();
@ -125,7 +125,7 @@ namespace Spine.Unity.Modules {
int rendererCount = partsRenderers.Count;
if (rendererCount <= 0) return;
int rendererIndex = 0;
if (copyPropertyBlock)
mainMeshRenderer.GetPropertyBlock(copiedBlock);
@ -134,11 +134,13 @@ namespace Spine.Unity.Modules {
var submeshInstructionsItems = submeshInstructions.Items;
int lastSubmeshInstruction = submeshInstructions.Count - 1;
var currentRenderer = partsRenderers[rendererIndex];
bool addNormals = skeletonRenderer.calculateNormals;
bool addTangents = skeletonRenderer.calculateTangents;
bool pmaVertexColors = skeletonRenderer.pmaVertexColors;
int rendererIndex = 0;
var currentRenderer = partsRenderers[rendererIndex];
for (int si = 0, start = 0; si <= lastSubmeshInstruction; si++) {
if (submeshInstructionsItems[si].forceSeparate || si == lastSubmeshInstruction) {
// Apply properties

View File

@ -267,6 +267,7 @@ namespace Spine.Unity {
bool isCustomSlotMaterialsPopulated = customSlotMaterials.Count > 0;
#endif
bool hasSeparators = separatorSlots.Count > 0;
int vertexCount = 0;
int submeshVertexCount = 0;
int submeshTriangleCount = 0, submeshFirstVertex = 0, submeshStartSlotIndex = 0;
@ -281,8 +282,9 @@ namespace Spine.Unity {
workingFlipsItems[i] = flip;
#endif
object rendererObject; // An AtlasRegion in plain Spine-Unity. Spine-TK2D hooks into TK2D's system. eventual source of Material object.
object rendererObject = null; // An AtlasRegion in plain Spine-Unity. Spine-TK2D hooks into TK2D's system. eventual source of Material object.
int attachmentVertexCount, attachmentTriangleCount;
bool noRender = false;
var regionAttachment = attachment as RegionAttachment;
if (regionAttachment != null) {
@ -290,56 +292,85 @@ namespace Spine.Unity {
attachmentVertexCount = 4;
attachmentTriangleCount = 6;
} else {
if (!renderMeshes)
continue;
var meshAttachment = attachment as MeshAttachment;
if (meshAttachment != null) {
rendererObject = meshAttachment.RendererObject;
attachmentVertexCount = meshAttachment.worldVerticesLength >> 1;
attachmentTriangleCount = meshAttachment.triangles.Length;
if (!renderMeshes) {
noRender = true;
attachmentVertexCount = 0;
attachmentTriangleCount = 0;
//continue;
} else {
continue;
var meshAttachment = attachment as MeshAttachment;
if (meshAttachment != null) {
rendererObject = meshAttachment.RendererObject;
attachmentVertexCount = meshAttachment.worldVerticesLength >> 1;
attachmentTriangleCount = meshAttachment.triangles.Length;
} else {
noRender = true;
attachmentVertexCount = 0;
attachmentTriangleCount = 0;
//continue;
}
}
}
#if !SPINE_TK2D
Material material; //= (Material)((AtlasRegion)rendererObject).page.rendererObject; // For no customSlotMaterials
if (isCustomSlotMaterialsPopulated) {
if (!customSlotMaterials.TryGetValue(slot, out material)) {
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
}
} else {
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
}
#else
Material material = (rendererObject.GetType() == typeof(Material)) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
#endif
// Create a new SubmeshInstruction when material changes. (or when forced to separate by a submeshSeparator)
bool forceSeparate = (separatorSlots.Count > 0 && separatorSlots.Contains(slot));
if (vertexCount > 0 && (lastMaterial.GetInstanceID() != material.GetInstanceID() || forceSeparate)) {
workingSubmeshInstructions.Add(
new Spine.Unity.MeshGeneration.SubmeshInstruction {
skeleton = this.skeleton,
material = lastMaterial,
startSlot = submeshStartSlotIndex,
endSlot = i,
triangleCount = submeshTriangleCount,
firstVertexIndex = submeshFirstVertex,
vertexCount = submeshVertexCount,
forceSeparate = forceSeparate
}
);
submeshTriangleCount = 0;
submeshVertexCount = 0;
submeshFirstVertex = vertexCount;
submeshStartSlotIndex = i;
// Slot with a separator/new material will become the starting slot of the next new instruction.
bool forceSeparate = (hasSeparators && separatorSlots.Contains(slot));
if (noRender) {
if (forceSeparate && vertexCount > 0 && this.generateMeshOverride != null) {
workingSubmeshInstructions.Add(
new Spine.Unity.MeshGeneration.SubmeshInstruction {
skeleton = this.skeleton,
material = lastMaterial,
startSlot = submeshStartSlotIndex,
endSlot = i,
triangleCount = submeshTriangleCount,
firstVertexIndex = submeshFirstVertex,
vertexCount = submeshVertexCount,
forceSeparate = forceSeparate
}
);
submeshTriangleCount = 0;
submeshVertexCount = 0;
submeshFirstVertex = vertexCount;
submeshStartSlotIndex = i;
}
} else {
#if !SPINE_TK2D
Material material;
if (isCustomSlotMaterialsPopulated) {
if (!customSlotMaterials.TryGetValue(slot, out material))
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
} else {
material = (Material)((AtlasRegion)rendererObject).page.rendererObject;
}
#else
Material material = (rendererObject.GetType() == typeof(Material)) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject;
#endif
if (vertexCount > 0 && (forceSeparate || lastMaterial.GetInstanceID() != material.GetInstanceID())) {
workingSubmeshInstructions.Add(
new Spine.Unity.MeshGeneration.SubmeshInstruction {
skeleton = this.skeleton,
material = lastMaterial,
startSlot = submeshStartSlotIndex,
endSlot = i,
triangleCount = submeshTriangleCount,
firstVertexIndex = submeshFirstVertex,
vertexCount = submeshVertexCount,
forceSeparate = forceSeparate
}
);
submeshTriangleCount = 0;
submeshVertexCount = 0;
submeshFirstVertex = vertexCount;
submeshStartSlotIndex = i;
}
// Update state for the next iteration.
lastMaterial = material;
submeshTriangleCount += attachmentTriangleCount;
vertexCount += attachmentVertexCount;
submeshVertexCount += attachmentVertexCount;
}
// Update state for the next iteration.
lastMaterial = material;
submeshTriangleCount += attachmentTriangleCount;
vertexCount += attachmentVertexCount;
submeshVertexCount += attachmentVertexCount;
}
if (submeshVertexCount != 0) {