Пример #1
0
 private static void ContextMenuItemCopyObject(MenuCommand command)
 {
     if (command.context)
     {
         PasteBinWindow.AddToClipboard(command.context, Utilities.GetDetailedObjectName(command.context), command.context);
     }
     else
     {
         PasteBinWindow.AddToClipboard(Selection.activeObject, Utilities.GetDetailedObjectName(Selection.activeObject), Selection.activeObject);
     }
 }
Пример #2
0
        private static void CopyCompleteGameObject(bool withChildren)
        {
            GameObject[] selectedGameObjects = Selection.GetFiltered <GameObject>(SelectionMode.TopLevel | SelectionMode.ExcludePrefab | SelectionMode.Editable);

            // Sorting selection can be important when all copied objects have the same name because their order will matter for Smart Paste's RelativePath
            System.Array.Sort(selectedGameObjects, (go1, go2) => CompareHierarchySiblingIndices(go1.transform, go2.transform));

            if (selectedGameObjects.Length > 0)
            {
                string label = Utilities.GetDetailedObjectName(selectedGameObjects[0]);
                if (selectedGameObjects.Length > 1)
                {
                    label += " (and " + (selectedGameObjects.Length - 1) + " more)";
                }

                PasteBinWindow.AddToClipboard(new GameObjectHierarchyClipboard(selectedGameObjects, withChildren), label + " (Complete GameObject)", null);
            }
        }
Пример #3
0
        private static void MenuItemCopyAssetFiles(MenuCommand command)
        {
            // We are using EditorApplication.update to copy all selected asset files in one batch (else-clause)
            if (command.context)
            {
                EditorApplication.update -= CallCopyAssetFilesOnce;
                EditorApplication.update += CallCopyAssetFilesOnce;
            }
            else
            {
                string[] selectedAssets = GetSelectedAssetPaths(false, true);
                if (selectedAssets.Length > 0)
                {
                    string label = selectedAssets[0];
                    if (selectedAssets.Length > 1)
                    {
                        label += " (and " + (selectedAssets.Length - 1) + " more)";
                    }

                    PasteBinWindow.AddToClipboard(new AssetFilesClipboard(selectedAssets), label + " (Asset File)", null);
                }
            }
        }
Пример #4
0
 private static void CopyValue(object obj)
 {
     PasteBinWindow.AddToClipboard((SerializedProperty)obj);
 }