/************************************************************************************************************************/ /// <summary> /// If <see cref="AnimationClip"/>s or <see cref="IAnimationClipSource"/>s are dropped inside the 'dropArea', /// this method creates a new state in the 'target' for each animation. /// </summary> public static void HandleDragAndDropAnimations(Rect dropArea, IAnimancerComponent target, int layerIndex) { AnimancerEditorUtilities.HandleDragAndDropAnimations(dropArea, (clip) => { target.GetOrCreateState(clip, layerIndex); }); }
private void DoAnimationsField(SerializedProperty property, GUIContent label) { GUILayout.Space(EditorGUIUtility.standardVerticalSpacing - 1); if (_Animations == null) { _Animations = new ReorderableList(property.serializedObject, property.Copy()) { drawHeaderCallback = DrawAnimationsHeader, drawElementCallback = DrawAnimationElement, elementHeight = EditorGUIUtility.singleLineHeight, onRemoveCallback = RemoveSelectedElement, }; } _RemoveAnimationIndex = -1; GUILayout.BeginVertical(); _Animations.DoLayoutList(); GUILayout.EndVertical(); if (_RemoveAnimationIndex >= 0) { property.DeleteArrayElementAtIndex(_RemoveAnimationIndex); } AnimancerEditorUtilities.HandleDragAndDropAnimations(GUILayoutUtility.GetLastRect(), (clip) => { var index = property.arraySize; property.arraySize = index + 1; var element = property.GetArrayElementAtIndex(index); element.objectReferenceValue = clip; }); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); }