public void Initialize(bool overwrite) { if ((IsValid && !overwrite) || skeletonDataAsset == null) { return; } SkeletonData skeletonData = skeletonDataAsset.GetSkeletonData(quiet: false); if (skeletonData == null || skeletonDataAsset.atlasAssets.Length <= 0 || skeletonDataAsset.atlasAssets[0].materials.Length <= 0) { return; } state = new AnimationState(skeletonDataAsset.GetAnimationStateData()); if (state == null) { Clear(); return; } skeleton = new Skeleton(skeletonData) { flipX = initialFlipX, flipY = initialFlipY }; meshBuffers = new DoubleBuffered <MeshRendererBuffers.SmartMesh>(); base.canvasRenderer.SetTexture(mainTexture); if (!string.IsNullOrEmpty(initialSkinName)) { skeleton.SetSkin(initialSkinName); } if (!string.IsNullOrEmpty(startingAnimation)) { state.SetAnimation(0, startingAnimation, startingLoop); Update(0f); } }
public void Initialize(bool overwrite) { if ((!this.IsValid || overwrite) && (this.skeletonDataAsset != null)) { Spine.SkeletonData skeletonData = this.skeletonDataAsset.GetSkeletonData(false); if ((skeletonData != null) && ((this.skeletonDataAsset.atlasAssets.Length > 0) && (this.skeletonDataAsset.atlasAssets[0].materials.Length > 0))) { this.state = new Spine.AnimationState(this.skeletonDataAsset.GetAnimationStateData()); if (this.state == null) { this.Clear(); } else { Spine.Skeleton skeleton = new Spine.Skeleton(skeletonData) { flipX = this.initialFlipX, flipY = this.initialFlipY }; this.skeleton = skeleton; this.meshBuffers = new DoubleBuffered <MeshRendererBuffers.SmartMesh>(); base.get_canvasRenderer().SetTexture(this.get_mainTexture()); if (!string.IsNullOrEmpty(this.initialSkinName)) { this.skeleton.SetSkin(this.initialSkinName); } if (!string.IsNullOrEmpty(this.startingAnimation)) { this.state.SetAnimation(0, this.startingAnimation, this.startingLoop); this.Update(0f); } } } } }
public void Initialize () { if (doubleBufferedMesh != null) { doubleBufferedMesh.GetNext().Clear(); doubleBufferedMesh.GetNext().Clear(); submeshMaterials.Clear(); } else { doubleBufferedMesh = new DoubleBuffered<SmartMesh>(); } }
protected void DisposeMeshBuffers() { if (meshBuffers != null) { meshBuffers.GetNext().Dispose(); meshBuffers.GetNext().Dispose(); meshBuffers = null; } }
public void Dispose() { if (this.doubleBufferedMesh != null) { this.doubleBufferedMesh.GetNext().Dispose(); this.doubleBufferedMesh.GetNext().Dispose(); this.doubleBufferedMesh = null; } }
public void Dispose() { if (doubleBufferedMesh != null) { doubleBufferedMesh.GetNext().Dispose(); doubleBufferedMesh.GetNext().Dispose(); doubleBufferedMesh = null; } }
public void Dispose() { if (doubleBufferedMesh == null) { return; } doubleBufferedMesh.GetNext().Dispose(); doubleBufferedMesh.GetNext().Dispose(); doubleBufferedMesh = null; }
protected void InitMeshBuffers() { if (meshBuffers != null) { meshBuffers.GetNext().Clear(); meshBuffers.GetNext().Clear(); } else { meshBuffers = new DoubleBuffered <MeshRendererBuffers.SmartMesh>(); } }
public void Initialize() { if (this.doubleBufferedMesh != null) { this.doubleBufferedMesh.GetNext().Clear(); this.doubleBufferedMesh.GetNext().Clear(); this.submeshMaterials.Clear(true); } else { this.doubleBufferedMesh = new DoubleBuffered <SmartMesh>(); } }
public void Initialize (bool overwrite) { if (this.IsValid && !overwrite) return; // Make sure none of the stuff is null if (this.skeletonDataAsset == null) return; var skeletonData = this.skeletonDataAsset.GetSkeletonData(false); if (skeletonData == null) return; if (skeletonDataAsset.atlasAssets.Length <= 0 || skeletonDataAsset.atlasAssets[0].materials.Length <= 0) return; this.state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData()); if (state == null) { Clear(); return; } this.skeleton = new Skeleton(skeletonData) { flipX = this.initialFlipX, flipY = this.initialFlipY }; meshBuffers = new DoubleBuffered<MeshRendererBuffers.SmartMesh>(); canvasRenderer.SetTexture(this.mainTexture); // Needed for overwriting initializations. // Set the initial Skin and Animation if (!string.IsNullOrEmpty(initialSkinName)) skeleton.SetSkin(initialSkinName); #if UNITY_EDITOR if (!string.IsNullOrEmpty(startingAnimation)) { if (Application.isPlaying) { state.SetAnimation(0, startingAnimation, startingLoop); } else { // Assume SkeletonAnimation is valid for skeletonData and skeleton. Checked above. var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation); if (animationObject != null) animationObject.PoseSkeleton(skeleton, 0); } Update(0); } #else if (!string.IsNullOrEmpty(startingAnimation)) { state.SetAnimation(0, startingAnimation, startingLoop); Update(0); } #endif }
public void Initialize(bool overwrite) { if (this.IsValid && !overwrite) { return; } // Make sure none of the stuff is null if (this.skeletonDataAsset == null) { return; } var skeletonData = this.skeletonDataAsset.GetSkeletonData(false); if (skeletonData == null) { return; } if (skeletonDataAsset.atlasAssets.Length <= 0 || skeletonDataAsset.atlasAssets[0].MaterialCount <= 0) { return; } this.state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData()); if (state == null) { Clear(); return; } this.skeleton = new Skeleton(skeletonData) { ScaleX = this.initialFlipX ? -1 : 1, ScaleY = this.initialFlipY ? -1 : 1 }; meshBuffers = new DoubleBuffered <MeshRendererBuffers.SmartMesh>(); baseTexture = skeletonDataAsset.atlasAssets[0].PrimaryMaterial.mainTexture; canvasRenderer.SetTexture(this.mainTexture); // Needed for overwriting initializations. // Set the initial Skin and Animation if (!string.IsNullOrEmpty(initialSkinName)) { skeleton.SetSkin(initialSkinName); } separatorSlots.Clear(); for (int i = 0; i < separatorSlotNames.Length; i++) { separatorSlots.Add(skeleton.FindSlot(separatorSlotNames[i])); } wasUpdatedAfterInit = false; if (!string.IsNullOrEmpty(startingAnimation)) { var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation); if (animationObject != null) { state.SetAnimation(0, animationObject, startingLoop); #if UNITY_EDITOR if (!Application.isPlaying) { Update(0f); } #endif } } if (OnRebuild != null) { OnRebuild(this); } }
public void Initialize(bool overwrite) { if (this.IsValid && !overwrite) { return; } // Make sure none of the stuff is null if (this.skeletonDataAsset == null) { return; } var skeletonData = this.skeletonDataAsset.GetSkeletonData(false); if (skeletonData == null) { return; } if (skeletonDataAsset.atlasAssets.Length <= 0 || skeletonDataAsset.atlasAssets[0].MaterialCount <= 0) { return; } this.state = new Spine.AnimationState(skeletonDataAsset.GetAnimationStateData()); if (state == null) { Clear(); return; } this.skeleton = new Skeleton(skeletonData) { scaleX = this.initialFlipX ? -1 : 1, scaleY = this.initialFlipY ? -1 : 1 }; meshBuffers = new DoubleBuffered <MeshRendererBuffers.SmartMesh>(); canvasRenderer.SetTexture(this.mainTexture); // Needed for overwriting initializations. // Set the initial Skin and Animation if (!string.IsNullOrEmpty(initialSkinName)) { skeleton.SetSkin(initialSkinName); } if (!string.IsNullOrEmpty(startingAnimation)) { var animationObject = skeletonDataAsset.GetSkeletonData(false).FindAnimation(startingAnimation); if (animationObject != null) { animationObject.PoseSkeleton(skeleton, 0f); skeleton.UpdateWorldTransform(); #if UNITY_EDITOR if (Application.isPlaying) { #endif // Make this block not run in Unity Editor edit mode. state.SetAnimation(0, animationObject, startingLoop); #if UNITY_EDITOR } #endif } } }
public void SetMeshBuffers(DoubleBuffered <MeshRendererBuffers.SmartMesh> meshB) { meshBuffers = meshB; }
public void Initialize() { doubleBufferedMesh = new DoubleBuffered <SmartMesh>(); }