- Home /
Forcing curves to update in animation editor window
Hi, I've written a tool to allow our artists to edit animation curves in the 3D view. I would like these to update the animation editor window's curves in real time as they're edited - currently, I have to switch between dopesheet and curve editor to see any changes.
I've tried a few methods but nothing seems to force the window to refresh those curves:
attempt 1:
`UnityEditorInternal.InternalEditorUtility.RepaintAllViews();` //doesn't seem to do anything
attempt 2:
System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly;
System.Type type = assembly.GetType("UnityEditor.AnimationWindow");
EditorWindow gameview = EditorWindow.GetWindow(type);
EditorUtility.SetDirty(gameview); //Was hoping this would inform unity that the animation is dirty
gameview.Repaint();
I tried grabbing the methods from the AnimationWindow but there was nothing in there that suggested curve editing. I also tried grabbing 'CurveEditorWindow' but I think this refers to the popup curve editor seen in the inspector panels as calling 'EditorWindow.GetWindow' seemed to invoke the constructor for that type rather than (as expected), grabbing a window of that type that's already extant, which caused a bunch of errors as its out of context.
So, anyway: does anybody know the magic words required to get this window to recalculate its curves?
Thanks for your time,