Vector int add to swizzle
Upgrade Building utils
This commit is contained in:
parent
ad760f57b0
commit
359b616be9
@ -1,13 +1,45 @@
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build.Player;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
public static class BuildingUtils
|
||||
{
|
||||
private const string SteamBuildDefine = "STEAM_BUILD";
|
||||
|
||||
[MenuItem("Tools/PrepareForBuild", priority = -10)]
|
||||
public static void PrepareForBuild()
|
||||
{
|
||||
var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(
|
||||
BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));
|
||||
var args = PlayerSettings.GetAdditionalCompilerArguments(namedBuildTarget);
|
||||
var argsList = args.ToList();
|
||||
argsList.Remove(SteamBuildDefine);
|
||||
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, argsList.ToArray());
|
||||
}
|
||||
|
||||
[MenuItem("Tools/PlatformDefines/Steam", priority = -1)]
|
||||
public static void SetDefinesForSteam()
|
||||
{
|
||||
PrepareForBuild();
|
||||
|
||||
var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(
|
||||
BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));
|
||||
var args = PlayerSettings.GetAdditionalCompilerArguments(namedBuildTarget);
|
||||
var argsList = args.ToList();
|
||||
argsList.Add(SteamBuildDefine);
|
||||
PlayerSettings.SetScriptingDefineSymbols(namedBuildTarget, argsList.ToArray());
|
||||
}
|
||||
|
||||
|
||||
[MenuItem("Tools/Build/Steam/Release")]
|
||||
public static void SteamRelease()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
|
||||
IncreaseBuildNumber();
|
||||
BuildRelease();
|
||||
UploadSteam();
|
||||
@ -16,6 +48,9 @@ public static class BuildingUtils
|
||||
[MenuItem("Tools/Build/Steam/Development")]
|
||||
public static void SteamDevelopment()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
|
||||
IncreaseBuildNumber();
|
||||
BuildDevelopment();
|
||||
UploadSteam();
|
||||
@ -25,20 +60,34 @@ public static class BuildingUtils
|
||||
[MenuItem("Tools/Build/All Release")]
|
||||
public static void BuildRelease()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
BuildWindowsRelease();
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build/All Development")]
|
||||
public static void BuildDevelopment()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
BuildWindowsDevelopment();
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build/Platform/Windows/x64-Development")]
|
||||
public static void BuildWindowsDevelopment() => BuildWindows(false);
|
||||
public static void BuildWindowsDevelopment()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
BuildWindows(false);
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Build/Platform/Windows/x64-Release")]
|
||||
public static void BuildWindowsRelease() => BuildWindows(true);
|
||||
public static void BuildWindowsRelease()
|
||||
{
|
||||
if(!CanBuild())
|
||||
return;
|
||||
BuildWindows(true);
|
||||
}
|
||||
|
||||
|
||||
private static void BuildWindows(bool release)
|
||||
@ -81,4 +130,25 @@ public static class BuildingUtils
|
||||
Debug.Log(process.ExitCode);
|
||||
process.Close();
|
||||
}
|
||||
|
||||
private static bool CanBuild()
|
||||
{
|
||||
if (CanBuildUtil())
|
||||
return true;
|
||||
Debug.LogError("Cannot build with defines set in project, please use PrepareForBuild and wait for scripts recompilation");
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool CanBuildUtil()
|
||||
{
|
||||
var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(
|
||||
BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget));
|
||||
var args = PlayerSettings.GetAdditionalCompilerArguments(namedBuildTarget);
|
||||
var argsList = args.ToList();
|
||||
|
||||
if (argsList.Contains(SteamBuildDefine))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace NEG.Utils
|
||||
* Version 1.0
|
||||
*/
|
||||
|
||||
static class Vector2Swizzles
|
||||
public static class Vector2Swizzles
|
||||
{
|
||||
//swizzles of size 2
|
||||
public static Vector2 xx(this Vector2 a) { return new Vector2(a.x, a.x); }
|
||||
@ -47,7 +47,7 @@ namespace NEG.Utils
|
||||
public static Vector4 yyyy(this Vector2 a) { return new Vector4(a.y, a.y, a.y, a.y); }
|
||||
}
|
||||
|
||||
static class Vector3Swizzles
|
||||
public static class Vector3Swizzles
|
||||
{
|
||||
//swizzles of size 2
|
||||
public static Vector2 xx(this Vector3 a) { return new Vector2(a.x, a.x); }
|
||||
@ -175,7 +175,7 @@ namespace NEG.Utils
|
||||
public static Vector4 zzzz(this Vector3 a) { return new Vector4(a.z, a.z, a.z, a.z); }
|
||||
}
|
||||
|
||||
static class Vector4Swizzles
|
||||
public static class Vector4Swizzles
|
||||
{
|
||||
//swizzles of size 2
|
||||
public static Vector2 xx(this Vector4 a) { return new Vector2(a.x, a.x); }
|
||||
@ -521,4 +521,67 @@ namespace NEG.Utils
|
||||
public static Vector4 zwww(this Vector4 a) { return new Vector4(a.z, a.w, a.w, a.w); }
|
||||
public static Vector4 wwww(this Vector4 a) { return new Vector4(a.w, a.w, a.w, a.w); }
|
||||
}
|
||||
|
||||
public static class Vector2IntSwizzles
|
||||
{
|
||||
//swizzles of size 2
|
||||
public static Vector2Int xx(this Vector2Int a) { return new Vector2Int(a.x, a.x); }
|
||||
public static Vector2Int yx(this Vector2Int a) { return new Vector2Int(a.y, a.x); }
|
||||
public static Vector2Int xy(this Vector2Int a) { return new Vector2Int(a.x, a.y); }
|
||||
|
||||
public static Vector2Int yy(this Vector2Int a) { return new Vector2Int(a.y, a.y); }
|
||||
|
||||
//swizzles of size 3
|
||||
public static Vector3Int xxx(this Vector2Int a) { return new Vector3Int(a.x, a.x, a.x); }
|
||||
public static Vector3Int yxx(this Vector2Int a) { return new Vector3Int(a.y, a.x, a.x); }
|
||||
public static Vector3Int xyx(this Vector2Int a) { return new Vector3Int(a.x, a.y, a.x); }
|
||||
public static Vector3Int yyx(this Vector2Int a) { return new Vector3Int(a.y, a.y, a.x); }
|
||||
public static Vector3Int xxy(this Vector2Int a) { return new Vector3Int(a.x, a.x, a.y); }
|
||||
public static Vector3Int yxy(this Vector2Int a) { return new Vector3Int(a.y, a.x, a.y); }
|
||||
public static Vector3Int xyy(this Vector2Int a) { return new Vector3Int(a.x, a.y, a.y); }
|
||||
public static Vector3Int yyy(this Vector2Int a) { return new Vector3Int(a.y, a.y, a.y); }
|
||||
}
|
||||
|
||||
public static class Vector3IntSwizzles
|
||||
{
|
||||
//swizzles of size 2
|
||||
public static Vector2Int xx(this Vector3Int a) { return new Vector2Int(a.x, a.x); }
|
||||
public static Vector2Int yx(this Vector3Int a) { return new Vector2Int(a.y, a.x); }
|
||||
public static Vector2Int zx(this Vector3Int a) { return new Vector2Int(a.z, a.x); }
|
||||
public static Vector2Int xy(this Vector3Int a) { return new Vector2Int(a.x, a.y); }
|
||||
public static Vector2Int yy(this Vector3Int a) { return new Vector2Int(a.y, a.y); }
|
||||
public static Vector2Int zy(this Vector3Int a) { return new Vector2Int(a.z, a.y); }
|
||||
public static Vector2Int xz(this Vector3Int a) { return new Vector2Int(a.x, a.z); }
|
||||
public static Vector2Int yz(this Vector3Int a) { return new Vector2Int(a.y, a.z); }
|
||||
public static Vector2Int zz(this Vector3Int a) { return new Vector2Int(a.z, a.z); }
|
||||
|
||||
//swizzles of size 3
|
||||
public static Vector3Int xxx(this Vector3Int a) { return new Vector3Int(a.x, a.x, a.x); }
|
||||
public static Vector3Int yxx(this Vector3Int a) { return new Vector3Int(a.y, a.x, a.x); }
|
||||
public static Vector3Int zxx(this Vector3Int a) { return new Vector3Int(a.z, a.x, a.x); }
|
||||
public static Vector3Int xyx(this Vector3Int a) { return new Vector3Int(a.x, a.y, a.x); }
|
||||
public static Vector3Int yyx(this Vector3Int a) { return new Vector3Int(a.y, a.y, a.x); }
|
||||
public static Vector3Int zyx(this Vector3Int a) { return new Vector3Int(a.z, a.y, a.x); }
|
||||
public static Vector3Int xzx(this Vector3Int a) { return new Vector3Int(a.x, a.z, a.x); }
|
||||
public static Vector3Int yzx(this Vector3Int a) { return new Vector3Int(a.y, a.z, a.x); }
|
||||
public static Vector3Int zzx(this Vector3Int a) { return new Vector3Int(a.z, a.z, a.x); }
|
||||
public static Vector3Int xxy(this Vector3Int a) { return new Vector3Int(a.x, a.x, a.y); }
|
||||
public static Vector3Int yxy(this Vector3Int a) { return new Vector3Int(a.y, a.x, a.y); }
|
||||
public static Vector3Int zxy(this Vector3Int a) { return new Vector3Int(a.z, a.x, a.y); }
|
||||
public static Vector3Int xyy(this Vector3Int a) { return new Vector3Int(a.x, a.y, a.y); }
|
||||
public static Vector3Int yyy(this Vector3Int a) { return new Vector3Int(a.y, a.y, a.y); }
|
||||
public static Vector3Int zyy(this Vector3Int a) { return new Vector3Int(a.z, a.y, a.y); }
|
||||
public static Vector3Int xzy(this Vector3Int a) { return new Vector3Int(a.x, a.z, a.y); }
|
||||
public static Vector3Int yzy(this Vector3Int a) { return new Vector3Int(a.y, a.z, a.y); }
|
||||
public static Vector3Int zzy(this Vector3Int a) { return new Vector3Int(a.z, a.z, a.y); }
|
||||
public static Vector3Int xxz(this Vector3Int a) { return new Vector3Int(a.x, a.x, a.z); }
|
||||
public static Vector3Int yxz(this Vector3Int a) { return new Vector3Int(a.y, a.x, a.z); }
|
||||
public static Vector3Int zxz(this Vector3Int a) { return new Vector3Int(a.z, a.x, a.z); }
|
||||
public static Vector3Int xyz(this Vector3Int a) { return new Vector3Int(a.x, a.y, a.z); }
|
||||
public static Vector3Int yyz(this Vector3Int a) { return new Vector3Int(a.y, a.y, a.z); }
|
||||
public static Vector3Int zyz(this Vector3Int a) { return new Vector3Int(a.z, a.y, a.z); }
|
||||
public static Vector3Int xzz(this Vector3Int a) { return new Vector3Int(a.x, a.z, a.z); }
|
||||
public static Vector3Int yzz(this Vector3Int a) { return new Vector3Int(a.y, a.z, a.z); }
|
||||
public static Vector3Int zzz(this Vector3Int a) { return new Vector3Int(a.z, a.z, a.z); }
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user