public static AnimationDataObject WizardAnimationPopup(string _title, ICECreatureControl _control, AnimationDataObject _anim) { if (_control.GetComponentInChildren <Animator>()) { _anim.InterfaceType = AnimationInterfaceType.MECANIM; } else if (_control.GetComponentInChildren <Animation>()) { _anim.InterfaceType = AnimationInterfaceType.LEGACY; } else { _anim.InterfaceType = AnimationInterfaceType.NONE; } if (_anim.InterfaceType != AnimationInterfaceType.NONE) { if (_anim.InterfaceType == AnimationInterfaceType.MECANIM) { _anim.Animator = WizardAnimationPopupMecanim(_title, _control, _anim.Animator); } else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY) { _anim.Animation = WizardAnimationPopupLegacy(_title, _control, _anim.Animation); } } return(_anim); }
public static void DrawAnimationDataObject(ICEWorldBehaviour _component, AnimationDataObject _anim, EditorHeaderType _type, string _help = "", string _title = "", string _hint = "", List <AnimationDataObject> _list = null) { if (_anim == null) { return; } if (string.IsNullOrEmpty(_title)) { _title = "Animation"; } if (string.IsNullOrEmpty(_hint)) { _hint = ""; } if (string.IsNullOrEmpty(_help)) { _help = Info.ANIMATION; } //-------------------------------------------------- // ANIMATION //-------------------------------------------------- bool _enabled = _anim.Enabled; //_anim.Enabled = (_anim.InterfaceType != AnimationInterfaceType.NONE?true:false); ICEEditorLayout.BeginHorizontal(); if (WorldObjectEditor.IsEnabledFoldoutType(_type)) { EditorGUI.BeginDisabledGroup(_anim.Enabled == false); } WorldObjectEditor.DrawObjectHeaderLine(_anim, WorldObjectEditor.GetSimpleFoldout(_type), _title, _hint); GUILayout.FlexibleSpace(); //EditorGUI.BeginDisabledGroup( _anim.Enabled == false ); _anim.AllowInterfaceSelector = !ICEEditorLayout.CheckButtonMiddle("AUTO", "Automatic Interface Selection", !_anim.AllowInterfaceSelector); //EditorGUI.EndDisabledGroup(); if (_list != null && _list.Count > 1) { if (ICEEditorLayout.Button("SHARE", "Use this move settings for all associated rules")) { foreach (AnimationDataObject _data in _list) { _data.Copy(_anim); } } } if (WorldObjectEditor.IsEnabledFoldoutType(_type)) { EditorGUI.EndDisabledGroup(); _anim.Enabled = ICEEditorLayout.EnableButton(_anim.Enabled); } ICEEditorLayout.EndHorizontal(_help); if (_enabled != _anim.Enabled && _anim.Enabled == true) { _anim.Foldout = true; } // CONTENT BEGIN if (WorldObjectEditor.BeginObjectContentOrReturn(_type, _anim)) { return; } if ((_component.GetComponentInChildren <Animator>() != null && _component.GetComponentInChildren <Animation>() != null) || _anim.AllowInterfaceSelector) { if (_anim.InterfaceType == AnimationInterfaceType.NONE && _component.GetComponentInChildren <Animator>() != null && _component.GetComponentInChildren <Animator>().runtimeAnimatorController != null) { _anim.InterfaceType = AnimationInterfaceType.MECANIM; } else if (_anim.InterfaceType == AnimationInterfaceType.NONE) { _anim.InterfaceType = AnimationInterfaceType.LEGACY; } _help = Info.ANIMATION_NONE; if (_anim.InterfaceType == AnimationInterfaceType.MECANIM) { _help = Info.ANIMATION_ANIMATOR; } else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY) { _help = Info.ANIMATION_ANIMATION; } else if (_anim.InterfaceType == AnimationInterfaceType.CLIP) { _help = Info.ANIMATION_CLIP; } else if (_anim.InterfaceType == AnimationInterfaceType.CUSTOM) { _help = Info.ANIMATION_CUSTOM; } _anim.InterfaceType = (AnimationInterfaceType)ICEEditorLayout.EnumPopup("Interface", "", _anim.InterfaceType, _help); } else if (_component.GetComponentInChildren <Animator>()) { _anim.InterfaceType = AnimationInterfaceType.MECANIM; } else { _anim.InterfaceType = AnimationInterfaceType.LEGACY; } if (_anim.InterfaceType != AnimationInterfaceType.NONE) { if (_anim.InterfaceType == AnimationInterfaceType.MECANIM) { _anim.Animator = DrawBehaviourAnimationAnimatorData(_component, _anim.Animator); } else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY) { _anim.Animation = DrawBehaviourAnimationAnimationData(_component, _anim.Animation); } else if (_anim.InterfaceType == AnimationInterfaceType.CLIP) { _anim.Clip = DrawBehaviourAnimationAnimationClipData(_component, _anim.Clip); } else if (_anim.InterfaceType == AnimationInterfaceType.CUSTOM) { Info.Help(_help); } if (_anim.InterfaceType == AnimationInterfaceType.MECANIM && _anim.Animator.Type == AnimatorControlType.DIRECT) { DrawAnimationEventData(_component, _anim.Events, AnimationTools.GetAnimationClipByAnimatorAndName(AnimationTools.TryGetAnimatorComponent(_component.gameObject), _anim.GetAnimationName()), EditorHeaderType.FOLDOUT_ENABLED); } else if (_anim.InterfaceType == AnimationInterfaceType.LEGACY) { DrawAnimationEventData(_component, _anim.Events, AnimationTools.GetAnimationClipByName(AnimationTools.TryGetAnimationComponent(_component.gameObject), _anim.GetAnimationName()), EditorHeaderType.FOLDOUT_ENABLED); } else if (_anim.InterfaceType == AnimationInterfaceType.CLIP) { DrawAnimationEventData(_component, _anim.Events, _anim.Clip.Clip, EditorHeaderType.FOLDOUT_ENABLED); } } else { Info.Help(Info.ANIMATION_NONE); } WorldObjectEditor.EndObjectContent(); // CONTENT END }