public static void Show(string defaultAnimationName, int defaultFPS, Action <string, int> callbackAccept) { CreateAnimationPopup window = CreateInstance <CreateAnimationPopup>(); window._callbackAccept = callbackAccept; window._animationName = defaultAnimationName; window._fps = defaultFPS; window.position = new Rect(Screen.width / 2, Screen.height / 2, 300, 160); window.titleContent.text = "Create animation"; window.ShowUtility(); }
static void CreateFromSprites_ContextMenu(MenuCommand command) { Texture2D[] frames = Selection.GetFiltered <Texture2D>(SelectionMode.Assets); if (frames.Length > 0) { Texture2D firstFrame = frames[0]; string firstFramePath = AssetDatabase.GetAssetPath(firstFrame); string folderPath = Path.GetDirectoryName(firstFramePath); string defaultAnimName = Path.GetFileNameWithoutExtension(firstFramePath); int defaultFPS = 24; CreateAnimationPopup.Show(defaultAnimName, defaultFPS, delegate(string animName, int fps) { CreateSpriteAnimation(fps, folderPath, animName, "", frames); }); } }