Initial Commit
This commit is contained in:
8
CopyCutPaste/Editor.meta
Normal file
8
CopyCutPaste/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 214b8dfd44e5d9240b993faa65d5bd17
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
84
CopyCutPaste/Editor/CopyCutPaste.cs
Normal file
84
CopyCutPaste/Editor/CopyCutPaste.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
namespace DreadScripts.CopyCutPaste
|
||||
{
|
||||
public class CopyCutPaste
|
||||
{
|
||||
private static bool copy;
|
||||
private static string[] _tempGUID;
|
||||
private static string[] assetsGUID;
|
||||
|
||||
[MenuItem("Assets/Copy", false, 20)]
|
||||
private static void Copy()
|
||||
{
|
||||
copy = true;
|
||||
assetsGUID = _tempGUID;
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Cut", false, 20)]
|
||||
private static void Cut()
|
||||
{
|
||||
copy = false;
|
||||
assetsGUID = _tempGUID;
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Paste", false, 20)]
|
||||
private static void Paste()
|
||||
{
|
||||
string folderPath = AssetDatabase.GetAssetPath(Selection.activeObject);
|
||||
Move(folderPath, assetsGUID, copy);
|
||||
}
|
||||
|
||||
public static void Move(string destination, string[] assetsGUID, bool copy)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Path.GetExtension(destination)) && !AssetDatabase.IsValidFolder(destination))
|
||||
destination = Path.GetDirectoryName(destination);
|
||||
|
||||
try
|
||||
{
|
||||
AssetDatabase.StartAssetEditing();
|
||||
|
||||
foreach (string s in assetsGUID)
|
||||
{
|
||||
string filePath = AssetDatabase.GUIDToAssetPath(s);
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
|
||||
|
||||
if (copy)
|
||||
{
|
||||
AssetDatabase.CopyAsset(filePath, AssetDatabase.GenerateUniqueAssetPath(destination + "/" + fileName));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (destination + "/" + fileName != filePath)
|
||||
AssetDatabase.MoveAsset(filePath, AssetDatabase.GenerateUniqueAssetPath(destination + "/" + fileName));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(System.Exception e) { Debug.LogError(e);}
|
||||
finally
|
||||
{
|
||||
AssetDatabase.StopAssetEditing();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Copy", true, 20)]
|
||||
[MenuItem("Assets/Cut", true, 20)]
|
||||
private static bool ValidateSelect()
|
||||
{
|
||||
_tempGUID = Selection.assetGUIDs;
|
||||
return _tempGUID.Length > 0;
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Paste", true, 20)]
|
||||
private static bool ValidateMove()
|
||||
{
|
||||
return (assetsGUID != null && assetsGUID.Length > 0 && Selection.activeObject);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
11
CopyCutPaste/Editor/CopyCutPaste.cs.meta
Normal file
11
CopyCutPaste/Editor/CopyCutPaste.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e426aee4657d89e48be7f5d84c4adbdd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "com.dreadscripts.copycutpaste.Editor",
|
||||
"references": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 76bf5f01c2ff3744eab2e7b22276e902
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
21
CopyCutPaste/LICENSE
Normal file
21
CopyCutPaste/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Dreadrith
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
7
CopyCutPaste/LICENSE.meta
Normal file
7
CopyCutPaste/LICENSE.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b549fccaaa3640d439317f3d4c5e43ba
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
7
CopyCutPaste/README.md
Normal file
7
CopyCutPaste/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# CopyCutPaste
|
||||
Adds 3 much needed buttons to Unity assets: Copy, Cut, and Paste. Does what's expected.
|
||||
|
||||
### [Download From Here](https://vpm.dreadscripts.com/)
|
||||
|
||||
### Thank You
|
||||
If you enjoy CopyCutPaste, please consider [supporting me ♡](https://ko-fi.com/Dreadrith)!
|
7
CopyCutPaste/README.md.meta
Normal file
7
CopyCutPaste/README.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b36388504e24a824fa514d38dbf5b32c
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
17
CopyCutPaste/package.json
Normal file
17
CopyCutPaste/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "com.dreadscripts.copycutpaste",
|
||||
"displayName": "DreadScripts - CopyCutPaste",
|
||||
"version": "1.0.1",
|
||||
"description": "Adds 3 much needed buttons to Unity assets: Copy, Cut, and Paste.",
|
||||
"gitDependencies": {},
|
||||
"vpmDependencies": {},
|
||||
"author": {
|
||||
"name": "Dreadrith",
|
||||
"email": "dreadscripts@gmail.com",
|
||||
"url": "https://www.dreadrith.com"
|
||||
},
|
||||
"legacyFolders": {},
|
||||
"legacyFiles": {},
|
||||
"type": "tool",
|
||||
"unity": "2019.4"
|
||||
}
|
7
CopyCutPaste/package.json.meta
Normal file
7
CopyCutPaste/package.json.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97bb26747222b3d4f96722ba6c1fb318
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user