五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

【Unity技巧2】簡(jiǎn)單的動(dòng)畫預(yù)覽工具

2022-08-06 16:13 作者:機(jī)智的小草yns  | 我要投稿

前言:當(dāng)有比較多動(dòng)畫片段需要預(yù)覽時(shí),需要找到原本的動(dòng)畫文件預(yù)覽比較麻煩。為了方便預(yù)覽較多的動(dòng)畫,就做了這個(gè)工具。

使用展示


打開位置:頂部菜單欄的Tools/EditorAnimDisplayWindow

使用:把角色模型拽上去,就會(huì)自動(dòng)顯示動(dòng)畫機(jī)內(nèi)的所有動(dòng)畫。

其次是下面的輸入框可以做搜索篩選

源碼:

using UnityEditor;
using UnityEngine;

namespace Assets.Editor
{
??? public class EditorAnimDisplay : EditorWindow
??? {
??????? #region init
??????? private static EditorAnimDisplay instance;
??????? [MenuItem("Tools/EditorAnimDisplayWindow")]
??????? static void PrefabWrapTool()
??????? {
??????????? //獲取當(dāng)前窗口實(shí)例
??????????? instance = EditorWindow.GetWindow<EditorAnimDisplay>();
??????????? instance.Show();
??????????? //ShowUtility() 實(shí)體窗口樣式
??????? }
??????? #endregion

??????? public AnimationClip[] clips;
??????? public GameObject player;
??????? public string Fitter = "";

??????? private AnimationClip curAnimClip;
??????? private float Timer = 0;
??????? private int playCount = 0;
??????? private Vector2 pos = Vector2.zero;


??????? void OnGUI()
??????? {
??????????? player = EditorGUILayout.ObjectField("player", player, typeof(GameObject), true) as GameObject;
??????????? Fitter= EditorGUILayout.TextField("NameFitter",Fitter );
??????????? if (player)
??????????? {
??????????????? clips = player.GetComponent<Animator>().runtimeAnimatorController.animationClips;
??????????????? pos = GUILayout.BeginScrollView(pos, false, false);
??????????????? foreach (var item in clips)
??????????????? {

??????????????????? if (IsShow(item.name)&&GUILayout.Button(item.name))
??????????????????? {
??????????????????????? PlayAnim(item);
??????????????????? }
??????????????? }
??????????????? GUILayout.EndScrollView();
??????????? }
??????? }

??????? private bool IsShow(string clipName)
??????? {
??????????? if (Fitter=="")
??????????????? return true;
??????????? else
??????????? {
??????????????? return clipName.ToLower().Contains(Fitter.ToLower());
??????????? }??????? ?
??????? }

??????? private void PlayAnim(AnimationClip clip)
??????? {
??????????? Timer = 0;
??????????? playCount = 0;
??????????? curAnimClip = clip;
??????????? Selection.activeObject = clip;
??????????? //DragAndDrop.objectReferences[0] = clip;
??????????? //Debug.Log("yns? play");
??????? }

??????? private void Update()
??????? {
??????????????? UpdateAnim(Time.deltaTime);
??????? }

??????? private void UpdateAnim(float delta)
??????? {
??????????? if (curAnimClip != null)
??????????? {
??????????????? Timer += delta;
??????????????? if (Timer > curAnimClip.length && playCount <2)
??????????????? {
??????????????????? playCount++;
??????????????????? Timer = 0;
??????????????? }
??????????????? else
??????????????? {

??????????????????? //動(dòng)畫執(zhí)行方法

??????????????????? curAnimClip.SampleAnimation(player, Timer);
??????????????? }
??????????? }
??????? }
??? }
}



【Unity技巧2】簡(jiǎn)單的動(dòng)畫預(yù)覽工具的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
揭阳市| 广昌县| 定日县| 湖南省| 清水县| 盐池县| 余庆县| 崇信县| 大竹县| 永城市| 广安市| 上犹县| 安阳县| 康保县| 西乌珠穆沁旗| 东源县| 宁安市| 兰西县| 南汇区| 北安市| 讷河市| 化德县| 长阳| 武穴市| 西贡区| 淮滨县| 丹凤县| 东阳市| 伊金霍洛旗| 石渠县| 新河县| 蒙自县| 乡宁县| 灵武市| 虹口区| 永年县| 榆中县| 大城县| 琼海市| 屏山县| 登封市|