|
@@ -19,105 +19,129 @@ namespace bs.Editor
|
|
|
/// Creates a new folder with in the specified folder.
|
|
/// Creates a new folder with in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the new folder in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the new folder in.</param>
|
|
|
- public static void CreateFolder(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateFolder(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New Folder");
|
|
string path = Path.Combine(folder, "New Folder");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
ProjectLibrary.CreateFolder(path);
|
|
ProjectLibrary.CreateFolder(path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new material with the default shader in the specified folder.
|
|
/// Creates a new material with the default shader in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the material in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the material in.</param>
|
|
|
- public static void CreateEmptyMaterial(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyMaterial(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New Material.asset");
|
|
string path = Path.Combine(folder, "New Material.asset");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
Material material = new Material(Builtin.GetShader(BuiltinShader.Standard));
|
|
Material material = new Material(Builtin.GetShader(BuiltinShader.Standard));
|
|
|
ProjectLibrary.Create(material, path);
|
|
ProjectLibrary.Create(material, path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new empty sprite texture in the specified folder.
|
|
/// Creates a new empty sprite texture in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the sprite texture in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the sprite texture in.</param>
|
|
|
- public static void CreateEmptySpriteTexture(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptySpriteTexture(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New Sprite Texture.asset");
|
|
string path = Path.Combine(folder, "New Sprite Texture.asset");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
SpriteTexture spriteTexture = new SpriteTexture(null);
|
|
SpriteTexture spriteTexture = new SpriteTexture(null);
|
|
|
ProjectLibrary.Create(spriteTexture, path);
|
|
ProjectLibrary.Create(spriteTexture, path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new empty string table in the specified folder.
|
|
/// Creates a new empty string table in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the string table in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the string table in.</param>
|
|
|
- public static void CreateEmptyStringTable(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyStringTable(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New String Table.asset");
|
|
string path = Path.Combine(folder, "New String Table.asset");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
StringTable stringTable = new StringTable();
|
|
StringTable stringTable = new StringTable();
|
|
|
ProjectLibrary.Create(stringTable, path);
|
|
ProjectLibrary.Create(stringTable, path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new empty GUI skin in the specified folder.
|
|
/// Creates a new empty GUI skin in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the GUI skin in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the GUI skin in.</param>
|
|
|
- public static void CreateEmptyGUISkin(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyGUISkin(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New GUI Skin.asset");
|
|
string path = Path.Combine(folder, "New GUI Skin.asset");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
GUISkin guiSkin = new GUISkin();
|
|
GUISkin guiSkin = new GUISkin();
|
|
|
ProjectLibrary.Create(guiSkin, path);
|
|
ProjectLibrary.Create(guiSkin, path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new shader containing a rough code outline in the specified folder.
|
|
/// Creates a new shader containing a rough code outline in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the shader in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the shader in.</param>
|
|
|
- public static void CreateEmptyShader(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyShader(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New Shader.bsl");
|
|
string path = Path.Combine(folder, "New Shader.bsl");
|
|
|
- path = Path.Combine(ProjectLibrary.ResourceFolder, path);
|
|
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
+ string filePath = Path.Combine(ProjectLibrary.ResourceFolder, path);
|
|
|
|
|
|
|
|
- File.WriteAllText(path, EditorBuiltin.EmptyShaderCode);
|
|
|
|
|
- ProjectLibrary.Refresh(path);
|
|
|
|
|
|
|
+ File.WriteAllText(filePath, EditorBuiltin.EmptyShaderCode);
|
|
|
|
|
+ ProjectLibrary.Refresh(filePath);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new C# script containing a rough code outline in the specified folder.
|
|
/// Creates a new C# script containing a rough code outline in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the C# script in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the C# script in.</param>
|
|
|
- public static void CreateEmptyCSScript(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyCSScript(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "NewScript.cs");
|
|
string path = Path.Combine(folder, "NewScript.cs");
|
|
|
- path = Path.Combine(ProjectLibrary.ResourceFolder, path);
|
|
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
+ string filePath = Path.Combine(ProjectLibrary.ResourceFolder, path);
|
|
|
|
|
+
|
|
|
|
|
+ File.WriteAllText(filePath, EditorBuiltin.EmptyCSScriptCode);
|
|
|
|
|
+ ProjectLibrary.Refresh(filePath);
|
|
|
|
|
|
|
|
- File.WriteAllText(path, EditorBuiltin.EmptyCSScriptCode);
|
|
|
|
|
- ProjectLibrary.Refresh(path);
|
|
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
/// Creates a new physics material with the default properties in the specified folder.
|
|
/// Creates a new physics material with the default properties in the specified folder.
|
|
|
/// </summary>
|
|
/// </summary>
|
|
|
/// <param name="folder">Folder relative to project library to create the material in.</param>
|
|
/// <param name="folder">Folder relative to project library to create the material in.</param>
|
|
|
- public static void CreateEmptyPhysicsMaterial(string folder)
|
|
|
|
|
|
|
+ /// <returns>The path of the created resource.</returns>
|
|
|
|
|
+ public static string CreateEmptyPhysicsMaterial(string folder)
|
|
|
{
|
|
{
|
|
|
string path = Path.Combine(folder, "New Physics Material.asset");
|
|
string path = Path.Combine(folder, "New Physics Material.asset");
|
|
|
path = GetUniquePath(path);
|
|
path = GetUniquePath(path);
|
|
|
|
|
|
|
|
PhysicsMaterial material = new PhysicsMaterial();
|
|
PhysicsMaterial material = new PhysicsMaterial();
|
|
|
ProjectLibrary.Create(material, path);
|
|
ProjectLibrary.Create(material, path);
|
|
|
|
|
+
|
|
|
|
|
+ return path;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -145,7 +169,7 @@ namespace bs.Editor
|
|
|
idx++;
|
|
idx++;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
string destination = path;
|
|
string destination = path;
|
|
|
while (ProjectLibrary.Exists(destination))
|
|
while (ProjectLibrary.Exists(destination))
|
|
|
{
|
|
{
|