111
This commit is contained in:
440
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIPackageManagerHelper.cs
vendored
Normal file
440
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIPackageManagerHelper.cs
vendored
Normal file
@@ -0,0 +1,440 @@
|
||||
// Amplify Impostors
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEditor;
|
||||
using UnityEditor.PackageManager.Requests;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace AmplifyImpostors
|
||||
{
|
||||
public enum AIImportFlags
|
||||
{
|
||||
None = 0,
|
||||
URP = 1 << 0,
|
||||
HDRP = 1 << 1,
|
||||
Both = URP | HDRP
|
||||
}
|
||||
|
||||
public enum AISRPBaseline
|
||||
{
|
||||
AI_SRP_INVALID = 0,
|
||||
AI_SRP_10_X = 100000,
|
||||
AI_SRP_11_X = 110000,
|
||||
AI_SRP_12_X = 120000,
|
||||
AI_SRP_13_X = 130000,
|
||||
AI_SRP_14_X = 140000,
|
||||
AI_SRP_15_X = 150000,
|
||||
AI_SRP_16_X = 160000,
|
||||
AI_SRP_17_0 = 170000,
|
||||
AI_SRP_17_1 = 170100,
|
||||
AI_SRP_17_2 = 170200
|
||||
}
|
||||
|
||||
public class AISRPPackageDesc
|
||||
{
|
||||
public AISRPBaseline baseline = AISRPBaseline.AI_SRP_INVALID;
|
||||
public string guidURP = string.Empty;
|
||||
public string guidHDRP = string.Empty;
|
||||
|
||||
public AISRPPackageDesc( AISRPBaseline baseline, string guidURP, string guidHDRP )
|
||||
{
|
||||
this.baseline = baseline;
|
||||
this.guidURP = guidURP;
|
||||
this.guidHDRP = guidHDRP;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[InitializeOnLoad]
|
||||
public static class AIPackageManagerHelper
|
||||
{
|
||||
private static string URPPackageId = "com.unity.render-pipelines.universal";
|
||||
private static string HDRPPackageId = "com.unity.render-pipelines.high-definition";
|
||||
|
||||
private static string NewVersionDetectedFormat = "A new {0} version {1} was detected and compatible shaders are being imported.\nPlease hit the Update button on your ASE canvas to recompile your shader under the newest version.";
|
||||
private static string PackageBaseFormat = "AI_PkgBase_{0}_{1}";
|
||||
private static string PackageCRCFormat = "AI_PkgCRC_{0}_{1}";
|
||||
|
||||
private static string URPBakeTemplateGUID = "6ee191abcace33c46a5dd52068b074e0";
|
||||
private static string URPOctahedronGUID = "83dd8de9a5c14874884f9012def4fdcc";
|
||||
private static string URPSphericalGUID = "da79d698f4bf0164e910ad798d07efdf";
|
||||
|
||||
private static string HDRPBakeTemplateGUID = "5b7fbe5f8e132bd40b11a10c99044f79";
|
||||
private static string HDRPOctahedronGUID = "56236dc63ad9b7949b63a27f0ad180b3";
|
||||
private static string HDRPSphericalGUID = "175c951fec709c44fa2f26b8ab78b8dd";
|
||||
|
||||
private const string ImpostorsGCincGUID = "806d6cc0f22ee994f8cd901b6718f08d";
|
||||
|
||||
private static Dictionary<int, AISRPPackageDesc> m_srpPackageSupport = new Dictionary<int, AISRPPackageDesc>()
|
||||
{
|
||||
{ ( int )AISRPBaseline.AI_SRP_10_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_10_X, "06e710174fd46404391092ae9bc5e849", "d7ac8a02737091445aa206cd5bbc7101" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_11_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_11_X, "06e710174fd46404391092ae9bc5e849", "d7ac8a02737091445aa206cd5bbc7101" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_12_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_12_X, "a51904d3fea17d942a8935be648c3f0d", "741ca0d5f350e034e84999facc1de789" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_13_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_13_X, "a51904d3fea17d942a8935be648c3f0d", "741ca0d5f350e034e84999facc1de789" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_14_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_14_X, "ade3eaef5ceb09e42ade0a2d51d48465", "417c33caa5dee86498451657f089dfba" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_15_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_15_X, "3ba162bb5fa749244af39891d40a737e", "50089e2e3ccdc9a4185eea86c35460c4" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_16_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_16_X, "5d2a70fd39a1c484486c3719d8fca5d9", "0488f1df97596c544b1640896e525f9c" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_0, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_0, "8931284b085cd8f46a6e9f2662ff4db9", "081ebeca8cd4ada43b058a4e6c212ff0" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_1, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_1, "f760d13996060f84fbeb2beb11565431", "80fd9acc1fb7dbc4498a2405d1ccfd03" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_2, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_2, "92f8554d40b366447a0fe0a25a7a20ca", "8a63de5da688cba4b9fcf5ee113e69d5" ) },
|
||||
};
|
||||
|
||||
public static bool Supports( AISRPBaseline baseline ) { return m_srpPackageSupport.ContainsKey( ( int )baseline ); }
|
||||
|
||||
private static ListRequest m_packageListRequest = null;
|
||||
private static UnityEditor.PackageManager.PackageInfo m_urpPackageInfo;
|
||||
private static UnityEditor.PackageManager.PackageInfo m_hdrpPackageInfo;
|
||||
|
||||
private static bool m_lateImport = false;
|
||||
private static string m_latePackageToImport;
|
||||
private static bool m_requireUpdateList = false;
|
||||
private static AIImportFlags m_importingPackage = AIImportFlags.None;
|
||||
|
||||
private static AISRPBaseline m_currentURPBaseline = AISRPBaseline.AI_SRP_INVALID;
|
||||
private static AISRPBaseline m_currentHDRPBaseline = AISRPBaseline.AI_SRP_INVALID;
|
||||
|
||||
public static AISRPBaseline CurrentURPBaseline { get { return m_currentURPBaseline; } }
|
||||
public static AISRPBaseline CurrentHDRPBaseline { get { return m_currentHDRPBaseline; } }
|
||||
|
||||
private static int m_packageURPVersion = 0; // @diogo: starts as missing
|
||||
private static int m_packageHDRPVersion = 0;
|
||||
|
||||
public static int PackageURPBaseline { get { return m_packageURPVersion; } }
|
||||
public static int PackageHDRPBaseline { get { return m_packageHDRPVersion; } }
|
||||
|
||||
private static string m_projectName = null;
|
||||
private static string ProjectName
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( string.IsNullOrEmpty( m_projectName ) )
|
||||
{
|
||||
string[] s = Application.dataPath.Split( '/' );
|
||||
m_projectName = s[ s.Length - 2 ];
|
||||
}
|
||||
return m_projectName;
|
||||
}
|
||||
}
|
||||
|
||||
static AIPackageManagerHelper()
|
||||
{
|
||||
RequestInfo();
|
||||
}
|
||||
|
||||
static void WaitForPackageListBeforeUpdating()
|
||||
{
|
||||
if ( m_packageListRequest.IsCompleted )
|
||||
{
|
||||
Update();
|
||||
EditorApplication.update -= WaitForPackageListBeforeUpdating;
|
||||
}
|
||||
}
|
||||
|
||||
public static void RequestInfo()
|
||||
{
|
||||
if ( !m_requireUpdateList && m_importingPackage == AIImportFlags.None )
|
||||
{
|
||||
m_requireUpdateList = true;
|
||||
m_packageListRequest = UnityEditor.PackageManager.Client.List( true );
|
||||
EditorApplication.update += WaitForPackageListBeforeUpdating;
|
||||
}
|
||||
}
|
||||
|
||||
static void FailedPackageImport( string packageName, string errorMessage )
|
||||
{
|
||||
FinishImporter();
|
||||
}
|
||||
|
||||
static void CancelledPackageImport( string packageName )
|
||||
{
|
||||
FinishImporter();
|
||||
}
|
||||
|
||||
static void CompletedPackageImport( string packageName )
|
||||
{
|
||||
FinishImporter();
|
||||
}
|
||||
|
||||
public static void CheckLatePackageImport()
|
||||
{
|
||||
if ( !Application.isPlaying && m_lateImport && !string.IsNullOrEmpty( m_latePackageToImport ) )
|
||||
{
|
||||
m_lateImport = false;
|
||||
StartImporting( m_latePackageToImport );
|
||||
m_latePackageToImport = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool StartImporting( string packagePath )
|
||||
{
|
||||
if ( !Preferences.GlobalAutoSRP )
|
||||
{
|
||||
m_importingPackage = AIImportFlags.None;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( Application.isPlaying )
|
||||
{
|
||||
if ( !m_lateImport )
|
||||
{
|
||||
m_lateImport = true;
|
||||
m_latePackageToImport = packagePath;
|
||||
Debug.LogWarning( "Amplify Impostors requires the \"" + packagePath + "\" package to be installed in order to continue. Please exit Play mode to proceed." );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
AssetDatabase.importPackageCancelled += CancelledPackageImport;
|
||||
AssetDatabase.importPackageCompleted += CompletedPackageImport;
|
||||
AssetDatabase.importPackageFailed += FailedPackageImport;
|
||||
AssetDatabase.ImportPackage( packagePath, false );
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void FinishImporter()
|
||||
{
|
||||
m_importingPackage = AIImportFlags.None;
|
||||
AssetDatabase.importPackageCancelled -= CancelledPackageImport;
|
||||
AssetDatabase.importPackageCompleted -= CompletedPackageImport;
|
||||
AssetDatabase.importPackageFailed -= FailedPackageImport;
|
||||
}
|
||||
|
||||
private static readonly string SemVerPattern = @"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$";
|
||||
|
||||
public static int PackageVersionStringToCode( string version, out int major, out int minor, out int patch )
|
||||
{
|
||||
MatchCollection matches = Regex.Matches( version, SemVerPattern, RegexOptions.Multiline );
|
||||
|
||||
bool validMatch = ( matches.Count > 0 && matches[ 0 ].Groups.Count >= 4 );
|
||||
major = validMatch ? int.Parse( matches[ 0 ].Groups[ 1 ].Value ) : 99;
|
||||
minor = validMatch ? int.Parse( matches[ 0 ].Groups[ 2 ].Value ) : 99;
|
||||
patch = validMatch ? int.Parse( matches[ 0 ].Groups[ 3 ].Value ) : 99;
|
||||
|
||||
int versionCode;
|
||||
versionCode = major * 10000;
|
||||
versionCode += minor * 100;
|
||||
versionCode += patch;
|
||||
return versionCode;
|
||||
}
|
||||
|
||||
private static int PackageVersionElementsToCode( int major, int minor, int patch )
|
||||
{
|
||||
return major * 10000 + minor * 100 + patch;
|
||||
}
|
||||
|
||||
private static void CheckPackageImport( AIImportFlags flag, AISRPBaseline baseline, string guid, string version )
|
||||
{
|
||||
Debug.Assert( flag == AIImportFlags.HDRP || flag == AIImportFlags.URP );
|
||||
|
||||
string path = AssetDatabase.GUIDToAssetPath( guid );
|
||||
|
||||
if ( !string.IsNullOrEmpty( path ) && File.Exists( path ) )
|
||||
{
|
||||
uint currentCRC = CRC32( File.ReadAllBytes( path ) );
|
||||
|
||||
string srpName = flag.ToString();
|
||||
string packageBaseKey = string.Format( PackageBaseFormat, srpName, ProjectName );
|
||||
string packageCRCKey = string.Format( PackageCRCFormat, srpName, ProjectName );
|
||||
|
||||
AISRPBaseline savedBaseline = ( AISRPBaseline )EditorPrefs.GetInt( packageBaseKey );
|
||||
uint savedCRC = ( uint )EditorPrefs.GetInt( packageCRCKey, 0 );
|
||||
|
||||
bool foundNewVersion = ( savedBaseline != baseline ) || ( savedCRC != currentCRC );
|
||||
|
||||
EditorPrefs.SetInt( packageBaseKey, ( int )baseline );
|
||||
EditorPrefs.SetInt( packageCRCKey, ( int )currentCRC );
|
||||
|
||||
string testPath0 = string.Empty;
|
||||
string testPath1 = string.Empty;
|
||||
string testPath2 = string.Empty;
|
||||
|
||||
switch ( flag )
|
||||
{
|
||||
case AIImportFlags.URP:
|
||||
{
|
||||
testPath0 = AssetDatabase.GUIDToAssetPath( URPBakeTemplateGUID );
|
||||
testPath1 = AssetDatabase.GUIDToAssetPath( URPOctahedronGUID );
|
||||
testPath2 = AssetDatabase.GUIDToAssetPath( URPSphericalGUID );
|
||||
break;
|
||||
}
|
||||
case AIImportFlags.HDRP:
|
||||
{
|
||||
testPath0 = AssetDatabase.GUIDToAssetPath( HDRPBakeTemplateGUID );
|
||||
testPath1 = AssetDatabase.GUIDToAssetPath( HDRPOctahedronGUID );
|
||||
testPath2 = AssetDatabase.GUIDToAssetPath( HDRPSphericalGUID );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( foundNewVersion || !File.Exists( testPath0 ) || !File.Exists( testPath1 ) || !File.Exists( testPath2 ) )
|
||||
{
|
||||
m_importingPackage |= flag;
|
||||
if ( StartImporting( path ) && foundNewVersion )
|
||||
{
|
||||
Debug.Log( "[AmplifyImpostors] " + string.Format( NewVersionDetectedFormat, srpName, version ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
CheckLatePackageImport();
|
||||
|
||||
if ( m_requireUpdateList && m_importingPackage == AIImportFlags.None )
|
||||
{
|
||||
if ( m_packageListRequest != null && m_packageListRequest.IsCompleted )
|
||||
{
|
||||
m_requireUpdateList = false;
|
||||
foreach ( UnityEditor.PackageManager.PackageInfo pi in m_packageListRequest.Result )
|
||||
{
|
||||
int version = PackageVersionStringToCode( pi.version, out int major, out int minor, out int patch );
|
||||
|
||||
int baselineMajor = major;
|
||||
int baselineMinor = ( major >= 17 ) ? minor: 0; // from 17+ baseline includes minor version
|
||||
int baseline = PackageVersionElementsToCode( baselineMajor, baselineMinor, 0 );
|
||||
|
||||
AISRPPackageDesc match;
|
||||
|
||||
if ( pi.name.Equals( URPPackageId ) && m_srpPackageSupport.TryGetValue( baseline, out match ) )
|
||||
{
|
||||
// Universal Rendering Pipeline
|
||||
m_currentURPBaseline = match.baseline;
|
||||
m_packageURPVersion = version;
|
||||
m_urpPackageInfo = pi;
|
||||
|
||||
CheckPackageImport( AIImportFlags.URP, match.baseline, match.guidURP, pi.version );
|
||||
}
|
||||
else if ( pi.name.Equals( HDRPPackageId ) && m_srpPackageSupport.TryGetValue( baseline, out match ) )
|
||||
{
|
||||
// High-Definition Rendering Pipeline
|
||||
m_currentHDRPBaseline = match.baseline;
|
||||
m_packageHDRPVersion = version;
|
||||
m_hdrpPackageInfo = pi;
|
||||
|
||||
CheckPackageImport( AIImportFlags.HDRP, match.baseline, match.guidHDRP, pi.version );
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure AmplifyImpostors.cginc is updated
|
||||
ApplySRP();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ApplySRP()
|
||||
{
|
||||
string impostorCGincPath = AssetDatabase.GUIDToAssetPath( ImpostorsGCincGUID );
|
||||
if ( string.IsNullOrEmpty( impostorCGincPath ) )
|
||||
return;
|
||||
|
||||
string cginc = string.Empty;
|
||||
if ( !string.IsNullOrEmpty( impostorCGincPath ) && File.Exists( impostorCGincPath ) )
|
||||
{
|
||||
cginc = File.ReadAllText( impostorCGincPath );
|
||||
}
|
||||
|
||||
bool saveAndRefresh = false;
|
||||
|
||||
Match cgincMatch = Regex.Match( cginc, @"#define AI_HDRP_VERSION (\d*)", RegexOptions.Multiline );
|
||||
if ( cgincMatch.Success )
|
||||
{
|
||||
string cgincSRPversion = cgincMatch.Groups[ 1 ].Value;
|
||||
if ( cgincSRPversion != ( ( int )m_packageHDRPVersion ).ToString() )
|
||||
{
|
||||
cginc = cginc.Replace( cgincMatch.Groups[ 0 ].Value, "#define AI_HDRP_VERSION " + ( ( int )m_packageHDRPVersion ).ToString() );
|
||||
saveAndRefresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
cgincMatch = Regex.Match( cginc, @"#define AI_URP_VERSION (\d*)", RegexOptions.Multiline );
|
||||
if ( cgincMatch.Success )
|
||||
{
|
||||
string cgincSRPversion = cgincMatch.Groups[ 1 ].Value;
|
||||
if ( cgincSRPversion != ( ( int )m_packageURPVersion ).ToString() )
|
||||
{
|
||||
cginc = cginc.Replace( cgincMatch.Groups[ 0 ].Value, "#define AI_URP_VERSION " + ( ( int )m_packageURPVersion ).ToString() );
|
||||
saveAndRefresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( saveAndRefresh )
|
||||
{
|
||||
File.WriteAllText( impostorCGincPath, cginc );
|
||||
}
|
||||
}
|
||||
|
||||
// Polynomial: 0xedb88320
|
||||
static readonly uint[] crc32_tab = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
|
||||
0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
|
||||
0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
|
||||
0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
|
||||
0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
|
||||
0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
|
||||
0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
|
||||
0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
|
||||
0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
|
||||
0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
|
||||
0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
|
||||
0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
|
||||
0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
|
||||
0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
|
||||
0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
|
||||
0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
|
||||
0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
|
||||
0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
|
||||
0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
|
||||
0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
|
||||
0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
|
||||
0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
|
||||
0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
|
||||
0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
|
||||
0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
|
||||
0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
|
||||
0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
|
||||
0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
|
||||
0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
|
||||
0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
|
||||
0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
|
||||
0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
|
||||
0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
||||
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
};
|
||||
|
||||
private static uint CRC32( byte[] buf, uint crc = 0 )
|
||||
{
|
||||
uint i = 0;
|
||||
uint size = ( uint )buf.Length;
|
||||
crc = crc ^ 0xFFFFFFFF;
|
||||
while ( size-- > 0 )
|
||||
{
|
||||
crc = crc32_tab[ ( crc ^ buf[ i++ ] ) & 0xFF ] ^ ( crc >> 8 );
|
||||
}
|
||||
return crc ^ 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class TemplatePostProcessor : AssetPostprocessor
|
||||
{
|
||||
static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths )
|
||||
{
|
||||
AIPackageManagerHelper.RequestInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIPackageManagerHelper.cs.meta
vendored
Normal file
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIPackageManagerHelper.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58d52c2ec7a4198409aea2abf9311161
|
||||
timeCreated: 1548881060
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
579
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIStartScreen.cs
vendored
Normal file
579
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIStartScreen.cs
vendored
Normal file
@@ -0,0 +1,579 @@
|
||||
// Amplify Impostors
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using UnityEngine.Networking;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AmplifyImpostors
|
||||
{
|
||||
public enum TemplateSRPType
|
||||
{
|
||||
BiRP,
|
||||
HDRP,
|
||||
URP
|
||||
}
|
||||
|
||||
public class AIStartScreen : EditorWindow
|
||||
{
|
||||
[MenuItem( "Window/Amplify Impostors/Start Screen", false, 1999 )]
|
||||
public static void Init()
|
||||
{
|
||||
AIStartScreen window = ( AIStartScreen )GetWindow( typeof( AIStartScreen ), true, "Amplify Impostors Start Screen" );
|
||||
window.minSize = new Vector2( 650, 500 );
|
||||
window.maxSize = new Vector2( 650, 500 );
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private static readonly string ChangeLogGUID = "967f64c31d8dde244a5e92f47deea593";
|
||||
private static readonly string ResourcesGUID = "ae29426773add424290db1134bffc616";
|
||||
private static readonly string BuiltInGUID = "ec7e2bd19b32d4c42948cb7cce07b40c";
|
||||
private static readonly string UniversalGUID = "157f886533623a54683ec845ecb4de98";
|
||||
private static readonly string HighDefinitionGUID = "25818ccda53725a4086c9b356f2f6139";
|
||||
|
||||
private static readonly string IconGUID = "1070aab9cfe961c409d48e3bec7f7ab0";
|
||||
|
||||
public static readonly string ChangelogURL = "https://amplify.pt/Banner/AIchangelog.json";
|
||||
|
||||
private static readonly string ManualURL = "https://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Impostors/Manual";
|
||||
|
||||
private static readonly string DiscordURL = "https://discordapp.com/invite/EdrVAP5";
|
||||
private static readonly string ForumURL = "https://forum.unity.com/threads/amplify-impostors-next-generation-billboards.539844/";
|
||||
|
||||
private static readonly string SiteURL = "http://amplify.pt/download/";
|
||||
private static readonly string StoreURL = "https://assetstore.unity.com/packages/tools/utilities/amplify-impostors-119877";
|
||||
|
||||
private static readonly GUIContent SamplesTitle = new GUIContent( "Samples", "Import samples according to you project rendering pipeline" );
|
||||
private static readonly GUIContent ResourcesTitle = new GUIContent( "Learning Resources", "Check the online wiki for various topics about how to use AI with node examples and explanations" );
|
||||
private static readonly GUIContent CommunityTitle = new GUIContent( "Community", "Need help? Reach us through our discord server or the official support Unity forum" );
|
||||
private static readonly GUIContent UpdateTitle = new GUIContent( "Latest Update", "Check the lastest additions, improvements and bug fixes done to AI" );
|
||||
private static readonly GUIContent AITitle = new GUIContent( "Amplify Impostors", "Are you using the latest version? Now you know" );
|
||||
|
||||
private const string OnlineVersionWarning = "Please enable \"Allow downloads over HTTP*\" in Player Settings to access latest version information via Start Screen.";
|
||||
|
||||
Vector2 m_scrollPosition = Vector2.zero;
|
||||
Preferences.ShowOption m_startup = Preferences.ShowOption.Never;
|
||||
|
||||
[NonSerialized]
|
||||
Texture packageIcon = null;
|
||||
[NonSerialized]
|
||||
Texture textIcon = null;
|
||||
[NonSerialized]
|
||||
Texture webIcon = null;
|
||||
|
||||
GUIContent HDRPbutton = null;
|
||||
GUIContent URPbutton = null;
|
||||
GUIContent BuiltInbutton = null;
|
||||
|
||||
GUIContent Manualbutton = null;
|
||||
|
||||
GUIContent DiscordButton = null;
|
||||
GUIContent ForumButton = null;
|
||||
|
||||
GUIContent AIIcon = null;
|
||||
RenderTexture rt;
|
||||
|
||||
[NonSerialized]
|
||||
GUIStyle m_buttonStyle = null;
|
||||
[NonSerialized]
|
||||
GUIStyle m_buttonLeftStyle = null;
|
||||
[NonSerialized]
|
||||
GUIStyle m_buttonRightStyle = null;
|
||||
[NonSerialized]
|
||||
GUIStyle m_minibuttonStyle = null;
|
||||
[NonSerialized]
|
||||
GUIStyle m_labelStyle = null;
|
||||
[NonSerialized]
|
||||
GUIStyle m_linkStyle = null;
|
||||
|
||||
private ChangeLogInfo m_changeLog;
|
||||
private bool m_infoDownloaded = false;
|
||||
private string m_newVersion = string.Empty;
|
||||
|
||||
private static Dictionary<int, AISRPPackageDesc> m_srpSamplePackages = new Dictionary<int, AISRPPackageDesc>()
|
||||
{
|
||||
{ ( int )AISRPBaseline.AI_SRP_12_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_12_X, "b96ac023f1ef6c144891ecea1fa57ae8", "9d8cb26fa0bbd5743910e10e476c1b34" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_13_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_13_X, "b96ac023f1ef6c144891ecea1fa57ae8", "9d8cb26fa0bbd5743910e10e476c1b34" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_14_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_14_X, "c297d913695beab48aafeed7e786c21e", "4592c91874062c644b0606bd98342356" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_15_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_15_X, "49ea3764a534e4347848722ad53b9bf1", "0fd95d7c6a1a1864eb85fef533f5e5df" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_16_X, new AISRPPackageDesc( AISRPBaseline.AI_SRP_16_X, "349761993cf8d6a41970c379725073d4", "f61a93a0b64d3dd499926d4ad5816cb1" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_0, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_0, "63629f491cb46bb4cbb75e8761fc34a4", "9fe9254fd01d40f41b61d641720448e9" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_1, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_1, "fd4d8f8d9ad14334587b00cb40e4b3e9", "8b71dc5534f40fa408a50c379920bf60" ) },
|
||||
{ ( int )AISRPBaseline.AI_SRP_17_2, new AISRPPackageDesc( AISRPBaseline.AI_SRP_17_2, "3015af40fd0745b43a5a3d20ec4c24a6", "c8fb2aae1cd370242acd84a1977fd5dc" ) },
|
||||
};
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
rt = new RenderTexture( 16, 16, 0 );
|
||||
rt.Create();
|
||||
|
||||
m_startup = ( Preferences.ShowOption )EditorPrefs.GetInt( Preferences.PrefGlobalStartUp, 0 );
|
||||
|
||||
if ( textIcon == null )
|
||||
{
|
||||
Texture icon = EditorGUIUtility.IconContent( "TextAsset Icon" ).image;
|
||||
var cache = RenderTexture.active;
|
||||
RenderTexture.active = rt;
|
||||
Graphics.Blit( icon, rt );
|
||||
RenderTexture.active = cache;
|
||||
textIcon = rt;
|
||||
|
||||
Manualbutton = new GUIContent( " Manual", textIcon );
|
||||
}
|
||||
|
||||
if ( packageIcon == null )
|
||||
{
|
||||
packageIcon = EditorGUIUtility.IconContent( "BuildSettings.Editor.Small" ).image;
|
||||
HDRPbutton = new GUIContent( " HDRP Samples", packageIcon );
|
||||
URPbutton = new GUIContent( " URP Samples", packageIcon );
|
||||
BuiltInbutton = new GUIContent( " Built-In Samples", packageIcon );
|
||||
}
|
||||
|
||||
if ( webIcon == null )
|
||||
{
|
||||
webIcon = EditorGUIUtility.IconContent( "BuildSettings.Web.Small" ).image;
|
||||
DiscordButton = new GUIContent( " Discord", webIcon );
|
||||
ForumButton = new GUIContent( " Unity Forum", webIcon );
|
||||
}
|
||||
|
||||
if ( m_changeLog == null )
|
||||
{
|
||||
var changelog = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( ChangeLogGUID ) );
|
||||
string lastUpdate = string.Empty;
|
||||
if ( changelog != null )
|
||||
{
|
||||
int oldestReleaseIndex = changelog.text.LastIndexOf( string.Format( "v{0}.{1}.{2}", VersionInfo.Major, VersionInfo.Minor, VersionInfo.Release ) );
|
||||
|
||||
lastUpdate = changelog.text.Substring( 0, changelog.text.IndexOf( "\nv", oldestReleaseIndex + 25 ) );// + "\n...";
|
||||
lastUpdate = lastUpdate.Replace( "* ", "\u2022 " );
|
||||
}
|
||||
m_changeLog = new ChangeLogInfo( VersionInfo.FullNumber, lastUpdate );
|
||||
}
|
||||
|
||||
if ( AIIcon == null )
|
||||
{
|
||||
AIIcon = new GUIContent( AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IconGUID ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if ( rt != null )
|
||||
{
|
||||
rt.Release();
|
||||
DestroyImmediate( rt );
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
if ( !m_infoDownloaded )
|
||||
{
|
||||
m_infoDownloaded = true;
|
||||
|
||||
StartBackgroundTask( StartRequest( ChangelogURL, () =>
|
||||
{
|
||||
if ( string.IsNullOrEmpty( www.error ) )
|
||||
{
|
||||
ChangeLogInfo temp;
|
||||
try
|
||||
{
|
||||
temp = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text );
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
temp = null;
|
||||
}
|
||||
if ( temp != null && temp.Version >= m_changeLog.Version )
|
||||
{
|
||||
m_changeLog = temp;
|
||||
}
|
||||
|
||||
int version = m_changeLog.Version;
|
||||
int major = version / 10000;
|
||||
int minor = version / 1000 - major * 10;
|
||||
int release = version / 100 - ( version / 1000 ) * 10;
|
||||
int revision = version - ( version / 100 ) * 100;
|
||||
|
||||
m_newVersion = major + "." + minor + "." + release + ( revision > 0 ? "." + revision : "" );
|
||||
|
||||
Repaint();
|
||||
}
|
||||
} ) );
|
||||
}
|
||||
|
||||
if ( m_buttonStyle == null )
|
||||
{
|
||||
m_buttonStyle = new GUIStyle( GUI.skin.button );
|
||||
m_buttonStyle.alignment = TextAnchor.MiddleLeft;
|
||||
}
|
||||
|
||||
if ( m_buttonLeftStyle == null )
|
||||
{
|
||||
m_buttonLeftStyle = new GUIStyle( "ButtonLeft" );
|
||||
m_buttonLeftStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_buttonLeftStyle.margin = m_buttonStyle.margin;
|
||||
m_buttonLeftStyle.margin.right = 0;
|
||||
}
|
||||
|
||||
if ( m_buttonRightStyle == null )
|
||||
{
|
||||
m_buttonRightStyle = new GUIStyle( "ButtonRight" );
|
||||
m_buttonRightStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_buttonRightStyle.margin = m_buttonStyle.margin;
|
||||
m_buttonRightStyle.margin.left = 0;
|
||||
}
|
||||
|
||||
if ( m_minibuttonStyle == null )
|
||||
{
|
||||
m_minibuttonStyle = new GUIStyle( "MiniButton" );
|
||||
m_minibuttonStyle.alignment = TextAnchor.MiddleLeft;
|
||||
m_minibuttonStyle.margin = m_buttonStyle.margin;
|
||||
m_minibuttonStyle.margin.left = 20;
|
||||
m_minibuttonStyle.normal.textColor = m_buttonStyle.normal.textColor;
|
||||
m_minibuttonStyle.hover.textColor = m_buttonStyle.hover.textColor;
|
||||
}
|
||||
|
||||
if ( m_labelStyle == null )
|
||||
{
|
||||
m_labelStyle = new GUIStyle( "BoldLabel" );
|
||||
m_labelStyle.margin = new RectOffset( 4, 4, 4, 4 );
|
||||
m_labelStyle.padding = new RectOffset( 2, 2, 2, 2 );
|
||||
m_labelStyle.fontSize = 13;
|
||||
}
|
||||
|
||||
if ( m_linkStyle == null )
|
||||
{
|
||||
var inv = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( "a91a70303ba684645a7a87a0ddec0eb7" ) ); // find a better solution for transparent buttons
|
||||
m_linkStyle = new GUIStyle();
|
||||
m_linkStyle.normal.textColor = new Color( 0.2980392f, 0.4901961f, 1f );
|
||||
m_linkStyle.hover.textColor = Color.white;
|
||||
m_linkStyle.active.textColor = Color.grey;
|
||||
m_linkStyle.margin.top = 3;
|
||||
m_linkStyle.margin.bottom = 2;
|
||||
m_linkStyle.hover.background = inv;
|
||||
m_linkStyle.active.background = inv;
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal( GUIStyle.none, GUILayout.ExpandWidth( true ) );
|
||||
{
|
||||
// left column
|
||||
EditorGUILayout.BeginVertical( GUILayout.Width( 175 ) );
|
||||
{
|
||||
GUILayout.Label( SamplesTitle, m_labelStyle );
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
if ( GUILayout.Button( HDRPbutton, m_buttonLeftStyle ) )
|
||||
{
|
||||
if ( AIPackageManagerHelper.CurrentHDRPBaseline != AISRPBaseline.AI_SRP_INVALID )
|
||||
{
|
||||
ImportSample( HDRPbutton.text, TemplateSRPType.HDRP );
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorUtility.DisplayDialog( "Import Sample", "Import failed because a valid HDRP package could not be found on this project.\n\nPlease install the \"High Definition RP\" package via \"Window/Package Manager\" before attempting to import HDRP samples again.", "OK" );
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if ( GUILayout.Button( URPbutton, m_buttonLeftStyle ) )
|
||||
{
|
||||
if ( AIPackageManagerHelper.CurrentURPBaseline != AISRPBaseline.AI_SRP_INVALID )
|
||||
{
|
||||
ImportSample( URPbutton.text, TemplateSRPType.URP );
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorUtility.DisplayDialog( "Import Sample", "Import failed because valid URP package could not be found on this project.\n\nPlease install the \"Universal RP\" package via \"Window/Package Manager\" before attempting to import URP samples again.", "OK" );
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
if ( GUILayout.Button( BuiltInbutton, m_buttonStyle ) )
|
||||
ImportSample( BuiltInbutton.text, TemplateSRPType.BiRP );
|
||||
|
||||
GUILayout.Space( 10 );
|
||||
|
||||
GUILayout.Label( ResourcesTitle, m_labelStyle );
|
||||
if ( GUILayout.Button( Manualbutton, m_buttonStyle ) )
|
||||
Application.OpenURL( ManualURL );
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
// right column
|
||||
EditorGUILayout.BeginVertical( GUILayout.Width( 650 - 175 - 9 ), GUILayout.ExpandHeight( true ) );
|
||||
{
|
||||
GUILayout.Label( CommunityTitle, m_labelStyle );
|
||||
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
|
||||
{
|
||||
if ( GUILayout.Button( DiscordButton, GUILayout.ExpandWidth( true ) ) )
|
||||
{
|
||||
Application.OpenURL( DiscordURL );
|
||||
}
|
||||
if ( GUILayout.Button( ForumButton, GUILayout.ExpandWidth( true ) ) )
|
||||
{
|
||||
Application.OpenURL( ForumURL );
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Label( UpdateTitle, m_labelStyle );
|
||||
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition, "ProgressBarBack", GUILayout.ExpandHeight( true ), GUILayout.ExpandWidth( true ) );
|
||||
GUILayout.Label( m_changeLog.LastUpdate, "WordWrappedMiniLabel", GUILayout.ExpandHeight( true ) );
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) );
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.Label( AITitle, m_labelStyle );
|
||||
|
||||
GUILayout.Label( "Installed Version: " + VersionInfo.StaticToString() );
|
||||
|
||||
if ( m_changeLog.Version > VersionInfo.FullNumber )
|
||||
{
|
||||
var cache = GUI.color;
|
||||
GUI.color = Color.red;
|
||||
GUILayout.Label( "New version available: " + m_newVersion, "BoldLabel" );
|
||||
GUI.color = cache;
|
||||
}
|
||||
else
|
||||
{
|
||||
var cache = GUI.color;
|
||||
GUI.color = Color.green;
|
||||
GUILayout.Label( "You are using the latest version", "BoldLabel" );
|
||||
GUI.color = cache;
|
||||
}
|
||||
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
GUILayout.Label( "Download links:" );
|
||||
if ( GUILayout.Button( "Amplify", m_linkStyle ) )
|
||||
Application.OpenURL( SiteURL );
|
||||
GUILayout.Label( "-" );
|
||||
if ( GUILayout.Button( "Asset Store", m_linkStyle ) )
|
||||
Application.OpenURL( StoreURL );
|
||||
EditorGUILayout.EndHorizontal();
|
||||
GUILayout.Space( 7 );
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUILayout.BeginVertical();
|
||||
GUILayout.Space( 7 );
|
||||
GUILayout.Label( AIIcon );
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
|
||||
EditorGUILayout.BeginHorizontal( "ProjectBrowserBottomBarBg", GUILayout.ExpandWidth( true ), GUILayout.Height( 22 ) );
|
||||
{
|
||||
GUILayout.FlexibleSpace();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
var cache = EditorGUIUtility.labelWidth;
|
||||
EditorGUIUtility.labelWidth = 100;
|
||||
m_startup = ( Preferences.ShowOption )EditorGUILayout.EnumPopup( "Show At Startup", m_startup, GUILayout.Width( 220 ) );
|
||||
EditorGUIUtility.labelWidth = cache;
|
||||
if ( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
EditorPrefs.SetInt( Preferences.PrefGlobalStartUp, ( int )m_startup );
|
||||
}
|
||||
}
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
void ImportSample( string pipeline, TemplateSRPType srpType )
|
||||
{
|
||||
if ( EditorUtility.DisplayDialog( "Import Sample", "This will import the samples for" + pipeline.Replace( " Samples", "" ) + ", please make sure the pipeline is properly installed and/or selected before importing the samples.\n\nContinue?", "Yes", "No" ) )
|
||||
{
|
||||
AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( ResourcesGUID ), false );
|
||||
|
||||
switch ( srpType )
|
||||
{
|
||||
case TemplateSRPType.BiRP:
|
||||
{
|
||||
AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( BuiltInGUID ), false );
|
||||
break;
|
||||
}
|
||||
case TemplateSRPType.URP:
|
||||
{
|
||||
if ( m_srpSamplePackages.TryGetValue( ( int )AIPackageManagerHelper.CurrentURPBaseline, out AISRPPackageDesc desc ) )
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath( desc.guidURP );
|
||||
if ( !string.IsNullOrEmpty( path ) )
|
||||
{
|
||||
AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( UniversalGUID ), false );
|
||||
AssetDatabase.ImportPackage( path, false );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TemplateSRPType.HDRP:
|
||||
{
|
||||
if ( m_srpSamplePackages.TryGetValue( ( int )AIPackageManagerHelper.CurrentHDRPBaseline, out AISRPPackageDesc desc ) )
|
||||
{
|
||||
string path = AssetDatabase.GUIDToAssetPath( desc.guidHDRP );
|
||||
if ( !string.IsNullOrEmpty( path ) )
|
||||
{
|
||||
AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( HighDefinitionGUID ), false );
|
||||
AssetDatabase.ImportPackage( path, false );
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// no action
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UnityWebRequest www;
|
||||
|
||||
IEnumerator StartRequest( string url, Action success = null )
|
||||
{
|
||||
using ( www = UnityWebRequest.Get( url ) )
|
||||
{
|
||||
yield return www.SendWebRequest();
|
||||
|
||||
while ( www.isDone == false )
|
||||
yield return null;
|
||||
|
||||
if ( success != null )
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
public static void StartBackgroundTask( IEnumerator update, Action end = null )
|
||||
{
|
||||
EditorApplication.CallbackFunction closureCallback = null;
|
||||
|
||||
closureCallback = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( update.MoveNext() == false )
|
||||
{
|
||||
if ( end != null )
|
||||
end();
|
||||
EditorApplication.update -= closureCallback;
|
||||
}
|
||||
}
|
||||
catch ( Exception ex )
|
||||
{
|
||||
if ( end != null )
|
||||
end();
|
||||
Debug.LogException( ex );
|
||||
EditorApplication.update -= closureCallback;
|
||||
}
|
||||
};
|
||||
|
||||
EditorApplication.update += closureCallback;
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
internal class ChangeLogInfo
|
||||
{
|
||||
public int Version;
|
||||
public string LastUpdate;
|
||||
|
||||
public static ChangeLogInfo CreateFromJSON( string jsonString )
|
||||
{
|
||||
return JsonUtility.FromJson<ChangeLogInfo>( jsonString );
|
||||
}
|
||||
|
||||
public ChangeLogInfo( int version, string lastUpdate )
|
||||
{
|
||||
Version = version;
|
||||
LastUpdate = lastUpdate;
|
||||
}
|
||||
}
|
||||
|
||||
[InitializeOnLoad]
|
||||
public static class ShowStartScreen
|
||||
{
|
||||
static ShowStartScreen()
|
||||
{
|
||||
EditorApplication.update += Update;
|
||||
}
|
||||
|
||||
static UnityWebRequest www;
|
||||
|
||||
static IEnumerator StartRequest( string url, Action success = null )
|
||||
{
|
||||
using ( www = UnityWebRequest.Get( url ) )
|
||||
{
|
||||
yield return www.SendWebRequest();
|
||||
|
||||
while ( www.isDone == false )
|
||||
yield return null;
|
||||
|
||||
if ( success != null )
|
||||
success();
|
||||
}
|
||||
}
|
||||
|
||||
static void Update()
|
||||
{
|
||||
EditorApplication.update -= Update;
|
||||
|
||||
if ( !EditorApplication.isPlayingOrWillChangePlaymode && !Application.isBatchMode )
|
||||
{
|
||||
Preferences.ShowOption show = Preferences.ShowOption.Never;
|
||||
if ( !EditorPrefs.HasKey( Preferences.PrefGlobalStartUp ) )
|
||||
{
|
||||
show = Preferences.ShowOption.Always;
|
||||
EditorPrefs.SetInt( Preferences.PrefGlobalStartUp, 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Time.realtimeSinceStartup < 10 )
|
||||
{
|
||||
show = ( Preferences.ShowOption )EditorPrefs.GetInt( Preferences.PrefGlobalStartUp, 0 );
|
||||
// check version here
|
||||
if ( show == Preferences.ShowOption.OnNewVersion )
|
||||
{
|
||||
AIStartScreen.StartBackgroundTask( StartRequest( AIStartScreen.ChangelogURL, () =>
|
||||
{
|
||||
if ( string.IsNullOrEmpty( www.error ) )
|
||||
{
|
||||
ChangeLogInfo changeLog;
|
||||
try
|
||||
{
|
||||
changeLog = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text );
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
changeLog = null;
|
||||
}
|
||||
if ( changeLog != null )
|
||||
{
|
||||
if ( changeLog.Version > VersionInfo.FullNumber )
|
||||
{
|
||||
AIStartScreen.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( show == Preferences.ShowOption.Always )
|
||||
{
|
||||
AIStartScreen.Init();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIStartScreen.cs.meta
vendored
Normal file
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AIStartScreen.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb3b831ec4e30074cac85e49f922a6e4
|
||||
timeCreated: 1585827066
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About.meta
vendored
Normal file
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About.meta
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec28673eb846ce34fa7fa827aa5c2f8a
|
||||
folderAsset: yes
|
||||
timeCreated: 1527851330
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About/About.cs
vendored
Normal file
67
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About/About.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
// Amplify Impostors
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace AmplifyImpostors
|
||||
{
|
||||
public class About : EditorWindow
|
||||
{
|
||||
private const string AboutImageGUID = "f6d52893e066905409ec8ac1bde8d300";
|
||||
private Vector2 m_scrollPosition = Vector2.zero;
|
||||
private Texture2D m_aboutImage;
|
||||
|
||||
[MenuItem( "Window/Amplify Impostors/Manual", false, 2000 )]
|
||||
static void OpenManual()
|
||||
{
|
||||
Application.OpenURL( "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Impostors/Manual" );
|
||||
}
|
||||
|
||||
[MenuItem( "Window/Amplify Impostors/About...", false, 2001 )]
|
||||
static void Init()
|
||||
{
|
||||
About window = (About)GetWindow( typeof( About ), true, "About Amplify Impostors" );
|
||||
window.minSize = new Vector2( 502, 250 );
|
||||
window.maxSize = new Vector2( 502, 250 );
|
||||
window.Show();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
m_aboutImage = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( AboutImageGUID ) );
|
||||
}
|
||||
|
||||
public void OnGUI()
|
||||
{
|
||||
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition );
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
|
||||
GUILayout.Space( 10 );
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Box( m_aboutImage, GUIStyle.none );
|
||||
|
||||
if( Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) )
|
||||
Application.OpenURL( "http://www.amplify.pt" );
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUIStyle labelStyle = new GUIStyle( EditorStyles.label );
|
||||
labelStyle.alignment = TextAnchor.MiddleCenter;
|
||||
labelStyle.wordWrap = true;
|
||||
|
||||
GUILayout.Label( "\nAmplify Impostors " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) );
|
||||
|
||||
GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) );
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About/About.cs.meta
vendored
Normal file
12
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/About/About.cs.meta
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ef56149981af214daf70b2c156f9442
|
||||
timeCreated: 1481126958
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AmplifyImpostors.Editor.asmdef
vendored
Normal file
18
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AmplifyImpostors.Editor.asmdef
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "AmplifyImpostors.Editor",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:a1a7cacb6cec073439a2b2c1849d773b"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AmplifyImpostors.Editor.asmdef.meta
vendored
Normal file
7
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/AmplifyImpostors.Editor.asmdef.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beb7ced4cc341384592d9187e65da6b5
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector.meta
vendored
Normal file
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector.meta
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9472d3e5cffc4654a8179ab127664b8f
|
||||
folderAsset: yes
|
||||
timeCreated: 1526997181
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
226
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector/AmplifyImpostorBakePresetEditor.cs
vendored
Normal file
226
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector/AmplifyImpostorBakePresetEditor.cs
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
// Amplify Impostors
|
||||
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditorInternal;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AmplifyImpostors
|
||||
{
|
||||
[CustomEditor( typeof( AmplifyImpostorBakePreset ) )]
|
||||
public class AmplifyImpostorBakePresetEditor : Editor
|
||||
{
|
||||
AmplifyImpostorBakePreset instance;
|
||||
private ReorderableList m_reorderableOutput = null;
|
||||
|
||||
private bool m_usingStandard;
|
||||
|
||||
public static readonly GUIContent BakeShaderStr = new GUIContent( "Bake Shader", "Shader used to bake the different outputs" );
|
||||
public static readonly GUIContent RuntimeShaderStr = new GUIContent( "Runtime Shader", "Custom impostor shader to assign the outputs to" );
|
||||
public static readonly GUIContent PipelineStr = new GUIContent( "Pipeline", "Defines the default preset for the selected pipeline" );
|
||||
|
||||
public static readonly GUIContent TargetsStr = new GUIContent( "RT#", "Render Target number" );
|
||||
public static readonly GUIContent SuffixStr = new GUIContent( "Suffix", "Name suffix for file saving and for material assignment" );
|
||||
|
||||
public static readonly int[] TexScaleOpt = { 1, 2, 4, 8 };
|
||||
public static readonly GUIContent[] TexScaleListStr = { new GUIContent( "1" ), new GUIContent( "1\u20442" ), new GUIContent( "1\u20444" ), new GUIContent( "1\u20448" ) };
|
||||
public static readonly GUIContent TexScaleStr = new GUIContent( "Scale", "Texture Scaling" );
|
||||
|
||||
public static readonly GUIContent ColorSpaceStr = new GUIContent( "sRGB", "Texture color space" );
|
||||
public static readonly GUIContent[] ColorSpaceListStr = { new GUIContent( "| sRGB" ), new GUIContent( "Linear" ) };
|
||||
|
||||
public static readonly int[] CompressionOpt = { 0, 3, 1, 2 };
|
||||
public static readonly GUIContent[] CompressionListStr = { new GUIContent( "None" ), new GUIContent( "Low" ), new GUIContent( "Normal" ), new GUIContent( "High" ) };
|
||||
public static readonly GUIContent CompressionStr = new GUIContent( "Compression", "Compression quality" );
|
||||
|
||||
public static readonly GUIContent FormatStr = new GUIContent( "Format", "File save format" );
|
||||
public static readonly GUIContent ChannelsStr = new GUIContent( "Channels", "Channels being used" );
|
||||
public GUIContent AlphaIcon;
|
||||
|
||||
public static readonly GUIContent OverrideStr = new GUIContent( "Override", "Override" );
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
instance = (AmplifyImpostorBakePreset)target;
|
||||
Preferences.LoadDefaults();
|
||||
|
||||
AlphaIcon = EditorGUIUtility.IconContent( "PreTextureAlpha" );
|
||||
AlphaIcon.tooltip = "Alpha output selection";
|
||||
AddList();
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
RemoveList();
|
||||
}
|
||||
|
||||
void RemoveList()
|
||||
{
|
||||
m_reorderableOutput.drawHeaderCallback -= DrawHeader;
|
||||
m_reorderableOutput.drawElementCallback -= DrawElement;
|
||||
|
||||
m_reorderableOutput.onAddCallback -= AddItem;
|
||||
}
|
||||
|
||||
void AddList()
|
||||
{
|
||||
m_usingStandard = false;
|
||||
if( instance.BakeShader == null )
|
||||
m_usingStandard = true;
|
||||
|
||||
m_reorderableOutput = new ReorderableList( instance.Output, typeof( TextureOutput ), !m_usingStandard, true, !m_usingStandard, !m_usingStandard );
|
||||
|
||||
m_reorderableOutput.drawHeaderCallback += DrawHeader;
|
||||
m_reorderableOutput.drawElementCallback += DrawElement;
|
||||
|
||||
m_reorderableOutput.onAddCallback += AddItem;
|
||||
}
|
||||
|
||||
void RefreshList()
|
||||
{
|
||||
RemoveList();
|
||||
|
||||
AddList();
|
||||
}
|
||||
|
||||
private void DrawHeader( Rect rect )
|
||||
{
|
||||
var style = new GUIStyle( GUI.skin.label ) { alignment = TextAnchor.MiddleCenter };
|
||||
|
||||
rect.xMax -= 20;
|
||||
Rect alphaRect = rect;
|
||||
alphaRect.width = 24;
|
||||
alphaRect.x = rect.xMax;
|
||||
alphaRect.height = 24;
|
||||
|
||||
rect.xMax -= 35;
|
||||
Rect overrideRect = rect;
|
||||
overrideRect.width = 32;
|
||||
EditorGUI.LabelField( overrideRect, TargetsStr, style );
|
||||
overrideRect = rect;
|
||||
overrideRect.xMin += 32 + ( m_usingStandard ? 0 : 13 );
|
||||
overrideRect.width = EditorGUIUtility.labelWidth - overrideRect.xMin + 13;
|
||||
EditorGUI.LabelField( overrideRect, SuffixStr, style );
|
||||
Rect optionRect = rect;
|
||||
optionRect.xMin = EditorGUIUtility.labelWidth + 23;
|
||||
float fullwidth = optionRect.width;
|
||||
optionRect.width = fullwidth * 0.25f;
|
||||
EditorGUI.LabelField( optionRect, TexScaleStr, style );
|
||||
optionRect.x += optionRect.width;
|
||||
EditorGUI.LabelField( optionRect, ( optionRect.width < 60 ) ? new GUIContent( "Chan" ) : ChannelsStr, style );
|
||||
optionRect.x += optionRect.width;
|
||||
optionRect.width = 35;
|
||||
EditorGUI.LabelField( optionRect, ColorSpaceStr, style );
|
||||
optionRect.x += optionRect.width;
|
||||
optionRect.width = fullwidth * 0.25f;
|
||||
EditorGUI.LabelField( optionRect, ( optionRect.width < 75 ) ? new GUIContent( "Comp" ) : CompressionStr, style );
|
||||
optionRect.x += optionRect.width;
|
||||
EditorGUI.LabelField( optionRect, ( optionRect.width < 40 ) ? new GUIContent( "Fmt" ) : FormatStr, style );
|
||||
|
||||
EditorGUI.LabelField( alphaRect, AlphaIcon, style );
|
||||
}
|
||||
|
||||
private void DrawElement( Rect rect, int index, bool active, bool focused )
|
||||
{
|
||||
rect.y += 1;
|
||||
Rect alphaRect = rect;
|
||||
alphaRect.height = EditorGUIUtility.singleLineHeight;
|
||||
alphaRect.width = 20;
|
||||
alphaRect.x = rect.xMax - alphaRect.width;
|
||||
rect.xMax -= alphaRect.width + 35;
|
||||
Rect overrideRect = rect;
|
||||
overrideRect.width = 16;
|
||||
overrideRect.height = EditorGUIUtility.singleLineHeight;
|
||||
EditorGUI.LabelField( overrideRect, new GUIContent( index.ToString() ) );
|
||||
|
||||
rect.height = EditorGUIUtility.singleLineHeight;
|
||||
Rect toggleRect = rect;
|
||||
toggleRect.x = overrideRect.xMax;
|
||||
toggleRect.width = 16;
|
||||
instance.Output[ index ].Active = EditorGUI.Toggle( toggleRect, instance.Output[ index ].Active );
|
||||
rect.y += 1;
|
||||
|
||||
EditorGUI.BeginDisabledGroup( !instance.Output[ index ].Active );
|
||||
Rect nameRect = rect;
|
||||
nameRect.x = toggleRect.xMax;
|
||||
nameRect.width = EditorGUIUtility.labelWidth - 32 - ( m_usingStandard ? 5 : 19 );
|
||||
instance.Output[ index ].Name = EditorGUI.TextField( nameRect, instance.Output[ index ].Name );
|
||||
|
||||
Rect optionRect = rect;
|
||||
optionRect.xMin = nameRect.xMax;
|
||||
float fullwidth = optionRect.width;
|
||||
optionRect.width = fullwidth * 0.25f;
|
||||
instance.Output[ index ].Scale = (TextureScale)EditorGUI.IntPopup( optionRect, (int)instance.Output[ index ].Scale, TexScaleListStr, TexScaleOpt );
|
||||
optionRect.x += optionRect.width;
|
||||
instance.Output[ index ].Channels = (TextureChannels)EditorGUI.EnumPopup( optionRect, instance.Output[ index ].Channels );
|
||||
optionRect.x += optionRect.width + 10;
|
||||
optionRect.width = 35;
|
||||
optionRect.y -= 1;
|
||||
instance.Output[ index ].SRGB = EditorGUI.Toggle( optionRect, instance.Output[ index ].SRGB );
|
||||
optionRect.y += 1;
|
||||
optionRect.x += optionRect.width - 10;
|
||||
optionRect.width = fullwidth * 0.25f;
|
||||
instance.Output[ index ].Compression = (TextureCompression)EditorGUI.IntPopup( optionRect, (int)instance.Output[ index ].Compression, CompressionListStr, CompressionOpt );
|
||||
optionRect.x += optionRect.width;
|
||||
instance.Output[ index ].ImageFormat = (ImageFormat)EditorGUI.EnumPopup( optionRect, instance.Output[ index ].ImageFormat );
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
alphaRect.xMin += 4;
|
||||
instance.AlphaIndex = EditorGUI.Toggle( alphaRect, instance.AlphaIndex == index, "radio" ) ? index : instance.AlphaIndex;
|
||||
}
|
||||
|
||||
private void AddItem( ReorderableList reordableList )
|
||||
{
|
||||
reordableList.list.Add( new TextureOutput() );
|
||||
|
||||
EditorUtility.SetDirty( target );
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
//base.OnInspectorGUI();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
instance.BakeShader = EditorGUILayout.ObjectField( BakeShaderStr, instance.BakeShader, typeof( Shader ), false ) as Shader;
|
||||
|
||||
instance.RuntimeShader = EditorGUILayout.ObjectField( RuntimeShaderStr, instance.RuntimeShader, typeof( Shader ), false ) as Shader;
|
||||
|
||||
//instance.Pipeline = (PresetPipeline)EditorGUILayout.EnumPopup( PipelineStr, instance.Pipeline );
|
||||
|
||||
m_usingStandard = instance.BakeShader == null;
|
||||
bool check = false;
|
||||
if( EditorGUI.EndChangeCheck() )
|
||||
{
|
||||
check = true;
|
||||
}
|
||||
|
||||
if( check || ( m_usingStandard && ( instance.Output.Count == 0 || instance.Output.Count < 6 ) ) )
|
||||
{
|
||||
check = false;
|
||||
if( m_usingStandard )
|
||||
{
|
||||
instance.Output.Clear();
|
||||
instance.Output = new List<TextureOutput>()
|
||||
{
|
||||
new TextureOutput(true, Preferences.GlobalAlbedo, TextureScale.Full, true, TextureChannels.RGBA, TextureCompression.High, ImageFormat.TGA ),
|
||||
new TextureOutput(true, Preferences.GlobalNormals, TextureScale.Full, false, TextureChannels.RGBA, TextureCompression.High, ImageFormat.TGA ),
|
||||
new TextureOutput(true, Preferences.GlobalSpecular, TextureScale.Full, true, TextureChannels.RGBA, TextureCompression.High, ImageFormat.TGA ),
|
||||
new TextureOutput(true, Preferences.GlobalOcclusion, TextureScale.Full, true, TextureChannels.RGB, TextureCompression.Normal, ImageFormat.TGA ),
|
||||
new TextureOutput(true, Preferences.GlobalEmission, TextureScale.Full, false, TextureChannels.RGB, TextureCompression.High, ImageFormat.EXR ),
|
||||
new TextureOutput(true, Preferences.GlobalPosition, TextureScale.Quarter, false, TextureChannels.RGB, TextureCompression.None, ImageFormat.TGA ),
|
||||
};
|
||||
}
|
||||
|
||||
RefreshList();
|
||||
|
||||
Repaint();
|
||||
}
|
||||
|
||||
m_reorderableOutput.DoLayoutList();
|
||||
|
||||
if( GUI.changed )
|
||||
EditorUtility.SetDirty( instance );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0c60e21ade34544d8b569cc5b4f9bcc
|
||||
timeCreated: 1533227802
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1471
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector/AmplifyImpostorInspector.cs
vendored
Normal file
1471
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/Inspector/AmplifyImpostorInspector.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e5cc34cc2f367241ac97a4989568b02
|
||||
timeCreated: 1517223131
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode.meta
vendored
Normal file
10
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode.meta
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce6be581eb19e354fa5ea32b84bc03d2
|
||||
folderAsset: yes
|
||||
timeCreated: 1531234144
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AIToASE.asmdef
vendored
Normal file
22
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AIToASE.asmdef
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "AIToASE",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:f540dafdfbc0586439d98823585550d4",
|
||||
"GUID:a1a7cacb6cec073439a2b2c1849d773b",
|
||||
"GUID:beb7ced4cc341384592d9187e65da6b5"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [
|
||||
"AMPLIFY_SHADER_EDITOR"
|
||||
],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AIToASE.asmdef.meta
vendored
Normal file
7
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AIToASE.asmdef.meta
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c36a092b2f77a6146a1ab23843ac10cb
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
1805
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AmplifyImpostorNode.cs
vendored
Normal file
1805
Assets/ThirdParty/Tools/AmplifyImpostors/Plugins/Editor/ShaderEditorNode/AmplifyImpostorNode.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd1302eae8cb12848b4b8f4f6d4efc58
|
||||
timeCreated: 1531149136
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user