Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
UniGLTF-1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ousttrue committed May 17, 2018
1 parent d7eedbb commit 04f8a4c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 9 deletions.
48 changes: 43 additions & 5 deletions Core/Scripts/Editor/UniGLTFVersionMenu.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System.IO;
#if UNIGLTF_DEVELOP
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;


Expand All @@ -24,24 +27,59 @@ public static class UniGLTFVersion
}}
";

#if UNIGLTF_DEVELOP
[MenuItem(UniGLTFVersion.IncrementMenuName)]
#endif
public static void IncrementVersion()
{
var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR + 1);
File.WriteAllText(path, source);
AssetDatabase.Refresh();
}

#if UNIGLTF_DEVELOP
[MenuItem(UniGLTFVersion.DecrementMenuName)]
#endif
public static void DecrementVersion()
{
var source = string.Format(template, UniGLTFVersion.MAJOR, UniGLTFVersion.MINOR - 1);
File.WriteAllText(path, source);
AssetDatabase.Refresh();
}

static IEnumerable<string> EnumerateFiles(string path)
{
if (Path.GetFileName(path).StartsWith(".git"))
{
yield break;
}

if (Directory.Exists(path))
{
foreach (var child in Directory.GetFileSystemEntries(path))
{
foreach (var x in EnumerateFiles(child))
{
yield return x;
}
}
}
else
{
if (Path.GetExtension(path).ToLower() != ".meta")
{
yield return path.Replace("\\", "/");
}
}
}

[MenuItem("UniGLTF/Export unitypackage")]
public static void CreateUnityPackage()
{
var path = EditorUtility.SaveFilePanel(
"export package",
null,
string.Format("UniGLTF-{0}.unitypackage", UniGLTFVersion.VERSION),
"unitypackage");
AssetDatabase.ExportPackage(EnumerateFiles("Assets/UniGLTF").ToArray()
, path, ExportPackageOptions.Interactive);
}
}
}
#endif
8 changes: 4 additions & 4 deletions Core/Scripts/UniGLTFVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ namespace UniGLTF
public static class UniGLTFVersion
{
public const int MAJOR = 1;
public const int MINOR = 5;
public const int MINOR = 6;

public const string VERSION = "1.5";
public const string VERSION = "1.6";

public const string DecrementMenuName = "UniGLTF/Version(1.5) Decrement";
public const string IncrementMenuName = "UniGLTF/Version(1.5) Increment";
public const string DecrementMenuName = "UniGLTF/Version(1.6) Decrement";
public const string IncrementMenuName = "UniGLTF/Version(1.6) Increment";
}
}

0 comments on commit 04f8a4c

Please sign in to comment.