Пример #1
0
    static bool OnSpeListAcceptDragObjs(EditorControl c, UnityEngine.Object[] objs, string[] paths)
    {
        //不支持多项拖入
        if (objs.Length > 1)
        {
            return(false);
        }

        if (SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode)
        {//骨骼绑定模式不允许拖拽
            return(false);
        }


        UnityEngine.Object obj = objs[0];

        if (SpecialEffectAnimClipEditorModel.GetInstance().IsLegalItem(obj))
        {
            return(true);
        }

        GameObject go = obj as GameObject;

        if (go != null)
        {
            return(true);
        }

        return(false);
    }
 public override void UnExecute()
 {
     clip.SetItemTimeLine(i, oldStartTime, oldLength);
     SpecialEffectAnimClipEditorModel.GetInstance().SyncCurrPlayTime();
     SpecialEffectAnimClipEditorModel.GetInstance().isClipValueChange = true;
     SpecialEffectAnimClipEditorModel.GetInstance().UpdateNotify();
 }
Пример #3
0
    static void OnSpeClipValueChange()
    {
        var clipProxy = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;
        TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl();

        //同步时间线
        int i = 0;

        //更新预览动作时间线
        var previewAction = SpecialEffectAnimClipEditorModel.GetInstance().GetPreviewModelAction();

        if (previewAction != null)
        {
            timeLineView.Items[i].startTime = 0.0f;
            timeLineView.Items[i].length    = previewAction.Length;
        }
        else
        {
            timeLineView.Items[i].startTime = 0.0f;
            timeLineView.Items[i].length    = 0.0f;
        }
        i++;

        foreach (var item in clipProxy.Clip.itemList)
        {
            timeLineView.Items[i].startTime = item.StartTime;
            timeLineView.Items[i].length    = item.Length;
            i++;
        }

        UpdatePreviewLength();
        RefreshUIState();
    }
 public override void UnExecute()
 {
     clip.InsertItem(item, i);
     SpecialEffectAnimClipEditorModel.GetInstance().SyncCurrPlayTime();
     SpecialEffectAnimClipEditorModel.GetInstance().isClipItemNumChange = true;
     SpecialEffectAnimClipEditorModel.GetInstance().UpdateNotify();
     SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect = -1;
 }
Пример #5
0
 public static SpecialEffectAnimClipEditorModel GetInstance()
 {
     if (_instance == null)
     {
         _instance = new SpecialEffectAnimClipEditorModel();
     }
     return(_instance);
 }
    public override void UnExecute()
    {
        clip.SetItemBindingPath(i, oldBindPath);

        //Add by HouXiaoGang for 代码改善 Start
        SpecialEffectAnimClipEditorModel.GetInstance().isClipItemSelect = true;
        SpecialEffectAnimClipEditorModel.GetInstance().UpdateNotify();
        //Add by HouXiaoGang  End
    }
 public override void Execute()
 {
     item = clip.QueryItem(i);
     clip.RemoveItem(i);
     SpecialEffectAnimClipEditorModel.GetInstance().SyncCurrPlayTime();
     SpecialEffectAnimClipEditorModel.GetInstance().isClipItemNumChange = true;
     SpecialEffectAnimClipEditorModel.GetInstance().UpdateNotify();
     SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect = -1;
 }
Пример #8
0
    static void RefreshListViewAndTimeLineViewSelectItem()
    {
        ListViewCtrl     listView     = GetListViewCtrl();
        TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl();
        int sel = SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect;

        listView.SelectItems.Clear();
        listView.SelectItems.Add(sel);
        timeLineView.LastSelectedItem = sel;
    }
Пример #9
0
 static void OnPlayCtrlValueChange(EditorControl c, object value)
 {
     if (SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode)
     { //对于绑定模式只修改特效动画播放进度
         SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip.CurrentPlayTime = GetPlayCtrl().PlayTime;
     }
     else
     {
         SpecialEffectAnimClipEditorModel.GetInstance().CurrentPlayTime = GetPlayCtrl().PlayTime;
     }
     GetTimeLineViewCtrl().CurrPlayTime = GetPlayCtrl().PlayTime;
 }
Пример #10
0
    static SpecialEffectAnimClipItem GetCurrentSelectItem()
    {
        int itemIndx = TransItemIndex(SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect);

        if (itemIndx < 0)
        {
            return(null);
        }
        var clip = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;

        return(clip.QueryItem(itemIndx));
    }
Пример #11
0
    static void OnEditorEnable(EditorRoot root)
    {
        SpecialEffectAnimClipEditorModel.GetInstance().Init();

        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipNew           = OnSpeClipNew;
        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipOpen          = OnSpeClipOpen;
        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipItemNumChange = OnSpeClipItemNumChange;
        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipValueChange   = OnSpeClipValueChange;
        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipItemSelect    = OnSpeClipItemSelectionChange;
        SpecialEffectAnimClipEditorModel.GetInstance().onSpeAnimClipSetNewAction  = OnSpeSetNewPreviewAction;

        RefreshUIState();
    }
Пример #12
0
    static void OnTimeLineDragItemsEnd(EditorControl c, List <TimeLineViewCtrl.ItemSelectInfo> indxList)
    {
        TimeLineViewCtrl timeLineCtrl = c.Root.FindControl <TimeLineViewCtrl>();

        if (timeLineCtrl == null)
        {
            return;
        }

        foreach (var selItem in indxList)
        {
            int i    = selItem.indx;
            var item = timeLineCtrl.Items[i];
            SpecialEffectAnimClipEditorModel.GetInstance().SetSpeAnimItemTimeLine(TransItemIndex(i), item.startTime, item.length);
        }
        RequestRepaint();
    }
Пример #13
0
    static void OnSpeListItemRightBtnUp(EditorControl c, int item)
    {
        if (item == 0)
        {//跳过预览项动作
            return;
        }

        if (SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode)
        {//骨骼绑定模式不允许删除项
            return;
        }

        GenericMenu menu = new GenericMenu();

        menu.AddItem(new GUIContent("删除"), false, OnSpeListRemoveItem, item);
        menu.ShowAsContext();
    }
Пример #14
0
    static void RefreshUIState()
    {
        var    clipProxy = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;
        string dirtyMark = "";

        if (clipProxy == null)
        {
            s_openFileName = "空";
        }
        else
        {
            if (clipProxy.ClipPrefab == null)
            {
                s_openFileName = "未命名新动画片段";
            }
            else
            {
                s_openFileName = clipProxy.ClipPrefab.name;
            }

            if (clipProxy.IsDirty)
            {
                dirtyMark = "*";
            }
        }
        (s_root.FindControl(s_openFileTextBoxName) as TextBoxCtrl).Text = s_openFileName + dirtyMark;

        if (SpecialEffectAnimClipEditorModel.GetInstance().CanUndo())
        {
            GetUndoBtnCtrl().Enable = true;
        }
        else
        {
            GetUndoBtnCtrl().Enable = false;
        }

        if (SpecialEffectAnimClipEditorModel.GetInstance().CanRedo())
        {
            GetRedoBtnCtrl().Enable = true;
        }
        else
        {
            GetRedoBtnCtrl().Enable = false;
        }
    }
Пример #15
0
    static void OnBindingTargetComboBoxValueChange(EditorControl c, object value)
    {
        var transInfoList = SpecialEffectAnimClipEditorModel.GetInstance().GetTPoseTransformInfos();

        if (transInfoList == null || transInfoList.Count == 0)
        {
            return;
        }

        int boneIndx = (int)value;

        if (boneIndx < 0 || boneIndx >= transInfoList.Count)
        {
            return;
        }

        int i = TransItemIndex(SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect);

        SpecialEffectAnimClipEditorModel.GetInstance().SetSpeAnimSelectItemBindingPath(i, transInfoList[boneIndx].path);
    }
Пример #16
0
    static void OnSpeListDropObjs(EditorControl c, UnityEngine.Object[] objs, string[] paths)
    {
        if (objs.Length > 1)
        {
            return;
        }


        if (SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode)
        {//骨骼绑定模式不允许拖拽
            return;
        }

        //支持拖拽动画片段子项
        UnityEngine.Object obj = objs[0];
        if (SpecialEffectAnimClipEditorModel.GetInstance().IsLegalItem(obj))
        {
            SpecialEffectAnimClipEditorModel.GetInstance().AddItem(obj);
            return;
        }

        //支持拖拽动画片段
        GameObject go   = obj as GameObject;
        var        clip = go.GetComponent <SpecialEffectAnimationClip>();

        if (clip != null)
        {
            SpecialEffectAnimClipEditorModel.GetInstance().OpenClip(obj);
            return;
        }

        //支持拖拽AnimationClip
        string        assetPath = AssetDatabase.GetAssetPath(obj);
        AnimationClip animClip  = AssetDatabase.LoadAssetAtPath(assetPath, typeof(AnimationClip)) as AnimationClip;

        if (animClip != null)
        {
            SpecialEffectAnimClipEditorModel.GetInstance().SetPreviewModelAction(animClip);
            return;
        }
    }
Пример #17
0
    static void OnTabViewSelect(EditorControl c, int item)
    {
        if (item == 0)
        {//编辑模式
            GetNewBtnCtrl().Enable       = true;
            GetSaveBtnCtrl().Enable      = true;
            GetUndoBtnCtrl().Enable      = true;
            GetRedoBtnCtrl().Enable      = true;
            GetPreviewModelCtrl().Enable = true;
            GetListViewCtrl().Enable     = true;
            GetTimeLineViewCtrl().Enable = true;
            GetPlayCtrl().Enable         = true;

            SpecialEffectAnimClipEditorModel.GetInstance().ShowRefModelBoneSpheres(false);

            SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode = false;

            SpecialEffectAnimClipEditorModel.GetInstance().SyncCurrPlayTime();
        }
        else
        {//骨骼绑定模式
            GetNewBtnCtrl().Enable       = false;
            GetSaveBtnCtrl().Enable      = false;
            GetUndoBtnCtrl().Enable      = false;
            GetRedoBtnCtrl().Enable      = false;
            GetPreviewModelCtrl().Enable = false;
            GetListViewCtrl().Enable     = true;
            GetTimeLineViewCtrl().Enable = false;
            GetPlayCtrl().Enable         = true;

            //骨骼绑定模式将模型强制变为TPose
            SpecialEffectAnimClipEditorModel.GetInstance().ShowPreviewModelTPose();

            SpecialEffectAnimClipEditorModel.GetInstance().ShowRefModelBoneSpheres(true);

            SpecialEffectAnimClipEditorModel.GetInstance().IsBindingMode = true;
        }

        RequestRepaint();
    }
Пример #18
0
    static void OnSpeListItemDoubleClick(EditorControl c, object value)
    {
        SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect = (int)value;

        int itemIndx = TransItemIndex((int)value);

        if (itemIndx < 0)
        {//略过动画项
            Selection.activeObject = null;
            return;
        }
        var clip = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;

        if (clip == null)
        {
            return;
        }

        var clipItem = clip.QueryItem(itemIndx);

        Selection.activeObject = clipItem.obj;
    }
Пример #19
0
    static void RefreshSelItemPropertyTabView()
    {
        if (SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip == null)
        {
            return;
        }

        int itemIndx = TransItemIndex(SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect);

        if (itemIndx < 0)
        {//略过动画项
            GetBindingTargetComboBoxCtrl().Enable = false;
            GetDeathTypeComboBoxCtrl().Enable     = false;
            return;
        }

        GetBindingTargetComboBoxCtrl().Enable = true;
        GetDeathTypeComboBoxCtrl().Enable     = true;

        var clip     = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;
        var clipItem = clip.QueryItem(itemIndx);

        //在InspectorView高亮选中特效动画项
        if (clipItem as SpecialEffectAnimClipEffectItem != null)
        {
            var effectItem = clipItem as SpecialEffectAnimClipEffectItem;
            Selection.activeObject = effectItem.effInst.gameObject;
        }
        else
        {
            Selection.activeObject = null;
        }

        var transInfoList = SpecialEffectAnimClipEditorModel.GetInstance().GetTPoseTransformInfos();
        var comboBox      = GetBindingTargetComboBoxCtrl();

        comboBox.ClearItem();

        string currItemBindPath = clipItem.bindingTargetPath;
        int    i = 0;

        //Add by HouXiaoGang for 代码改善 Start
        ComboItem ite = new ComboItem("None", i);

        comboBox.AddItem(ite);
        //Add by HouXiaoGang  End

        foreach (var trans in transInfoList)
        {
            string    path = trans.path;
            ComboItem item = new ComboItem(path.Substring(path.LastIndexOf('/') + 1), i);
            comboBox.AddItem(item);
            i++;
        }

        i = 0;

        int currSel = -1;

        foreach (var trans in transInfoList)
        {
            if (trans.path == currItemBindPath)
            {
                currSel = i;
                break;
            }
            i++;
        }
        comboBox.CurrValue = currSel;

        GetBindingTargetTextBoxCtrl().Text = currItemBindPath;


        var deathTypeComboBox = GetDeathTypeComboBoxCtrl();

        deathTypeComboBox.ClearItem();
        deathTypeComboBox.AddItem(new ComboItem("停止", 0));
        deathTypeComboBox.AddItem(new ComboItem("未播放的不播放", 1));
        deathTypeComboBox.CurrValue = clipItem.deathType;

        GUI.FocusControl("");
    }
Пример #20
0
 static void OnSaveBtnClick(EditorControl c)
 {
     SpecialEffectAnimClipEditorModel.GetInstance().SaveClip();
 }
Пример #21
0
    static void RebuildListViewAndTimeLineView()
    {
        var clip = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip;

        //更新ListView
        ListViewCtrl listView = GetListViewCtrl();

        listView.ClearItems();

        var previewAnimClip = clip.PreviewAnimClip;

        {
            ListCtrlItem item = new ListCtrlItem();
            if (previewAnimClip != null)
            {
                item.name = previewAnimClip.name;
            }
            else
            {
                item.name = "空动作";
            }
            item.image = UnityInternalIconCache.GetInstance().GetCacheIcon("UnityEditor.AnimationWindow");
            listView.AddItem(item);
        }


        foreach (var item in clip.Clip.itemList)
        {
            ListCtrlItem listItem = new ListCtrlItem();
            listItem.name = item.obj.name;
            if (item as SpecialEffectAnimClipAudioItem != null)
            {
                listItem.image = UnityInternalIconCache.GetInstance().GetCacheIcon("SceneViewAudio");
            }
            else if (item as SpecialEffectAnimClipEffectItem != null)
            {
                listItem.image = UnityInternalIconCache.GetInstance().GetCacheIcon("AvatarPivot");
            }
            listView.AddItem(listItem);
        }


        //更新TimeLineView
        TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl();

        timeLineView.Items.Clear();

        {
            TimeLineItem item = new TimeLineItem();
            item.startTime = 0.0f;
            if (previewAnimClip != null)
            {
                item.length = previewAnimClip.length;
            }
            else
            {
                item.length = 0.0f;
            }
            timeLineView.Items.Add(item);
        }

        foreach (var item in clip.Clip.itemList)
        {
            TimeLineItem timeLineItem = new TimeLineItem();
            timeLineItem.startTime = item.StartTime;
            timeLineItem.length    = item.Length;
            timeLineView.Items.Add(timeLineItem);
        }

        UpdatePreviewLength();
    }
Пример #22
0
 static void UpdatePreviewLength()
 {
     GetPlayCtrl().TotalTime         = SpecialEffectAnimClipEditorModel.GetInstance().PreviewLength;
     GetTimeLineViewCtrl().TotalTime = SpecialEffectAnimClipEditorModel.GetInstance().PreviewLength;
 }
Пример #23
0
 static void OnRedoBtnClick(EditorControl c)
 {
     SpecialEffectAnimClipEditorModel.GetInstance().Redo();
 }
Пример #24
0
 static void OnSpeListItemSelect(EditorControl c, int item)
 {
     SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect = item;
 }
Пример #25
0
 static void OnPreviewModelValueChanged(EditorControl c, object value)
 {
     SpecialEffectAnimClipEditorModel.GetInstance().SetPreviewModel(value as UnityEngine.Object);
 }
Пример #26
0
 static void OnEditorDestroy(EditorRoot root)
 {
     SpecialEffectAnimClipEditorModel.GetInstance().Destory();
 }
Пример #27
0
    static void OnSpeListRemoveItem(object userData)
    {
        int itemIndx = (int)userData;

        SpecialEffectAnimClipEditorModel.GetInstance().RemoveItem(TransItemIndex(itemIndx));
    }
Пример #28
0
    static void OnDeathTypeComboBoxValueChange(EditorControl c, object value)
    {
        int i = TransItemIndex(SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect);

        SpecialEffectAnimClipEditorModel.GetInstance().SetSpeAnimItemDeathType(i, (int)value);
    }