summaryrefslogtreecommitdiffstats
path: root/Scripts/Fold/Editor/FoldEditorWindow.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/Fold/Editor/FoldEditorWindow.cs')
-rwxr-xr-xScripts/Fold/Editor/FoldEditorWindow.cs38
1 files changed, 30 insertions, 8 deletions
diff --git a/Scripts/Fold/Editor/FoldEditorWindow.cs b/Scripts/Fold/Editor/FoldEditorWindow.cs
index 48bfe2b..7cfb8aa 100755
--- a/Scripts/Fold/Editor/FoldEditorWindow.cs
+++ b/Scripts/Fold/Editor/FoldEditorWindow.cs
@@ -249,13 +249,16 @@ public class FoldEditorWindow : EditorWindow
{
EditorGUILayout.BeginHorizontal();
- if (GUILayout.Button("Create Keyframe", GUILayout.Height(30)))
+ if (GUILayout.Button(new GUIContent("W", "Write keyframe at playhead"), GUILayout.Width(36), GUILayout.Height(36)))
ApplyToMaterial(recordKeyframes: true);
- if (GUILayout.Button("Delete Keyframe", GUILayout.Height(30), GUILayout.Width(120)))
+ if (GUILayout.Button(new GUIContent("R", "Read animation values at playhead into editor"), GUILayout.Width(36), GUILayout.Height(36)))
+ ReadFromPlayhead();
+
+ if (GUILayout.Button(new GUIContent("X", "Delete keyframe at playhead"), GUILayout.Width(36), GUILayout.Height(36)))
DeleteKeyframeAtCurrentTime();
- if (GUILayout.Button("Clear All", GUILayout.Height(30), GUILayout.Width(80)))
+ if (GUILayout.Button(new GUIContent("C", "Clear all operations"), GUILayout.Width(36), GUILayout.Height(36)))
{
if (EditorUtility.DisplayDialog("Clear All Operations",
"Remove all operations from the pipeline?", "Clear", "Cancel"))
@@ -272,13 +275,13 @@ public class FoldEditorWindow : EditorWindow
EditorGUILayout.Space(3);
EditorGUILayout.BeginHorizontal();
- if (GUILayout.Button(new GUIContent("<", "Retreat playhead"), GUILayout.Width(30), GUILayout.Height(20)))
+ if (GUILayout.Button(new GUIContent("<", "Retreat playhead"), GUILayout.Width(36), GUILayout.Height(36)))
AdvancePlayhead(-frameStep);
- frameStep = EditorGUILayout.IntField(frameStep, GUILayout.Width(40));
+ frameStep = EditorGUILayout.IntField(frameStep, GUILayout.Width(40), GUILayout.Height(36));
if (frameStep < 1) frameStep = 1;
- if (GUILayout.Button(new GUIContent(">", "Advance playhead"), GUILayout.Width(30), GUILayout.Height(20)))
+ if (GUILayout.Button(new GUIContent(">", "Advance playhead"), GUILayout.Width(36), GUILayout.Height(36)))
AdvancePlayhead(frameStep);
- if (GUILayout.Button(new GUIContent("x", "Snap to nearest keyframe"), GUILayout.Width(30), GUILayout.Height(20)))
+ if (GUILayout.Button(new GUIContent("Q", "Quantize: snap to nearest keyframe"), GUILayout.Width(36), GUILayout.Height(36)))
SnapToNearestKeyframe();
GUILayout.FlexibleSpace();
EditorGUILayout.LabelField($"Operations: {operations.Count}/16", EditorStyles.miniLabel);
@@ -376,6 +379,20 @@ public class FoldEditorWindow : EditorWindow
#region Animation Recording
+ void ReadFromPlayhead()
+ {
+ if (!TryGetAnimationWindowState(out var clip, out float time))
+ return;
+
+ var savedExpanded = new List<int>(expandedOps);
+ LoadFromAnimationClip(clip, time);
+ expandedOps = savedExpanded;
+ expandedOps.RemoveAll(i => i >= operations.Count);
+ lastAnimTime = time;
+ ApplyToMaterial();
+ Repaint();
+ }
+
void RecordAnimationKeyframes(FoldPipelineBuilder builder)
{
if (targetObject == null || !AnimationMode.InAnimationMode())
@@ -519,7 +536,10 @@ public class FoldEditorWindow : EditorWindow
if (!TryGetAnimationWindowState(out var clip, out float time))
return;
float frameDuration = 1f / clip.frameRate;
- SetAnimationWindowTime(time + frames * frameDuration);
+ float newTime = time + frames * frameDuration;
+ SetAnimationWindowTime(newTime);
+ lastAnimTime = newTime; // Suppress OnEditorUpdate from reloading animation data.
+ ApplyToMaterial(); // Re-apply current editor state so the scene stays in sync.
Repaint();
}
@@ -552,6 +572,8 @@ public class FoldEditorWindow : EditorWindow
if (bestDist < float.MaxValue)
{
SetAnimationWindowTime(bestTime);
+ lastAnimTime = bestTime; // Suppress OnEditorUpdate from reloading animation data.
+ ApplyToMaterial(); // Re-apply current editor state so the scene stays in sync.
Repaint();
}
}