public static InstantiateSkeletonAnimation ( SkeletonDataAsset skeletonDataAsset, Spine.Skin skin = null, bool destroyInvalid = true ) : SkeletonAnimation | ||
skeletonDataAsset | SkeletonDataAsset | |
skin | Spine.Skin | |
destroyInvalid | bool | |
Результат | SkeletonAnimation |
void CreatePreviewInstances() { this.DestroyPreviewInstances(); var skeletonDataAsset = (SkeletonDataAsset)target; if (skeletonDataAsset.GetSkeletonData(false) == null) { return; } if (this.m_previewInstance == null) { string skinName = EditorPrefs.GetString(m_skeletonDataAssetGUID + "_lastSkin", ""); m_previewInstance = SpineEditorUtilities.InstantiateSkeletonAnimation(skeletonDataAsset, skinName).gameObject; if (m_previewInstance != null) { m_previewInstance.hideFlags = HideFlags.HideAndDontSave; m_previewInstance.layer = 0x1f; m_skeletonAnimation = m_previewInstance.GetComponent <SkeletonAnimation>(); m_skeletonAnimation.initialSkinName = skinName; m_skeletonAnimation.LateUpdate(); m_skeletonData = m_skeletonAnimation.skeletonDataAsset.GetSkeletonData(true); m_previewInstance.GetComponent <Renderer>().enabled = false; m_initialized = true; } AdjustCameraGoals(true); } }
private void CreatePreviewInstances() { this.DestroyPreviewInstances(); if (this.m_previewInstance == null) { try { string skinName = EditorPrefs.GetString(m_skeletonDataAssetGUID + "_lastSkin", ""); m_previewInstance = SpineEditorUtilities.InstantiateSkeletonAnimation((SkeletonDataAsset)target, skinName).gameObject; m_previewInstance.hideFlags = HideFlags.HideAndDontSave; m_previewInstance.layer = 0x1f; m_skeletonAnimation = m_previewInstance.GetComponent <SkeletonAnimation>(); m_skeletonAnimation.initialSkinName = skinName; m_skeletonAnimation.LateUpdate(); m_skeletonData = m_skeletonAnimation.skeletonDataAsset.GetSkeletonData(true); m_previewInstance.GetComponent <Renderer>().enabled = false; m_initialized = true; AdjustCameraGoals(true); } catch { // WARNING: Suppresses errors. } } }
public void Initialize(SkeletonDataAsset skeletonDataAsset, string skinName = "") { if (skeletonDataAsset == null) { return; } if (skeletonDataAsset.GetSkeletonData(false) == null) { return; } this.skeletonDataAsset = skeletonDataAsset; this.skeletonData = skeletonDataAsset.GetSkeletonData(false); if (previewRenderUtility == null) { previewRenderUtility = new PreviewRenderUtility(true); animationLastTime = Time.realtimeSinceStartup; const int PreviewLayer = 31; const int PreviewCameraCullingMask = 1 << PreviewLayer; { var c = this.PreviewUtilityCamera; c.orthographic = true; c.orthographicSize = 1; c.cullingMask = PreviewCameraCullingMask; c.nearClipPlane = 0.01f; c.farClipPlane = 1000f; } DestroyPreviewGameObject(); if (previewGameObject == null) { try { previewGameObject = SpineEditorUtilities.InstantiateSkeletonAnimation(skeletonDataAsset, skinName).gameObject; if (previewGameObject != null) { previewGameObject.hideFlags = HideFlags.HideAndDontSave; previewGameObject.layer = PreviewLayer; skeletonAnimation = previewGameObject.GetComponent <SkeletonAnimation>(); skeletonAnimation.initialSkinName = skinName; skeletonAnimation.LateUpdate(); previewGameObject.GetComponent <Renderer>().enabled = false; previewRenderUtility.AddSingleGO(previewGameObject); } AdjustCameraGoals(true); } catch { DestroyPreviewGameObject(); } } } }
void CreatePreviewInstances() { return; this.DestroyPreviewInstances(); if (warnings.Count > 0) { m_skeletonDataAsset.Clear(); return; } var skeletonDataAsset = (SkeletonDataAsset)target; if (skeletonDataAsset.GetSkeletonData(false) == null) { return; } if (this.m_previewInstance == null) { string skinName = EditorPrefs.GetString(m_skeletonDataAssetGUID + "_lastSkin", ""); try { m_previewInstance = SpineEditorUtilities.InstantiateSkeletonAnimation(skeletonDataAsset, skinName).gameObject; // var t = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; // t.SetParent(this.m_previewInstance.transform); // t.localPosition = Vector3.zero; if (m_previewInstance != null) { m_previewInstance.hideFlags = HideFlags.HideAndDontSave; m_previewInstance.layer = 0x1f; m_skeletonAnimation = m_previewInstance.GetComponent <SkeletonAnimation>(); m_skeletonAnimation.initialSkinName = skinName; m_skeletonAnimation.LateUpdate(); m_skeletonData = m_skeletonAnimation.skeletonDataAsset.GetSkeletonData(true); m_previewInstance.GetComponent <Renderer>().enabled = false; m_initialized = true; } AdjustCameraGoals(true); } catch { DestroyPreviewInstances(); } } }