Curved World 에셋 추가
8
Assets/Amazing Assets.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b013368b271448a43b75befbe3f0a458
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Amazing Assets/Curved World.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42cd215498d879940ab85e9e2333b4b5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Amazing Assets/Curved World/Documentation.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8542d43eaf3b2044884cfb3008f6f0de
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,3 @@
|
||||
Online documentation is available from the link below:
|
||||
|
||||
https://docs.google.com/document/d/1nptLK-X8kwUdXWbE_RyqiaPHYd5R96zu7LptWJ2tcf4/edit?usp=sharing
|
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d4077a1cb2de064f9a6bec875ceb400
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Amazing Assets/Curved World/Editor.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cea8934922fa8fe4c96df862055823f5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Amazing Assets/Curved World/Editor/Base.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b15a9227a5260504193a3b13a208683d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
16
Assets/Amazing Assets/Curved World/Editor/Base/AssetInfo.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
internal static class AssetInfo
|
||||
{
|
||||
public const string assetName = "Curved World";
|
||||
public static readonly string assetNameTrimmed = assetName.Replace(" ", string.Empty);
|
||||
public const string assetVersion = "2024.1";
|
||||
public const string assetStorePath = "content/173251";
|
||||
public const string assetStorePathShortLink = "http://u3d.as/1W8h";
|
||||
public const string assetForumPath = "https://forum.unity.com/threads/curved-world-2.344041/";
|
||||
public const string assetManualLocation = "https://docs.google.com/document/d/1nptLK-X8kwUdXWbE_RyqiaPHYd5R96zu7LptWJ2tcf4/edit?usp=sharing";
|
||||
|
||||
public const string assetSupportMail = "support@amazingassets.world";
|
||||
public const string publisherPage = "https://assetstore.unity.com/publishers/1295";
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79bae737a16fecb428e6849a402681c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,310 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
static internal class EditorGUIHelper
|
||||
{
|
||||
#region GUI
|
||||
public class GUIEnabled : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private bool PreviousState
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public GUIEnabled(bool newState)
|
||||
{
|
||||
PreviousState = GUI.enabled;
|
||||
if (PreviousState == false)
|
||||
GUI.enabled = false;
|
||||
else
|
||||
GUI.enabled = newState;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.enabled = PreviousState;
|
||||
}
|
||||
}
|
||||
|
||||
public class GUIColor : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private Color PreviousColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public GUIColor(Color newColor)
|
||||
{
|
||||
PreviousColor = GUI.color;
|
||||
GUI.color = newColor;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.color = PreviousColor;
|
||||
}
|
||||
}
|
||||
|
||||
public class GUIBackgroundColor : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private Color PreviousColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public GUIBackgroundColor(Color newColor)
|
||||
{
|
||||
PreviousColor = GUI.color;
|
||||
GUI.backgroundColor = newColor;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.backgroundColor = PreviousColor;
|
||||
}
|
||||
}
|
||||
|
||||
public class GUISkinLabelFontStyle : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private FontStyle PreviousStyle
|
||||
{
|
||||
set;
|
||||
get;
|
||||
}
|
||||
|
||||
public GUISkinLabelFontStyle(FontStyle newStyle)
|
||||
{
|
||||
PreviousStyle = GUI.skin.label.fontStyle;
|
||||
GUI.skin.label.fontStyle = newStyle;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.skin.label.fontStyle = PreviousStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public class GUISkinLabelNormalTextColor : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private Color PreviousTextColor
|
||||
{
|
||||
set;
|
||||
get;
|
||||
}
|
||||
|
||||
public GUISkinLabelNormalTextColor(Color newColor)
|
||||
{
|
||||
PreviousTextColor = GUI.skin.label.normal.textColor;
|
||||
GUI.skin.label.normal.textColor = newColor;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUI.skin.label.normal.textColor = PreviousTextColor;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region GUI Layout
|
||||
public class GUILayoutBeginHorizontal : IDisposable
|
||||
{
|
||||
public GUILayoutBeginHorizontal()
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
}
|
||||
|
||||
public GUILayoutBeginHorizontal(params GUILayoutOption[] layoutOptions)
|
||||
{
|
||||
GUILayout.BeginHorizontal(layoutOptions);
|
||||
}
|
||||
|
||||
public GUILayoutBeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
GUILayout.BeginHorizontal(style, options);
|
||||
}
|
||||
|
||||
public GUILayoutBeginHorizontal(string text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
GUILayout.BeginHorizontal(text, style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
public class GUILayoutBeginVertical : IDisposable
|
||||
{
|
||||
public GUILayoutBeginVertical()
|
||||
{
|
||||
GUILayout.BeginVertical();
|
||||
}
|
||||
|
||||
public GUILayoutBeginVertical(params GUILayoutOption[] options)
|
||||
{
|
||||
GUILayout.BeginVertical(options);
|
||||
}
|
||||
|
||||
public GUILayoutBeginVertical(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
GUILayout.BeginVertical(style, options);
|
||||
}
|
||||
|
||||
public GUILayoutBeginVertical(string text, GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
GUILayout.BeginVertical(text, style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
GUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Editor GUI
|
||||
public class EditorGUIIndentLevel : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private int PreviousIndent
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public EditorGUIIndentLevel(int newIndent)
|
||||
{
|
||||
PreviousIndent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = EditorGUI.indentLevel + newIndent;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditorGUI.indentLevel = PreviousIndent;
|
||||
}
|
||||
}
|
||||
|
||||
public class EditorGUIUtilityLabelWidth : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private float PreviousWidth
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public EditorGUIUtilityLabelWidth(float newWidth)
|
||||
{
|
||||
PreviousWidth = UnityEditor.EditorGUIUtility.labelWidth;
|
||||
UnityEditor.EditorGUIUtility.labelWidth = newWidth;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEditor.EditorGUIUtility.labelWidth = PreviousWidth;
|
||||
}
|
||||
}
|
||||
|
||||
public class EditorGUIUtilityFieldWidth : IDisposable
|
||||
{
|
||||
[SerializeField]
|
||||
private float PreviousWidth
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public EditorGUIUtilityFieldWidth(float newWidth)
|
||||
{
|
||||
PreviousWidth = UnityEditor.EditorGUIUtility.fieldWidth;
|
||||
UnityEditor.EditorGUIUtility.fieldWidth = newWidth;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEditor.EditorGUIUtility.fieldWidth = PreviousWidth;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Editor GUI Layout
|
||||
public class EditorGUILayoutBeginHorizontal : IDisposable
|
||||
{
|
||||
public EditorGUILayoutBeginHorizontal()
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
}
|
||||
|
||||
public EditorGUILayoutBeginHorizontal(params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(options);
|
||||
}
|
||||
|
||||
public EditorGUILayoutBeginHorizontal(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginHorizontal(style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
public class EditorGUILayoutBeginVertical : IDisposable
|
||||
{
|
||||
public EditorGUILayoutBeginVertical()
|
||||
{
|
||||
EditorGUILayout.BeginVertical();
|
||||
}
|
||||
|
||||
public EditorGUILayoutBeginVertical(params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(options);
|
||||
}
|
||||
|
||||
public EditorGUILayoutBeginVertical(GUIStyle style, params GUILayoutOption[] options)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(style, options);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
internal static bool ToggleAsButton(Rect rect, bool value, string label, bool hasError = false, bool hasWarning = false)
|
||||
{
|
||||
using (new EditorGUIHelper.GUIBackgroundColor(hasError ? Color.red : (hasWarning ? Color.yellow : GetToggleButtonColor(value))))
|
||||
{
|
||||
return GUI.Toggle(rect, value, label, "Button");
|
||||
}
|
||||
}
|
||||
|
||||
internal static Color GetToggleButtonColor(bool isEnabled)
|
||||
{
|
||||
return (UnityEditor.EditorGUIUtility.isProSkin && isEnabled == true) ? Color.green * 0.6f : Color.white;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28f2d91033f90d4468ee28c7d425d3dd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
1815
Assets/Amazing Assets/Curved World/Editor/Base/EditorUtilities.cs
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3fb91ec039cf3154796b626366bb9af5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,143 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.IMGUI.Controls;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
internal class ShaderSelectionDropdown : AdvancedDropdown
|
||||
{
|
||||
private class ShaderDropdownItem : AdvancedDropdownItem
|
||||
{
|
||||
private string m_FullName;
|
||||
|
||||
private string m_Prefix;
|
||||
|
||||
public string fullName => m_FullName;
|
||||
|
||||
public string prefix => m_Prefix;
|
||||
|
||||
public ShaderDropdownItem(string prefix, string fullName, string shaderName)
|
||||
: base(shaderName)
|
||||
{
|
||||
m_FullName = fullName;
|
||||
m_Prefix = prefix;
|
||||
base.id = (prefix + fullName + shaderName).GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
private Action<object> m_OnSelectedShaderPopup;
|
||||
|
||||
|
||||
public ShaderSelectionDropdown(Action<object> onSelectedShaderPopup)
|
||||
: base(new AdvancedDropdownState())
|
||||
{
|
||||
base.minimumSize = new Vector2(270f, 308f);
|
||||
m_OnSelectedShaderPopup = onSelectedShaderPopup;
|
||||
}
|
||||
|
||||
protected override AdvancedDropdownItem BuildRoot()
|
||||
{
|
||||
AdvancedDropdownItem root = new AdvancedDropdownItem("Shaders");
|
||||
ShaderInfo[] allShaderInfo = ShaderUtil.GetAllShaderInfo();
|
||||
List<string> list = new List<string>();
|
||||
List<string> list2 = new List<string>();
|
||||
List<string> list3 = new List<string>();
|
||||
List<string> list4 = new List<string>();
|
||||
ShaderInfo[] array = allShaderInfo;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
ShaderInfo shaderInfo = array[i];
|
||||
if (!shaderInfo.name.StartsWith("Deprecated") && !shaderInfo.name.StartsWith("Hidden"))
|
||||
{
|
||||
if (shaderInfo.hasErrors)
|
||||
{
|
||||
list4.Add(shaderInfo.name);
|
||||
}
|
||||
else if (!shaderInfo.supported)
|
||||
{
|
||||
list3.Add(shaderInfo.name);
|
||||
}
|
||||
else if (shaderInfo.name.StartsWith("Legacy Shaders/"))
|
||||
{
|
||||
list2.Add(shaderInfo.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
list.Add(shaderInfo.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
list.Sort(delegate (string s1, string s2)
|
||||
{
|
||||
int num = s2.Count((char c) => c == '/') - s1.Count((char c) => c == '/');
|
||||
if (num == 0)
|
||||
{
|
||||
num = s1.CompareTo(s2);
|
||||
}
|
||||
return num;
|
||||
});
|
||||
list2.Sort();
|
||||
list3.Sort();
|
||||
list4.Sort();
|
||||
list.ForEach(delegate (string s)
|
||||
{
|
||||
AddShaderToMenu("", root, s, s);
|
||||
});
|
||||
if (list2.Any() || list3.Any() || list4.Any())
|
||||
{
|
||||
root.AddSeparator();
|
||||
}
|
||||
list2.ForEach(delegate (string s)
|
||||
{
|
||||
AddShaderToMenu("", root, s, s);
|
||||
});
|
||||
list3.ForEach(delegate (string s)
|
||||
{
|
||||
AddShaderToMenu("Not supported/", root, s, "Not supported/" + s);
|
||||
});
|
||||
list4.ForEach(delegate (string s)
|
||||
{
|
||||
AddShaderToMenu("Failed to compile/", root, s, "Failed to compile/" + s);
|
||||
});
|
||||
return root;
|
||||
}
|
||||
|
||||
protected override void ItemSelected(AdvancedDropdownItem item)
|
||||
{
|
||||
m_OnSelectedShaderPopup(((ShaderDropdownItem)item).fullName);
|
||||
}
|
||||
|
||||
private void AddShaderToMenu(string prefix, AdvancedDropdownItem parent, string fullShaderName, string shaderName)
|
||||
{
|
||||
string[] array = shaderName.Split('/');
|
||||
if (array.Length > 1)
|
||||
{
|
||||
AddShaderToMenu(prefix, FindOrCreateChild(parent, shaderName), fullShaderName, shaderName.Substring(array[0].Length + 1));
|
||||
return;
|
||||
}
|
||||
ShaderDropdownItem shaderDropdownItem = new ShaderDropdownItem(prefix, fullShaderName, shaderName);
|
||||
parent.AddChild(shaderDropdownItem);
|
||||
}
|
||||
|
||||
private AdvancedDropdownItem FindOrCreateChild(AdvancedDropdownItem parent, string path)
|
||||
{
|
||||
string[] array = path.Split('/');
|
||||
string text = array[0];
|
||||
foreach (AdvancedDropdownItem child in parent.children)
|
||||
{
|
||||
if (child.name == text)
|
||||
{
|
||||
return child;
|
||||
}
|
||||
}
|
||||
AdvancedDropdownItem advancedDropdownItem = new AdvancedDropdownItem(text);
|
||||
parent.AddChild(advancedDropdownItem);
|
||||
return advancedDropdownItem;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c6fb834b58532e49bf29b510ddfa4d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9ac523fcaa9ce142906f3bbbc8be902
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,142 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
class CurvedWorldBendSettingsEditorWindow : EditorWindow
|
||||
{
|
||||
enum NORMAL_TRANSFORM { Default, Enable, Disable }
|
||||
|
||||
|
||||
public delegate void DataChanged(CurvedWorld.BEND_TYPE bendType, int bendID, int normalTransformState, object obj);
|
||||
static DataChanged callback;
|
||||
|
||||
|
||||
static public CurvedWorldBendSettingsEditorWindow window;
|
||||
|
||||
|
||||
CurvedWorld.BEND_TYPE bendType;
|
||||
int bendID;
|
||||
NORMAL_TRANSFORM normalTransform;
|
||||
|
||||
|
||||
static object objMaterial;
|
||||
static Vector2 windowResolution = new Vector2(340, 120);
|
||||
|
||||
|
||||
|
||||
static public void ShowWindow(Vector2 position, DataChanged method, object obj)
|
||||
{
|
||||
if (window != null)
|
||||
{
|
||||
window.Close();
|
||||
window = null;
|
||||
}
|
||||
|
||||
|
||||
window = (CurvedWorldBendSettingsEditorWindow)CurvedWorldBendSettingsEditorWindow.CreateInstance(typeof(CurvedWorldBendSettingsEditorWindow));
|
||||
window.titleContent = new GUIContent("Bend Settings");
|
||||
|
||||
callback = method;
|
||||
objMaterial = obj;
|
||||
|
||||
|
||||
window.minSize = windowResolution;
|
||||
window.maxSize = windowResolution;
|
||||
|
||||
window.ShowUtility();
|
||||
window.position = new Rect(position.x, position.y, windowResolution.x, windowResolution.y);
|
||||
}
|
||||
|
||||
void OnLostFocus()
|
||||
{
|
||||
if (window != null)
|
||||
{
|
||||
window.Close();
|
||||
window = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (callback == null ||
|
||||
(window != null && this != window))
|
||||
this.Close();
|
||||
|
||||
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginVertical(EditorStyles.helpBox))
|
||||
{
|
||||
Rect drawRect = EditorGUILayout.GetControlRect();
|
||||
|
||||
#region BendType
|
||||
Rect rc = drawRect;
|
||||
rc.width = 140;
|
||||
EditorGUI.LabelField(rc, "Bend Type");
|
||||
|
||||
rc.xMin = rc.xMax;
|
||||
rc.xMax = drawRect.xMax;
|
||||
if (GUI.Button(rc, EditorUtilities.GetBendTypeNameInfo(bendType).forLable, EditorStyles.popup))
|
||||
{
|
||||
GenericMenu menu = EditorUtilities.BuildBendTypesMenu(bendType, CallbackBendTypeMenu);
|
||||
|
||||
menu.DropDown(new Rect(rc.xMin, rc.yMin, rc.width, UnityEditor.EditorGUIUtility.singleLineHeight));
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region BendID
|
||||
|
||||
drawRect = EditorGUILayout.GetControlRect();
|
||||
|
||||
rc = drawRect;
|
||||
rc.width = 140;
|
||||
EditorGUI.LabelField(rc, "Bend ID");
|
||||
|
||||
rc.xMin = rc.xMax;
|
||||
rc.xMax = drawRect.xMax;
|
||||
bendID = EditorGUI.IntSlider(rc, bendID, 1, EditorUtilities.MAX_SUPPORTED_BEND_IDS);
|
||||
#endregion
|
||||
|
||||
|
||||
#region Transorm Normal
|
||||
|
||||
drawRect = EditorGUILayout.GetControlRect();
|
||||
|
||||
rc = drawRect;
|
||||
rc.width = 140;
|
||||
EditorGUI.LabelField(rc, "Transform Normal");
|
||||
|
||||
rc.xMin = rc.xMax;
|
||||
rc.xMax = drawRect.xMax;
|
||||
normalTransform = (NORMAL_TRANSFORM)EditorGUI.EnumPopup(rc, normalTransform);
|
||||
#endregion
|
||||
|
||||
|
||||
GUILayout.Space(32);
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginHorizontal())
|
||||
{
|
||||
if (GUILayout.Button("Change"))
|
||||
{
|
||||
if (callback != null)
|
||||
callback(bendType, bendID, (int)normalTransform, objMaterial);
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
||||
if (GUILayout.Button("Cancel"))
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CallbackBendTypeMenu(object obj)
|
||||
{
|
||||
bendType = (CurvedWorld.BEND_TYPE)obj;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d607814884d16e44995bff1c8c135612
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f85a235e25e26e54aa267b8e3d1e7e63
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,150 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
class CurvedWorldMaterialDuplicateEditorWindow : EditorWindow
|
||||
{
|
||||
static public CurvedWorldMaterialDuplicateEditorWindow window;
|
||||
|
||||
|
||||
public delegate void DataChanged(string subFolderName, string prefix, string suffix, object obj);
|
||||
static DataChanged callback;
|
||||
|
||||
|
||||
string subFolderName;
|
||||
string prefix;
|
||||
string suffix;
|
||||
|
||||
|
||||
static object objMaterial;
|
||||
static Vector2 windowResolution = new Vector2(340, 158);
|
||||
|
||||
|
||||
|
||||
static public void ShowWindow(Vector2 position, DataChanged method, object obj)
|
||||
{
|
||||
if (window != null)
|
||||
{
|
||||
window.Close();
|
||||
window = null;
|
||||
}
|
||||
|
||||
|
||||
window = (CurvedWorldMaterialDuplicateEditorWindow)CurvedWorldMaterialDuplicateEditorWindow.CreateInstance(typeof(CurvedWorldMaterialDuplicateEditorWindow));
|
||||
window.titleContent = new GUIContent("Duplicate Material");
|
||||
|
||||
callback = method;
|
||||
objMaterial = obj;
|
||||
|
||||
|
||||
window.minSize = windowResolution;
|
||||
window.maxSize = windowResolution;
|
||||
|
||||
window.ShowUtility();
|
||||
window.position = new Rect(position.x, position.y, windowResolution.x, windowResolution.y);
|
||||
}
|
||||
|
||||
|
||||
void OnLostFocus()
|
||||
{
|
||||
if (window != null)
|
||||
{
|
||||
window.Close();
|
||||
window = null;
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (callback == null ||
|
||||
(window != null && this != window))
|
||||
this.Close();
|
||||
|
||||
|
||||
subFolderName = subFolderName == null ? string.Empty : subFolderName;
|
||||
prefix = prefix == null ? string.Empty : prefix;
|
||||
suffix = suffix == null ? string.Empty : suffix;
|
||||
|
||||
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginVertical(EditorStyles.helpBox))
|
||||
{
|
||||
using (new EditorGUIHelper.EditorGUIUtilityLabelWidth(110))
|
||||
{
|
||||
using (new EditorGUIHelper.GUIBackgroundColor(EditorUtilities.ContainsInvalidFileNameCharacters(subFolderName.Trim()) ? Color.red : Color.white))
|
||||
{
|
||||
subFolderName = EditorGUILayout.TextField("Subfolder Name", subFolderName);
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
EditorGUILayout.HelpBox("Leave 'Subfolder Name' field empty to create material duplicate in the same folder. In this case file prefix/suffix are required.", MessageType.Info);
|
||||
GUILayout.Space(5);
|
||||
|
||||
if (prefix == null) prefix = string.Empty;
|
||||
if (suffix == null) suffix = string.Empty;
|
||||
|
||||
Color backGroundColor = Color.white;
|
||||
if (string.IsNullOrEmpty(subFolderName.Trim()))
|
||||
{
|
||||
if (string.IsNullOrEmpty((prefix + suffix).Trim()) || EditorUtilities.ContainsInvalidFileNameCharacters(prefix))
|
||||
backGroundColor = Color.red;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EditorUtilities.ContainsInvalidFileNameCharacters(prefix))
|
||||
backGroundColor = Color.red;
|
||||
}
|
||||
using (new EditorGUIHelper.GUIBackgroundColor(backGroundColor))
|
||||
{
|
||||
prefix = EditorGUILayout.TextField("File Prefix", prefix);
|
||||
}
|
||||
|
||||
|
||||
backGroundColor = Color.white;
|
||||
if (string.IsNullOrEmpty(subFolderName.Trim()))
|
||||
{
|
||||
if (string.IsNullOrEmpty((prefix + suffix).Trim()) || EditorUtilities.ContainsInvalidFileNameCharacters(suffix))
|
||||
backGroundColor = Color.red;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EditorUtilities.ContainsInvalidFileNameCharacters(suffix))
|
||||
backGroundColor = Color.red;
|
||||
}
|
||||
using (new EditorGUIHelper.GUIBackgroundColor(backGroundColor))
|
||||
{
|
||||
suffix = EditorGUILayout.TextField("File Suffix", suffix);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(15);
|
||||
bool saveAvailable = true;
|
||||
string checkString = (prefix + suffix).Trim();
|
||||
if (string.IsNullOrEmpty(subFolderName.Trim()))
|
||||
{
|
||||
if (string.IsNullOrEmpty(checkString) || EditorUtilities.ContainsInvalidFileNameCharacters(checkString))
|
||||
saveAvailable = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (EditorUtilities.ContainsInvalidFileNameCharacters(subFolderName.Trim()))
|
||||
saveAvailable = false;
|
||||
else if (EditorUtilities.ContainsInvalidFileNameCharacters(checkString))
|
||||
saveAvailable = false;
|
||||
}
|
||||
|
||||
|
||||
using (new EditorGUIHelper.GUIEnabled(saveAvailable))
|
||||
{
|
||||
if (GUILayout.Button("Create Duplicate"))
|
||||
{
|
||||
this.Close();
|
||||
|
||||
callback(subFolderName.Trim(), prefix, suffix, objMaterial);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5da3c2439f8112749b8a9b2dc6372758
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Amazing Assets/Curved World/Editor/Icons.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd8006b1aeb31424bb5ffce95c4c7b07
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconForum.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f1319b2b1c0bb64785d5f224eee98ea
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconManual.png
Normal file
After Width: | Height: | Size: 549 B |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ec001be57ce71d4db04ad239082fd6b
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconMaterial.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 52b0267c98cc6f540aa102286513d822
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconMore.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
@ -0,0 +1,104 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0ceacf8845c57c34d85fa2f966fea4e8
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconRate.png
Normal file
After Width: | Height: | Size: 807 B |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71326c59e368da1489bc7318bea5f0a5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
After Width: | Height: | Size: 485 B |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18f1f2298833f34f8220fd55bd6fc73
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconShader.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 724270213cb481740a0d1ab7d6b190d5
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
BIN
Assets/Amazing Assets/Curved World/Editor/Icons/IconSupport.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,128 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10abee663bc5a994489f7a09726ea490
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 11
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 0
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 1
|
||||
spriteTessellationDetail: -1
|
||||
textureType: 2
|
||||
textureShape: 1
|
||||
singleChannelComponent: 0
|
||||
maxTextureSizeSet: 0
|
||||
compressionQualitySet: 0
|
||||
textureFormatSet: 0
|
||||
applyGammaDecoding: 0
|
||||
platformSettings:
|
||||
- serializedVersion: 3
|
||||
buildTarget: DefaultTexturePlatform
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 0
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
secondaryTextures: []
|
||||
spritePackingTag:
|
||||
pSDRemoveMatte: 0
|
||||
pSDShowRemoveMatteOption: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bc2cf3ddd90d384a985e3480a0b5004
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 748880e412557724c9bc4f63339e05c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
internal class DefaultShaderGUI : ShaderGUI
|
||||
{
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.HelpBox, false, false);
|
||||
|
||||
base.OnGUI(materialEditor, properties);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3815d98e725fef49a3a544cf9fa8083
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,16 @@
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
internal class SpritesShaderGUI : ShaderGUI
|
||||
{
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.HelpBox, false, true);
|
||||
|
||||
base.OnGUI(materialEditor, properties);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd8f8b6acb1c8c54fb55b21bf75d757c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,14 @@
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
internal class TerrainShaderGUI : ShaderGUI
|
||||
{
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.HelpBox, false, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60c1b1133fcecd8488f32c73fdecedb0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,237 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
static public class MaterialProperties
|
||||
{
|
||||
public enum STYLE { None, Standard, HelpBox, Foldout }
|
||||
|
||||
|
||||
[Flags]
|
||||
public enum Expandable
|
||||
{
|
||||
CurvedWorld = 1 << 4,
|
||||
}
|
||||
|
||||
public enum BlendMode
|
||||
{
|
||||
Opaque,
|
||||
Cutout,
|
||||
Fade, // Old school alpha-blending mode, fresnel does not affect amount of transparency
|
||||
Transparent // Physically plausible transparency mode, implemented as alpha pre-multiply
|
||||
}
|
||||
private static class Label
|
||||
{
|
||||
public static string mainGroupName = "Curved World";
|
||||
|
||||
public static string bendType = "Bend Type";
|
||||
public static string bendID = "Bend ID";
|
||||
public static string bendTransformNormal = "Transform Normal";
|
||||
|
||||
public static string renderingMode = "Rendering Mode";
|
||||
public static string renderFace = "Render Face";
|
||||
|
||||
public static readonly string[] blendNames = Enum.GetNames(typeof(BlendMode));
|
||||
}
|
||||
|
||||
static MaterialProperty _CurvedWorldBendSettings = null;
|
||||
|
||||
static MaterialProperty _BlendMode = null;
|
||||
static MaterialProperty _Cull = null;
|
||||
|
||||
static Material material;
|
||||
|
||||
static bool foldout = true;
|
||||
|
||||
|
||||
static public void InitCurvedWorldMaterialProperties(MaterialProperty[] props)
|
||||
{
|
||||
_CurvedWorldBendSettings = FindProperty(EditorUtilities.shaderProprtyName_BendSettings, props, false);
|
||||
|
||||
_BlendMode = FindProperty("_Mode", props, false);
|
||||
_Cull = FindProperty("_Cull", props, false);
|
||||
|
||||
}
|
||||
|
||||
static public void DrawCurvedWorldMaterialProperties(MaterialEditor materialEditor, STYLE style, bool drawRenderingOptions, bool drawCull)
|
||||
{
|
||||
if (drawRenderingOptions && _BlendMode != null)
|
||||
{
|
||||
//Make sure that needed setup(ie keywords / renderqueue) are set up if we're switching some existing
|
||||
Material material = materialEditor.target as Material;
|
||||
SetupMaterialWithBlendMode(material, (BlendMode)material.GetFloat("_Mode")); //If blend modes are not available - use default blend mode
|
||||
}
|
||||
|
||||
switch (style)
|
||||
{
|
||||
case STYLE.HelpBox:
|
||||
{
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginVertical(EditorStyles.helpBox))
|
||||
{
|
||||
EditorGUILayout.LabelField(Label.mainGroupName, EditorStyles.boldLabel);
|
||||
|
||||
if (_CurvedWorldBendSettings != null)
|
||||
materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
|
||||
}
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLE.Standard:
|
||||
{
|
||||
EditorGUILayout.LabelField(Label.mainGroupName, EditorStyles.boldLabel);
|
||||
|
||||
if (_CurvedWorldBendSettings != null)
|
||||
materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLE.Foldout:
|
||||
{
|
||||
foldout = EditorGUILayout.BeginFoldoutHeaderGroup(foldout, Label.mainGroupName);
|
||||
|
||||
if (foldout)
|
||||
{
|
||||
if (_CurvedWorldBendSettings != null)
|
||||
materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
|
||||
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
|
||||
EditorGUILayout.EndFoldoutHeaderGroup();
|
||||
}
|
||||
break;
|
||||
|
||||
case STYLE.None:
|
||||
default:
|
||||
{
|
||||
if (_CurvedWorldBendSettings != null)
|
||||
materialEditor.ShaderProperty(_CurvedWorldBendSettings, Label.bendType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (drawRenderingOptions && _BlendMode != null)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
BlendModePopup(materialEditor);
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (var obj in _BlendMode.targets)
|
||||
{
|
||||
Material mat = (Material)obj;
|
||||
SetupMaterialWithBlendMode(mat, (BlendMode)mat.GetFloat("_Mode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (drawCull && _Cull != null)
|
||||
{
|
||||
materialEditor.ShaderProperty(_Cull, Label.renderFace);
|
||||
}
|
||||
}
|
||||
|
||||
static public void SetKeyWords(Material material)
|
||||
{
|
||||
if (material.HasProperty(EditorUtilities.shaderProprtyName_BendSettings))
|
||||
{
|
||||
CurvedWorld.BEND_TYPE bendType;
|
||||
int bendID;
|
||||
bool normalTransform;
|
||||
|
||||
EditorUtilities.GetBendSettingsFromVector(material.GetVector(EditorUtilities.shaderProprtyName_BendSettings), out bendType, out bendID, out normalTransform);
|
||||
|
||||
EditorUtilities.UpdateMaterialKeyWords(material, bendType, bendID, normalTransform);
|
||||
}
|
||||
}
|
||||
|
||||
static public MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties, bool mandatory = true)
|
||||
{
|
||||
for (int index = 0; index < properties.Length; ++index)
|
||||
{
|
||||
if (properties[index] != null && properties[index].name == propertyName)
|
||||
return properties[index];
|
||||
}
|
||||
|
||||
if (mandatory)
|
||||
throw new System.ArgumentException("Could not find MaterialProperty: '" + propertyName + "', Num properties: " + (object)properties.Length);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
static void BlendModePopup(MaterialEditor materialEditor)
|
||||
{
|
||||
EditorGUI.showMixedValue = _BlendMode.hasMixedValue;
|
||||
var mode = (BlendMode)_BlendMode.floatValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
mode = (BlendMode)EditorGUILayout.Popup(Label.renderingMode, (int)mode, Label.blendNames);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
materialEditor.RegisterPropertyChangeUndo("Rendering Mode");
|
||||
_BlendMode.floatValue = (float)mode;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
|
||||
static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
|
||||
{
|
||||
switch (blendMode)
|
||||
{
|
||||
case BlendMode.Opaque:
|
||||
material.SetOverrideTag("RenderType", "CurvedWorld_Opaque");
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.SetInt("_ZWrite", 1);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = -1;
|
||||
break;
|
||||
case BlendMode.Cutout:
|
||||
material.SetOverrideTag("RenderType", "CurvedWorld_TransparentCutout");
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
|
||||
material.SetInt("_ZWrite", 1);
|
||||
material.EnableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
|
||||
break;
|
||||
case BlendMode.Fade:
|
||||
material.SetOverrideTag("RenderType", "Transparent");
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.SetInt("_ZWrite", 0);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.EnableKeyword("_ALPHABLEND_ON");
|
||||
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
|
||||
break;
|
||||
case BlendMode.Transparent:
|
||||
material.SetOverrideTag("RenderType", "Transparent");
|
||||
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
|
||||
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
|
||||
material.SetInt("_ZWrite", 0);
|
||||
material.DisableKeyword("_ALPHATEST_ON");
|
||||
material.DisableKeyword("_ALPHABLEND_ON");
|
||||
material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
|
||||
material.renderQueue = (int)UnityEngine.Rendering.RenderQueue.Transparent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: adc71d890e0997c45ac6ae44ec4061f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4083bb5ef1a21ee458d7b6bebff77507
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,140 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
class SpeedTree8ShaderGUI : ShaderGUI
|
||||
{
|
||||
private bool m_FirstTimeApply = true;
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
if (this.m_FirstTimeApply)
|
||||
{
|
||||
foreach (Material target in materialEditor.targets)
|
||||
SpeedTree8ShaderGUI.MaterialChanged(target);
|
||||
this.m_FirstTimeApply = false;
|
||||
}
|
||||
UnityEditor.EditorGUIUtility.labelWidth = 0.0f;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, AmazingAssets.CurvedWorldEditor.MaterialProperties.STYLE.HelpBox, false, false);
|
||||
|
||||
|
||||
GUILayout.Label(SpeedTree8ShaderGUI.Styles.primaryMapsText, EditorStyles.boldLabel);
|
||||
MaterialProperty property1 = ShaderGUI.FindProperty("_MainTex", properties);
|
||||
MaterialProperty property2 = ShaderGUI.FindProperty("_Color", properties);
|
||||
materialEditor.TexturePropertySingleLine(SpeedTree8ShaderGUI.Styles.colorText, property1, (MaterialProperty)null, property2);
|
||||
MaterialProperty property3 = ShaderGUI.FindProperty("_BumpMap", properties);
|
||||
materialEditor.TexturePropertySingleLine(SpeedTree8ShaderGUI.Styles.normalMapText, property3);
|
||||
MaterialProperty property4 = ShaderGUI.FindProperty("_ExtraTex", properties);
|
||||
materialEditor.TexturePropertySingleLine(SpeedTree8ShaderGUI.Styles.extraMapText, property4, (MaterialProperty)null);
|
||||
if ((Object)property4.textureValue == (Object)null)
|
||||
{
|
||||
MaterialProperty property5 = ShaderGUI.FindProperty("_Glossiness", properties);
|
||||
materialEditor.ShaderProperty(property5, SpeedTree8ShaderGUI.Styles.smoothnessText, 2);
|
||||
MaterialProperty property6 = ShaderGUI.FindProperty("_Metallic", properties);
|
||||
materialEditor.ShaderProperty(property6, SpeedTree8ShaderGUI.Styles.metallicText, 2);
|
||||
}
|
||||
MaterialProperty property7 = ShaderGUI.FindProperty("_SubsurfaceTex", properties);
|
||||
MaterialProperty property8 = ShaderGUI.FindProperty("_SubsurfaceColor", properties);
|
||||
materialEditor.TexturePropertySingleLine(SpeedTree8ShaderGUI.Styles.subsurfaceMapText, property7, (MaterialProperty)null, property8);
|
||||
EditorGUILayout.Space();
|
||||
GUILayout.Label(SpeedTree8ShaderGUI.Styles.optionsText, EditorStyles.boldLabel);
|
||||
SpeedTree8ShaderGUI.MakeAlignedProperty(ShaderGUI.FindProperty("_TwoSided", properties), SpeedTree8ShaderGUI.Styles.twoSidedText, materialEditor, true);
|
||||
SpeedTree8ShaderGUI.MakeAlignedProperty(ShaderGUI.FindProperty("_WindQuality", properties), SpeedTree8ShaderGUI.Styles.windQualityText, materialEditor, true);
|
||||
SpeedTree8ShaderGUI.MakeCheckedProperty(ShaderGUI.FindProperty("_HueVariationKwToggle", properties), ShaderGUI.FindProperty("_HueVariationColor", properties), SpeedTree8ShaderGUI.Styles.hueVariationText, materialEditor);
|
||||
SpeedTree8ShaderGUI.MakeAlignedProperty(ShaderGUI.FindProperty("_NormalMapKwToggle", properties), SpeedTree8ShaderGUI.Styles.normalMappingText, materialEditor, true);
|
||||
MaterialProperty property9 = ShaderGUI.FindProperty("_SubsurfaceKwToggle", properties);
|
||||
SpeedTree8ShaderGUI.MakeAlignedProperty(property9, SpeedTree8ShaderGUI.Styles.subsurfaceText, materialEditor, true);
|
||||
if ((double)property9.floatValue > 0.0)
|
||||
{
|
||||
MaterialProperty property10 = ShaderGUI.FindProperty("_SubsurfaceIndirect", properties);
|
||||
materialEditor.ShaderProperty(property10, SpeedTree8ShaderGUI.Styles.subsurfaceIndirectText, 2);
|
||||
}
|
||||
MaterialProperty property11 = ShaderGUI.FindProperty("_BillboardKwToggle", properties);
|
||||
SpeedTree8ShaderGUI.MakeAlignedProperty(property11, SpeedTree8ShaderGUI.Styles.billboardText, materialEditor, true);
|
||||
if ((double)property11.floatValue > 0.0)
|
||||
{
|
||||
MaterialProperty property12 = ShaderGUI.FindProperty("_BillboardShadowFade", properties);
|
||||
materialEditor.ShaderProperty(property12, SpeedTree8ShaderGUI.Styles.billboardShadowFadeText, 2);
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
foreach (Material target in materialEditor.targets)
|
||||
{
|
||||
SpeedTree8ShaderGUI.MaterialChanged(target);
|
||||
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.SetKeyWords(target);
|
||||
}
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
GUILayout.Label(SpeedTree8ShaderGUI.Styles.advancedText, EditorStyles.boldLabel);
|
||||
materialEditor.EnableInstancingField();
|
||||
materialEditor.DoubleSidedGIField();
|
||||
}
|
||||
|
||||
private static void MakeAlignedProperty(
|
||||
MaterialProperty prop,
|
||||
GUIContent text,
|
||||
MaterialEditor materialEditor,
|
||||
bool doubleWide = false)
|
||||
{
|
||||
Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
|
||||
controlRect.width = EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth * (doubleWide ? 2f : 1f);
|
||||
materialEditor.ShaderProperty(controlRect, prop, text);
|
||||
}
|
||||
|
||||
private static void MakeCheckedProperty(
|
||||
MaterialProperty keywordToggleProp,
|
||||
MaterialProperty prop,
|
||||
GUIContent text,
|
||||
MaterialEditor materialEditor,
|
||||
bool doubleWide = false)
|
||||
{
|
||||
Rect controlRect = EditorGUILayout.GetControlRect(true, EditorGUIUtility.singleLineHeight + 2f);
|
||||
controlRect.width = EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth / 2f;
|
||||
|
||||
materialEditor.ShaderProperty(controlRect, keywordToggleProp, text);
|
||||
using (new EditorGUI.DisabledScope((double)keywordToggleProp.floatValue == 0.0))
|
||||
{
|
||||
controlRect.width = EditorGUIUtility.labelWidth + EditorGUIUtility.fieldWidth * (doubleWide ? 2f : 1f);
|
||||
controlRect.x += EditorGUIUtility.fieldWidth / 2f;
|
||||
materialEditor.ShaderProperty(controlRect, prop, " ");
|
||||
}
|
||||
}
|
||||
|
||||
private static void MaterialChanged(Material material) => SpeedTree8ShaderGUI.SetKeyword(material, "EFFECT_EXTRA_TEX", (bool)(Object)material.GetTexture("_ExtraTex"));
|
||||
|
||||
private static void SetKeyword(Material m, string keyword, bool state)
|
||||
{
|
||||
if (state)
|
||||
m.EnableKeyword(keyword);
|
||||
else
|
||||
m.DisableKeyword(keyword);
|
||||
}
|
||||
|
||||
private static class Styles
|
||||
{
|
||||
public static GUIContent colorText = new GUIContent("Color", "Color (RGB) and Opacity (A)");
|
||||
public static GUIContent normalMapText = new GUIContent("Normal", "Normal (RGB)");
|
||||
public static GUIContent extraMapText = new GUIContent("Extra", "Smoothness (R), Metallic (G), AO (B)");
|
||||
public static GUIContent subsurfaceMapText = new GUIContent("Subsurface", "Subsurface (RGB)");
|
||||
public static GUIContent smoothnessText = new GUIContent("Smoothness", "Smoothness value");
|
||||
public static GUIContent metallicText = new GUIContent("Metallic", "Metallic value");
|
||||
public static GUIContent twoSidedText = new GUIContent("Two-Sided", "Set this material to render as two-sided");
|
||||
public static GUIContent windQualityText = new GUIContent("Wind Quality", "Wind quality setting");
|
||||
public static GUIContent hueVariationText = new GUIContent("Hue Variation", "Hue variation Color (RGB) and Amount (A)");
|
||||
public static GUIContent normalMappingText = new GUIContent("Normal Map", "Enable normal mapping");
|
||||
public static GUIContent subsurfaceText = new GUIContent("Subsurface", "Enable subsurface scattering");
|
||||
public static GUIContent subsurfaceIndirectText = new GUIContent("Indirect Subsurface", "Scalar on subsurface from indirect light");
|
||||
public static GUIContent billboardText = new GUIContent("Billboard", "Enable billboard features (crossfading, etc.)");
|
||||
public static GUIContent billboardShadowFadeText = new GUIContent("Shadow Fade", "Fade shadow effect on billboards");
|
||||
public static GUIContent primaryMapsText = new GUIContent("Maps");
|
||||
public static GUIContent optionsText = new GUIContent("Options");
|
||||
public static GUIContent advancedText = new GUIContent("Advanced Options");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af1494dce88de7442a23cebf70c689b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,172 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
public class SpeedTreeMaterialInspector : ShaderGUI
|
||||
{
|
||||
private enum SpeedTreeGeometryType
|
||||
{
|
||||
Branch,
|
||||
BranchDetail,
|
||||
Frond,
|
||||
Leaf,
|
||||
Mesh,
|
||||
}
|
||||
|
||||
private string[] speedTreeGeometryTypeString = new string[5]
|
||||
{
|
||||
"GEOM_TYPE_BRANCH",
|
||||
"GEOM_TYPE_BRANCH_DETAIL",
|
||||
"GEOM_TYPE_FROND",
|
||||
"GEOM_TYPE_LEAF",
|
||||
"GEOM_TYPE_MESH"
|
||||
};
|
||||
|
||||
|
||||
|
||||
private bool ShouldEnableAlphaTest(SpeedTreeGeometryType geomType)
|
||||
{
|
||||
return geomType == SpeedTreeGeometryType.Frond || geomType == SpeedTreeGeometryType.Leaf;
|
||||
}
|
||||
private bool? ToggleShaderProperty(MaterialEditor materialEditor, MaterialProperty prop, bool enable, bool hasMixedEnable)
|
||||
{
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = hasMixedEnable;
|
||||
Rect controlRect = EditorGUILayout.GetControlRect(false, GUILayout.ExpandWidth(false));
|
||||
controlRect.width = (double)controlRect.width > (double)EditorGUIUtility.fieldWidth ? controlRect.width - EditorGUIUtility.fieldWidth : controlRect.width;
|
||||
enable = EditorGUI.ToggleLeft(controlRect, prop.displayName, enable);
|
||||
EditorGUI.showMixedValue = false;
|
||||
bool? nullable = EditorGUI.EndChangeCheck() ? new bool?(enable) : new bool?();
|
||||
GUILayout.Space(-EditorGUIUtility.singleLineHeight);
|
||||
using (new EditorGUI.DisabledScope(!enable && !hasMixedEnable))
|
||||
{
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
materialEditor.ShaderProperty(prop, " ");
|
||||
EditorGUI.showMixedValue = false;
|
||||
}
|
||||
return nullable;
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
|
||||
{
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.HelpBox, false, false);
|
||||
|
||||
|
||||
|
||||
List<MaterialProperty> materialPropertyList = new List<MaterialProperty>((IEnumerable<MaterialProperty>)MaterialEditor.GetMaterialProperties(materialEditor.targets));
|
||||
materialEditor.SetDefaultGUIWidths();
|
||||
SpeedTreeGeometryType[] source1 = new SpeedTreeGeometryType[materialEditor.targets.Length];
|
||||
for (int index1 = 0; index1 < materialEditor.targets.Length; ++index1)
|
||||
{
|
||||
source1[index1] = SpeedTreeGeometryType.Branch;
|
||||
for (int index2 = 0; index2 < this.speedTreeGeometryTypeString.Length; ++index2)
|
||||
{
|
||||
if (((IEnumerable<string>)((Material)materialEditor.targets[index1]).shaderKeywords).Contains<string>(this.speedTreeGeometryTypeString[index2]))
|
||||
{
|
||||
source1[index1] = (SpeedTreeGeometryType)index2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = ((IEnumerable<SpeedTreeGeometryType>)source1).Distinct<SpeedTreeGeometryType>().Count<SpeedTreeGeometryType>() > 1;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
SpeedTreeGeometryType geomType = (SpeedTreeGeometryType)EditorGUILayout.EnumPopup("Geometry Type", (Enum)source1[0]);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
bool flag = this.ShouldEnableAlphaTest(geomType);
|
||||
CullMode cullMode = flag ? CullMode.Off : CullMode.Back;
|
||||
foreach (Material material in materialEditor.targets.Cast<Material>())
|
||||
{
|
||||
if (flag)
|
||||
material.SetOverrideTag("RenderType", "treeTransparentCutout");
|
||||
for (int index = 0; index < this.speedTreeGeometryTypeString.Length; ++index)
|
||||
material.DisableKeyword(this.speedTreeGeometryTypeString[index]);
|
||||
material.EnableKeyword(this.speedTreeGeometryTypeString[(int)geomType]);
|
||||
material.renderQueue = flag ? 2450 : 2000;
|
||||
material.SetFloat("_Cull", (float) cullMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
MaterialProperty prop1 = materialPropertyList.Find((Predicate<MaterialProperty>)(prop => prop.name == "_MainTex"));
|
||||
if (prop1 != null)
|
||||
{
|
||||
materialPropertyList.Remove(prop1);
|
||||
materialEditor.ShaderProperty(prop1, prop1.displayName);
|
||||
}
|
||||
MaterialProperty prop2 = materialPropertyList.Find((Predicate<MaterialProperty>)(prop => prop.name == "_BumpMap"));
|
||||
if (prop2 != null)
|
||||
{
|
||||
materialPropertyList.Remove(prop2);
|
||||
IEnumerable<bool> source2 = ((IEnumerable<UnityEngine.Object>)materialEditor.targets).Select<UnityEngine.Object, bool>((Func<UnityEngine.Object, bool>)(t => ((IEnumerable<string>)((Material)t).shaderKeywords).Contains<string>("EFFECT_BUMP")));
|
||||
bool? nullable = ToggleShaderProperty(materialEditor, prop2, source2.First<bool>(), source2.Distinct<bool>().Count<bool>() > 1);
|
||||
if (nullable.HasValue)
|
||||
{
|
||||
foreach (Material material in materialEditor.targets.Cast<Material>())
|
||||
{
|
||||
if (nullable.Value)
|
||||
material.EnableKeyword("EFFECT_BUMP");
|
||||
else
|
||||
material.DisableKeyword("EFFECT_BUMP");
|
||||
}
|
||||
}
|
||||
}
|
||||
MaterialProperty prop3 = materialPropertyList.Find((Predicate<MaterialProperty>)(prop => prop.name == "_DetailTex"));
|
||||
if (prop3 != null)
|
||||
{
|
||||
materialPropertyList.Remove(prop3);
|
||||
if (((IEnumerable<SpeedTreeGeometryType>)source1).Contains<SpeedTreeGeometryType>(SpeedTreeGeometryType.BranchDetail))
|
||||
materialEditor.ShaderProperty(prop3, prop3.displayName);
|
||||
}
|
||||
IEnumerable<bool> source3 = ((IEnumerable<UnityEngine.Object>)materialEditor.targets).Select<UnityEngine.Object, bool>((Func<UnityEngine.Object, bool>)(t => ((IEnumerable<string>)((Material)t).shaderKeywords).Contains<string>("EFFECT_HUE_VARIATION")));
|
||||
MaterialProperty prop4 = materialPropertyList.Find((Predicate<MaterialProperty>)(prop => prop.name == "_HueVariation"));
|
||||
if (source3 != null && prop4 != null)
|
||||
{
|
||||
materialPropertyList.Remove(prop4);
|
||||
bool? nullable = ToggleShaderProperty(materialEditor, prop4, source3.First<bool>(), source3.Distinct<bool>().Count<bool>() > 1);
|
||||
if (nullable.HasValue)
|
||||
{
|
||||
foreach (Material material in materialEditor.targets.Cast<Material>())
|
||||
{
|
||||
if (nullable.Value)
|
||||
material.EnableKeyword("EFFECT_HUE_VARIATION");
|
||||
else
|
||||
material.DisableKeyword("EFFECT_HUE_VARIATION");
|
||||
}
|
||||
}
|
||||
}
|
||||
MaterialProperty prop5 = materialPropertyList.Find((Predicate<MaterialProperty>)(prop => prop.name == "_Cutoff"));
|
||||
if (prop5 != null)
|
||||
{
|
||||
materialPropertyList.Remove(prop5);
|
||||
if (((IEnumerable<SpeedTreeGeometryType>)source1).Any<SpeedTreeGeometryType>((Func<SpeedTreeGeometryType, bool>)(t => this.ShouldEnableAlphaTest(t))))
|
||||
materialEditor.ShaderProperty(prop5, prop5.displayName);
|
||||
}
|
||||
foreach (MaterialProperty prop6 in materialPropertyList)
|
||||
{
|
||||
if ((uint)(prop6.flags & MaterialProperty.PropFlags.HideInInspector) <= 0U)
|
||||
materialEditor.ShaderProperty(prop6, prop6.displayName);
|
||||
}
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.Space();
|
||||
materialEditor.RenderQueueField();
|
||||
materialEditor.EnableInstancingField();
|
||||
materialEditor.DoubleSidedGIField();
|
||||
|
||||
|
||||
//base.OnGUI(materialEditor, properties);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02e45a1748825a141b3efe8223819629
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7433cfd613b02d43b2995ab699cf2cd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,97 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace TMPro.EditorUtilities
|
||||
{
|
||||
public class TMP_CurvedWorld_BitmapShaderGUI : TMP_BaseShaderGUI
|
||||
{
|
||||
static bool s_Face = true;
|
||||
|
||||
protected override void DoGUI()
|
||||
{
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(this.m_Properties);
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(m_Editor, AmazingAssets.CurvedWorldEditor.MaterialProperties.STYLE.HelpBox, false, false);
|
||||
|
||||
s_Face = BeginPanel("Face", s_Face);
|
||||
if (s_Face)
|
||||
{
|
||||
DoFacePanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended);
|
||||
if (s_DebugExtended)
|
||||
{
|
||||
DoDebugPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
void DoFacePanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
|
||||
{
|
||||
DoColor("_FaceColor", "Color");
|
||||
DoTexture2D("_FaceTex", "Texture", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoColor("_Color", "Color");
|
||||
DoSlider("_DiffusePower", "Diffuse Power");
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel -= 1;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoDebugPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoTexture2D("_MainTex", "Font Atlas");
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_VertexOffsetX))
|
||||
{
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_Padding))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_Padding", "Padding");
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_VertexOffsetX", "Offset X");
|
||||
DoFloat("_VertexOffsetY", "Offset Y");
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_MaskSoftnessX", "Softness X");
|
||||
DoFloat("_MaskSoftnessY", "Softness Y");
|
||||
DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_Stencil", "Stencil ID");
|
||||
DoFloat("_StencilComp", "Stencil Comp");
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ShaderTag_CullMode))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoPopup("_CullMode", "Cull Mode", s_CullingTypeLabels);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUI.indentLevel -= 1;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fd624d9deb7ab34788a9b0c059e0cc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,512 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace TMPro.EditorUtilities
|
||||
{
|
||||
public class TMP_CurvedWorld_SDFShaderGUI : TMP_BaseShaderGUI
|
||||
{
|
||||
static ShaderFeature s_OutlineFeature, s_UnderlayFeature, s_BevelFeature, s_GlowFeature, s_MaskFeature;
|
||||
|
||||
static bool s_Face = true, s_Outline = true, s_Outline2, s_Underlay, s_Lighting, s_Glow, s_Bevel, s_Light, s_Bump, s_Env;
|
||||
|
||||
static string[]
|
||||
s_FaceUVSpeedName = { "_FaceUVSpeed" },
|
||||
s_FaceUvSpeedNames = { "_FaceUVSpeedX", "_FaceUVSpeedY" },
|
||||
s_OutlineUvSpeedNames = { "_OutlineUVSpeedX", "_OutlineUVSpeedY" };
|
||||
|
||||
static TMP_CurvedWorld_SDFShaderGUI()
|
||||
{
|
||||
s_OutlineFeature = new ShaderFeature()
|
||||
{
|
||||
undoLabel = "Outline",
|
||||
keywords = new[] { "OUTLINE_ON" }
|
||||
};
|
||||
|
||||
s_UnderlayFeature = new ShaderFeature()
|
||||
{
|
||||
undoLabel = "Underlay",
|
||||
keywords = new[] { "UNDERLAY_ON", "UNDERLAY_INNER" },
|
||||
label = new GUIContent("Underlay Type"),
|
||||
keywordLabels = new[]
|
||||
{
|
||||
new GUIContent("None"), new GUIContent("Normal"), new GUIContent("Inner")
|
||||
}
|
||||
};
|
||||
|
||||
s_BevelFeature = new ShaderFeature()
|
||||
{
|
||||
undoLabel = "Bevel",
|
||||
keywords = new[] { "BEVEL_ON" }
|
||||
};
|
||||
|
||||
s_GlowFeature = new ShaderFeature()
|
||||
{
|
||||
undoLabel = "Glow",
|
||||
keywords = new[] { "GLOW_ON" }
|
||||
};
|
||||
|
||||
s_MaskFeature = new ShaderFeature()
|
||||
{
|
||||
undoLabel = "Mask",
|
||||
keywords = new[] { "MASK_HARD", "MASK_SOFT" },
|
||||
label = new GUIContent("Mask"),
|
||||
keywordLabels = new[]
|
||||
{
|
||||
new GUIContent("Mask Off"), new GUIContent("Mask Hard"), new GUIContent("Mask Soft")
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void DoGUI()
|
||||
{
|
||||
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.InitCurvedWorldMaterialProperties(this.m_Properties);
|
||||
AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(m_Editor, AmazingAssets.CurvedWorldEditor.MaterialProperties.STYLE.HelpBox, false, false);
|
||||
|
||||
|
||||
s_Face = BeginPanel("Face", s_Face);
|
||||
if (s_Face)
|
||||
{
|
||||
DoFacePanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Outline = m_Material.HasProperty(ShaderUtilities.ID_OutlineTex) ? BeginPanel("Outline", s_Outline) : BeginPanel("Outline", s_OutlineFeature, s_Outline);
|
||||
if (s_Outline)
|
||||
{
|
||||
DoOutlinePanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_Outline2Color))
|
||||
{
|
||||
s_Outline2 = BeginPanel("Outline 2", s_OutlineFeature, s_Outline2);
|
||||
if (s_Outline2)
|
||||
{
|
||||
DoOutline2Panel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_UnderlayColor))
|
||||
{
|
||||
s_Underlay = BeginPanel("Underlay", s_UnderlayFeature, s_Underlay);
|
||||
if (s_Underlay)
|
||||
{
|
||||
DoUnderlayPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty("_SpecularColor"))
|
||||
{
|
||||
s_Lighting = BeginPanel("Lighting", s_BevelFeature, s_Lighting);
|
||||
if (s_Lighting)
|
||||
{
|
||||
s_Bevel = BeginPanel("Bevel", s_Bevel);
|
||||
if (s_Bevel)
|
||||
{
|
||||
DoBevelPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Light = BeginPanel("Local Lighting", s_Light);
|
||||
if (s_Light)
|
||||
{
|
||||
DoLocalLightingPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Bump = BeginPanel("Bump Map", s_Bump);
|
||||
if (s_Bump)
|
||||
{
|
||||
DoBumpMapPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Env = BeginPanel("Environment Map", s_Env);
|
||||
if (s_Env)
|
||||
{
|
||||
DoEnvMapPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
else if (m_Material.HasProperty("_SpecColor"))
|
||||
{
|
||||
s_Bevel = BeginPanel("Bevel", s_Bevel);
|
||||
if (s_Bevel)
|
||||
{
|
||||
DoBevelPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Light = BeginPanel("Surface Lighting", s_Light);
|
||||
if (s_Light)
|
||||
{
|
||||
DoSurfaceLightingPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Bump = BeginPanel("Bump Map", s_Bump);
|
||||
if (s_Bump)
|
||||
{
|
||||
DoBumpMapPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
|
||||
s_Env = BeginPanel("Environment Map", s_Env);
|
||||
if (s_Env)
|
||||
{
|
||||
DoEnvMapPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_GlowColor))
|
||||
{
|
||||
s_Glow = BeginPanel("Glow", s_GlowFeature, s_Glow);
|
||||
if (s_Glow)
|
||||
{
|
||||
DoGlowPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
s_DebugExtended = BeginPanel("Debug Settings", s_DebugExtended);
|
||||
if (s_DebugExtended)
|
||||
{
|
||||
DoDebugPanel();
|
||||
}
|
||||
|
||||
EndPanel();
|
||||
}
|
||||
|
||||
void DoFacePanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
|
||||
DoColor("_FaceColor", "Color");
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_FaceTex))
|
||||
{
|
||||
if (m_Material.HasProperty("_FaceUVSpeedX"))
|
||||
{
|
||||
DoTexture2D("_FaceTex", "Texture", true, s_FaceUvSpeedNames);
|
||||
}
|
||||
else if (m_Material.HasProperty("_FaceUVSpeed"))
|
||||
{
|
||||
DoTexture2D("_FaceTex", "Texture", true, s_FaceUVSpeedName);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoTexture2D("_FaceTex", "Texture", true);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty("_FaceSoftness"))
|
||||
{
|
||||
DoSlider("_FaceSoftness", "X", "Softness");
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty("_OutlineSoftness"))
|
||||
{
|
||||
DoSlider("_OutlineSoftness", "Softness");
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_FaceDilate))
|
||||
{
|
||||
DoSlider("_FaceDilate", "Dilate");
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_Shininess))
|
||||
{
|
||||
DoSlider("_FaceShininess", "Gloss");
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoOutlinePanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoColor("_OutlineColor", "Color");
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_OutlineTex))
|
||||
{
|
||||
if (m_Material.HasProperty("_OutlineUVSpeedX"))
|
||||
{
|
||||
DoTexture2D("_OutlineTex", "Texture", true, s_OutlineUvSpeedNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
DoTexture2D("_OutlineTex", "Texture", true);
|
||||
}
|
||||
}
|
||||
|
||||
DoSlider("_OutlineWidth", "Thickness");
|
||||
if (m_Material.HasProperty("_OutlineShininess"))
|
||||
{
|
||||
DoSlider("_OutlineShininess", "Gloss");
|
||||
}
|
||||
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoOutline2Panel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoColor("_Outline2Color", "Color");
|
||||
//if (m_Material.HasProperty(ShaderUtilities.ID_OutlineTex))
|
||||
//{
|
||||
// if (m_Material.HasProperty("_OutlineUVSpeedX"))
|
||||
// {
|
||||
// DoTexture2D("_OutlineTex", "Texture", true, s_OutlineUvSpeedNames);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// DoTexture2D("_OutlineTex", "Texture", true);
|
||||
// }
|
||||
//}
|
||||
|
||||
DoSlider("_Outline2Width", "Thickness");
|
||||
//if (m_Material.HasProperty("_OutlineShininess"))
|
||||
//{
|
||||
// DoSlider("_OutlineShininess", "Gloss");
|
||||
//}
|
||||
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoUnderlayPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
s_UnderlayFeature.DoPopup(m_Editor, m_Material);
|
||||
DoColor("_UnderlayColor", "Color");
|
||||
DoSlider("_UnderlayOffsetX", "Offset X");
|
||||
DoSlider("_UnderlayOffsetY", "Offset Y");
|
||||
DoSlider("_UnderlayDilate", "Dilate");
|
||||
DoSlider("_UnderlaySoftness", "Softness");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
static GUIContent[] s_BevelTypeLabels =
|
||||
{
|
||||
new GUIContent("Outer Bevel"),
|
||||
new GUIContent("Inner Bevel")
|
||||
};
|
||||
|
||||
void DoBevelPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoPopup("_ShaderFlags", "Type", s_BevelTypeLabels);
|
||||
DoSlider("_Bevel", "Amount");
|
||||
DoSlider("_BevelOffset", "Offset");
|
||||
DoSlider("_BevelWidth", "Width");
|
||||
DoSlider("_BevelRoundness", "Roundness");
|
||||
DoSlider("_BevelClamp", "Clamp");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoLocalLightingPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoSlider("_LightAngle", "Light Angle");
|
||||
DoColor("_SpecularColor", "Specular Color");
|
||||
DoSlider("_SpecularPower", "Specular Power");
|
||||
DoSlider("_Reflectivity", "Reflectivity Power");
|
||||
DoSlider("_Diffuse", "Diffuse Shadow");
|
||||
DoSlider("_Ambient", "Ambient Shadow");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoSurfaceLightingPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoColor("_SpecColor", "Specular Color");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoBumpMapPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoTexture2D("_BumpMap", "Texture");
|
||||
DoSlider("_BumpFace", "Face");
|
||||
DoSlider("_BumpOutline", "Outline");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoEnvMapPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoColor("_ReflectFaceColor", "Face Color");
|
||||
DoColor("_ReflectOutlineColor", "Outline Color");
|
||||
DoCubeMap("_Cube", "Texture");
|
||||
DoVector3("_EnvMatrixRotation", "Rotation");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoGlowPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoColor("_GlowColor", "Color");
|
||||
DoSlider("_GlowOffset", "Offset");
|
||||
DoSlider("_GlowInner", "Inner");
|
||||
DoSlider("_GlowOuter", "Outer");
|
||||
DoSlider("_GlowPower", "Power");
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoDebugPanel()
|
||||
{
|
||||
EditorGUI.indentLevel += 1;
|
||||
DoTexture2D("_MainTex", "Font Atlas");
|
||||
DoFloat("_GradientScale", "Gradient Scale");
|
||||
DoFloat("_TextureWidth", "Texture Width");
|
||||
DoFloat("_TextureHeight", "Texture Height");
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_ScaleX", "Scale X");
|
||||
DoFloat("_ScaleY", "Scale Y");
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_Sharpness))
|
||||
DoSlider("_Sharpness", "Sharpness");
|
||||
|
||||
DoSlider("_PerspectiveFilter", "Perspective Filter");
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_VertexOffsetX", "Offset X");
|
||||
DoFloat("_VertexOffsetY", "Offset Y");
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_MaskCoord))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
s_MaskFeature.ReadState(m_Material);
|
||||
s_MaskFeature.DoPopup(m_Editor, m_Material);
|
||||
if (s_MaskFeature.Active)
|
||||
{
|
||||
DoMaskSubgroup();
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
|
||||
}
|
||||
else if (m_Material.HasProperty("_MaskTex"))
|
||||
{
|
||||
DoMaskTexSubgroup();
|
||||
}
|
||||
else if (m_Material.HasProperty(ShaderUtilities.ID_MaskSoftnessX))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_MaskSoftnessX", "Softness X");
|
||||
DoFloat("_MaskSoftnessY", "Softness Y");
|
||||
DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ID_StencilID))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoFloat("_Stencil", "Stencil ID");
|
||||
DoFloat("_StencilComp", "Stencil Comp");
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
bool useRatios = EditorGUILayout.Toggle("Use Ratios", !m_Material.IsKeywordEnabled("RATIOS_OFF"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
m_Editor.RegisterPropertyChangeUndo("Use Ratios");
|
||||
if (useRatios)
|
||||
{
|
||||
m_Material.DisableKeyword("RATIOS_OFF");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Material.EnableKeyword("RATIOS_OFF");
|
||||
}
|
||||
}
|
||||
|
||||
if (m_Material.HasProperty(ShaderUtilities.ShaderTag_CullMode))
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoPopup("_CullMode", "Cull Mode", s_CullingTypeLabels);
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(true);
|
||||
DoFloat("_ScaleRatioA", "Scale Ratio A");
|
||||
DoFloat("_ScaleRatioB", "Scale Ratio B");
|
||||
DoFloat("_ScaleRatioC", "Scale Ratio C");
|
||||
EditorGUI.EndDisabledGroup();
|
||||
EditorGUI.indentLevel -= 1;
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
|
||||
void DoMaskSubgroup()
|
||||
{
|
||||
DoVector("_MaskCoord", "Mask Bounds", s_XywhVectorLabels);
|
||||
if (Selection.activeGameObject != null)
|
||||
{
|
||||
Renderer renderer = Selection.activeGameObject.GetComponent<Renderer>();
|
||||
if (renderer != null)
|
||||
{
|
||||
Rect rect = EditorGUILayout.GetControlRect();
|
||||
rect.x += EditorGUIUtility.labelWidth;
|
||||
rect.width -= EditorGUIUtility.labelWidth;
|
||||
if (GUI.Button(rect, "Match Renderer Bounds"))
|
||||
{
|
||||
FindProperty("_MaskCoord", m_Properties).vectorValue = new Vector4(
|
||||
0,
|
||||
0,
|
||||
Mathf.Round(renderer.bounds.extents.x * 1000) / 1000,
|
||||
Mathf.Round(renderer.bounds.extents.y * 1000) / 1000
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (s_MaskFeature.State == 1)
|
||||
{
|
||||
DoFloat("_MaskSoftnessX", "Softness X");
|
||||
DoFloat("_MaskSoftnessY", "Softness Y");
|
||||
}
|
||||
}
|
||||
|
||||
void DoMaskTexSubgroup()
|
||||
{
|
||||
EditorGUILayout.Space();
|
||||
DoTexture2D("_MaskTex", "Mask Texture");
|
||||
DoToggle("_MaskInverse", "Inverse Mask");
|
||||
DoColor("_MaskEdgeColor", "Edge Color");
|
||||
DoSlider("_MaskEdgeSoftness", "Edge Softness");
|
||||
DoSlider("_MaskWipeControl", "Wipe Position");
|
||||
DoFloat("_MaskSoftnessX", "Softness X");
|
||||
DoFloat("_MaskSoftnessY", "Softness Y");
|
||||
DoVector("_ClipRect", "Clip Rect", s_LbrtVectorLabels);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 021acc702ca0ac84fafa5df4acc1406f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b9e9b0e695db5e47aacc7f013fea7d4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,147 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_BakedLitShader : BaseShaderGUI
|
||||
{
|
||||
// Properties
|
||||
private BakedLitGUI.BakedLitProperties shadingModelProperties;
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
// collect properties from the material properties
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
shadingModelProperties = new BakedLitGUI.BakedLitProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
// material changed check
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
BakedLitGUI.Inputs(shadingModelProperties, materialEditor);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
if (surfaceType == SurfaceType.Opaque)
|
||||
{
|
||||
material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fbb7fb9925358b1439833586384487e0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,76 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_LitDetailGUI
|
||||
{
|
||||
public static class Styles
|
||||
{
|
||||
public static readonly GUIContent detailInputs = new GUIContent("Detail Inputs",
|
||||
"These settings define the surface details by tiling and overlaying additional maps on the surface.");
|
||||
|
||||
public static readonly GUIContent detailMaskText = new GUIContent("Mask",
|
||||
"Select a mask for the Detail map. The mask uses the alpha channel of the selected texture. The Tiling and Offset settings have no effect on the mask.");
|
||||
|
||||
public static readonly GUIContent detailAlbedoMapText = new GUIContent("Base Map",
|
||||
"Select the surface detail texture.The alpha of your texture determines surface hue and intensity.");
|
||||
|
||||
public static readonly GUIContent detailNormalMapText = new GUIContent("Normal Map",
|
||||
"Designates a Normal Map to create the illusion of bumps and dents in the details of this Material's surface.");
|
||||
|
||||
public static readonly GUIContent detailAlbedoMapScaleInfo = new GUIContent("Setting the scaling factor to a value other than 1 results in a less performant shader variant.");
|
||||
public static readonly GUIContent detailAlbedoMapFormatError = new GUIContent("This texture is not in linear space.");
|
||||
}
|
||||
|
||||
public struct LitProperties
|
||||
{
|
||||
public MaterialProperty detailMask;
|
||||
public MaterialProperty detailAlbedoMapScale;
|
||||
public MaterialProperty detailAlbedoMap;
|
||||
public MaterialProperty detailNormalMapScale;
|
||||
public MaterialProperty detailNormalMap;
|
||||
|
||||
public LitProperties(MaterialProperty[] properties)
|
||||
{
|
||||
detailMask = BaseShaderGUI.FindProperty("_DetailMask", properties, false);
|
||||
detailAlbedoMapScale = BaseShaderGUI.FindProperty("_DetailAlbedoMapScale", properties, false);
|
||||
detailAlbedoMap = BaseShaderGUI.FindProperty("_DetailAlbedoMap", properties, false);
|
||||
detailNormalMapScale = BaseShaderGUI.FindProperty("_DetailNormalMapScale", properties, false);
|
||||
detailNormalMap = BaseShaderGUI.FindProperty("_DetailNormalMap", properties, false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoDetailArea(LitProperties properties, MaterialEditor materialEditor)
|
||||
{
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailMaskText, properties.detailMask);
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailAlbedoMapText, properties.detailAlbedoMap,
|
||||
properties.detailAlbedoMap.textureValue != null ? properties.detailAlbedoMapScale : null);
|
||||
if (properties.detailAlbedoMapScale.floatValue != 1.0f)
|
||||
{
|
||||
EditorGUILayout.HelpBox(Styles.detailAlbedoMapScaleInfo.text, MessageType.Info, true);
|
||||
}
|
||||
var detailAlbedoTexture = properties.detailAlbedoMap.textureValue as Texture2D;
|
||||
if (detailAlbedoTexture != null && GraphicsFormatUtility.IsSRGBFormat(detailAlbedoTexture.graphicsFormat))
|
||||
{
|
||||
EditorGUILayout.HelpBox(Styles.detailAlbedoMapFormatError.text, MessageType.Warning, true);
|
||||
}
|
||||
materialEditor.TexturePropertySingleLine(Styles.detailNormalMapText, properties.detailNormalMap,
|
||||
properties.detailNormalMap.textureValue != null ? properties.detailNormalMapScale : null);
|
||||
materialEditor.TextureScaleOffsetProperty(properties.detailAlbedoMap);
|
||||
}
|
||||
|
||||
public static void SetMaterialKeywords(Material material)
|
||||
{
|
||||
if (material.HasProperty("_DetailAlbedoMap") && material.HasProperty("_DetailNormalMap") && material.HasProperty("_DetailAlbedoMapScale"))
|
||||
{
|
||||
bool isScaled = material.GetFloat("_DetailAlbedoMapScale") != 1.0f;
|
||||
bool hasDetailMap = material.GetTexture("_DetailAlbedoMap") || material.GetTexture("_DetailNormalMap");
|
||||
CoreUtils.SetKeyword(material, "_DETAIL_MULX2", !isScaled && hasDetailMap);
|
||||
CoreUtils.SetKeyword(material, "_DETAIL_SCALED", isScaled && hasDetailMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6291fa52792434c448667fb3f07c4d03
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,178 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_LitShader : BaseShaderGUI
|
||||
{
|
||||
static readonly string[] workflowModeNames = Enum.GetNames(typeof(LitGUI.WorkflowMode));
|
||||
|
||||
private LitGUI.LitProperties litProperties;
|
||||
private CurvedWorld_LitDetailGUI.LitProperties litDetailProperties;
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
materialScopesList.RegisterHeaderScope(CurvedWorld_LitDetailGUI.Styles.detailInputs, Expandable.Details, _ => CurvedWorld_LitDetailGUI.DoDetailArea(litDetailProperties, materialEditor));
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
// collect properties from the material properties
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
litProperties = new LitGUI.LitProperties(properties);
|
||||
litDetailProperties = new CurvedWorld_LitDetailGUI.LitProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
// material changed check
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, CurvedWorld_LitDetailGUI.SetMaterialKeywords);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
if (litProperties.workflowMode != null)
|
||||
DoPopup(LitGUI.Styles.workflowModeText, litProperties.workflowMode, workflowModeNames);
|
||||
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
LitGUI.Inputs(litProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
// material main advanced options
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
if (litProperties.reflections != null && litProperties.highlights != null)
|
||||
{
|
||||
materialEditor.ShaderProperty(litProperties.highlights, LitGUI.Styles.highlightsText);
|
||||
materialEditor.ShaderProperty(litProperties.reflections, LitGUI.Styles.reflectionsText);
|
||||
}
|
||||
|
||||
base.DrawAdvancedOptions(material);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
if (surfaceType == SurfaceType.Opaque)
|
||||
{
|
||||
material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
|
||||
if (oldShader.name.Equals("Standard (Specular setup)"))
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Specular);
|
||||
Texture texture = material.GetTexture("_SpecGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetFloat("_WorkflowMode", (float)LitGUI.WorkflowMode.Metallic);
|
||||
Texture texture = material.GetTexture("_MetallicGlossMap");
|
||||
if (texture != null)
|
||||
material.SetTexture("_MetallicSpecGlossMap", texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d49c04dda14af104cac38d2d50d93a8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_ParticlesLitShader : BaseShaderGUI
|
||||
{
|
||||
// Properties
|
||||
private LitGUI.LitProperties litProperties;
|
||||
private ParticleGUI.ParticleProperties particleProps;
|
||||
|
||||
// List of renderers using this material in the scene, used for validating vertex streams
|
||||
List<ParticleSystemRenderer> m_RenderersUsingThisMaterial = new List<ParticleSystemRenderer>();
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
litProperties = new LitGUI.LitProperties(properties);
|
||||
particleProps = new ParticleGUI.ParticleProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, LitGUI.SetMaterialKeywords, ParticleGUI.SetMaterialKeywords);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
base.DrawSurfaceOptions(material);
|
||||
DoPopup(ParticleGUI.Styles.colorMode, particleProps.colorMode, Enum.GetNames(typeof(ParticleGUI.ColorMode)));
|
||||
}
|
||||
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
LitGUI.Inputs(litProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
}
|
||||
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
materialEditor.ShaderProperty(particleProps.flipbookMode, ParticleGUI.Styles.flipbookMode);
|
||||
ParticleGUI.FadingOptions(material, materialEditor, particleProps);
|
||||
ParticleGUI.DoVertexStreamsArea(material, m_RenderersUsingThisMaterial, true);
|
||||
|
||||
DrawQueueOffsetField();
|
||||
}
|
||||
|
||||
public override void OnOpenGUI(Material material, MaterialEditor materialEditor)
|
||||
{
|
||||
CacheRenderersUsingThisMaterial(material);
|
||||
base.OnOpenGUI(material, materialEditor);
|
||||
}
|
||||
|
||||
void CacheRenderersUsingThisMaterial(Material material)
|
||||
{
|
||||
m_RenderersUsingThisMaterial.Clear();
|
||||
|
||||
ParticleSystemRenderer[] renderers = UnityEngine.Object.FindObjectsOfType(typeof(ParticleSystemRenderer)) as ParticleSystemRenderer[];
|
||||
foreach (ParticleSystemRenderer renderer in renderers)
|
||||
{
|
||||
if (renderer.sharedMaterial == material)
|
||||
m_RenderersUsingThisMaterial.Add(renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace UnityEditor
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ae9b3f434672db4c9d2df393bbbb82c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_ParticlesSimpleLitShader : BaseShaderGUI
|
||||
{
|
||||
// Properties
|
||||
private SimpleLitGUI.SimpleLitProperties shadingModelProperties;
|
||||
private ParticleGUI.ParticleProperties particleProps;
|
||||
|
||||
// List of renderers using this material in the scene, used for validating vertex streams
|
||||
List<ParticleSystemRenderer> m_RenderersUsingThisMaterial = new List<ParticleSystemRenderer>();
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
shadingModelProperties = new SimpleLitGUI.SimpleLitProperties(properties);
|
||||
particleProps = new ParticleGUI.ParticleProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, SimpleLitGUI.SetMaterialKeywords, ParticleGUI.SetMaterialKeywords);
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
base.DrawSurfaceOptions(material);
|
||||
DoPopup(ParticleGUI.Styles.colorMode, particleProps.colorMode, Enum.GetNames(typeof(ParticleGUI.ColorMode)));
|
||||
}
|
||||
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
SimpleLitGUI.Inputs(shadingModelProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
}
|
||||
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
SimpleLitGUI.Advanced(shadingModelProperties);
|
||||
|
||||
materialEditor.ShaderProperty(particleProps.flipbookMode, ParticleGUI.Styles.flipbookMode);
|
||||
ParticleGUI.FadingOptions(material, materialEditor, particleProps);
|
||||
ParticleGUI.DoVertexStreamsArea(material, m_RenderersUsingThisMaterial, true);
|
||||
|
||||
DrawQueueOffsetField();
|
||||
}
|
||||
|
||||
public override void OnOpenGUI(Material material, MaterialEditor materialEditor)
|
||||
{
|
||||
CacheRenderersUsingThisMaterial(material);
|
||||
base.OnOpenGUI(material, materialEditor);
|
||||
}
|
||||
|
||||
void CacheRenderersUsingThisMaterial(Material material)
|
||||
{
|
||||
m_RenderersUsingThisMaterial.Clear();
|
||||
|
||||
ParticleSystemRenderer[] renderers = UnityEngine.Object.FindObjectsOfType(typeof(ParticleSystemRenderer)) as ParticleSystemRenderer[];
|
||||
foreach (ParticleSystemRenderer renderer in renderers)
|
||||
{
|
||||
if (renderer.sharedMaterial == material)
|
||||
m_RenderersUsingThisMaterial.Add(renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace UnityEditor
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0a83509d11985d14d82fe2ac98f42564
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,123 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_ParticlesUnlitShader : BaseShaderGUI
|
||||
{
|
||||
// Properties
|
||||
private BakedLitGUI.BakedLitProperties shadingModelProperties;
|
||||
private ParticleGUI.ParticleProperties particleProps;
|
||||
|
||||
// List of renderers using this material in the scene, used for validating vertex streams
|
||||
List<ParticleSystemRenderer> m_RenderersUsingThisMaterial = new List<ParticleSystemRenderer>();
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
shadingModelProperties = new BakedLitGUI.BakedLitProperties(properties);
|
||||
particleProps = new ParticleGUI.ParticleProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, null, ParticleGUI.SetMaterialKeywords);
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
base.DrawSurfaceOptions(material);
|
||||
DoPopup(ParticleGUI.Styles.colorMode, particleProps.colorMode, Enum.GetNames(typeof(ParticleGUI.ColorMode)));
|
||||
}
|
||||
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
BakedLitGUI.Inputs(shadingModelProperties, materialEditor);
|
||||
DrawEmissionProperties(material, true);
|
||||
}
|
||||
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
materialEditor.ShaderProperty(particleProps.flipbookMode, ParticleGUI.Styles.flipbookMode);
|
||||
ParticleGUI.FadingOptions(material, materialEditor, particleProps);
|
||||
ParticleGUI.DoVertexStreamsArea(material, m_RenderersUsingThisMaterial);
|
||||
|
||||
DrawQueueOffsetField();
|
||||
}
|
||||
|
||||
public override void OnOpenGUI(Material material, MaterialEditor materialEditor)
|
||||
{
|
||||
CacheRenderersUsingThisMaterial(material);
|
||||
base.OnOpenGUI(material, materialEditor);
|
||||
}
|
||||
|
||||
void CacheRenderersUsingThisMaterial(Material material)
|
||||
{
|
||||
m_RenderersUsingThisMaterial.Clear();
|
||||
|
||||
ParticleSystemRenderer[] renderers = UnityEngine.Object.FindObjectsOfType(typeof(ParticleSystemRenderer)) as ParticleSystemRenderer[];
|
||||
foreach (ParticleSystemRenderer renderer in renderers)
|
||||
{
|
||||
if (renderer.sharedMaterial == material)
|
||||
m_RenderersUsingThisMaterial.Add(renderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace UnityEditor
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4940ae40fb86bc843b61434ce828827e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using UnityEngine.Assertions;
|
||||
|
||||
namespace UnityEditor.Rendering.Universal
|
||||
{
|
||||
class CurvedWorld_SavedParameter<T>
|
||||
where T : IEquatable<T>
|
||||
{
|
||||
internal delegate void SetParameter(string key, T value);
|
||||
internal delegate T GetParameter(string key, T defaultValue);
|
||||
|
||||
readonly string m_Key;
|
||||
bool m_Loaded;
|
||||
T m_Value;
|
||||
|
||||
readonly SetParameter m_Setter;
|
||||
readonly GetParameter m_Getter;
|
||||
|
||||
public CurvedWorld_SavedParameter(string key, T value, GetParameter getter, SetParameter setter)
|
||||
{
|
||||
Assert.IsNotNull(setter);
|
||||
Assert.IsNotNull(getter);
|
||||
|
||||
m_Key = key;
|
||||
m_Loaded = false;
|
||||
m_Value = value;
|
||||
m_Setter = setter;
|
||||
m_Getter = getter;
|
||||
}
|
||||
|
||||
void Load()
|
||||
{
|
||||
if (m_Loaded)
|
||||
return;
|
||||
|
||||
m_Loaded = true;
|
||||
m_Value = m_Getter(m_Key, m_Value);
|
||||
}
|
||||
|
||||
public T value
|
||||
{
|
||||
get
|
||||
{
|
||||
Load();
|
||||
return m_Value;
|
||||
}
|
||||
set
|
||||
{
|
||||
Load();
|
||||
|
||||
if (m_Value.Equals(value))
|
||||
return;
|
||||
|
||||
m_Value = value;
|
||||
m_Setter(m_Key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Pre-specialized class for easier use and compatibility with existing code
|
||||
sealed class CurvedWorld_SavedBool : CurvedWorld_SavedParameter<bool>
|
||||
{
|
||||
public CurvedWorld_SavedBool(string key, bool value)
|
||||
: base(key, value, EditorPrefs.GetBool, EditorPrefs.SetBool) { }
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 28fd8d194a566c84cbd0825e2069bcd9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,144 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_SimpleLitShader : BaseShaderGUI
|
||||
{
|
||||
// Properties
|
||||
private SimpleLitGUI.SimpleLitProperties shadingModelProperties;
|
||||
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
// collect properties from the material properties
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
shadingModelProperties = new SimpleLitGUI.SimpleLitProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
// material changed check
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material, SimpleLitGUI.SetMaterialKeywords);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
SimpleLitGUI.Inputs(shadingModelProperties, materialEditor, material);
|
||||
DrawEmissionProperties(material, true);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
public override void DrawAdvancedOptions(Material material)
|
||||
{
|
||||
SimpleLitGUI.Advanced(shadingModelProperties);
|
||||
base.DrawAdvancedOptions(material);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c3252892bc74a644a9ee966209d04baa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,341 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
namespace UnityEditor.Rendering.Universal
|
||||
{
|
||||
internal class CurvedWorldTerrainLitShaderGUI : UnityEditor.ShaderGUI, ITerrainLayerCustomUI
|
||||
{
|
||||
private class StylesLayer
|
||||
{
|
||||
public readonly GUIContent warningHeightBasedBlending = new GUIContent("Height-based blending is disabled if you have more than four TerrainLayer materials!");
|
||||
|
||||
public readonly GUIContent enableHeightBlend = new GUIContent("Enable Height-based Blend", "Blend terrain layers based on height values.");
|
||||
public readonly GUIContent heightTransition = new GUIContent("Height Transition", "Size in world units of the smooth transition between layers.");
|
||||
public readonly GUIContent enableInstancedPerPixelNormal = new GUIContent("Enable Per-pixel Normal", "Enable per-pixel normal when the terrain uses instanced rendering.");
|
||||
|
||||
public readonly GUIContent diffuseTexture = new GUIContent("Diffuse");
|
||||
public readonly GUIContent colorTint = new GUIContent("Color Tint");
|
||||
public readonly GUIContent opacityAsDensity = new GUIContent("Opacity as Density", "Enable Density Blend (if unchecked, opacity is used as Smoothness)");
|
||||
public readonly GUIContent normalMapTexture = new GUIContent("Normal Map");
|
||||
public readonly GUIContent normalScale = new GUIContent("Normal Scale");
|
||||
public readonly GUIContent maskMapTexture = new GUIContent("Mask", "R: Metallic\nG: AO\nB: Height\nA: Smoothness");
|
||||
public readonly GUIContent maskMapTextureWithoutHeight = new GUIContent("Mask Map", "R: Metallic\nG: AO\nA: Smoothness");
|
||||
public readonly GUIContent channelRemapping = new GUIContent("Channel Remapping");
|
||||
public readonly GUIContent defaultValues = new GUIContent("Channel Default Values");
|
||||
public readonly GUIContent metallic = new GUIContent("R: Metallic");
|
||||
public readonly GUIContent ao = new GUIContent("G: AO");
|
||||
public readonly GUIContent height = new GUIContent("B: Height");
|
||||
public readonly GUIContent heightParametrization = new GUIContent("Parametrization");
|
||||
public readonly GUIContent heightAmplitude = new GUIContent("Amplitude (cm)");
|
||||
public readonly GUIContent heightBase = new GUIContent("Base (cm)");
|
||||
public readonly GUIContent heightMin = new GUIContent("Min (cm)");
|
||||
public readonly GUIContent heightMax = new GUIContent("Max (cm)");
|
||||
public readonly GUIContent heightCm = new GUIContent("B: Height (cm)");
|
||||
public readonly GUIContent smoothness = new GUIContent("A: Smoothness");
|
||||
}
|
||||
|
||||
static StylesLayer s_Styles = null;
|
||||
private static StylesLayer styles { get { if (s_Styles == null) s_Styles = new StylesLayer(); return s_Styles; } }
|
||||
|
||||
public CurvedWorldTerrainLitShaderGUI()
|
||||
{
|
||||
}
|
||||
|
||||
MaterialProperty _CurvedWorldBendSettings = null;
|
||||
|
||||
|
||||
// Height blend params
|
||||
MaterialProperty enableHeightBlend = null;
|
||||
const string kEnableHeightBlend = "_EnableHeightBlend";
|
||||
|
||||
MaterialProperty heightTransition = null;
|
||||
const string kHeightTransition = "_HeightTransition";
|
||||
|
||||
// Per-pixel Normal (while instancing)
|
||||
MaterialProperty enableInstancedPerPixelNormal = null;
|
||||
const string kEnableInstancedPerPixelNormal = "_EnableInstancedPerPixelNormal";
|
||||
|
||||
private bool m_ShowChannelRemapping = false;
|
||||
enum HeightParametrization
|
||||
{
|
||||
Amplitude,
|
||||
MinMax
|
||||
};
|
||||
private HeightParametrization m_HeightParametrization = HeightParametrization.Amplitude;
|
||||
|
||||
private static bool DoesTerrainUseMaskMaps(TerrainLayer[] terrainLayers)
|
||||
{
|
||||
for (int i = 0; i < terrainLayers.Length; ++i)
|
||||
{
|
||||
if (terrainLayers[i].maskMapTexture != null)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void FindMaterialProperties(MaterialProperty[] props)
|
||||
{
|
||||
_CurvedWorldBendSettings = FindProperty("_CurvedWorldBendSettings", props);
|
||||
|
||||
enableHeightBlend = FindProperty(kEnableHeightBlend, props, false);
|
||||
heightTransition = FindProperty(kHeightTransition, props, false);
|
||||
enableInstancedPerPixelNormal = FindProperty(kEnableInstancedPerPixelNormal, props, false);
|
||||
}
|
||||
|
||||
static public void SetupMaterialKeywords(Material material)
|
||||
{
|
||||
bool enableHeightBlend = (material.HasProperty(kEnableHeightBlend) && material.GetFloat(kEnableHeightBlend) > 0);
|
||||
CoreUtils.SetKeyword(material, "_TERRAIN_BLEND_HEIGHT", enableHeightBlend);
|
||||
|
||||
bool enableInstancedPerPixelNormal = material.GetFloat(kEnableInstancedPerPixelNormal) > 0.0f;
|
||||
CoreUtils.SetKeyword(material, "_TERRAIN_INSTANCED_PERPIXEL_NORMAL", enableInstancedPerPixelNormal);
|
||||
}
|
||||
|
||||
static public bool TextureHasAlpha(Texture2D inTex)
|
||||
{
|
||||
if (inTex != null)
|
||||
{
|
||||
return GraphicsFormatUtility.HasAlphaChannel(GraphicsFormatUtility.GetGraphicsFormat(inTex.format, true));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
FindMaterialProperties(properties);
|
||||
|
||||
|
||||
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
{
|
||||
EditorGUILayout.LabelField("Curved World", EditorStyles.boldLabel);
|
||||
|
||||
if (_CurvedWorldBendSettings != null)
|
||||
materialEditorIn.ShaderProperty(_CurvedWorldBendSettings, "Bend Type");
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
GUILayout.Space(10);
|
||||
|
||||
|
||||
bool optionsChanged = false;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
{
|
||||
if (enableHeightBlend != null)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
materialEditorIn.ShaderProperty(enableHeightBlend, styles.enableHeightBlend);
|
||||
if (enableHeightBlend.floatValue > 0)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.HelpBox(styles.warningHeightBasedBlending.text, MessageType.Info);
|
||||
materialEditorIn.ShaderProperty(heightTransition, styles.heightTransition);
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.Space();
|
||||
}
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
optionsChanged = true;
|
||||
}
|
||||
|
||||
bool enablePerPixelNormalChanged = false;
|
||||
|
||||
// Since Instanced Per-pixel normal is actually dependent on instancing enabled or not, it is not
|
||||
// important to check it in the GUI. The shader will make sure it is enabled/disabled properly.s
|
||||
if (enableInstancedPerPixelNormal != null)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
materialEditorIn.ShaderProperty(enableInstancedPerPixelNormal, styles.enableInstancedPerPixelNormal);
|
||||
enablePerPixelNormalChanged = EditorGUI.EndChangeCheck();
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
if (optionsChanged || enablePerPixelNormalChanged)
|
||||
{
|
||||
foreach (var obj in materialEditorIn.targets)
|
||||
{
|
||||
SetupMaterialKeywords((Material)obj);
|
||||
}
|
||||
}
|
||||
|
||||
// We should always do this call at the end
|
||||
materialEditorIn.serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
bool ITerrainLayerCustomUI.OnTerrainLayerGUI(TerrainLayer terrainLayer, Terrain terrain)
|
||||
{
|
||||
var terrainLayers = terrain.terrainData.terrainLayers;
|
||||
|
||||
// Don't use the member field enableHeightBlend as ShaderGUI.OnGUI might not be called if the material UI is folded.
|
||||
// heightblend shouldn't be available if we are in multi-pass mode, because it is guaranteed to be broken.
|
||||
bool heightBlendAvailable = (terrainLayers.Length <= 4);
|
||||
bool heightBlend = heightBlendAvailable && terrain.materialTemplate.HasProperty(kEnableHeightBlend) && (terrain.materialTemplate.GetFloat(kEnableHeightBlend) > 0);
|
||||
|
||||
terrainLayer.diffuseTexture = EditorGUILayout.ObjectField(styles.diffuseTexture, terrainLayer.diffuseTexture, typeof(Texture2D), false) as Texture2D;
|
||||
TerrainLayerUtility.ValidateDiffuseTextureUI(terrainLayer.diffuseTexture);
|
||||
|
||||
var diffuseRemapMin = terrainLayer.diffuseRemapMin;
|
||||
var diffuseRemapMax = terrainLayer.diffuseRemapMax;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
bool enableDensity = false;
|
||||
if (terrainLayer.diffuseTexture != null)
|
||||
{
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
rect.y += 16 + 4;
|
||||
rect.width = EditorGUIUtility.labelWidth + 64;
|
||||
rect.height = 16;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
|
||||
var diffuseTint = new Color(diffuseRemapMax.x, diffuseRemapMax.y, diffuseRemapMax.z);
|
||||
diffuseTint = EditorGUI.ColorField(rect, styles.colorTint, diffuseTint, true, false, false);
|
||||
diffuseRemapMax.x = diffuseTint.r;
|
||||
diffuseRemapMax.y = diffuseTint.g;
|
||||
diffuseRemapMax.z = diffuseTint.b;
|
||||
diffuseRemapMin.x = diffuseRemapMin.y = diffuseRemapMin.z = 0;
|
||||
|
||||
if (!heightBlend)
|
||||
{
|
||||
rect.y = rect.yMax + 2;
|
||||
enableDensity = EditorGUI.Toggle(rect, styles.opacityAsDensity, diffuseRemapMin.w > 0);
|
||||
}
|
||||
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
diffuseRemapMax.w = 1;
|
||||
diffuseRemapMin.w = enableDensity ? 1 : 0;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
terrainLayer.diffuseRemapMin = diffuseRemapMin;
|
||||
terrainLayer.diffuseRemapMax = diffuseRemapMax;
|
||||
}
|
||||
|
||||
// Display normal map UI
|
||||
terrainLayer.normalMapTexture = EditorGUILayout.ObjectField(styles.normalMapTexture, terrainLayer.normalMapTexture, typeof(Texture2D), false) as Texture2D;
|
||||
TerrainLayerUtility.ValidateNormalMapTextureUI(terrainLayer.normalMapTexture, TerrainLayerUtility.CheckNormalMapTextureType(terrainLayer.normalMapTexture));
|
||||
|
||||
if (terrainLayer.normalMapTexture != null)
|
||||
{
|
||||
var rect = GUILayoutUtility.GetLastRect();
|
||||
rect.y += 16 + 4;
|
||||
rect.width = EditorGUIUtility.labelWidth + 64;
|
||||
rect.height = 16;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
terrainLayer.normalScale = EditorGUI.FloatField(rect, styles.normalScale, terrainLayer.normalScale);
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
// Display the mask map UI and the remap controls
|
||||
terrainLayer.maskMapTexture = EditorGUILayout.ObjectField(heightBlend ? styles.maskMapTexture : styles.maskMapTextureWithoutHeight, terrainLayer.maskMapTexture, typeof(Texture2D), false) as Texture2D;
|
||||
TerrainLayerUtility.ValidateMaskMapTextureUI(terrainLayer.maskMapTexture);
|
||||
|
||||
var maskMapRemapMin = terrainLayer.maskMapRemapMin;
|
||||
var maskMapRemapMax = terrainLayer.maskMapRemapMax;
|
||||
var smoothness = terrainLayer.smoothness;
|
||||
var metallic = terrainLayer.metallic;
|
||||
|
||||
++EditorGUI.indentLevel;
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
m_ShowChannelRemapping = EditorGUILayout.Foldout(m_ShowChannelRemapping, terrainLayer.maskMapTexture != null ? s_Styles.channelRemapping : s_Styles.defaultValues);
|
||||
|
||||
if (m_ShowChannelRemapping)
|
||||
{
|
||||
if (terrainLayer.maskMapTexture != null)
|
||||
{
|
||||
float min, max;
|
||||
min = maskMapRemapMin.x; max = maskMapRemapMax.x;
|
||||
EditorGUILayout.MinMaxSlider(s_Styles.metallic, ref min, ref max, 0, 1);
|
||||
maskMapRemapMin.x = min; maskMapRemapMax.x = max;
|
||||
|
||||
min = maskMapRemapMin.y; max = maskMapRemapMax.y;
|
||||
EditorGUILayout.MinMaxSlider(s_Styles.ao, ref min, ref max, 0, 1);
|
||||
maskMapRemapMin.y = min; maskMapRemapMax.y = max;
|
||||
|
||||
if (heightBlend)
|
||||
{
|
||||
EditorGUILayout.LabelField(styles.height);
|
||||
++EditorGUI.indentLevel;
|
||||
m_HeightParametrization = (HeightParametrization)EditorGUILayout.EnumPopup(styles.heightParametrization, m_HeightParametrization);
|
||||
if (m_HeightParametrization == HeightParametrization.Amplitude)
|
||||
{
|
||||
// (height - heightBase) * amplitude
|
||||
float amplitude = Mathf.Max(maskMapRemapMax.z - maskMapRemapMin.z, Mathf.Epsilon); // to avoid divide by zero
|
||||
float heightBase = maskMapRemapMin.z / amplitude;
|
||||
amplitude = EditorGUILayout.FloatField(styles.heightAmplitude, amplitude * 100) / 100;
|
||||
heightBase = EditorGUILayout.FloatField(styles.heightBase, heightBase * 100) / 100;
|
||||
maskMapRemapMin.z = heightBase * amplitude;
|
||||
maskMapRemapMax.z = (1.0f - heightBase) * amplitude;
|
||||
}
|
||||
else
|
||||
{
|
||||
maskMapRemapMin.z = EditorGUILayout.FloatField(styles.heightMin, maskMapRemapMin.z * 100) / 100;
|
||||
maskMapRemapMax.z = EditorGUILayout.FloatField(styles.heightMax, maskMapRemapMax.z * 100) / 100;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
}
|
||||
|
||||
min = maskMapRemapMin.w; max = maskMapRemapMax.w;
|
||||
EditorGUILayout.MinMaxSlider(s_Styles.smoothness, ref min, ref max, 0, 1);
|
||||
maskMapRemapMin.w = min; maskMapRemapMax.w = max;
|
||||
}
|
||||
else
|
||||
{
|
||||
metallic = EditorGUILayout.Slider(s_Styles.metallic, metallic, 0, 1);
|
||||
// AO and Height are still exclusively controlled via the maskRemap controls
|
||||
// metallic and smoothness have their own values as fields within the LayerData.
|
||||
maskMapRemapMax.y = EditorGUILayout.Slider(s_Styles.ao, maskMapRemapMax.y, 0, 1);
|
||||
if (heightBlend)
|
||||
{
|
||||
maskMapRemapMax.z = EditorGUILayout.FloatField(s_Styles.heightCm, maskMapRemapMax.z * 100) / 100;
|
||||
}
|
||||
|
||||
// There's a possibility that someone could slide max below the existing min value
|
||||
// so we'll just protect against that by locking the min value down a little bit.
|
||||
// In the case of height (Z), we are trying to set min to no lower than zero value unless
|
||||
// max goes negative. Zero is a good sensible value for the minimum. For AO (Y), we
|
||||
// don't need this extra protection step because the UI blocks us from going negative
|
||||
// anyway. In both cases, pushing the slider below the min value will lock them together,
|
||||
// but min will be "left behind" if you go back up.
|
||||
maskMapRemapMin.y = Mathf.Min(maskMapRemapMin.y, maskMapRemapMax.y);
|
||||
maskMapRemapMin.z = Mathf.Min(Mathf.Max(0, maskMapRemapMin.z), maskMapRemapMax.z);
|
||||
|
||||
if (TextureHasAlpha(terrainLayer.diffuseTexture))
|
||||
{
|
||||
GUIStyle warnStyle = new GUIStyle(GUI.skin.label);
|
||||
warnStyle.wordWrap = true;
|
||||
GUILayout.Label("Smoothness is controlled by diffuse alpha channel", warnStyle);
|
||||
}
|
||||
else
|
||||
smoothness = EditorGUILayout.Slider(s_Styles.smoothness, smoothness, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
terrainLayer.maskMapRemapMin = maskMapRemapMin;
|
||||
terrainLayer.maskMapRemapMax = maskMapRemapMax;
|
||||
terrainLayer.smoothness = smoothness;
|
||||
terrainLayer.metallic = metallic;
|
||||
}
|
||||
--EditorGUI.indentLevel;
|
||||
|
||||
EditorGUILayout.Space();
|
||||
TerrainLayerUtility.TilingSettingsUI(terrainLayer);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3a7fa38092b06845b52c32f2736130a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,140 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
using AmazingAssets.CurvedWorldEditor;
|
||||
|
||||
|
||||
namespace UnityEditor.Rendering.Universal.ShaderGUI
|
||||
{
|
||||
internal class CurvedWorld_UnlitShader : BaseShaderGUI
|
||||
{
|
||||
//Curved World
|
||||
MaterialHeaderScopeList curvedWorldMaterialScope;
|
||||
|
||||
|
||||
public override void FillAdditionalFoldouts(MaterialHeaderScopeList materialScopesList)
|
||||
{
|
||||
base.FillAdditionalFoldouts(materialScopesList);
|
||||
|
||||
|
||||
//Curved World
|
||||
Material material = (Material)materialEditor.target;
|
||||
if (curvedWorldMaterialScope == null)
|
||||
curvedWorldMaterialScope = new MaterialHeaderScopeList();
|
||||
if (material.HasProperty("_CurvedWorldBendSettings"))
|
||||
curvedWorldMaterialScope.RegisterHeaderScope(new GUIContent("Curved World"), AmazingAssets.CurvedWorldEditor.MaterialProperties.Expandable.CurvedWorld, _ => AmazingAssets.CurvedWorldEditor.MaterialProperties.DrawCurvedWorldMaterialProperties(materialEditor, MaterialProperties.STYLE.None, false, false));
|
||||
}
|
||||
|
||||
|
||||
public override void OnGUI(MaterialEditor materialEditorIn, MaterialProperty[] properties)
|
||||
{
|
||||
if (materialEditorIn == null)
|
||||
throw new ArgumentNullException("materialEditorIn");
|
||||
|
||||
materialEditor = materialEditorIn;
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
FindProperties(properties); // MaterialProperties can be animated so we do not cache them but fetch them every event to ensure animated values are updated correctly
|
||||
|
||||
// Make sure that needed setup (ie keywords/renderqueue) are set up if we're switching some existing
|
||||
// material to a universal shader.
|
||||
if (m_FirstTimeApply)
|
||||
{
|
||||
OnOpenGUI(material, materialEditorIn);
|
||||
m_FirstTimeApply = false;
|
||||
}
|
||||
|
||||
|
||||
//Curved World
|
||||
curvedWorldMaterialScope.DrawHeaders(materialEditor, material);
|
||||
|
||||
|
||||
ShaderPropertiesGUI(material);
|
||||
}
|
||||
|
||||
|
||||
public override void FindProperties(MaterialProperty[] properties)
|
||||
{
|
||||
base.FindProperties(properties);
|
||||
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.InitCurvedWorldMaterialProperties(properties);
|
||||
}
|
||||
|
||||
public override void ValidateMaterial(Material material)
|
||||
{
|
||||
SetMaterialKeywords(material);
|
||||
|
||||
//Curved World
|
||||
MaterialProperties.SetKeyWords(material);
|
||||
}
|
||||
|
||||
// material main surface options
|
||||
public override void DrawSurfaceOptions(Material material)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// Use default labelWidth
|
||||
EditorGUIUtility.labelWidth = 0f;
|
||||
|
||||
base.DrawSurfaceOptions(material);
|
||||
}
|
||||
|
||||
// material main surface inputs
|
||||
public override void DrawSurfaceInputs(Material material)
|
||||
{
|
||||
base.DrawSurfaceInputs(material);
|
||||
DrawTileOffset(materialEditor, baseMapProp);
|
||||
}
|
||||
|
||||
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader)
|
||||
{
|
||||
if (material == null)
|
||||
throw new ArgumentNullException("material");
|
||||
|
||||
// _Emission property is lost after assigning Standard shader to the material
|
||||
// thus transfer it before assigning the new shader
|
||||
if (material.HasProperty("_Emission"))
|
||||
{
|
||||
material.SetColor("_EmissionColor", material.GetColor("_Emission"));
|
||||
}
|
||||
|
||||
base.AssignNewShaderToMaterial(material, oldShader, newShader);
|
||||
|
||||
if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/"))
|
||||
{
|
||||
SetupMaterialBlendMode(material);
|
||||
return;
|
||||
}
|
||||
|
||||
SurfaceType surfaceType = SurfaceType.Opaque;
|
||||
BlendMode blendMode = BlendMode.Alpha;
|
||||
if (oldShader.name.Contains("/Transparent/Cutout/"))
|
||||
{
|
||||
surfaceType = SurfaceType.Opaque;
|
||||
material.SetFloat("_AlphaClip", 1);
|
||||
}
|
||||
else if (oldShader.name.Contains("/Transparent/"))
|
||||
{
|
||||
// NOTE: legacy shaders did not provide physically based transparency
|
||||
// therefore Fade mode
|
||||
surfaceType = SurfaceType.Transparent;
|
||||
blendMode = BlendMode.Alpha;
|
||||
}
|
||||
material.SetFloat("_Blend", (float)blendMode);
|
||||
|
||||
material.SetFloat("_Surface", (float)surfaceType);
|
||||
if (surfaceType == SurfaceType.Opaque)
|
||||
{
|
||||
material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
else
|
||||
{
|
||||
material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ac7ed8f915940a42aa0de0aed665230
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 389b6987aff353a4da22ce9b5b3fa26a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,245 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
public class CurvedWorldBendSettingsDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
static CurvedWorld.BEND_TYPE[] shaderSupportedBendTypes;
|
||||
static int[] shaderSupportedBendIDs;
|
||||
static bool hasNormalTransform;
|
||||
|
||||
|
||||
CurvedWorld.BEND_TYPE updateBendType;
|
||||
int updateBendID;
|
||||
bool updateNormalTransform;
|
||||
Material updateMaterial;
|
||||
MaterialEditor updateMaterialEditor;
|
||||
|
||||
|
||||
public void Init(string label)
|
||||
{
|
||||
EditorUtilities.StringToBendSettings(label, out shaderSupportedBendTypes, out shaderSupportedBendIDs, out hasNormalTransform);
|
||||
}
|
||||
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
|
||||
{
|
||||
Material material = (Material)editor.target;
|
||||
Init(prop.displayName);
|
||||
|
||||
|
||||
//Read settings
|
||||
CurvedWorld.BEND_TYPE bendType;
|
||||
int bendID;
|
||||
bool normalTransform;
|
||||
|
||||
EditorUtilities.GetBendSettingsFromVector(prop.vectorValue, out bendType, out bendID, out normalTransform);
|
||||
|
||||
//Make sure keywords are assinged correctly
|
||||
if ((material.IsKeywordEnabled(EditorUtilities.GetKeywordName(bendType)) == false || material.IsKeywordEnabled(EditorUtilities.GetKeywordName(bendID)) == false) &&
|
||||
File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)))
|
||||
{
|
||||
if (shaderSupportedBendTypes.Contains(bendType) == false || shaderSupportedBendIDs.Contains(bendID) == false ||
|
||||
File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)) == false)
|
||||
{
|
||||
//Displaying Actions button below
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorUtilities.UpdateMaterialKeyWords(material, bendType, bendID, normalTransform);
|
||||
|
||||
if (CurvedWorldEditorWindow.activeWindow != null && CurvedWorldEditorWindow.activeWindow.gTab == CurvedWorldEditorWindow.TAB.RenderersOverview)
|
||||
{
|
||||
CurvedWorldEditorWindow.activeWindow.RebuildSceneShadersOverview();
|
||||
CurvedWorldEditorWindow.activeWindow.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (normalTransform != material.IsKeywordEnabled(EditorUtilities.shaderKeywordName_BendTransformNormal))
|
||||
{
|
||||
if (material.IsKeywordEnabled(EditorUtilities.shaderKeywordName_BendTransformNormal))
|
||||
normalTransform = true;
|
||||
else
|
||||
normalTransform = false;
|
||||
|
||||
prop.vectorValue = new Vector4((int)bendType, bendID, (hasNormalTransform ? (normalTransform ? 1 : 0) : 0), 0);
|
||||
|
||||
if (CurvedWorldEditorWindow.activeWindow != null && CurvedWorldEditorWindow.activeWindow.gTab == CurvedWorldEditorWindow.TAB.RenderersOverview)
|
||||
{
|
||||
CurvedWorldEditorWindow.activeWindow.RebuildSceneShadersOverview();
|
||||
CurvedWorldEditorWindow.activeWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
position.height = 18;
|
||||
using (new EditorGUIHelper.EditorGUIUtilityLabelWidth(0))
|
||||
{
|
||||
position.height = 18;
|
||||
|
||||
bendType = (CurvedWorld.BEND_TYPE)EditorGUI.Popup(new Rect(position.xMin, position.yMin, position.width - 20, position.height), " ", (int)bendType, EditorUtilities.bendTypesNamesForMenu);
|
||||
EditorGUI.LabelField(new Rect(position.xMin, position.yMin, position.width - 20, position.height), "Bend Type", EditorUtilities.GetBendTypeNameInfo(bendType).forLable, EditorStyles.popup);
|
||||
|
||||
|
||||
if (GUI.Button(new Rect(position.xMax - 20, position.yMin, 20, position.height), "≡"))
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
menu.AddItem(new GUIContent("Find Controller"), false, EditorUtilities.CallbackFindController, (int)bendType + "_" + bendID);
|
||||
menu.AddItem(new GUIContent("Editor Window"), false, EditorUtilities.CallbackOpenCurvedWorldSettingsWindow, (int)bendType + "_" + bendID);
|
||||
menu.AddItem(new GUIContent("Curved World Keywords"), false, EditorUtilities.CallbackAnalyzeShaderCurvedWorldKeywords, material.shader);
|
||||
|
||||
menu.AddItem(new GUIContent("Reimport Shader"), false, EditorUtilities.CallbackReimportShader, material.shader);
|
||||
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
|
||||
|
||||
position.yMin += 20;
|
||||
position.height = 18;
|
||||
bendID = EditorGUI.IntSlider(position, "Bend ID", bendID, 1, EditorUtilities.MAX_SUPPORTED_BEND_IDS);
|
||||
|
||||
if (hasNormalTransform)
|
||||
{
|
||||
position.yMin += 20;
|
||||
position.height = 18;
|
||||
normalTransform = EditorGUI.Toggle(position, "Normal Transform", normalTransform);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (bendID < 1)
|
||||
bendID = 1;
|
||||
|
||||
// Set the new value if it has changed
|
||||
prop.vectorValue = new Vector4((int)bendType, bendID, (hasNormalTransform ? (normalTransform ? 1 : 0) : 0), 0);
|
||||
|
||||
if (File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)))
|
||||
{
|
||||
Undo.RecordObjects(editor.targets, "Change Keywords");
|
||||
|
||||
foreach (Material mat in editor.targets)
|
||||
{
|
||||
EditorUtilities.UpdateMaterialKeyWords(mat, bendType, bendID, normalTransform);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If file does not exist still adjust keyword for normal transformation
|
||||
foreach (Material mat in editor.targets)
|
||||
{
|
||||
if (normalTransform)
|
||||
mat.EnableKeyword(EditorUtilities.shaderKeywordName_BendTransformNormal);
|
||||
else
|
||||
mat.DisableKeyword(EditorUtilities.shaderKeywordName_BendTransformNormal);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurvedWorldEditorWindow.activeWindow != null && CurvedWorldEditorWindow.activeWindow.gTab == CurvedWorldEditorWindow.TAB.RenderersOverview)
|
||||
{
|
||||
CurvedWorldEditorWindow.activeWindow.RebuildSceneShadersOverview();
|
||||
CurvedWorldEditorWindow.activeWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (shaderSupportedBendTypes.Contains(bendType) == false || shaderSupportedBendIDs.Contains(bendID) == false ||
|
||||
File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)) == false)
|
||||
{
|
||||
position.yMin += 20;
|
||||
position.height = 36;
|
||||
EditorGUI.HelpBox(position, "Missing Keywords!", MessageType.Error);
|
||||
|
||||
if (GUI.Button(new Rect(position.xMax - 64 - 5, position.yMin + 9, 64, 18), "Actions"))
|
||||
{
|
||||
updateBendType = bendType;
|
||||
updateBendID = bendID;
|
||||
updateNormalTransform = normalTransform;
|
||||
updateMaterial = material;
|
||||
updateMaterialEditor = editor;
|
||||
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Update Shader"), false, CallBackUpdateShader);
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
Material material = (Material)editor.target;
|
||||
Init(prop.displayName);
|
||||
|
||||
//Read settings
|
||||
CurvedWorld.BEND_TYPE bendType;
|
||||
int bendID;
|
||||
bool enabledNormalTransform;
|
||||
|
||||
EditorUtilities.GetBendSettingsFromVector(prop.vectorValue, out bendType, out bendID, out enabledNormalTransform);
|
||||
|
||||
|
||||
float height = base.GetPropertyHeight(prop, label, editor) * (2 + (hasNormalTransform ? 1 : 0)) + 2;
|
||||
|
||||
|
||||
if (shaderSupportedBendTypes.Contains(bendType) == false || shaderSupportedBendIDs.Contains(bendID) == false ||
|
||||
File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)) == false)
|
||||
{
|
||||
height += 40;
|
||||
}
|
||||
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
void CallBackUpdateShader()
|
||||
{
|
||||
if (File.Exists(EditorUtilities.GetBendFileLocation(updateBendType, updateBendID, EditorUtilities.EXTENSTION.cginc)) == false)
|
||||
{
|
||||
EditorUtilities.CreateCGINCFile(updateBendType, updateBendID);
|
||||
}
|
||||
|
||||
|
||||
if (EditorUtilities.AddShaderBendSettings(updateMaterial.shader, updateBendType, updateBendID, EditorUtilities.KEYWORDS_COMPILE.Default, false))
|
||||
{
|
||||
EditorUtilities.CallbackReimportShader(updateMaterial.shader);
|
||||
|
||||
foreach (Material mat in updateMaterialEditor.targets)
|
||||
{
|
||||
EditorUtilities.UpdateMaterialKeyWords(mat, updateBendType, updateBendID, updateNormalTransform);
|
||||
}
|
||||
|
||||
if (CurvedWorldEditorWindow.activeWindow != null &&
|
||||
CurvedWorldEditorWindow.activeWindow.gTab == CurvedWorldEditorWindow.TAB.CurvedWorldKeywords &&
|
||||
CurvedWorldEditorWindow.activeWindow.gCurvedWorldKeywordsShader == updateMaterial.shader)
|
||||
{
|
||||
CurvedWorldEditorWindow.gCurvedWorldKeywordsShaderInfo = null;
|
||||
CurvedWorldEditorWindow.activeWindow.Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
if (CurvedWorldEditorWindow.activeWindow != null && CurvedWorldEditorWindow.activeWindow.gTab == CurvedWorldEditorWindow.TAB.RenderersOverview)
|
||||
{
|
||||
CurvedWorldEditorWindow.activeWindow.RebuildSceneShadersOverview();
|
||||
CurvedWorldEditorWindow.activeWindow.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4da0a8a4aae856439281c0537bb0e19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,193 @@
|
||||
using System.IO;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
public class CurvedWorldBendSettingsTerrainDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
private static class Label
|
||||
{
|
||||
public static string mainGroupName = "Curved World";
|
||||
|
||||
public static string bendType = "Bend Type";
|
||||
public static string bendID = "Bend ID";
|
||||
public static string bendTransformNormal = "Transform Normal";
|
||||
}
|
||||
|
||||
CurvedWorld.BEND_TYPE shaderSupportedBendType;
|
||||
int shaderSupportedBendID;
|
||||
|
||||
CurvedWorld.BEND_TYPE updateBendType;
|
||||
int updateBendID;
|
||||
Material updateMaterial;
|
||||
|
||||
|
||||
void Init(string label)
|
||||
{
|
||||
CurvedWorld.BEND_TYPE[] bendTypes;
|
||||
int[] bendIDs;
|
||||
bool hasNormalTransform;
|
||||
|
||||
if (EditorUtilities.StringToBendSettings(label, out bendTypes, out bendIDs, out hasNormalTransform))
|
||||
{
|
||||
shaderSupportedBendType = bendTypes[0];
|
||||
shaderSupportedBendID = bendIDs[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
|
||||
{
|
||||
Material material = (Material)editor.target;
|
||||
Init(prop.displayName);
|
||||
|
||||
|
||||
CurvedWorld.BEND_TYPE bendType;
|
||||
int bendID;
|
||||
bool normalTransform;
|
||||
|
||||
EditorUtilities.GetBendSettingsFromVector(prop.vectorValue, out bendType, out bendID, out normalTransform);
|
||||
|
||||
|
||||
#region Bend Type
|
||||
EditorGUI.BeginChangeCheck();
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginHorizontal())
|
||||
{
|
||||
bendType = (CurvedWorld.BEND_TYPE)EditorGUILayout.Popup(" ", (int)bendType, EditorUtilities.bendTypesNamesForMenu);
|
||||
EditorGUI.LabelField(GUILayoutUtility.GetLastRect(), "Bend Type", EditorUtilities.GetBendTypeNameInfo(bendType).forLable, EditorStyles.popup);
|
||||
|
||||
if (GUILayout.Button("≡", GUILayout.MaxWidth(20)))
|
||||
{
|
||||
GenericMenu menu = new GenericMenu();
|
||||
|
||||
menu.AddItem(new GUIContent("Find Controller"), false, EditorUtilities.CallbackFindController, (int)bendType + "_" + bendID);
|
||||
menu.AddItem(new GUIContent("Editor Window"), false, EditorUtilities.CallbackOpenCurvedWorldSettingsWindow, (int)bendType + "_" + bendID);
|
||||
menu.AddItem(new GUIContent("Curved World Keywords"), false, EditorUtilities.CallbackAnalyzeShaderCurvedWorldKeywords, material.shader);
|
||||
|
||||
menu.AddItem(new GUIContent("Reimport Shader"), false, EditorUtilities.CallbackReimportShader, material.shader);
|
||||
|
||||
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
}
|
||||
|
||||
bendID = EditorGUILayout.IntSlider("Bend ID", bendID, 1, EditorUtilities.MAX_SUPPORTED_BEND_IDS);
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.vectorValue = new Vector4((int)bendType, bendID, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
if (bendType != shaderSupportedBendType || bendID != shaderSupportedBendID ||
|
||||
File.Exists(EditorUtilities.GetBendFileLocation(bendType, bendID, EditorUtilities.EXTENSTION.cginc)) == false)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Missing Keywords!", MessageType.Error);
|
||||
|
||||
Rect helpBox = GUILayoutUtility.GetLastRect();
|
||||
|
||||
if (GUI.Button(new Rect(helpBox.xMax - 64 - 5, helpBox.yMin + 8, 64, 20), "Actions"))
|
||||
{
|
||||
updateBendType = bendType;
|
||||
updateBendID = bendID;
|
||||
updateMaterial = material;
|
||||
|
||||
GenericMenu menu = new GenericMenu();
|
||||
menu.AddItem(new GUIContent("Update Shader"), false, CallBackUpdateShader);
|
||||
menu.ShowAsContext();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CallBackUpdateShader()
|
||||
{
|
||||
string mainCGINCFilePath = EditorUtilities.GetGeneratedFilePath(updateBendType, updateBendID, EditorUtilities.EXTENSTION.cginc, false);
|
||||
if (File.Exists(mainCGINCFilePath) == false)
|
||||
{
|
||||
EditorUtilities.CreateCGINCFile(updateBendType, updateBendID);
|
||||
|
||||
AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
|
||||
}
|
||||
|
||||
|
||||
string shaderPath = EditorUtilities.GetGeneratedTerrainShaderPath(updateBendType, updateBendID, false);
|
||||
if (File.Exists(shaderPath) == false)
|
||||
{
|
||||
string sourceFolderPath = EditorUtilities.GetTempleTerrainFolderPath();
|
||||
string desitnationFolderPath = EditorUtilities.GetGeneratedTerrainShadersFolderPath(updateBendType, updateBendID);
|
||||
|
||||
|
||||
//https://stackoverflow.com/questions/58744/copy-the-entire-contents-of-a-directory-in-c-sharp
|
||||
|
||||
//Now Create all of the directories
|
||||
string[] directories = Directory.GetDirectories(sourceFolderPath, "*", SearchOption.AllDirectories);
|
||||
if (directories != null && directories.Length > 0)
|
||||
{
|
||||
foreach (string dirPath in directories)
|
||||
Directory.CreateDirectory(dirPath.Replace(sourceFolderPath, desitnationFolderPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(desitnationFolderPath);
|
||||
}
|
||||
|
||||
//Copy all the files & Replaces any files with the same name
|
||||
foreach (string newPath in Directory.GetFiles(sourceFolderPath, "*.*",
|
||||
SearchOption.AllDirectories))
|
||||
File.Copy(newPath, newPath.Replace(sourceFolderPath, desitnationFolderPath), true);
|
||||
|
||||
|
||||
|
||||
//Deleta all meta files
|
||||
string[] allMetaFiles = Directory.GetFiles(desitnationFolderPath, "*.meta", SearchOption.AllDirectories);
|
||||
foreach (string metaFile in allMetaFiles)
|
||||
{
|
||||
System.IO.File.Delete(metaFile);
|
||||
}
|
||||
|
||||
|
||||
//Read all files and make changes
|
||||
string BEND_NAME_SMALL = EditorUtilities.GetBendTypeNameInfo(updateBendType).forLable;
|
||||
string BEND_NAME_BIG = updateBendType.ToString().ToUpperInvariant();
|
||||
string BEND_NAME_INDEX = ((int)updateBendType).ToString();
|
||||
string ID = updateBendID.ToString();
|
||||
|
||||
string[] allShaderFiles = Directory.GetFiles(desitnationFolderPath, "*", SearchOption.AllDirectories);
|
||||
foreach (string shaderFile in allShaderFiles)
|
||||
{
|
||||
string[] allLines = File.ReadAllLines(shaderFile);
|
||||
|
||||
for (int i = 0; i < allLines.Length; i++)
|
||||
{
|
||||
allLines[i] = allLines[i].Replace("#BEND_NAME_SMALL#", BEND_NAME_SMALL).
|
||||
Replace("#ID#", ID).
|
||||
Replace("#BEND_NAME_INDEX#", BEND_NAME_INDEX).
|
||||
Replace("#BEND_NAME_BIG#", BEND_NAME_BIG);
|
||||
}
|
||||
|
||||
File.WriteAllLines(shaderFile, allLines);
|
||||
}
|
||||
|
||||
//Change .txt files extension to .shader
|
||||
string[] allTxtFiles = Directory.GetFiles(desitnationFolderPath, "*.txt", SearchOption.AllDirectories);
|
||||
foreach (string txtFile in allTxtFiles)
|
||||
{
|
||||
File.Move(txtFile, Path.ChangeExtension(txtFile, ".shader"));
|
||||
}
|
||||
|
||||
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
updateMaterial.shader = (Shader)AssetDatabase.LoadAssetAtPath(shaderPath, typeof(Shader));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d1939e7a8c1eef4d9f20a05259bde2a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
public class CurvedWorldSeparatorDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
float fValue;
|
||||
if (float.TryParse(label, out fValue))
|
||||
return fValue;
|
||||
else
|
||||
return 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f43a8002285fbdf4593b2a38a9ef8a18
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
public class CurvedWorldToggleFloatDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
|
||||
{
|
||||
// Setup
|
||||
bool value = (prop.floatValue > 0.5f);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
// Show the toggle control
|
||||
value = EditorGUI.Toggle(position, label, value);
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
// Set the new value if it has changed
|
||||
prop.floatValue = value ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62e47537684e6a347bbef12bf3b1c87e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
class CurvedWorldUVScrollDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
|
||||
Vector2 vector = prop.vectorValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
vector = TextureScaleOffsetProperty(position, vector, new GUIContent("Scroll"));
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.vectorValue = vector;
|
||||
}
|
||||
}
|
||||
|
||||
static Vector2 TextureScaleOffsetProperty(Rect position, Vector2 scroll, GUIContent label)
|
||||
{
|
||||
float kLineHeight = 18;
|
||||
|
||||
|
||||
Vector2 vector2_1 = new Vector2(scroll.x, scroll.y);
|
||||
float width = UnityEditor.EditorGUIUtility.labelWidth;
|
||||
float x1 = position.x + width;
|
||||
float x2 = position.x + EditorGUI.indentLevel * 15f;
|
||||
int indentLevel = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
Rect totalPosition = new Rect(x2, position.y, width, kLineHeight);
|
||||
Rect position1 = new Rect(x1, position.y, position.width - width, kLineHeight);
|
||||
EditorGUI.PrefixLabel(totalPosition, label);
|
||||
Vector2 vector2_3 = EditorGUI.Vector2Field(position1, GUIContent.none, vector2_1);
|
||||
|
||||
EditorGUI.indentLevel = indentLevel;
|
||||
|
||||
return new Vector2(vector2_3.x, vector2_3.y);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b85cbf3a741297348a545c82eb9ce25f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b7a19f5335a8e3145bf0c83a1bcd4450
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
[CreateAssetMenu(menuName = "Rendering/Curved World RP (Pipeline Asset)")]
|
||||
public class CurvedWorldRenderPipeline : UniversalRenderPipelineAsset
|
||||
{
|
||||
|
||||
public Shader detailLitShader;
|
||||
public Shader wavingGrassShader;
|
||||
public Shader wavingGrassBillboardShader;
|
||||
|
||||
|
||||
public override Shader terrainDetailLitShader => detailLitShader;
|
||||
public override Shader terrainDetailGrassShader => wavingGrassShader;
|
||||
public override Shader terrainDetailGrassBillboardShader => wavingGrassBillboardShader;
|
||||
}
|
||||
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a777ea048e19f954db0e2c52822a7fba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Rendering.Universal;
|
||||
|
||||
[CustomEditor(typeof(CurvedWorldRenderPipeline), true)]
|
||||
public class CurvedWorldRenderPipelineEditor : Editor
|
||||
{
|
||||
private Editor originalEditor;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(CurvedWorldRenderPipeline.detailLitShader)));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(CurvedWorldRenderPipeline.wavingGrassShader)));
|
||||
EditorGUILayout.PropertyField(serializedObject.FindProperty(nameof(CurvedWorldRenderPipeline.wavingGrassBillboardShader)));
|
||||
EditorGUILayout.Space();
|
||||
|
||||
if (originalEditor == null)
|
||||
{
|
||||
originalEditor = Editor.CreateEditor(target, typeof(UniversalRenderPipelineAssetEditor));
|
||||
}
|
||||
originalEditor.OnInspectorGUI();
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb7f01623a9e566459600d846409bcd9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 581a37d9b02662549ad00d69b0f80bfd
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,75 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
[CustomEditor(typeof(CurvedWorld.CurvedWorldBoundingBox))]
|
||||
[CanEditMultipleObjects]
|
||||
public class CurvedWorldBoundingBoxEditor : Editor
|
||||
{
|
||||
#region Component Menu
|
||||
[MenuItem("Component/Amazing Assets/Curved World/Bounding Box", false, 513)]
|
||||
static public void AddComponent()
|
||||
{
|
||||
if (Selection.gameObjects != null && Selection.gameObjects.Length > 1)
|
||||
{
|
||||
for (int i = 0; i < Selection.gameObjects.Length; i++)
|
||||
{
|
||||
if (Selection.gameObjects[i] != null)
|
||||
Selection.gameObjects[i].AddComponent<CurvedWorld.CurvedWorldBoundingBox>();
|
||||
}
|
||||
}
|
||||
else if (Selection.activeGameObject != null)
|
||||
{
|
||||
Selection.activeGameObject.AddComponent<CurvedWorld.CurvedWorldBoundingBox>();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Component/Amazing Assets/Curved World/Boundung Box", true)]
|
||||
static public bool ValidateAddComponent()
|
||||
{
|
||||
return (Selection.gameObjects == null || Selection.gameObjects.Length == 0) ? false : true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variables
|
||||
SerializedProperty scale;
|
||||
SerializedProperty visualizeInEditor;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity Functions
|
||||
void OnEnable()
|
||||
{
|
||||
scale = serializedObject.FindProperty("scale");
|
||||
visualizeInEditor = serializedObject.FindProperty("visualizeInEditor");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
|
||||
GUILayout.Space(5);
|
||||
using (new EditorGUIHelper.EditorGUILayoutBeginHorizontal())
|
||||
{
|
||||
EditorGUILayout.PropertyField(scale);
|
||||
|
||||
if (GUILayout.Button("Recalculate", GUILayout.MaxWidth(90)))
|
||||
{
|
||||
((CurvedWorld.CurvedWorldBoundingBox)target).RecalculateBounds();
|
||||
}
|
||||
}
|
||||
EditorGUILayout.PropertyField(visualizeInEditor);
|
||||
|
||||
if (scale.floatValue < 1)
|
||||
scale.floatValue = 1;
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 393c2b7c5ce295a4ab6fffbe6e4d41cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,91 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
|
||||
namespace AmazingAssets.CurvedWorldEditor
|
||||
{
|
||||
[CustomEditor(typeof(CurvedWorld.CurvedWorldCamera))]
|
||||
[CanEditMultipleObjects]
|
||||
public class CurvedWorldCameraEditor : Editor
|
||||
{
|
||||
#region Component Menu
|
||||
[MenuItem("Component/Amazing Assets/Curved World/Camera", false, 512)]
|
||||
static public void AddComponent()
|
||||
{
|
||||
if (Selection.gameObjects != null && Selection.gameObjects.Length > 1)
|
||||
{
|
||||
for (int i = 0; i < Selection.gameObjects.Length; i++)
|
||||
{
|
||||
if (Selection.gameObjects[i] != null)
|
||||
Selection.gameObjects[i].AddComponent<CurvedWorld.CurvedWorldCamera>();
|
||||
}
|
||||
}
|
||||
else if (Selection.activeGameObject != null)
|
||||
{
|
||||
Selection.activeGameObject.AddComponent<CurvedWorld.CurvedWorldCamera>();
|
||||
}
|
||||
}
|
||||
|
||||
[MenuItem("Component/Amazing Assets/Curved World/Camera", true)]
|
||||
static public bool ValidateAddComponent()
|
||||
{
|
||||
return (Selection.gameObjects == null || Selection.gameObjects.Length == 0) ? false : true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Variables
|
||||
SerializedProperty matrixType;
|
||||
SerializedProperty fieldOfView;
|
||||
SerializedProperty size;
|
||||
SerializedProperty nearClipPlaneSameAsCamera;
|
||||
SerializedProperty nearClipPlane;
|
||||
SerializedProperty visualizeInEditor;
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity Functions
|
||||
void OnEnable()
|
||||
{
|
||||
matrixType = serializedObject.FindProperty("matrixType");
|
||||
fieldOfView = serializedObject.FindProperty("fieldOfView");
|
||||
size = serializedObject.FindProperty("size");
|
||||
nearClipPlaneSameAsCamera = serializedObject.FindProperty("nearClipPlaneSameAsCamera");
|
||||
nearClipPlane = serializedObject.FindProperty("nearClipPlane");
|
||||
visualizeInEditor = serializedObject.FindProperty("visualizeInEditor");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
|
||||
|
||||
GUILayout.Space(5);
|
||||
EditorGUILayout.PropertyField(matrixType);
|
||||
|
||||
if (matrixType.enumValueIndex == (int)CurvedWorld.CurvedWorldCamera.MATRIX_TYPE.Perspective)
|
||||
EditorGUILayout.PropertyField(fieldOfView);
|
||||
else
|
||||
EditorGUILayout.PropertyField(size);
|
||||
|
||||
if (matrixType.enumValueIndex == (int)CurvedWorld.CurvedWorldCamera.MATRIX_TYPE.Orthographic)
|
||||
{
|
||||
nearClipPlaneSameAsCamera.boolValue = EditorGUILayout.IntPopup("Near Clip Plane", nearClipPlaneSameAsCamera.boolValue ? 1 : 0, new string[] { "Custom", "Same As Camera" }, new int[] { 0, 1 }) == 1 ? true : false;
|
||||
if (nearClipPlaneSameAsCamera.boolValue == false)
|
||||
{
|
||||
using (new EditorGUIHelper.EditorGUIIndentLevel(1))
|
||||
{
|
||||
EditorGUILayout.PropertyField(nearClipPlane, new GUIContent("Value"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EditorGUILayout.PropertyField(visualizeInEditor);
|
||||
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|