private void setAnimationClip(object userData) { ContextSetAnimationClip arg = userData as ContextSetAnimationClip; if (arg != null) { Undo.RecordObject(arg.shot, "Set AnimationClip"); arg.shot.clipName = arg.clipName; arg.shot.LoadAnim(); } }
protected override void showContextMenu(Behaviour behaviour) { CinemaShot shot = behaviour as CinemaShot; if (shot == null) { return; } Camera[] cameras = Object.FindObjectsOfType <Camera>(); GenericMenu createMenu = new GenericMenu(); createMenu.AddItem(new GUIContent("Rename"), false, renameItem, behaviour); createMenu.AddItem(new GUIContent("Copy"), false, copyItem, behaviour); createMenu.AddItem(new GUIContent("Delete"), false, deleteItem, shot); createMenu.AddSeparator(string.Empty); createMenu.AddItem(new GUIContent("Focus"), false, focusShot, shot); foreach (Camera c in cameras) { ContextSetCamera arg = new ContextSetCamera { shot = shot, camera = c }; createMenu.AddItem(new GUIContent(string.Format(MODIFY_CAMERA, c.gameObject.name)), false, setCamera, arg); } Cutscene.ForeachDir(CinemaShot.animDir, path => { ContextSetAnimationClip arg = new ContextSetAnimationClip { shot = shot, clipName = path }; createMenu.AddItem(new GUIContent(string.Format(MODIFY_ANIMATION, path)), false, setAnimationClip, arg); }); createMenu.ShowAsContext(); }