|
@@ -22,7 +22,6 @@ namespace BansheeEditor
|
|
|
private const float DRAG_SCALE = 10.0f;
|
|
private const float DRAG_SCALE = 10.0f;
|
|
|
private const float ZOOM_SCALE = 0.1f/120.0f; // One scroll step is usually 120 units, we want 1/10 of that
|
|
private const float ZOOM_SCALE = 0.1f/120.0f; // One scroll step is usually 120 units, we want 1/10 of that
|
|
|
|
|
|
|
|
- private bool isInitialized;
|
|
|
|
|
private SceneObject selectedSO;
|
|
private SceneObject selectedSO;
|
|
|
|
|
|
|
|
#region Overrides
|
|
#region Overrides
|
|
@@ -45,17 +44,13 @@ namespace BansheeEditor
|
|
|
private void OnInitialize()
|
|
private void OnInitialize()
|
|
|
{
|
|
{
|
|
|
Selection.OnSelectionChanged += OnSelectionChanged;
|
|
Selection.OnSelectionChanged += OnSelectionChanged;
|
|
|
- EditorInput.OnPointerPressed += OnPointerPressed;
|
|
|
|
|
- EditorInput.OnPointerMoved += OnPointerMoved;
|
|
|
|
|
- EditorInput.OnPointerReleased += OnPointerReleased;
|
|
|
|
|
- EditorInput.OnButtonUp += OnButtonUp;
|
|
|
|
|
|
|
|
|
|
- RebuildGUI();
|
|
|
|
|
|
|
+ UpdateSelectedSO();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnEditorUpdate()
|
|
private void OnEditorUpdate()
|
|
|
{
|
|
{
|
|
|
- if (!isInitialized)
|
|
|
|
|
|
|
+ if (selectedSO == null)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
HandleDragAndZoomInput();
|
|
HandleDragAndZoomInput();
|
|
@@ -64,15 +59,19 @@ namespace BansheeEditor
|
|
|
private void OnDestroy()
|
|
private void OnDestroy()
|
|
|
{
|
|
{
|
|
|
Selection.OnSelectionChanged -= OnSelectionChanged;
|
|
Selection.OnSelectionChanged -= OnSelectionChanged;
|
|
|
- EditorInput.OnPointerPressed -= OnPointerPressed;
|
|
|
|
|
- EditorInput.OnPointerMoved -= OnPointerMoved;
|
|
|
|
|
- EditorInput.OnPointerReleased -= OnPointerReleased;
|
|
|
|
|
- EditorInput.OnButtonUp -= OnButtonUp;
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (selectedSO != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ EditorInput.OnPointerPressed -= OnPointerPressed;
|
|
|
|
|
+ EditorInput.OnPointerMoved -= OnPointerMoved;
|
|
|
|
|
+ EditorInput.OnPointerReleased -= OnPointerReleased;
|
|
|
|
|
+ EditorInput.OnButtonUp -= OnButtonUp;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected override void WindowResized(int width, int height)
|
|
protected override void WindowResized(int width, int height)
|
|
|
{
|
|
{
|
|
|
- if (!isInitialized)
|
|
|
|
|
|
|
+ if (selectedSO == null)
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
ResizeGUI(width, height);
|
|
ResizeGUI(width, height);
|
|
@@ -111,15 +110,6 @@ namespace BansheeEditor
|
|
|
private void RebuildGUI()
|
|
private void RebuildGUI()
|
|
|
{
|
|
{
|
|
|
GUI.Clear();
|
|
GUI.Clear();
|
|
|
- selectedFields.Clear();
|
|
|
|
|
- curves.Clear();
|
|
|
|
|
- isInitialized = false;
|
|
|
|
|
-
|
|
|
|
|
- if (selectedSO != Selection.SceneObject)
|
|
|
|
|
- {
|
|
|
|
|
- zoomAmount = 0.0f;
|
|
|
|
|
- selectedSO = Selection.SceneObject;
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
if (selectedSO == null)
|
|
if (selectedSO == null)
|
|
|
{
|
|
{
|
|
@@ -137,9 +127,6 @@ namespace BansheeEditor
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // TODO - Retrieve Animation & AnimationClip from the selected object, fill curves dictionary
|
|
|
|
|
- // - If not available, show a button to create new animation clip
|
|
|
|
|
-
|
|
|
|
|
// Top button row
|
|
// Top button row
|
|
|
GUIContent playIcon = new GUIContent(EditorBuiltin.GetAnimationWindowIcon(AnimationWindowIcon.Play),
|
|
GUIContent playIcon = new GUIContent(EditorBuiltin.GetAnimationWindowIcon(AnimationWindowIcon.Play),
|
|
|
new LocEdString("Play"));
|
|
new LocEdString("Play"));
|
|
@@ -220,23 +207,90 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
addPropertyBtn.OnClick += () =>
|
|
addPropertyBtn.OnClick += () =>
|
|
|
{
|
|
{
|
|
|
- Vector2I windowPos = ScreenToWindowPos(Input.PointerPosition);
|
|
|
|
|
- FieldSelectionWindow fieldSelection = DropDownWindow.Open<FieldSelectionWindow>(this, windowPos);
|
|
|
|
|
- fieldSelection.OnFieldSelected += OnFieldAdded;
|
|
|
|
|
|
|
+ Action openPropertyWindow = () =>
|
|
|
|
|
+ {
|
|
|
|
|
+ Vector2I windowPos = ScreenToWindowPos(Input.PointerPosition);
|
|
|
|
|
+ FieldSelectionWindow fieldSelection = DropDownWindow.Open<FieldSelectionWindow>(this, windowPos);
|
|
|
|
|
+ fieldSelection.OnFieldSelected += OnFieldAdded;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ if (clipInfo.clip == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ LocEdString title = new LocEdString("Warning");
|
|
|
|
|
+ LocEdString message =
|
|
|
|
|
+ new LocEdString("Selected object doesn't have an animation clip assigned. Would you like to create" +
|
|
|
|
|
+ " a new animation clip?");
|
|
|
|
|
+
|
|
|
|
|
+ DialogBox.Open(title, message, DialogBox.Type.YesNoCancel, type =>
|
|
|
|
|
+ {
|
|
|
|
|
+ if (type == DialogBox.ResultType.Yes)
|
|
|
|
|
+ {
|
|
|
|
|
+ string[] clipSavePaths;
|
|
|
|
|
+ if (BrowseDialog.OpenFile(ProjectLibrary.ResourceFolder, "", false, out clipSavePaths))
|
|
|
|
|
+ {
|
|
|
|
|
+ if (clipSavePaths.Length > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ AnimationClip newClip = new AnimationClip();
|
|
|
|
|
+
|
|
|
|
|
+ ProjectLibrary.Create(newClip, clipSavePaths[0]);
|
|
|
|
|
+ LoadAnimClip(newClip);
|
|
|
|
|
+
|
|
|
|
|
+ Animation animation = selectedSO.GetComponent<Animation>();
|
|
|
|
|
+ if (animation == null)
|
|
|
|
|
+ animation = selectedSO.AddComponent<Animation>();
|
|
|
|
|
+
|
|
|
|
|
+ animation.DefaultClip = newClip;
|
|
|
|
|
+ EditorApplication.SetSceneDirty();
|
|
|
|
|
+
|
|
|
|
|
+ openPropertyWindow();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ if (IsClipImported(clipInfo.clip))
|
|
|
|
|
+ {
|
|
|
|
|
+ LocEdString title = new LocEdString("Warning");
|
|
|
|
|
+ LocEdString message =
|
|
|
|
|
+ new LocEdString("You cannot add/edit/remove curves from animation clips that" +
|
|
|
|
|
+ " are imported from an external file.");
|
|
|
|
|
+
|
|
|
|
|
+ DialogBox.Open(title, message, DialogBox.Type.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ openPropertyWindow();
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
delPropertyBtn.OnClick += () =>
|
|
delPropertyBtn.OnClick += () =>
|
|
|
{
|
|
{
|
|
|
- LocEdString title = new LocEdString("Warning");
|
|
|
|
|
- LocEdString message = new LocEdString("Are you sure you want to remove all selected fields?");
|
|
|
|
|
|
|
+ if (clipInfo.clip == null)
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ if (IsClipImported(clipInfo.clip))
|
|
|
|
|
+ {
|
|
|
|
|
+ LocEdString title = new LocEdString("Warning");
|
|
|
|
|
+ LocEdString message =
|
|
|
|
|
+ new LocEdString("You cannot add/edit/remove curves from animation clips that" +
|
|
|
|
|
+ " are imported from an external file.");
|
|
|
|
|
|
|
|
- DialogBox.Open(title, message, DialogBox.Type.YesNo, x =>
|
|
|
|
|
|
|
+ DialogBox.Open(title, message, DialogBox.Type.OK);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- if (x == DialogBox.ResultType.Yes)
|
|
|
|
|
|
|
+ LocEdString title = new LocEdString("Warning");
|
|
|
|
|
+ LocEdString message = new LocEdString("Are you sure you want to remove all selected fields?");
|
|
|
|
|
+
|
|
|
|
|
+ DialogBox.Open(title, message, DialogBox.Type.YesNo, x =>
|
|
|
{
|
|
{
|
|
|
- RemoveSelectedFields();
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ if (x == DialogBox.ResultType.Yes)
|
|
|
|
|
+ {
|
|
|
|
|
+ RemoveSelectedFields();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
GUILayout mainLayout = GUI.AddLayoutY();
|
|
GUILayout mainLayout = GUI.AddLayoutY();
|
|
@@ -291,6 +345,10 @@ namespace BansheeEditor
|
|
|
Vector2I curveEditorSize = GetCurveEditorSize();
|
|
Vector2I curveEditorSize = GetCurveEditorSize();
|
|
|
guiCurveEditor = new GUICurveEditor(this, editorPanel, curveEditorSize.x, curveEditorSize.y);
|
|
guiCurveEditor = new GUICurveEditor(this, editorPanel, curveEditorSize.x, curveEditorSize.y);
|
|
|
guiCurveEditor.OnFrameSelected += OnFrameSelected;
|
|
guiCurveEditor.OnFrameSelected += OnFrameSelected;
|
|
|
|
|
+ guiCurveEditor.OnEventAdded += OnEventsChanged;
|
|
|
|
|
+ guiCurveEditor.OnEventModified += EditorApplication.SetProjectDirty;
|
|
|
|
|
+ guiCurveEditor.OnEventDeleted += OnEventsChanged;
|
|
|
|
|
+ guiCurveEditor.OnCurveModified += EditorApplication.SetProjectDirty;
|
|
|
guiCurveEditor.Redraw();
|
|
guiCurveEditor.Redraw();
|
|
|
|
|
|
|
|
horzScrollBar.SetWidth(curveEditorSize.x);
|
|
horzScrollBar.SetWidth(curveEditorSize.x);
|
|
@@ -298,8 +356,6 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
SetCurrentFrame(currentFrameIdx);
|
|
SetCurrentFrame(currentFrameIdx);
|
|
|
UpdateScrollBarSize();
|
|
UpdateScrollBarSize();
|
|
|
-
|
|
|
|
|
- isInitialized = true;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void ResizeGUI(int width, int height)
|
|
private void ResizeGUI(int width, int height)
|
|
@@ -470,420 +526,85 @@ namespace BansheeEditor
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
|
|
#region Curve save/load
|
|
#region Curve save/load
|
|
|
- /// <summary>
|
|
|
|
|
- /// A set of animation curves for a field of a certain type.
|
|
|
|
|
- /// </summary>
|
|
|
|
|
- private struct FieldCurves
|
|
|
|
|
- {
|
|
|
|
|
- public SerializableProperty.FieldType type;
|
|
|
|
|
- public EdAnimationCurve[] curves;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- [SerializeObject]
|
|
|
|
|
- private class EditorVector3CurveTangents
|
|
|
|
|
- {
|
|
|
|
|
- public string name;
|
|
|
|
|
- public TangentMode[] tangentsX;
|
|
|
|
|
- public TangentMode[] tangentsY;
|
|
|
|
|
- public TangentMode[] tangentsZ;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ private EditorAnimClipInfo clipInfo;
|
|
|
|
|
|
|
|
- [SerializeObject]
|
|
|
|
|
- private class EditorFloatCurveTangents
|
|
|
|
|
|
|
+ private void LoadAnimClip(AnimationClip clip)
|
|
|
{
|
|
{
|
|
|
- public string name;
|
|
|
|
|
- public TangentMode[] tangents;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- [SerializeObject]
|
|
|
|
|
- private class EditorCurveData
|
|
|
|
|
- {
|
|
|
|
|
- public EditorVector3CurveTangents[] positionCurves;
|
|
|
|
|
- public EditorVector3CurveTangents[] rotationCurves;
|
|
|
|
|
- public EditorVector3CurveTangents[] scaleCurves;
|
|
|
|
|
- public EditorFloatCurveTangents[] floatCurves;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ EditorPersistentData persistentData = EditorApplication.PersistentData;
|
|
|
|
|
|
|
|
- private Dictionary<string, FieldCurves> curves = new Dictionary<string, FieldCurves>();
|
|
|
|
|
- private bool clipIsImported;
|
|
|
|
|
-
|
|
|
|
|
- private void LoadFromClip(AnimationClip clip)
|
|
|
|
|
- {
|
|
|
|
|
- curves.Clear();
|
|
|
|
|
- selectedFields.Clear();
|
|
|
|
|
- guiFieldDisplay.SetFields(new string[0]);
|
|
|
|
|
-
|
|
|
|
|
- clipIsImported = IsClipImported(clip);
|
|
|
|
|
-
|
|
|
|
|
- AnimationCurves clipCurves = clip.Curves;
|
|
|
|
|
- EditorCurveData editorCurveData = null;
|
|
|
|
|
-
|
|
|
|
|
- string resourcePath = ProjectLibrary.GetPath(clip);
|
|
|
|
|
- if (!string.IsNullOrEmpty(resourcePath))
|
|
|
|
|
|
|
+ bool clipIsImported = IsClipImported(clip);
|
|
|
|
|
+ if (persistentData.dirtyAnimClips.TryGetValue(clip.UUID, out clipInfo))
|
|
|
{
|
|
{
|
|
|
- LibraryEntry entry = ProjectLibrary.GetEntry(resourcePath);
|
|
|
|
|
- string clipName = PathEx.GetTail(resourcePath);
|
|
|
|
|
-
|
|
|
|
|
- if (entry != null && entry.Type == LibraryEntryType.File)
|
|
|
|
|
- {
|
|
|
|
|
- FileEntry fileEntry = (FileEntry)entry;
|
|
|
|
|
- ResourceMeta[] metas = fileEntry.ResourceMetas;
|
|
|
|
|
-
|
|
|
|
|
- for (int i = 0; i < metas.Length; i++)
|
|
|
|
|
- {
|
|
|
|
|
- if (clipName == metas[i].SubresourceName)
|
|
|
|
|
- {
|
|
|
|
|
- editorCurveData = metas[i].EditorData as EditorCurveData;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if(editorCurveData == null)
|
|
|
|
|
- editorCurveData = new EditorCurveData();
|
|
|
|
|
-
|
|
|
|
|
- Action<NamedVector3Curve[], EditorVector3CurveTangents[], string> loadVector3Curve =
|
|
|
|
|
- (curves, tangents, subPath) =>
|
|
|
|
|
|
|
+ // If an animation clip is imported, we don't care about it's cached curve values as they could have changed
|
|
|
|
|
+ // since last modification, so we re-load the clip. But we persist the events as those can only be set
|
|
|
|
|
+ // within the editor.
|
|
|
|
|
+ if (clipIsImported)
|
|
|
{
|
|
{
|
|
|
- foreach (var curveEntry in curves)
|
|
|
|
|
- {
|
|
|
|
|
- TangentMode[] tangentsX = null;
|
|
|
|
|
- TangentMode[] tangentsY = null;
|
|
|
|
|
- TangentMode[] tangentsZ = null;
|
|
|
|
|
- foreach (var tangentEntry in tangents)
|
|
|
|
|
- {
|
|
|
|
|
- if (tangentEntry.name == curveEntry.Name)
|
|
|
|
|
- {
|
|
|
|
|
- tangentsX = tangentEntry.tangentsX;
|
|
|
|
|
- tangentsY = tangentEntry.tangentsY;
|
|
|
|
|
- tangentsZ = tangentEntry.tangentsZ;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Vector3;
|
|
|
|
|
- fieldCurves.curves = new EdAnimationCurve[3];
|
|
|
|
|
-
|
|
|
|
|
- fieldCurves.curves[0] = new EdAnimationCurve(curveEntry.X, tangentsX);
|
|
|
|
|
- fieldCurves.curves[1] = new EdAnimationCurve(curveEntry.Y, tangentsY);
|
|
|
|
|
- fieldCurves.curves[2] = new EdAnimationCurve(curveEntry.Z, tangentsZ);
|
|
|
|
|
-
|
|
|
|
|
- string curvePath = curveEntry.Name.TrimEnd('/') + subPath;
|
|
|
|
|
- guiFieldDisplay.AddField(curvePath);
|
|
|
|
|
- this.curves[curvePath] = fieldCurves;
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- loadVector3Curve(clipCurves.PositionCurves, editorCurveData.positionCurves, "/Position");
|
|
|
|
|
- loadVector3Curve(clipCurves.RotationCurves, editorCurveData.rotationCurves, "/Rotation");
|
|
|
|
|
- loadVector3Curve(clipCurves.ScaleCurves, editorCurveData.scaleCurves, "/Scale");
|
|
|
|
|
-
|
|
|
|
|
- // Find which individual float curves belong to the same field
|
|
|
|
|
- Dictionary<string, Tuple<int, int, bool>[]> floatCurveMapping = new Dictionary<string, Tuple<int, int, bool>[]>();
|
|
|
|
|
- {
|
|
|
|
|
- int curveIdx = 0;
|
|
|
|
|
- foreach (var curveEntry in clipCurves.FloatCurves)
|
|
|
|
|
- {
|
|
|
|
|
- string path = curveEntry.Name;
|
|
|
|
|
- string pathNoSuffix = null;
|
|
|
|
|
-
|
|
|
|
|
- string pathSuffix;
|
|
|
|
|
- if (path.Length >= 2)
|
|
|
|
|
- {
|
|
|
|
|
- pathSuffix = path.Substring(path.Length - 2, 2);
|
|
|
|
|
- pathNoSuffix = path.Substring(0, path.Length - 2);
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- pathSuffix = "";
|
|
|
|
|
-
|
|
|
|
|
- int tangentIdx = -1;
|
|
|
|
|
- int currentTangentIdx = 0;
|
|
|
|
|
- foreach (var tangentEntry in editorCurveData.floatCurves)
|
|
|
|
|
- {
|
|
|
|
|
- if (tangentEntry.name == curveEntry.Name)
|
|
|
|
|
- {
|
|
|
|
|
- tangentIdx = currentTangentIdx;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- currentTangentIdx++;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- Animation.PropertySuffixInfo suffixInfo;
|
|
|
|
|
- if (Animation.PropertySuffixInfos.TryGetValue(pathSuffix, out suffixInfo))
|
|
|
|
|
- {
|
|
|
|
|
- Tuple<int, int, bool>[] curveInfo;
|
|
|
|
|
- if (!floatCurveMapping.TryGetValue(pathNoSuffix, out curveInfo))
|
|
|
|
|
- curveInfo = new Tuple<int, int, bool>[4];
|
|
|
|
|
-
|
|
|
|
|
- curveInfo[suffixInfo.elementIdx] = Tuple.Create(curveIdx, tangentIdx, suffixInfo.isVector);
|
|
|
|
|
- floatCurveMapping[pathNoSuffix] = curveInfo;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- Tuple<int, int, bool>[] curveInfo = new Tuple<int, int, bool>[4];
|
|
|
|
|
- curveInfo[0] = Tuple.Create(curveIdx, tangentIdx, suffixInfo.isVector);
|
|
|
|
|
-
|
|
|
|
|
- floatCurveMapping[path] = curveInfo;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- curveIdx++;
|
|
|
|
|
|
|
+ EditorAnimClipInfo newClipInfo = EditorAnimClipInfo.Create(clip);
|
|
|
|
|
+ newClipInfo.events = clipInfo.events;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ else
|
|
|
|
|
+ clipInfo = EditorAnimClipInfo.Create(clip);
|
|
|
|
|
|
|
|
- foreach (var KVP in floatCurveMapping)
|
|
|
|
|
- {
|
|
|
|
|
- int numCurves = 0;
|
|
|
|
|
- for (int i = 0; i < 4; i++)
|
|
|
|
|
- {
|
|
|
|
|
- if (KVP.Value[i] == null)
|
|
|
|
|
- continue;
|
|
|
|
|
-
|
|
|
|
|
- numCurves++;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (numCurves == 0)
|
|
|
|
|
- continue; // Invalid curve
|
|
|
|
|
-
|
|
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
-
|
|
|
|
|
- // Deduce type (note that all single value types are assumed to be float even if their source type is int or bool)
|
|
|
|
|
- if (numCurves == 1)
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Float;
|
|
|
|
|
- else if (numCurves == 2)
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Vector2;
|
|
|
|
|
- else if (numCurves == 3)
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Vector3;
|
|
|
|
|
- else // 4 curves
|
|
|
|
|
- {
|
|
|
|
|
- bool isVector = KVP.Value[0].Item3;
|
|
|
|
|
- if (isVector)
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Vector4;
|
|
|
|
|
- else
|
|
|
|
|
- fieldCurves.type = SerializableProperty.FieldType.Color;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- fieldCurves.curves = new EdAnimationCurve[numCurves];
|
|
|
|
|
-
|
|
|
|
|
- for (int i = 0; i < numCurves; i++)
|
|
|
|
|
- {
|
|
|
|
|
- int curveIdx = KVP.Value[i].Item1;
|
|
|
|
|
- int tangentIdx = KVP.Value[i].Item2;
|
|
|
|
|
-
|
|
|
|
|
- TangentMode[] tangents = null;
|
|
|
|
|
- if (tangentIdx != -1)
|
|
|
|
|
- tangents = editorCurveData.floatCurves[tangentIdx].tangents;
|
|
|
|
|
-
|
|
|
|
|
- fieldCurves.curves[i] = new EdAnimationCurve(clipCurves.FloatCurves[curveIdx].Curve, tangents);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ persistentData.dirtyAnimClips[clip.UUID] = clipInfo;
|
|
|
|
|
|
|
|
- string curvePath = KVP.Key;
|
|
|
|
|
|
|
+ foreach (var curve in clipInfo.curves)
|
|
|
|
|
+ guiFieldDisplay.AddField(curve.Key);
|
|
|
|
|
|
|
|
- guiFieldDisplay.AddField(curvePath);
|
|
|
|
|
- curves[curvePath] = fieldCurves;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ guiCurveEditor.Events = clipInfo.events;
|
|
|
|
|
+ guiCurveEditor.DisableCurveEdit = clipIsImported;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- // Add events
|
|
|
|
|
- guiCurveEditor.Events = clip.Events;
|
|
|
|
|
|
|
+ private static bool IsClipImported(AnimationClip clip)
|
|
|
|
|
+ {
|
|
|
|
|
+ string resourcePath = ProjectLibrary.GetPath(clip);
|
|
|
|
|
+ return ProjectLibrary.IsSubresource(resourcePath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void SaveToClip(AnimationClip clip, string saveToPath)
|
|
|
|
|
|
|
+ private void UpdateSelectedSO()
|
|
|
{
|
|
{
|
|
|
- if (!clipIsImported)
|
|
|
|
|
|
|
+ SceneObject so = Selection.SceneObject;
|
|
|
|
|
+ if (selectedSO != so)
|
|
|
{
|
|
{
|
|
|
- List<NamedVector3Curve> positionCurves = new List<NamedVector3Curve>();
|
|
|
|
|
- List<NamedVector3Curve> rotationCurves = new List<NamedVector3Curve>();
|
|
|
|
|
- List<NamedVector3Curve> scaleCurves = new List<NamedVector3Curve>();
|
|
|
|
|
- List<NamedFloatCurve> floatCurves = new List<NamedFloatCurve>();
|
|
|
|
|
-
|
|
|
|
|
- List<EditorVector3CurveTangents> positionTangents = new List<EditorVector3CurveTangents>();
|
|
|
|
|
- List<EditorVector3CurveTangents> rotationTangents = new List<EditorVector3CurveTangents>();
|
|
|
|
|
- List<EditorVector3CurveTangents> scaleTangents = new List<EditorVector3CurveTangents>();
|
|
|
|
|
- List<EditorFloatCurveTangents> floatTangents = new List<EditorFloatCurveTangents>();
|
|
|
|
|
-
|
|
|
|
|
- foreach (var kvp in curves)
|
|
|
|
|
|
|
+ if (selectedSO != null && so == null)
|
|
|
{
|
|
{
|
|
|
- string[] pathEntries = kvp.Key.Split('/');
|
|
|
|
|
- if (pathEntries.Length == 0)
|
|
|
|
|
- continue;
|
|
|
|
|
-
|
|
|
|
|
- string lastEntry = pathEntries[pathEntries.Length - 1];
|
|
|
|
|
-
|
|
|
|
|
- if (lastEntry == "Position" || lastEntry == "Rotation" || lastEntry == "Scale")
|
|
|
|
|
- {
|
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
|
- for (int i = 0; i < pathEntries.Length - 2; i++)
|
|
|
|
|
- sb.Append(pathEntries[i] + "/");
|
|
|
|
|
-
|
|
|
|
|
- if (pathEntries.Length > 1)
|
|
|
|
|
- sb.Append(pathEntries[pathEntries.Length - 2]);
|
|
|
|
|
-
|
|
|
|
|
- string curvePath = sb.ToString();
|
|
|
|
|
-
|
|
|
|
|
- NamedVector3Curve curve = new NamedVector3Curve(curvePath,
|
|
|
|
|
- new AnimationCurve(kvp.Value.curves[0].KeyFrames),
|
|
|
|
|
- new AnimationCurve(kvp.Value.curves[1].KeyFrames),
|
|
|
|
|
- new AnimationCurve(kvp.Value.curves[2].KeyFrames));
|
|
|
|
|
-
|
|
|
|
|
- EditorVector3CurveTangents tangents = new EditorVector3CurveTangents();
|
|
|
|
|
- tangents.name = curvePath;
|
|
|
|
|
- tangents.tangentsX = kvp.Value.curves[0].TangentModes;
|
|
|
|
|
- tangents.tangentsY = kvp.Value.curves[1].TangentModes;
|
|
|
|
|
- tangents.tangentsZ = kvp.Value.curves[2].TangentModes;
|
|
|
|
|
-
|
|
|
|
|
- if (lastEntry == "Position")
|
|
|
|
|
- {
|
|
|
|
|
- positionCurves.Add(curve);
|
|
|
|
|
- positionTangents.Add(tangents);
|
|
|
|
|
- }
|
|
|
|
|
- else if (lastEntry == "Rotation")
|
|
|
|
|
- {
|
|
|
|
|
- rotationCurves.Add(curve);
|
|
|
|
|
- rotationTangents.Add(tangents);
|
|
|
|
|
- }
|
|
|
|
|
- else if (lastEntry == "Scale")
|
|
|
|
|
- {
|
|
|
|
|
- scaleCurves.Add(curve);
|
|
|
|
|
- scaleTangents.Add(tangents);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- Action<int, string> addCurve = (idx, subPath) =>
|
|
|
|
|
- {
|
|
|
|
|
- string path = kvp.Key + subPath;
|
|
|
|
|
-
|
|
|
|
|
- NamedFloatCurve curve = new NamedFloatCurve(path,
|
|
|
|
|
- new AnimationCurve(kvp.Value.curves[idx].KeyFrames));
|
|
|
|
|
-
|
|
|
|
|
- EditorFloatCurveTangents tangents = new EditorFloatCurveTangents();
|
|
|
|
|
- tangents.name = path;
|
|
|
|
|
- tangents.tangents = kvp.Value.curves[idx].TangentModes;
|
|
|
|
|
-
|
|
|
|
|
- floatCurves.Add(curve);
|
|
|
|
|
- floatTangents.Add(tangents);
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- switch (kvp.Value.type)
|
|
|
|
|
- {
|
|
|
|
|
- case SerializableProperty.FieldType.Vector2:
|
|
|
|
|
- addCurve(0, ".x");
|
|
|
|
|
- addCurve(1, ".y");
|
|
|
|
|
- break;
|
|
|
|
|
- case SerializableProperty.FieldType.Vector3:
|
|
|
|
|
- addCurve(0, ".x");
|
|
|
|
|
- addCurve(1, ".y");
|
|
|
|
|
- addCurve(2, ".z");
|
|
|
|
|
- break;
|
|
|
|
|
- case SerializableProperty.FieldType.Vector4:
|
|
|
|
|
- addCurve(0, ".x");
|
|
|
|
|
- addCurve(1, ".y");
|
|
|
|
|
- addCurve(2, ".z");
|
|
|
|
|
- addCurve(3, ".w");
|
|
|
|
|
- break;
|
|
|
|
|
- case SerializableProperty.FieldType.Color:
|
|
|
|
|
- addCurve(0, ".r");
|
|
|
|
|
- addCurve(1, ".g");
|
|
|
|
|
- addCurve(2, ".b");
|
|
|
|
|
- addCurve(3, ".a");
|
|
|
|
|
- break;
|
|
|
|
|
- case SerializableProperty.FieldType.Bool:
|
|
|
|
|
- case SerializableProperty.FieldType.Int:
|
|
|
|
|
- case SerializableProperty.FieldType.Float:
|
|
|
|
|
- addCurve(0, "");
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ EditorInput.OnPointerPressed -= OnPointerPressed;
|
|
|
|
|
+ EditorInput.OnPointerMoved -= OnPointerMoved;
|
|
|
|
|
+ EditorInput.OnPointerReleased -= OnPointerReleased;
|
|
|
|
|
+ EditorInput.OnButtonUp -= OnButtonUp;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- AnimationCurves newClipCurves = new AnimationCurves();
|
|
|
|
|
- newClipCurves.PositionCurves = positionCurves.ToArray();
|
|
|
|
|
- newClipCurves.RotationCurves = rotationCurves.ToArray();
|
|
|
|
|
- newClipCurves.ScaleCurves = scaleCurves.ToArray();
|
|
|
|
|
- newClipCurves.FloatCurves = floatCurves.ToArray();
|
|
|
|
|
-
|
|
|
|
|
- clip.Curves = newClipCurves;
|
|
|
|
|
- clip.Events = guiCurveEditor.Events;
|
|
|
|
|
-
|
|
|
|
|
- string resourcePath = ProjectLibrary.GetPath(clip);
|
|
|
|
|
- if (string.IsNullOrEmpty(resourcePath))
|
|
|
|
|
- ProjectLibrary.Create(clip, saveToPath);
|
|
|
|
|
- else
|
|
|
|
|
- ProjectLibrary.Save(clip);
|
|
|
|
|
-
|
|
|
|
|
- // Save tangents for editor only use
|
|
|
|
|
- LibraryEntry entry = ProjectLibrary.GetEntry(resourcePath);
|
|
|
|
|
- string clipName = PathEx.GetTail(resourcePath);
|
|
|
|
|
-
|
|
|
|
|
- if (entry != null && entry.Type == LibraryEntryType.File)
|
|
|
|
|
|
|
+ else if (selectedSO == null && so != null)
|
|
|
{
|
|
{
|
|
|
- FileEntry fileEntry = (FileEntry)entry;
|
|
|
|
|
- ResourceMeta[] metas = fileEntry.ResourceMetas;
|
|
|
|
|
-
|
|
|
|
|
- for (int i = 0; i < metas.Length; i++)
|
|
|
|
|
- {
|
|
|
|
|
- if (clipName == metas[i].SubresourceName)
|
|
|
|
|
- {
|
|
|
|
|
- EditorCurveData newCurveData = new EditorCurveData();
|
|
|
|
|
- newCurveData.positionCurves = positionTangents.ToArray();
|
|
|
|
|
- newCurveData.rotationCurves = rotationTangents.ToArray();
|
|
|
|
|
- newCurveData.scaleCurves = scaleTangents.ToArray();
|
|
|
|
|
- newCurveData.floatCurves = floatTangents.ToArray();
|
|
|
|
|
-
|
|
|
|
|
- ProjectLibrary.SetEditorData(resourcePath, newCurveData);
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ EditorInput.OnPointerPressed += OnPointerPressed;
|
|
|
|
|
+ EditorInput.OnPointerMoved += OnPointerMoved;
|
|
|
|
|
+ EditorInput.OnPointerReleased += OnPointerReleased;
|
|
|
|
|
+ EditorInput.OnButtonUp += OnButtonUp;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- string resourcePath = ProjectLibrary.GetPath(clip);
|
|
|
|
|
- LibraryEntry entry = ProjectLibrary.GetEntry(resourcePath);
|
|
|
|
|
|
|
|
|
|
- if (entry != null && entry.Type == LibraryEntryType.File)
|
|
|
|
|
- {
|
|
|
|
|
- FileEntry fileEntry = (FileEntry) entry;
|
|
|
|
|
- MeshImportOptions meshImportOptions = (MeshImportOptions)fileEntry.Options;
|
|
|
|
|
|
|
+ zoomAmount = 0.0f;
|
|
|
|
|
+ selectedSO = so;
|
|
|
|
|
+ selectedFields.Clear();
|
|
|
|
|
|
|
|
- string clipName = PathEx.GetTail(resourcePath);
|
|
|
|
|
|
|
+ RebuildGUI();
|
|
|
|
|
|
|
|
- List<ImportedAnimationEvents> newEvents = new List<ImportedAnimationEvents>();
|
|
|
|
|
- newEvents.AddRange(meshImportOptions.AnimationEvents);
|
|
|
|
|
|
|
+ clipInfo = null;
|
|
|
|
|
|
|
|
- bool isExisting = false;
|
|
|
|
|
- for (int i = 0; i < newEvents.Count; i++)
|
|
|
|
|
- {
|
|
|
|
|
- if (newEvents[i].name == clipName)
|
|
|
|
|
- {
|
|
|
|
|
- newEvents[i].events = guiCurveEditor.Events;
|
|
|
|
|
- isExisting = true;
|
|
|
|
|
- break;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (!isExisting)
|
|
|
|
|
|
|
+ // Load existing clip if one exists
|
|
|
|
|
+ if (selectedSO != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ Animation animation = selectedSO.GetComponent<Animation>();
|
|
|
|
|
+ if (animation != null)
|
|
|
{
|
|
{
|
|
|
- ImportedAnimationEvents newEntry = new ImportedAnimationEvents();
|
|
|
|
|
- newEntry.name = clipName;
|
|
|
|
|
- newEntry.events = guiCurveEditor.Events;
|
|
|
|
|
-
|
|
|
|
|
- newEvents.Add(newEntry);
|
|
|
|
|
|
|
+ AnimationClip clip = animation.DefaultClip;
|
|
|
|
|
+ if (clip != null)
|
|
|
|
|
+ LoadAnimClip(clip);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- meshImportOptions.AnimationEvents = newEvents.ToArray();
|
|
|
|
|
-
|
|
|
|
|
- ProjectLibrary.Reimport(resourcePath, meshImportOptions, true);
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- private bool IsClipImported(AnimationClip clip)
|
|
|
|
|
- {
|
|
|
|
|
- string resourcePath = ProjectLibrary.GetPath(clip);
|
|
|
|
|
- return ProjectLibrary.IsSubresource(resourcePath);
|
|
|
|
|
|
|
+ if(clipInfo == null)
|
|
|
|
|
+ clipInfo = new EditorAnimClipInfo();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
@@ -909,7 +630,7 @@ namespace BansheeEditor
|
|
|
float time = guiCurveEditor.GetTimeForFrame(currentFrameIdx);
|
|
float time = guiCurveEditor.GetTimeForFrame(currentFrameIdx);
|
|
|
|
|
|
|
|
List<GUIAnimFieldPathValue> values = new List<GUIAnimFieldPathValue>();
|
|
List<GUIAnimFieldPathValue> values = new List<GUIAnimFieldPathValue>();
|
|
|
- foreach (var kvp in curves)
|
|
|
|
|
|
|
+ foreach (var kvp in clipInfo.curves)
|
|
|
{
|
|
{
|
|
|
string suffix;
|
|
string suffix;
|
|
|
SerializableProperty property = Animation.FindProperty(selectedSO, kvp.Key, out suffix);
|
|
SerializableProperty property = Animation.FindProperty(selectedSO, kvp.Key, out suffix);
|
|
@@ -1035,7 +756,7 @@ namespace BansheeEditor
|
|
|
{
|
|
{
|
|
|
case SerializableProperty.FieldType.Vector4:
|
|
case SerializableProperty.FieldType.Vector4:
|
|
|
{
|
|
{
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves = new FieldAnimCurves();
|
|
|
fieldCurves.type = type;
|
|
fieldCurves.type = type;
|
|
|
fieldCurves.curves = new EdAnimationCurve[4];
|
|
fieldCurves.curves = new EdAnimationCurve[4];
|
|
|
|
|
|
|
@@ -1047,12 +768,12 @@ namespace BansheeEditor
|
|
|
selectedFields.Add(subFieldPath);
|
|
selectedFields.Add(subFieldPath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- curves[path] = fieldCurves;
|
|
|
|
|
|
|
+ clipInfo.curves[path] = fieldCurves;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case SerializableProperty.FieldType.Vector3:
|
|
case SerializableProperty.FieldType.Vector3:
|
|
|
{
|
|
{
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves = new FieldAnimCurves();
|
|
|
fieldCurves.type = type;
|
|
fieldCurves.type = type;
|
|
|
fieldCurves.curves = new EdAnimationCurve[3];
|
|
fieldCurves.curves = new EdAnimationCurve[3];
|
|
|
|
|
|
|
@@ -1064,12 +785,12 @@ namespace BansheeEditor
|
|
|
selectedFields.Add(subFieldPath);
|
|
selectedFields.Add(subFieldPath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- curves[path] = fieldCurves;
|
|
|
|
|
|
|
+ clipInfo.curves[path] = fieldCurves;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case SerializableProperty.FieldType.Vector2:
|
|
case SerializableProperty.FieldType.Vector2:
|
|
|
{
|
|
{
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves = new FieldAnimCurves();
|
|
|
fieldCurves.type = type;
|
|
fieldCurves.type = type;
|
|
|
fieldCurves.curves = new EdAnimationCurve[2];
|
|
fieldCurves.curves = new EdAnimationCurve[2];
|
|
|
|
|
|
|
@@ -1081,12 +802,12 @@ namespace BansheeEditor
|
|
|
selectedFields.Add(subFieldPath);
|
|
selectedFields.Add(subFieldPath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- curves[path] = fieldCurves;
|
|
|
|
|
|
|
+ clipInfo.curves[path] = fieldCurves;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case SerializableProperty.FieldType.Color:
|
|
case SerializableProperty.FieldType.Color:
|
|
|
{
|
|
{
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves = new FieldAnimCurves();
|
|
|
fieldCurves.type = type;
|
|
fieldCurves.type = type;
|
|
|
fieldCurves.curves = new EdAnimationCurve[4];
|
|
fieldCurves.curves = new EdAnimationCurve[4];
|
|
|
|
|
|
|
@@ -1098,23 +819,24 @@ namespace BansheeEditor
|
|
|
selectedFields.Add(subFieldPath);
|
|
selectedFields.Add(subFieldPath);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- curves[path] = fieldCurves;
|
|
|
|
|
|
|
+ clipInfo.curves[path] = fieldCurves;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
default: // Primitive type
|
|
default: // Primitive type
|
|
|
{
|
|
{
|
|
|
- FieldCurves fieldCurves = new FieldCurves();
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves = new FieldAnimCurves();
|
|
|
fieldCurves.type = type;
|
|
fieldCurves.type = type;
|
|
|
fieldCurves.curves = new EdAnimationCurve[1];
|
|
fieldCurves.curves = new EdAnimationCurve[1];
|
|
|
|
|
|
|
|
fieldCurves.curves[0] = new EdAnimationCurve();
|
|
fieldCurves.curves[0] = new EdAnimationCurve();
|
|
|
selectedFields.Add(path);
|
|
selectedFields.Add(path);
|
|
|
|
|
|
|
|
- curves[path] = fieldCurves;
|
|
|
|
|
|
|
+ clipInfo.curves[path] = fieldCurves;
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ EditorApplication.SetProjectDirty();
|
|
|
UpdateDisplayedCurves();
|
|
UpdateDisplayedCurves();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1139,16 +861,17 @@ namespace BansheeEditor
|
|
|
for (int i = 0; i < selectedFields.Count; i++)
|
|
for (int i = 0; i < selectedFields.Count; i++)
|
|
|
{
|
|
{
|
|
|
selectedFields.Remove(selectedFields[i]);
|
|
selectedFields.Remove(selectedFields[i]);
|
|
|
- curves.Remove(GetSubPathParent(selectedFields[i]));
|
|
|
|
|
|
|
+ clipInfo.curves.Remove(GetSubPathParent(selectedFields[i]));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
List<string> existingFields = new List<string>();
|
|
List<string> existingFields = new List<string>();
|
|
|
- foreach (var KVP in curves)
|
|
|
|
|
|
|
+ foreach (var KVP in clipInfo.curves)
|
|
|
existingFields.Add(KVP.Key);
|
|
existingFields.Add(KVP.Key);
|
|
|
|
|
|
|
|
guiFieldDisplay.SetFields(existingFields.ToArray());
|
|
guiFieldDisplay.SetFields(existingFields.ToArray());
|
|
|
|
|
|
|
|
selectedFields.Clear();
|
|
selectedFields.Clear();
|
|
|
|
|
+ EditorApplication.SetProjectDirty();
|
|
|
UpdateDisplayedCurves();
|
|
UpdateDisplayedCurves();
|
|
|
}
|
|
}
|
|
|
#endregion
|
|
#endregion
|
|
@@ -1195,8 +918,8 @@ namespace BansheeEditor
|
|
|
subPathSuffix = path.Substring(index, path.Length - index);
|
|
subPathSuffix = path.Substring(index, path.Length - index);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- FieldCurves fieldCurves;
|
|
|
|
|
- if (curves.TryGetValue(parentPath, out fieldCurves))
|
|
|
|
|
|
|
+ FieldAnimCurves fieldCurves;
|
|
|
|
|
+ if (clipInfo.curves.TryGetValue(parentPath, out fieldCurves))
|
|
|
{
|
|
{
|
|
|
if (!string.IsNullOrEmpty(subPathSuffix))
|
|
if (!string.IsNullOrEmpty(subPathSuffix))
|
|
|
{
|
|
{
|
|
@@ -1264,9 +987,6 @@ namespace BansheeEditor
|
|
|
#region Input callbacks
|
|
#region Input callbacks
|
|
|
private void OnPointerPressed(PointerEvent ev)
|
|
private void OnPointerPressed(PointerEvent ev)
|
|
|
{
|
|
{
|
|
|
- if (!isInitialized)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
guiCurveEditor.OnPointerPressed(ev);
|
|
guiCurveEditor.OnPointerPressed(ev);
|
|
|
|
|
|
|
|
if (ev.button == PointerButton.Middle)
|
|
if (ev.button == PointerButton.Middle)
|
|
@@ -1283,9 +1003,6 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
private void OnPointerMoved(PointerEvent ev)
|
|
private void OnPointerMoved(PointerEvent ev)
|
|
|
{
|
|
{
|
|
|
- if (!isInitialized)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
guiCurveEditor.OnPointerMoved(ev);
|
|
guiCurveEditor.OnPointerMoved(ev);
|
|
|
|
|
|
|
|
if (isButtonHeld)
|
|
if (isButtonHeld)
|
|
@@ -1321,17 +1038,11 @@ namespace BansheeEditor
|
|
|
isButtonHeld = false;
|
|
isButtonHeld = false;
|
|
|
isDragInProgress = false;
|
|
isDragInProgress = false;
|
|
|
|
|
|
|
|
- if (!isInitialized)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
guiCurveEditor.OnPointerReleased(ev);
|
|
guiCurveEditor.OnPointerReleased(ev);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnButtonUp(ButtonEvent ev)
|
|
private void OnButtonUp(ButtonEvent ev)
|
|
|
{
|
|
{
|
|
|
- if (!isInitialized)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
guiCurveEditor.OnButtonUp(ev);
|
|
guiCurveEditor.OnButtonUp(ev);
|
|
|
}
|
|
}
|
|
|
#endregion
|
|
#endregion
|
|
@@ -1368,13 +1079,19 @@ namespace BansheeEditor
|
|
|
|
|
|
|
|
private void OnSelectionChanged(SceneObject[] sceneObjects, string[] resourcePaths)
|
|
private void OnSelectionChanged(SceneObject[] sceneObjects, string[] resourcePaths)
|
|
|
{
|
|
{
|
|
|
- RebuildGUI();
|
|
|
|
|
|
|
+ UpdateSelectedSO();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void OnFrameSelected(int frameIdx)
|
|
private void OnFrameSelected(int frameIdx)
|
|
|
{
|
|
{
|
|
|
SetCurrentFrame(frameIdx);
|
|
SetCurrentFrame(frameIdx);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ private void OnEventsChanged()
|
|
|
|
|
+ {
|
|
|
|
|
+ clipInfo.events = guiCurveEditor.Events;
|
|
|
|
|
+ EditorApplication.SetProjectDirty();
|
|
|
|
|
+ }
|
|
|
#endregion
|
|
#endregion
|
|
|
}
|
|
}
|
|
|
|
|
|