コード例 #1
0
        private static void AddToClipboard(object obj, string propertyName, string label, Object context)
        {
            if (obj == null || obj.Equals(null))
            {
                return;
            }

            LoadClipboard();

            if (clipboard.Count >= CLIPBOARD_CAPACITY)
            {
                clipboard.RemoveAt(0);

                if (mainWindow)
                {
                    mainWindow.clipboardValues.RemoveAt(0);
                }
            }

            clipboard.Add(new SerializedClipboard(obj, context, propertyName, label));
            ActiveClipboardIndex = clipboard.Count - 1;

            if (mainWindow)
            {
                mainWindow.clipboardValues.Add(clipboard[clipboard.Count - 1].RootValue.GetClipboardObject(null));
                mainWindow.Repaint();
            }

            // Call SaveClipboard in the next frame because sometimes AddToClipboard can be called in a batch (e.g. drag & drop,
            // context menu) and we don't want to execute multiple file save operations in the same frame for no reason
            EditorApplication.update -= SaveClipboardDelayed;
            EditorApplication.update += SaveClipboardDelayed;
        }
コード例 #2
0
        public static void AddToClipboard(object obj, string label)
        {
            if (obj == null || obj.Equals(null))
            {
                return;
            }

            if (clipboard.Count >= CLIPBOARD_CAPACITY)
            {
                clipboard.RemoveAt(0);
                clipboardLabels.RemoveAt(0);
            }

            clipboard.Add(obj);
            clipboardLabels.Add(new GUIContent(label, label));

            activeClipboardIndex = clipboard.Count - 1;

            if (mainWindow)
            {
                mainWindow.Repaint();
            }
        }