当前位置: 首页>>代码示例>>C#>>正文


C# SkeletonDataAsset类代码示例

本文整理汇总了C#中SkeletonDataAsset的典型用法代码示例。如果您正苦于以下问题:C# SkeletonDataAsset类的具体用法?C# SkeletonDataAsset怎么用?C# SkeletonDataAsset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SkeletonDataAsset类属于命名空间,在下文中一共展示了SkeletonDataAsset类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnEnable

		void OnEnable () {
			SpineEditorUtilities.ConfirmInitialization();

			atlasAssets = serializedObject.FindProperty("atlasAssets");
			skeletonJSON = serializedObject.FindProperty("skeletonJSON");
			scale = serializedObject.FindProperty("scale");
			fromAnimation = serializedObject.FindProperty("fromAnimation");
			toAnimation = serializedObject.FindProperty("toAnimation");
			duration = serializedObject.FindProperty("duration");
			defaultMix = serializedObject.FindProperty("defaultMix");

			#if SPINE_SKELETON_ANIMATOR
			controller = serializedObject.FindProperty("controller");
			#endif

			#if SPINE_TK2D
			atlasAssets.isExpanded = false;
			spriteCollection = serializedObject.FindProperty("spriteCollection");
			#else
			atlasAssets.isExpanded = true;
			#endif

			#if SPINE_BAKING
			isBakingExpanded = EditorPrefs.GetBool(ShowBakingPrefsKey, false);
			#endif

			m_skeletonDataAsset = (SkeletonDataAsset)target;
			m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
			EditorApplication.update += EditorUpdate;
			m_skeletonData = m_skeletonDataAsset.GetSkeletonData(false);
			RepopulateWarnings();
		}
开发者ID:smartether,项目名称:spine-runtimes,代码行数:32,代码来源:SkeletonDataAssetInspector.cs

示例2: OnEnable

		void OnEnable () {

			SpineEditorUtilities.ConfirmInitialization();

			try {
				atlasAssets = serializedObject.FindProperty("atlasAssets");
				atlasAssets.isExpanded = true;
				skeletonJSON = serializedObject.FindProperty("skeletonJSON");
				scale = serializedObject.FindProperty("scale");
				fromAnimation = serializedObject.FindProperty("fromAnimation");
				toAnimation = serializedObject.FindProperty("toAnimation");
				duration = serializedObject.FindProperty("duration");
				defaultMix = serializedObject.FindProperty("defaultMix");
				#if SPINE_SKELETON_ANIMATOR
				controller = serializedObject.FindProperty("controller");
				#endif
				#if SPINE_TK2D
				spriteCollection = serializedObject.FindProperty("spriteCollection");
				#endif

				m_skeletonDataAsset = (SkeletonDataAsset)target;
				m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));

				EditorApplication.update += Update;
			} catch {
				// TODO: WARNING: empty catch block supresses errors.

			}

			m_skeletonData = m_skeletonDataAsset.GetSkeletonData(true);

			showBaking = EditorPrefs.GetBool("SkeletonDataAssetInspector_showUnity", false);

			RepopulateWarnings();
		}
开发者ID:SirFelolis,项目名称:Snot-Ninja,代码行数:35,代码来源:SkeletonDataAssetInspector.cs

示例3: OnEnable

	void OnEnable () {

		SpineEditorUtilities.ConfirmInitialization();

		try {
			atlasAssets = serializedObject.FindProperty("atlasAssets");
			skeletonJSON = serializedObject.FindProperty("skeletonJSON");
			scale = serializedObject.FindProperty("scale");
			fromAnimation = serializedObject.FindProperty("fromAnimation");
			toAnimation = serializedObject.FindProperty("toAnimation");
			duration = serializedObject.FindProperty("duration");
			defaultMix = serializedObject.FindProperty("defaultMix");
			controller = serializedObject.FindProperty("controller");
#if SPINE_TK2D
			spriteCollection = serializedObject.FindProperty("spriteCollection");
#endif

			m_skeletonDataAsset = (SkeletonDataAsset)target;
			m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));

			EditorApplication.update += Update;
		} catch {


		}

		m_skeletonData = m_skeletonDataAsset.GetSkeletonData(true);

		showUnity = EditorPrefs.GetBool("SkeletonDataAssetInspector_showUnity", true);

		RepopulateWarnings();
	}
开发者ID:wenhaoisbad,项目名称:kxsm,代码行数:32,代码来源:SkeletonDataAssetInspector.cs

示例4: GetBuildSpineData

    // 包含json!,不包含圖集
    static CDepCollectInfo GetBuildSpineData(SkeletonDataAsset data)
    {
        string path = AssetDatabase.GetAssetPath(data);

        // DataAsset
        bool needBuildDataAsset = KBuildTools.CheckNeedBuild(path);
        if (needBuildDataAsset)
            KBuildTools.MarkBuildVersion(path);

        // Spine的JSON
        string textAssetPath = AssetDatabase.GetAssetPath(data.skeletonJSON);
        bool needBuildJsonTextAsset = KBuildTools.CheckNeedBuild(textAssetPath);
        if (needBuildJsonTextAsset)
            KBuildTools.MarkBuildVersion(textAssetPath);

        //string originPath = path;
        //string tmpPath = "Assets/~TempSkeletonDataAsset.asset";
        //bool copyResult = AssetDatabase.CopyAsset(path, tmpPath);
        //Logger.Assert(copyResult);
        //SkeletonDataAsset copyData = AssetDatabase.LoadAssetAtPath(tmpPath, typeof(SkeletonDataAsset)) as SkeletonDataAsset;
        if (data.spriteCollection == null || data.skeletonJSON == null)
        {
            Logger.LogError("Err Spine Data: {0}, Lack of SpriteCollection or Json", data.name);
            //return "";
        }

        string spriteColPath = BuildSpriteCollection(data.spriteCollection);
        string spriteColAssetPath = AssetDatabase.GetAssetPath(data.spriteCollection.gameObject);
        bool needBuildSpriteCol = KBuildTools.CheckNeedBuild(spriteColAssetPath);
        if (needBuildSpriteCol)
            KBuildTools.MarkBuildVersion(spriteColAssetPath);

        SkeletonDataAsset copyData = GameObject.Instantiate(data) as SkeletonDataAsset;
        copyData.spriteCollection = null; // 挖空图集, 保留Json!


        // SpineData包括了这个SkeletonData!
        var skeletonDataBuildResult = __DoBuildScriptableObject(DepBuildToFolder + "/SkeletonData_" + data.name, copyData, needBuildDataAsset || needBuildJsonTextAsset);  // json文件直接放在SkeletonDataAsset打包! 分离图集

        CSpineData spineData = ScriptableObject.CreateInstance<CSpineData>();
        spineData.SpriteCollectionPath = spriteColPath;
        spineData.DataAssetPath = skeletonDataBuildResult.Path; // 保留json文件,不挖空 copyData.skeletonJSON

        path = __GetPrefabBuildPath(path);
        // DataAsset或圖集或Json任一重打包了,都要重新打包CSpineData(記錄圖集保存地方和Jsondataasset保存地方)
        var spineDataBuildResult = __DoBuildScriptableObject(DepBuildToFolder + "/SpineData_" + path, spineData, needBuildDataAsset || needBuildSpriteCol || needBuildJsonTextAsset);
        spineDataBuildResult.Child = skeletonDataBuildResult;

        GameObject.DestroyImmediate(copyData);

        return spineDataBuildResult;
    }
开发者ID:s3chugo,项目名称:KEngine,代码行数:53,代码来源:CDepBuild_Spine.cs

示例5: OnEnable

	void OnEnable () {
		atlasAsset = serializedObject.FindProperty("atlasAsset");
		skeletonJSON = serializedObject.FindProperty("skeletonJSON");
		scale = serializedObject.FindProperty("scale");
		fromAnimation = serializedObject.FindProperty("fromAnimation");
		toAnimation = serializedObject.FindProperty("toAnimation");
		duration = serializedObject.FindProperty("duration");
		defaultMix = serializedObject.FindProperty("defaultMix");
		
		m_skeletonDataAsset = (SkeletonDataAsset)target;
		m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath(m_skeletonDataAsset) );
		
		EditorApplication.update += Update;
	}
开发者ID:Henry-T,项目名称:UnityPG,代码行数:14,代码来源:SkeletonDataAssetInspector.cs

示例6: OnEnable

		void OnEnable () {
			SpineEditorUtilities.ConfirmInitialization();
			m_skeletonDataAsset = (SkeletonDataAsset)target;

			// Clear empty atlas array items.
			{
				bool hasNulls = false;
				foreach (var a in m_skeletonDataAsset.atlasAssets) {
					if (a == null) {
						hasNulls = true;
						break;
					}
				}
				if (hasNulls) {
					var trimmedAtlasAssets = new List<AtlasAsset>();
					foreach (var a in m_skeletonDataAsset.atlasAssets) {
						if (a != null) trimmedAtlasAssets.Add(a);
					}
					m_skeletonDataAsset.atlasAssets = trimmedAtlasAssets.ToArray();
				}
			}

			atlasAssets = serializedObject.FindProperty("atlasAssets");
			skeletonJSON = serializedObject.FindProperty("skeletonJSON");
			scale = serializedObject.FindProperty("scale");
			fromAnimation = serializedObject.FindProperty("fromAnimation");
			toAnimation = serializedObject.FindProperty("toAnimation");
			duration = serializedObject.FindProperty("duration");
			defaultMix = serializedObject.FindProperty("defaultMix");

			#if SPINE_SKELETON_ANIMATOR
			controller = serializedObject.FindProperty("controller");
			#endif

			#if SPINE_TK2D
			atlasAssets.isExpanded = false;
			spriteCollection = serializedObject.FindProperty("spriteCollection");
			#else
			atlasAssets.isExpanded = true;
			#endif

			#if SPINE_BAKING
			isBakingExpanded = EditorPrefs.GetBool(ShowBakingPrefsKey, false);
			#endif

			m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));
			EditorApplication.update += EditorUpdate;
			m_skeletonData = m_skeletonDataAsset.GetSkeletonData(false);
			RepopulateWarnings();
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:50,代码来源:SkeletonDataAssetInspector.cs

示例7: OnGUI

	public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) {
		if (property.propertyType != SerializedPropertyType.String) {
			EditorGUI.LabelField(position, "ERROR:", "May only apply to type string");
			return;
		}

		SpineSlot attrib = (SpineSlot)attribute;

		var dataProperty = property.serializedObject.FindProperty(attrib.dataField);

		if (dataProperty != null) {
			if (dataProperty.objectReferenceValue is SkeletonDataAsset) {
				skeletonDataAsset = (SkeletonDataAsset)dataProperty.objectReferenceValue;
			} else if (dataProperty.objectReferenceValue is SkeletonRenderer) {
				var renderer = (SkeletonRenderer)dataProperty.objectReferenceValue;
				if (renderer != null)
					skeletonDataAsset = renderer.skeletonDataAsset;
			} else {
				EditorGUI.LabelField(position, "ERROR:", "Invalid reference type");
				return;
			}

		} else if (property.serializedObject.targetObject is Component) {
			var component = (Component)property.serializedObject.targetObject;
			if (component.GetComponentInChildren<SkeletonRenderer>() != null) {
				var skeletonRenderer = component.GetComponentInChildren<SkeletonRenderer>();
				skeletonDataAsset = skeletonRenderer.skeletonDataAsset;
			}
		}

		if (skeletonDataAsset == null) {
			EditorGUI.LabelField(position, "ERROR:", "Must have reference to a SkeletonDataAsset");
			return;
		}

		position = EditorGUI.PrefixLabel(position, label);

		if (GUI.Button(position, property.stringValue, EditorStyles.popup)) {
			Selector(property);
		}

	}
开发者ID:nolimet,项目名称:Liaka,代码行数:42,代码来源:SpineAttributeDrawers.cs

示例8: ShowInstantiateContextMenu

		public static void ShowInstantiateContextMenu (SkeletonDataAsset skeletonDataAsset, Vector3 spawnPoint) {
			var menu = new GenericMenu();

			// SkeletonAnimation
			menu.AddItem(new GUIContent("SkeletonAnimation"), false, HandleSkeletonComponentDrop, new SpawnMenuData {
				skeletonDataAsset = skeletonDataAsset,
				spawnPoint = spawnPoint,
				instantiateDelegate = (data) => InstantiateSkeletonAnimation(data),
				isUI = false
			});

			// SkeletonGraphic
			var skeletonGraphicInspectorType = System.Type.GetType("Spine.Unity.Editor.SkeletonGraphicInspector");
			if (skeletonGraphicInspectorType != null) {
				var graphicInstantiateDelegate = skeletonGraphicInspectorType.GetMethod("SpawnSkeletonGraphicFromDrop", BindingFlags.Static | BindingFlags.Public);
				if (graphicInstantiateDelegate != null)
					menu.AddItem(new GUIContent("SkeletonGraphic (UI)"), false, HandleSkeletonComponentDrop, new SpawnMenuData {
						skeletonDataAsset = skeletonDataAsset,
						spawnPoint = spawnPoint,
						instantiateDelegate = System.Delegate.CreateDelegate(typeof(InstantiateDelegate), graphicInstantiateDelegate) as InstantiateDelegate,
						isUI = true
					});
			}

			#if SPINE_SKELETONANIMATOR
			menu.AddSeparator("");
			// SkeletonAnimator
			menu.AddItem(new GUIContent("SkeletonAnimator"), false, HandleSkeletonComponentDrop, new SpawnMenuData {
				skeletonDataAsset = skeletonDataAsset,
				spawnPoint = spawnPoint,
				instantiateDelegate = (data) => InstantiateSkeletonAnimator(data)
			});
			#endif

			menu.ShowAsContext();
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:36,代码来源:SpineEditorUtilities.cs

示例9: GetBoneData

	public static Spine.BoneData GetBoneData(string boneName, SkeletonDataAsset skeletonDataAsset) {
		var data = skeletonDataAsset.GetSkeletonData(true);

		return data.FindBone(boneName);
	}
开发者ID:nolimet,项目名称:Liaka,代码行数:5,代码来源:SpineAttributes.cs

示例10: InstantiateSkeletonAnimator

	public static SkeletonAnimator InstantiateSkeletonAnimator (SkeletonDataAsset skeletonDataAsset, string skinName) {
		return InstantiateSkeletonAnimator(skeletonDataAsset, skeletonDataAsset.GetSkeletonData(true).FindSkin(skinName));
	}
开发者ID:nolimet,项目名称:Liaka,代码行数:3,代码来源:SpineEditorUtilities.cs

示例11: BakeToPrefab

	public static void BakeToPrefab (SkeletonDataAsset skeletonDataAsset, List<Skin> skins, string outputPath = "", bool bakeAnimations = true, bool bakeIK = true, SendMessageOptions eventOptions = SendMessageOptions.DontRequireReceiver) {
		if (skeletonDataAsset == null || skeletonDataAsset.GetSkeletonData(true) == null) {
			Debug.LogError("Could not export Spine Skeleton because SkeletonDataAsset is null or invalid!");
			return;
		}

		if (outputPath == "") {
			outputPath = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(skeletonDataAsset)) + "/Baked";
			System.IO.Directory.CreateDirectory(outputPath);
		}

		var skeletonData = skeletonDataAsset.GetSkeletonData(true);
		bool hasAnimations = bakeAnimations && skeletonData.Animations.Count > 0;
#if UNITY_5
		UnityEditor.Animations.AnimatorController controller = null;
#else
		UnityEditorInternal.AnimatorController controller = null;
#endif
		if (hasAnimations) {
			string controllerPath = outputPath + "/" + skeletonDataAsset.skeletonJSON.name + " Controller.controller";
			bool newAnimContainer = false;

			var runtimeController = AssetDatabase.LoadAssetAtPath(controllerPath, typeof(RuntimeAnimatorController));

#if UNITY_5
			if (runtimeController != null) {
				controller = (UnityEditor.Animations.AnimatorController)runtimeController;
			} else {
				controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath(controllerPath);
				newAnimContainer = true;
			}
#else
			if (runtimeController != null) {
				controller = (UnityEditorInternal.AnimatorController)runtimeController;
			} else {
				controller = UnityEditorInternal.AnimatorController.CreateAnimatorControllerAtPath(controllerPath);
				newAnimContainer = true;
			}
#endif

			Dictionary<string, AnimationClip> existingClipTable = new Dictionary<string, AnimationClip>();
			List<string> unusedClipNames = new List<string>();
			Object[] animObjs = AssetDatabase.LoadAllAssetsAtPath(controllerPath);

			foreach (Object o in animObjs) {
				if (o is AnimationClip) {
					var clip = (AnimationClip)o;
					existingClipTable.Add(clip.name, clip);
					unusedClipNames.Add(clip.name);
				}
			}

			Dictionary<int, List<string>> slotLookup = new Dictionary<int, List<string>>();

			int skinCount = skins.Count;

			for (int s = 0; s < skeletonData.Slots.Count; s++) {
				List<string> attachmentNames = new List<string>();
				for (int i = 0; i < skinCount; i++) {
					var skin = skins[i];
					List<string> temp = new List<string>();
					skin.FindNamesForSlot(s, temp);
					foreach (string str in temp) {
						if (!attachmentNames.Contains(str))
							attachmentNames.Add(str);
					}
				}
				slotLookup.Add(s, attachmentNames);
			}

			foreach (var anim in skeletonData.Animations) {

				AnimationClip clip = null;
				if (existingClipTable.ContainsKey(anim.Name)) {
					clip = existingClipTable[anim.Name];
				}

				clip = ExtractAnimation(anim.Name, skeletonData, slotLookup, bakeIK, eventOptions, clip);

				if (unusedClipNames.Contains(clip.name)) {
					unusedClipNames.Remove(clip.name);
				} else {
					AssetDatabase.AddObjectToAsset(clip, controller);
#if UNITY_5
					controller.AddMotion(clip);
#else
					UnityEditorInternal.AnimatorController.AddAnimationClipToController(controller, clip);
#endif

				}
			}

			if (newAnimContainer) {
				EditorUtility.SetDirty(controller);
				AssetDatabase.SaveAssets();
				AssetDatabase.ImportAsset(controllerPath, ImportAssetOptions.ForceUpdate);
				AssetDatabase.Refresh();
			} else {

				foreach (string str in unusedClipNames) {
//.........这里部分代码省略.........
开发者ID:wenhaoisbad,项目名称:kxsm,代码行数:101,代码来源:SkeletonBaker.cs

示例12: InstantiateSkeletonGraphic

		public static SkeletonGraphic InstantiateSkeletonGraphic (SkeletonDataAsset skeletonDataAsset, string skinName) {
			return InstantiateSkeletonGraphic(skeletonDataAsset, skeletonDataAsset.GetSkeletonData(true).FindSkin(skinName));
		}
开发者ID:EsotericSoftware,项目名称:spine-runtimes,代码行数:3,代码来源:SkeletonGraphicInspector.cs

示例13: SpawnAnimatedSkeleton

	public static SkeletonAnimation SpawnAnimatedSkeleton (SkeletonDataAsset skeletonDataAsset, string skinName) {
		SkeletonData skelData = skeletonDataAsset.GetSkeletonData(false);
		if(skelData == null){
			return null;
		}
		return SpawnAnimatedSkeleton(skeletonDataAsset, skelData.FindSkin(skinName));
	}
开发者ID:nagyistoce,项目名称:spine-runtimes,代码行数:7,代码来源:SpineEditorUtilities.cs

示例14: InstantiateSkeletonAnimation

	public static SkeletonAnimation InstantiateSkeletonAnimation (SkeletonDataAsset skeletonDataAsset, Skin skin = null) {
		string spineGameObjectName = string.Format("Spine GameObject ({0})", skeletonDataAsset.name.Replace("_SkeletonData", ""));
		GameObject go = new GameObject(spineGameObjectName, typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation));
		SkeletonAnimation anim = go.GetComponent<SkeletonAnimation>();
		anim.skeletonDataAsset = skeletonDataAsset;

		bool requiresNormals = false;

		foreach (AtlasAsset atlasAsset in anim.skeletonDataAsset.atlasAssets) {
			foreach (Material m in atlasAsset.materials) {
				if (m.shader.name.Contains("Lit")) {
					requiresNormals = true;
					break;
				}
			}
		}



		anim.calculateNormals = requiresNormals;

		SkeletonData data = skeletonDataAsset.GetSkeletonData(true);

		if (data == null) {
			for (int i = 0; i < skeletonDataAsset.atlasAssets.Length; i++) {
				string reloadAtlasPath = AssetDatabase.GetAssetPath(skeletonDataAsset.atlasAssets[i]);
				skeletonDataAsset.atlasAssets[i] = (AtlasAsset)AssetDatabase.LoadAssetAtPath(reloadAtlasPath, typeof(AtlasAsset));
			}

			data = skeletonDataAsset.GetSkeletonData(true);
		}

		if (skin == null)
			skin = data.DefaultSkin;

		if (skin == null)
			skin = data.Skins.Items[0];

		anim.Initialize(false);

		anim.skeleton.SetSkin(skin);
		anim.initialSkinName = skin.Name;

		anim.skeleton.Update(1);
		anim.state.Update(1);
		anim.state.Apply(anim.skeleton);
		anim.skeleton.UpdateWorldTransform();

		return anim;
	}
开发者ID:czlc,项目名称:spine-runtimes,代码行数:50,代码来源:SpineEditorUtilities.cs

示例15: OnEnable

    void OnEnable()
    {
        SpineEditorUtilities.ConfirmInitialization();

        try {
            atlasAssets = serializedObject.FindProperty("atlasAssets");
            skeletonJSON = serializedObject.FindProperty("skeletonJSON");
            scale = serializedObject.FindProperty("scale");
            fromAnimation = serializedObject.FindProperty("fromAnimation");
            toAnimation = serializedObject.FindProperty("toAnimation");
            duration = serializedObject.FindProperty("duration");
            defaultMix = serializedObject.FindProperty("defaultMix");

            m_skeletonDataAsset = (SkeletonDataAsset)target;
            m_skeletonDataAssetGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_skeletonDataAsset));

            EditorApplication.update += Update;
        } catch {

        }

        m_skeletonData = m_skeletonDataAsset.GetSkeletonData(true);

        RepopulateWarnings();
    }
开发者ID:Fensal,项目名称:FairJudgementBac,代码行数:25,代码来源:SkeletonDataAssetInspector.cs


注:本文中的SkeletonDataAsset类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。