Ejemplo n.º 1
0
    protected override void showBodyContextMenu(Event evt)
    {
        TimelineTrack itemTrack = TargetTrack.Behaviour as TimelineTrack;

        if (itemTrack == null)
        {
            return;
        }

        List <Type> trackTypes = itemTrack.GetAllowedCutsceneItems();
        GenericMenu createMenu = new GenericMenu();

        for (int i = 0; i < trackTypes.Count; i++)
        {
            ContextData data = getContextData(trackTypes[i]);
            data.Firetime = (evt.mousePosition.x - state.Translation.x) / state.Scale.x;
            createMenu.AddItem(new GUIContent(string.Format("Add New/{0}/{1}", data.Category, data.Label)), false, addCutsceneItem, data);
        }

        Behaviour    b            = DirectorCopyPaste.Peek();
        PasteContext pasteContext = new PasteContext(evt.mousePosition, itemTrack);

        if (b != null && DirectorHelper.IsTrackItemValidForTrack(b, itemTrack))
        {
            createMenu.AddItem(new GUIContent("Paste"), false, pasteItem, pasteContext);
        }
        else
        {
            createMenu.AddDisabledItem(new GUIContent("Paste"));
        }


        createMenu.ShowAsContext();
    }
Ejemplo n.º 2
0
    protected override void showBodyContextMenu(Event evt)
    {
        ShotTrack itemTrack = TargetTrack.Behaviour as ShotTrack;

        if (itemTrack == null)
        {
            return;
        }

        Behaviour b = DirectorCopyPaste.Peek();

        PasteContext pasteContext = new PasteContext(evt.mousePosition, itemTrack);
        GenericMenu  createMenu   = new GenericMenu();

        if (b != null && DirectorHelper.IsTrackItemValidForTrack(b, itemTrack))
        {
            createMenu.AddItem(new GUIContent("Paste"), false, pasteItem, pasteContext);
        }
        else
        {
            createMenu.AddDisabledItem(new GUIContent("Paste"));
        }
        createMenu.ShowAsContext();
    }