extra assets + decoration
This commit is contained in:
8
Assets/Imported Assets/BOXOPHOBIC/Utils/Editor.meta
Normal file
8
Assets/Imported Assets/BOXOPHOBIC/Utils/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ef1e41b6d86c1b45ac76cb263c1447a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "Boxophobic.Utils.Editor",
|
||||
"references": [
|
||||
"GUID:825ad574da7360d4e8aea558f272972e"
|
||||
],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": []
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10f1dd4cfd6afb54da274d7d818bd8f6
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6830cf83a08955746a19c26bcb75fbec
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.Constants
|
||||
{
|
||||
public static class CONSTANT
|
||||
{
|
||||
public static Color CategoryColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
return CONSTANT.ColorDarkGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CONSTANT.ColorLightGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Color LineColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
return new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Color(0.65f, 0.65f, 0.65f, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Color ColorDarkGray
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Color(0.2f, 0.2f, 0.2f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public static Color ColorLightGray
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Color(0.82f, 0.82f, 0.82f, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public static GUIStyle TitleStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
GUIStyle guiStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
|
||||
return guiStyle;
|
||||
}
|
||||
}
|
||||
|
||||
public static GUIStyle HeaderStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
GUIStyle guiStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
fontStyle = FontStyle.Bold,
|
||||
alignment = TextAnchor.MiddleLeft
|
||||
};
|
||||
|
||||
return guiStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0cf8ff3bbc97374f88272f686fb80e5
|
||||
timeCreated: 1541442079
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38851c0055860034180f030b34a3d452
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.Utils
|
||||
{
|
||||
public partial class SettingsUtils
|
||||
{
|
||||
public static string LoadSettingsData(string settingsPath, string defaultData)
|
||||
{
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
return settings.data;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultData;
|
||||
}
|
||||
}
|
||||
|
||||
public static int LoadSettingsData(string settingsPath, int defaultData)
|
||||
{
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
int value;
|
||||
|
||||
if (int.TryParse(settings.data, out value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultData;
|
||||
}
|
||||
}
|
||||
|
||||
public static float LoadSettingsData(string settingsPath, float defaultData)
|
||||
{
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
if (settings != null)
|
||||
{
|
||||
float value;
|
||||
|
||||
if (float.TryParse(settings.data, out value))
|
||||
{
|
||||
return float.Parse(settings.data, CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultData;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90057ce590a8bd148ab59e018f35d9cb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Boxophobic.Utils
|
||||
{
|
||||
public partial class SettingsUtils
|
||||
{
|
||||
public static void SaveSettingsData(string settingsPath, string data)
|
||||
{
|
||||
CreateFileIfMissing(settingsPath);
|
||||
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
settings.data = data;
|
||||
|
||||
SaveFile(settingsPath);
|
||||
}
|
||||
|
||||
public static void SaveSettingsData(string settingsPath, int data)
|
||||
{
|
||||
CreateFileIfMissing(settingsPath);
|
||||
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
settings.data = data.ToString();
|
||||
|
||||
SaveFile(settingsPath);
|
||||
}
|
||||
|
||||
public static void SaveSettingsData(string settingsPath, float data)
|
||||
{
|
||||
CreateFileIfMissing(settingsPath);
|
||||
|
||||
var settings = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
settings.data = data.ToString();
|
||||
|
||||
SaveFile(settingsPath);
|
||||
}
|
||||
|
||||
private static void CreateFileIfMissing(string settingsPath)
|
||||
{
|
||||
if (File.Exists(settingsPath) == false)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(settingsPath);
|
||||
|
||||
if (Directory.Exists(directory) == false)
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
AssetDatabase.CreateAsset(ScriptableObject.CreateInstance<SettingsData>(), settingsPath);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
private static void SaveFile(string settingsPath)
|
||||
{
|
||||
var file = AssetDatabase.LoadAssetAtPath<SettingsData>(settingsPath);
|
||||
|
||||
EditorUtility.SetDirty(file);
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7afe5a6ac49829c408df7e64761e822d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a7bbb7ae81438674299a895f4c6636c3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,158 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawInspectorBanner(Color color, string title)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 1);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = new Color(color.r, color.g, color.b, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
Color guiColor = CONSTANT.ColorDarkGray;
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", CONSTANT.TitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(string title)
|
||||
{
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 1);
|
||||
|
||||
Color color;
|
||||
Color guiColor;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = CONSTANT.ColorDarkGray;
|
||||
guiColor = CONSTANT.ColorLightGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
guiColor = CONSTANT.ColorDarkGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", CONSTANT.TitleStyle);
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(Color color, string title, string subtitle)
|
||||
{
|
||||
GUIStyle titleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
|
||||
GUIStyle subTitleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var subRect = new Rect(18, 16, fullRect.width - 2, fullRect.height);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 1);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = new Color(color.r, color.g, color.b, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
Color guiColor = CONSTANT.ColorDarkGray;
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.enabled = false;
|
||||
GUI.Label(subRect, "<size=10>" + subtitle + "</size>", subTitleStyle);
|
||||
GUI.enabled = true;
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
public static void DrawInspectorBanner(string title, string subtitle)
|
||||
{
|
||||
GUIStyle titleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
|
||||
GUIStyle subTitleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 36);
|
||||
var subRect = new Rect(18, 16, fullRect.width - 2, fullRect.height);
|
||||
var lineRect = new Rect(0, fullRect.position.y, fullRect.xMax + 3, 1);
|
||||
|
||||
Color color;
|
||||
Color guiColor;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = CONSTANT.ColorDarkGray;
|
||||
guiColor = CONSTANT.ColorLightGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
guiColor = CONSTANT.ColorDarkGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.enabled = false;
|
||||
GUI.Label(subRect, "<size=10>" + subtitle + "</size>", subTitleStyle);
|
||||
GUI.enabled = true;
|
||||
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1525d4228f26951498e86e425363f3f0
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawInspectorCategory(string bannerText)
|
||||
{
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
EditorGUI.DrawRect(fillRect, CONSTANT.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, CONSTANT.HeaderStyle);
|
||||
}
|
||||
|
||||
public static bool DrawInspectorCategory(string bannerText, bool enabled, bool colapsable, float top, float down)
|
||||
{
|
||||
GUI.color = new Color(1, 1, 1, 0.9f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y - 1, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x - 1, fullRect.position.y, fullRect.width, 18);
|
||||
var arrowRect = new Rect(fullRect.position.x - 15, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(arrowRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enabled = true;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, CONSTANT.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, CONSTANT.HeaderStyle);
|
||||
|
||||
GUI.color = new Color(1, 1, 1, 0.39f);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>▼</size>", CONSTANT.HeaderStyle);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(arrowRect, "<size=10>►</size>", CONSTANT.HeaderStyle);
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
GUI.color = Color.white;
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87b94a9c1333f074e8c24cd5a2fe1d73
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,149 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawWindowBanner(Color color, string title)
|
||||
{
|
||||
GUILayout.Space(15);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(1, fullRect.position.y, fullRect.xMax - 2, 36);
|
||||
var lineRect = new Rect(1, fullRect.position.y, fullRect.xMax - 2, 1);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = new Color(color.r, color.g, color.b, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
Color guiColor = CONSTANT.ColorDarkGray;
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", CONSTANT.TitleStyle);
|
||||
|
||||
GUILayout.Space(15);
|
||||
}
|
||||
|
||||
public static void DrawWindowBanner(string title)
|
||||
{
|
||||
GUILayout.Space(15);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(2, fullRect.position.y, fullRect.xMax - 4, 36);
|
||||
|
||||
Color color;
|
||||
Color guiColor;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = CONSTANT.ColorDarkGray;
|
||||
guiColor = CONSTANT.ColorLightGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
guiColor = CONSTANT.ColorDarkGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", CONSTANT.TitleStyle);
|
||||
|
||||
GUILayout.Space(15);
|
||||
}
|
||||
|
||||
public static void DrawWindowBanner(Color color, string title, string subtitle)
|
||||
{
|
||||
GUIStyle titleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
|
||||
GUIStyle subTitleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
|
||||
GUILayout.Space(15);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var fillRect = new Rect(1, fullRect.position.y, fullRect.xMax - 2, 36);
|
||||
var subRect = new Rect(18, 39, fullRect.width - 36, fullRect.height);
|
||||
var lineRect = new Rect(1, fullRect.position.y, fullRect.xMax - 2, 1);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = new Color(color.r, color.g, color.b, 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
Color guiColor = CONSTANT.ColorDarkGray;
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", subTitleStyle);
|
||||
|
||||
GUILayout.Space(15);
|
||||
}
|
||||
|
||||
public static void DrawWindowBanner(string title, string subtitle)
|
||||
{
|
||||
GUIStyle titleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter
|
||||
};
|
||||
|
||||
GUIStyle subTitleStyle = new GUIStyle("label")
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleRight
|
||||
};
|
||||
|
||||
GUILayout.Space(15);
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 36, 0);
|
||||
var subRect = new Rect(18, 39, fullRect.width - 36, fullRect.height);
|
||||
var fillRect = new Rect(2, fullRect.position.y, fullRect.xMax - 4, 36);
|
||||
|
||||
Color color;
|
||||
Color guiColor;
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
color = CONSTANT.ColorDarkGray;
|
||||
guiColor = CONSTANT.ColorLightGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = CONSTANT.ColorLightGray;
|
||||
guiColor = CONSTANT.ColorDarkGray;
|
||||
}
|
||||
EditorGUI.DrawRect(fillRect, color);
|
||||
|
||||
GUI.Label(fullRect, "<size=16><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + title + "</color></size>", titleStyle);
|
||||
GUI.Label(subRect, "<b><size=11><color=#" + ColorUtility.ToHtmlStringRGB(guiColor) + ">" + subtitle + "</color></size></b>", subTitleStyle);
|
||||
|
||||
GUILayout.Space(15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd0ddca94871d9a4586a143a83184806
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,89 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public partial class StyledGUI
|
||||
{
|
||||
public static void DrawWindowCategory(string bannerText)
|
||||
{
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x + 4, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
EditorGUI.DrawRect(fillRect, CONSTANT.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, CONSTANT.HeaderStyle);
|
||||
}
|
||||
|
||||
public static bool DrawWindowCategory(string bannerText, bool enabled, float top, float down, bool colapsable)
|
||||
{
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
}
|
||||
|
||||
var fullRect = GUILayoutUtility.GetRect(0, 0, 18, 0);
|
||||
var fillRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 18);
|
||||
var lineRect = new Rect(0, fullRect.y, fullRect.xMax + 10, 1);
|
||||
var titleRect = new Rect(fullRect.position.x + 4, fullRect.position.y, fullRect.width, 18);
|
||||
|
||||
if (EditorGUIUtility.isProSkin)
|
||||
{
|
||||
GUI.color = CONSTANT.ColorDarkGray;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.color = CONSTANT.ColorLightGray;
|
||||
}
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (GUI.Button(fullRect, "", GUIStyle.none))
|
||||
{
|
||||
enabled = !enabled;
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.DrawRect(fillRect, CONSTANT.CategoryColor);
|
||||
EditorGUI.DrawRect(lineRect, CONSTANT.LineColor);
|
||||
|
||||
GUI.Label(titleRect, bannerText, CONSTANT.HeaderStyle);
|
||||
|
||||
if (colapsable)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aac99d6d81f90e54cabd822770c11875
|
||||
timeCreated: 1542661236
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7841477f6d1bbe44eab37cd31c0c5697
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,27 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledBanner))]
|
||||
public class StyledBannerAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledBanner a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledBanner)attribute;
|
||||
|
||||
var bannerColor = new Color(a.colorR, a.colorG, a.colorB);
|
||||
|
||||
StyledGUI.DrawInspectorBanner(bannerColor, a.title);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a832b9f47ccef214e81c89efe6bf31dd
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledButton))]
|
||||
public class StyledButtonAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledButton a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledButton)attribute;
|
||||
|
||||
GUILayout.Space(a.Top);
|
||||
|
||||
if (GUILayout.Button(a.Text))
|
||||
{
|
||||
property.boolValue = true;
|
||||
}
|
||||
|
||||
GUILayout.Space(a.Down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1d35dbbb9b6c214aa892d7b240de3df
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledCategory))]
|
||||
public class StyledCategoryAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledCategory a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledCategory)attribute;
|
||||
|
||||
property.boolValue = StyledGUI.DrawInspectorCategory(a.category, property.boolValue, a.colapsable, a.top, a.down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb59d41716ab6114cb7cf03a5695083b
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledEnum))]
|
||||
public class StyledEnumAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledEnum a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledEnum)attribute;
|
||||
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
if (Resources.Load<TextAsset>(a.file) != null)
|
||||
{
|
||||
var layersPath = AssetDatabase.GetAssetPath(Resources.Load<TextAsset>(a.file));
|
||||
|
||||
StreamReader reader = new StreamReader(layersPath);
|
||||
|
||||
a.options = reader.ReadLine();
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
string[] enumSplit = a.options.Split(char.Parse(" "));
|
||||
List<string> enumOptions = new List<string>(enumSplit.Length / 2);
|
||||
List<int> enumIndices = new List<int>(enumSplit.Length / 2);
|
||||
|
||||
for (int i = 0; i < enumSplit.Length; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
enumOptions.Add(enumSplit[i].Replace("_", " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
enumIndices.Add(int.Parse(enumSplit[i]));
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(a.top);
|
||||
|
||||
int index = property.intValue;
|
||||
int realIndex = enumIndices[0];
|
||||
|
||||
for (int i = 0; i < enumIndices.Count; i++)
|
||||
{
|
||||
if (enumIndices[i] == index)
|
||||
{
|
||||
realIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (a.display == "")
|
||||
{
|
||||
a.display = property.displayName;
|
||||
}
|
||||
|
||||
realIndex = EditorGUILayout.Popup(a.display, realIndex, enumOptions.ToArray());
|
||||
|
||||
//Debug Value
|
||||
//EditorGUILayout.LabelField(enumIndices[realIndex].ToString());
|
||||
|
||||
property.intValue = enumIndices[realIndex];
|
||||
|
||||
GUILayout.Space(a.down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c3935e6d6b91844d8053d3fa7faff1b
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledIndent))]
|
||||
public class StyledIndentAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledIndent a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledIndent)attribute;
|
||||
|
||||
EditorGUI.indentLevel = a.indent;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea3f7407f69f900468d4b60de570e49d
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledInteractive))]
|
||||
public class StyledInteractiveAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
if (property.boolValue == true)
|
||||
{
|
||||
GUI.enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80229de18cd73624b8181a9db49a304f
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledLayers))]
|
||||
public class StyledLayersAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledLayers a;
|
||||
private int index;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledLayers)attribute;
|
||||
|
||||
index = property.intValue;
|
||||
|
||||
string[] allLayers = new string[32];
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if (LayerMask.LayerToName(i).Length < 1)
|
||||
{
|
||||
allLayers[i] = "Missing";
|
||||
}
|
||||
else
|
||||
{
|
||||
allLayers[i] = LayerMask.LayerToName(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (a.display == "")
|
||||
{
|
||||
a.display = property.displayName;
|
||||
}
|
||||
|
||||
index = EditorGUILayout.Popup(a.display, index, allLayers);
|
||||
|
||||
property.intValue = index;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b351b243374f2d948a9e9943abe174bf
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,77 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledMask))]
|
||||
public class StyledMaskAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledMask a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledMask)attribute;
|
||||
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
if (Resources.Load<TextAsset>(a.file) != null)
|
||||
{
|
||||
var layersPath = AssetDatabase.GetAssetPath(Resources.Load<TextAsset>(a.file));
|
||||
|
||||
StreamReader reader = new StreamReader(layersPath);
|
||||
|
||||
a.options = reader.ReadLine();
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
string[] enumSplit = a.options.Split(char.Parse(" "));
|
||||
List<string> enumOptions = new List<string>(enumSplit.Length / 2);
|
||||
|
||||
for (int i = 0; i < enumSplit.Length; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
enumOptions.Add(enumSplit[i].Replace("_", " "));
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(a.top);
|
||||
|
||||
int index = property.intValue;
|
||||
|
||||
if (a.display == "")
|
||||
{
|
||||
a.display = property.displayName;
|
||||
}
|
||||
|
||||
index = EditorGUILayout.MaskField(a.display, index, enumOptions.ToArray());
|
||||
|
||||
if (Mathf.Abs(index) > 32000)
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
//Debug Value
|
||||
EditorGUILayout.LabelField(index.ToString());
|
||||
|
||||
property.intValue = index;
|
||||
|
||||
GUILayout.Space(a.down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ceb6b7bf0fb6a8449797ccd85dea11c
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledMessage))]
|
||||
public class StyledMessageAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledMessage a;
|
||||
|
||||
bool show;
|
||||
MessageType messageType;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
show = property.boolValue;
|
||||
|
||||
if (show)
|
||||
{
|
||||
a = (StyledMessage)attribute;
|
||||
|
||||
if (a.Type == "None")
|
||||
{
|
||||
messageType = MessageType.None;
|
||||
}
|
||||
else if (a.Type == "Info")
|
||||
{
|
||||
messageType = MessageType.Info;
|
||||
}
|
||||
else if (a.Type == "Warning")
|
||||
{
|
||||
messageType = MessageType.Warning;
|
||||
}
|
||||
else if (a.Type == "Error")
|
||||
{
|
||||
messageType = MessageType.Error;
|
||||
}
|
||||
|
||||
GUILayout.Space(a.Top);
|
||||
EditorGUILayout.HelpBox(a.Message, messageType);
|
||||
GUILayout.Space(a.Down);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2734a300c1fbfb8499fe8a71e9b109e7
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledRangeOptions))]
|
||||
public class StyledRangeOptionsAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledRangeOptions a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledRangeOptions)attribute;
|
||||
|
||||
GUIStyle styleMid = new GUIStyle();
|
||||
styleMid.alignment = TextAnchor.MiddleCenter;
|
||||
styleMid.normal.textColor = Color.gray;
|
||||
styleMid.fontSize = 7;
|
||||
|
||||
if (a.display.Length > 0)
|
||||
{
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
GUILayout.Space(5);
|
||||
}
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(8);
|
||||
property.floatValue = GUILayout.HorizontalSlider(property.floatValue, a.min, a.max);
|
||||
property.floatValue = Mathf.Clamp(property.floatValue, a.min, a.max);
|
||||
property.floatValue = Mathf.Round(property.floatValue * 1000f) / 1000f;
|
||||
GUILayout.Space(8);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
GUILayout.Space(15);
|
||||
#endif
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
int maxWidth = 20;
|
||||
|
||||
#if UNITY_2019_3_OR_NEWER
|
||||
maxWidth = 28;
|
||||
#endif
|
||||
for (int i = 0; i < a.options.Length - 1; i++)
|
||||
{
|
||||
GUILayout.Label(a.options[i], styleMid, GUILayout.Width(maxWidth));
|
||||
GUILayout.Label("", styleMid);
|
||||
}
|
||||
|
||||
GUILayout.Label(a.options[a.options.Length - 1], styleMid, GUILayout.Width(maxWidth));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledRangeOptions)attribute;
|
||||
|
||||
if (a.display.Length > 0)
|
||||
{
|
||||
return 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5681c6e5862ae545ba9b00a5b813250
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledSpace))]
|
||||
public class StyledSpaceAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledSpace a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledSpace)attribute;
|
||||
|
||||
GUILayout.Space(a.space);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db0457065a494f34aa3b619f240d8bda
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,38 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledText))]
|
||||
public class StyledTextAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
StyledText a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledText)attribute;
|
||||
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
styleLabel.alignment = a.alignment;
|
||||
|
||||
GUILayout.Space(a.top);
|
||||
|
||||
GUILayout.Label(property.stringValue, styleLabel);
|
||||
|
||||
GUILayout.Space(a.down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aeec2ac650d2d8f40aa3b9e0cb807db5
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,100 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(StyledTexturePreview))]
|
||||
public class StyledTexturePreviewAttributeDrawer : PropertyDrawer
|
||||
{
|
||||
int channel = 0;
|
||||
ColorWriteMask channelMask = ColorWriteMask.All;
|
||||
|
||||
StyledTexturePreview a;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
a = (StyledTexturePreview)attribute;
|
||||
|
||||
var tex = (Texture)property.objectReferenceValue;
|
||||
|
||||
if (a.displayName != "")
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(a.displayName, GUILayout.Width(EditorGUIUtility.labelWidth - 1));
|
||||
tex = (Texture)EditorGUILayout.ObjectField(tex, typeof(Texture), false);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
property.objectReferenceValue = tex;
|
||||
}
|
||||
|
||||
if (tex == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var styledText = new GUIStyle(EditorStyles.toolbarButton)
|
||||
{
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
fontStyle = FontStyle.Normal,
|
||||
fontSize = 10,
|
||||
};
|
||||
|
||||
var styledPopup = new GUIStyle(EditorStyles.toolbarPopup)
|
||||
{
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
fontSize = 10,
|
||||
};
|
||||
|
||||
var rect = GUILayoutUtility.GetRect(0, 0, Screen.width, 0);
|
||||
|
||||
EditorGUI.DrawPreviewTexture(rect, tex, null, ScaleMode.ScaleAndCrop, 1, 0, channelMask);
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label((UnityEngine.Profiling.Profiler.GetRuntimeMemorySizeLong(tex) / 1024f / 1024f).ToString("F2") + " mb", styledText);
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(tex.width.ToString(), styledText);
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(tex.graphicsFormat.ToString(), styledText);
|
||||
GUILayout.Space(-1);
|
||||
|
||||
channel = EditorGUILayout.Popup(channel, new string[] { "RGB", "R", "G", "B", "A" }, styledPopup, GUILayout.MaxWidth(60));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (channel == 0)
|
||||
{
|
||||
channelMask = ColorWriteMask.All;
|
||||
}
|
||||
else if (channel == 1)
|
||||
{
|
||||
channelMask = ColorWriteMask.Red;
|
||||
}
|
||||
else if (channel == 2)
|
||||
{
|
||||
channelMask = ColorWriteMask.Green;
|
||||
}
|
||||
else if (channel == 3)
|
||||
{
|
||||
channelMask = ColorWriteMask.Blue;
|
||||
}
|
||||
else if (channel == 4)
|
||||
{
|
||||
channelMask = ColorWriteMask.Alpha;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8daad1bc4051084ca6204e12dc0890d
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9620c57a884632041b9c61552e22bde8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using Boxophobic.Constants;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledBannerDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string title;
|
||||
|
||||
public StyledBannerDrawer(string title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor materialEditor)
|
||||
{
|
||||
StyledGUI.DrawInspectorBanner(title);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 864d8c89c5d2ef240b0c51f15c5211e2
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,71 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledButtonDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string text;
|
||||
public string target = "";
|
||||
public float value = 1;
|
||||
public float top;
|
||||
public float down;
|
||||
|
||||
public StyledButtonDrawer(string text)
|
||||
{
|
||||
this.text = text;
|
||||
this.value = 1;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledButtonDrawer(string text, float value, float top, float down)
|
||||
{
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public StyledButtonDrawer(string text, string target, float value, float top, float down)
|
||||
{
|
||||
this.text = text;
|
||||
this.target = target;
|
||||
this.value = value;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
if (GUILayout.Button(text))
|
||||
{
|
||||
if (target == "")
|
||||
{
|
||||
prop.floatValue = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (material.HasProperty(target))
|
||||
{
|
||||
material.SetFloat(target, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b40d7a397aa055b46a1651ee9f9bdd03
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,126 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledCategoryDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public bool isEnabled = true;
|
||||
|
||||
public string category;
|
||||
public float top;
|
||||
public float down;
|
||||
public string colapsable;
|
||||
public string conditions = "";
|
||||
|
||||
public StyledCategoryDrawer(string category)
|
||||
{
|
||||
this.category = category;
|
||||
this.colapsable = "false";
|
||||
this.top = 10;
|
||||
this.down = 10;
|
||||
}
|
||||
|
||||
public StyledCategoryDrawer(string category, string colapsable)
|
||||
{
|
||||
this.category = category;
|
||||
this.colapsable = colapsable;
|
||||
this.top = 10;
|
||||
this.down = 10;
|
||||
}
|
||||
|
||||
public StyledCategoryDrawer(string category, float top, float down)
|
||||
{
|
||||
this.category = category;
|
||||
this.colapsable = "false";
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public StyledCategoryDrawer(string category, string colapsable, float top, float down)
|
||||
{
|
||||
this.category = category;
|
||||
this.colapsable = colapsable;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public StyledCategoryDrawer(string category, string colapsable, string conditions, float top, float down)
|
||||
{
|
||||
this.category = category;
|
||||
this.colapsable = colapsable;
|
||||
this.conditions = conditions;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUI.enabled = true;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
if (conditions == "")
|
||||
{
|
||||
DrawInspector(prop);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
bool showInspector = false;
|
||||
|
||||
string[] split = conditions.Split(char.Parse(" "));
|
||||
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
if (material.HasProperty(split[i]))
|
||||
{
|
||||
showInspector = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (showInspector)
|
||||
{
|
||||
DrawInspector(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
void DrawInspector(MaterialProperty prop)
|
||||
{
|
||||
bool isColapsable = false;
|
||||
|
||||
if (colapsable == "true")
|
||||
{
|
||||
isColapsable = true;
|
||||
}
|
||||
|
||||
//bool isEnabled = true;
|
||||
|
||||
//if (prop.floatValue < 0.5f)
|
||||
//{
|
||||
// isEnabled = false;
|
||||
//}
|
||||
|
||||
isEnabled = StyledGUI.DrawInspectorCategory(category, isEnabled, isColapsable, top, down);
|
||||
|
||||
//if (isEnabled)
|
||||
//{
|
||||
// prop.floatValue = 1;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// prop.floatValue = 0;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b5715cd99e4a2e4c91d69653d31dad9
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,93 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledDiffusionMaterialDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string propName;
|
||||
//GUIStyle styleCenteredHelpBox;
|
||||
|
||||
public StyledDiffusionMaterialDrawer(string propName)
|
||||
{
|
||||
this.propName = propName;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
//SetGUIStyles();
|
||||
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
UnityEngine.Object materialAsset = null;
|
||||
|
||||
GUILayout.Space(5);
|
||||
|
||||
if (material.GetInt(propName) == 0)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Diffusion profile values not set! Due to the current HDRP architecture the diffusion profiles are not directly supported. You will need to create an HDRP Lit material and assign a Diffusion Profile to it, drag this HDRP material to the " + label + " slot to allow the profile values to be copied to the material. The HDRP material will not be saved to the property field! Please refer to the documentation for more information.", MessageType.Warning);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox("Diffusion profile values set! Due to the current HDRP architecture the diffusion profiles are not directly supported. You will need to create an HDRP Lit material and assign a Diffusion Profile to it, drag this HDRP material to the " + label + " slot to allow the profile values to be copied to the material. The HDRP material will not be saved to the property field! Please refer to the documentation for more information.", MessageType.Info);
|
||||
}
|
||||
|
||||
GUILayout.Space(10);
|
||||
|
||||
materialAsset = (Material)EditorGUILayout.ObjectField(label, materialAsset, typeof(Material), false);
|
||||
|
||||
Material materialObject = AssetDatabase.LoadAssetAtPath<Material>(AssetDatabase.GetAssetPath(materialAsset));
|
||||
|
||||
if (materialAsset != null)
|
||||
{
|
||||
if (materialObject.HasProperty("_DiffusionProfileAsset") && materialObject.HasProperty("_DiffusionProfileHash"))
|
||||
{
|
||||
var diffusionProfileAsset = materialObject.GetVector("_DiffusionProfileAsset");
|
||||
var diffusionProfileHash = materialObject.GetFloat("_DiffusionProfileHash");
|
||||
|
||||
if (diffusionProfileAsset.x != 0 && diffusionProfileHash != 0)
|
||||
{
|
||||
material.SetVector(propName + "_asset", diffusionProfileAsset);
|
||||
material.SetFloat(propName, diffusionProfileHash);
|
||||
|
||||
Debug.Log("Diffusion Profile settings copied from " + materialObject.name + "!");
|
||||
|
||||
materialAsset = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
material.SetVector(propName + "_asset", Vector4.zero);
|
||||
material.SetFloat(propName, 0.0f);
|
||||
|
||||
Debug.Log("Diffusion Profile settings set to None because " + materialObject.name + " has no Diffusion Profile asset!");
|
||||
|
||||
materialAsset = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("The Material used to copy the Diffusion Profile does not a valid Diffusion Profile!");
|
||||
}
|
||||
}
|
||||
|
||||
//EditorGUI.HelpBox(new Rect(position.x, position.y + top, position.width, position.height), message, mType);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//void SetGUIStyles()
|
||||
//{
|
||||
// styleCenteredHelpBox = new GUIStyle(GUI.skin.GetStyle("HelpBox"))
|
||||
// {
|
||||
// alignment = TextAnchor.MiddleCenter,
|
||||
// };
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f13faeb510c3cb54ba5d051ecaad26e3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,119 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
public class StyledEmissiveIntensityDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string reference = "";
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledEmissiveIntensityDrawer()
|
||||
{
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledEmissiveIntensityDrawer(string reference)
|
||||
{
|
||||
this.reference = reference;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledEmissiveIntensityDrawer(float top, float down)
|
||||
{
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public StyledEmissiveIntensityDrawer(string reference, float top, float down)
|
||||
{
|
||||
this.reference = reference;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
|
||||
{
|
||||
var stylePopup = new GUIStyle(EditorStyles.popup)
|
||||
{
|
||||
fontSize = 9,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
};
|
||||
|
||||
var internalReference = MaterialEditor.GetMaterialProperty(editor.targets, reference);
|
||||
|
||||
Vector4 propVector = prop.vectorValue;
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(label, GUILayout.Width(EditorGUIUtility.labelWidth - 1));
|
||||
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(3);
|
||||
|
||||
if (propVector.w == 0)
|
||||
{
|
||||
propVector.y = EditorGUILayout.FloatField(propVector.y, GUILayout.Height(17));
|
||||
}
|
||||
else if (propVector.w == 1)
|
||||
{
|
||||
propVector.z = EditorGUILayout.FloatField(propVector.z, GUILayout.Height(17));
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
propVector.w = (float)EditorGUILayout.Popup((int)propVector.w, new string[] { "Nits", "EV100" }, stylePopup, GUILayout.Width(50));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (propVector.w == 0)
|
||||
{
|
||||
propVector.x = propVector.y;
|
||||
}
|
||||
else if (propVector.w == 1)
|
||||
{
|
||||
propVector.x = ConvertEvToLuminance(propVector.z);
|
||||
}
|
||||
|
||||
if (internalReference.displayName != null)
|
||||
{
|
||||
internalReference.floatValue = propVector.x;
|
||||
}
|
||||
|
||||
prop.vectorValue = propVector;
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
//public float ConvertLuminanceToEv(float luminance)
|
||||
//{
|
||||
// return (float)Math.Log((luminance * 100f) / 12.5f, 2);
|
||||
//}
|
||||
|
||||
public float ConvertEvToLuminance(float ev)
|
||||
{
|
||||
return (12.5f / 100.0f) * Mathf.Pow(2f, ev);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1d76466e8080c147b2fa9e3b42e8850
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,92 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledEnumDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string file = "";
|
||||
public string options = "";
|
||||
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledEnumDrawer(string file, string options, float top, float down)
|
||||
{
|
||||
this.file = file;
|
||||
this.options = options;
|
||||
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
if (Resources.Load<TextAsset>(file) != null)
|
||||
{
|
||||
var layersPath = AssetDatabase.GetAssetPath(Resources.Load<TextAsset>(file));
|
||||
|
||||
StreamReader reader = new StreamReader(layersPath);
|
||||
|
||||
options = reader.ReadLine();
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
string[] enumSplit = options.Split(char.Parse(" "));
|
||||
List<string> enumOptions = new List<string>(enumSplit.Length / 2);
|
||||
List<int> enumIndices = new List<int>(enumSplit.Length / 2);
|
||||
|
||||
for (int i = 0; i < enumSplit.Length; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
enumOptions.Add(enumSplit[i].Replace("_", " "));
|
||||
}
|
||||
else
|
||||
{
|
||||
enumIndices.Add(int.Parse(enumSplit[i]));
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
int index = (int)prop.floatValue;
|
||||
int realIndex = enumIndices[0];
|
||||
|
||||
for (int i = 0; i < enumIndices.Count; i++)
|
||||
{
|
||||
if (enumIndices[i] == index)
|
||||
{
|
||||
realIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
realIndex = EditorGUILayout.Popup(prop.displayName, realIndex, enumOptions.ToArray());
|
||||
|
||||
//Debug Value
|
||||
//EditorGUILayout.LabelField(enumIndices[realIndex].ToString());
|
||||
|
||||
prop.floatValue = enumIndices[realIndex];
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5dbd5cf6c68f1d4ebd1369f8795ee3a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledIndentDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float indent;
|
||||
|
||||
public StyledIndentDrawer(float indent)
|
||||
{
|
||||
this.indent = indent;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
//Material material = materialEditor.target as Material;
|
||||
|
||||
EditorGUI.indentLevel = (int)indent;
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae4fb3d8081065c47860724ea515c97c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,33 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledInteractiveDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public StyledInteractiveDrawer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
if (prop.floatValue > 0.5f)
|
||||
{
|
||||
GUI.enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cc33d297d20daa40a9b09fbb8e59502
|
||||
timeCreated: 1544039105
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,74 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledLayersDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledLayersDrawer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public StyledLayersDrawer(float top, float down)
|
||||
{
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
int index = (int)prop.floatValue;
|
||||
|
||||
string[] allLayers = new string[32];
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
if (LayerMask.LayerToName(i).Length < 1)
|
||||
{
|
||||
allLayers[i] = "Missing";
|
||||
}
|
||||
else
|
||||
{
|
||||
allLayers[i] = LayerMask.LayerToName(i);
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
index = EditorGUILayout.MaskField(prop.displayName, index, allLayers);
|
||||
|
||||
//if (index < 0)
|
||||
//{
|
||||
// index = -1;
|
||||
//}
|
||||
|
||||
//Debug Value
|
||||
//EditorGUILayout.LabelField(index.ToString());
|
||||
|
||||
prop.floatValue = index;
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c837d89f6f4cd574595a810c5fcc15f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,83 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledMaskDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string file = "";
|
||||
public string options = "";
|
||||
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledMaskDrawer(string file, string options, float top, float down)
|
||||
{
|
||||
this.file = file;
|
||||
this.options = options;
|
||||
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
if (Resources.Load<TextAsset>(file) != null)
|
||||
{
|
||||
var layersPath = AssetDatabase.GetAssetPath(Resources.Load<TextAsset>(file));
|
||||
|
||||
StreamReader reader = new StreamReader(layersPath);
|
||||
|
||||
options = reader.ReadLine();
|
||||
|
||||
reader.Close();
|
||||
}
|
||||
|
||||
string[] enumSplit = options.Split(char.Parse(" "));
|
||||
List<string> enumOptions = new List<string>(enumSplit.Length / 2);
|
||||
|
||||
for (int i = 0; i < enumSplit.Length; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
enumOptions.Add(enumSplit[i].Replace("_", " "));
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
int index = (int)prop.floatValue;
|
||||
|
||||
index = EditorGUILayout.MaskField(prop.displayName, index, enumOptions.ToArray());
|
||||
|
||||
if (index < 0)
|
||||
{
|
||||
index = -1;
|
||||
}
|
||||
|
||||
//Debug Value
|
||||
//EditorGUILayout.LabelField(index.ToString());
|
||||
|
||||
prop.floatValue = index;
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd2d7ee86763017438ae71ea6a9800f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,102 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledMessageDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string type;
|
||||
public string message;
|
||||
public string keyword;
|
||||
public float value;
|
||||
public float top;
|
||||
public float down;
|
||||
|
||||
MessageType mType;
|
||||
|
||||
public StyledMessageDrawer(string t, string m)
|
||||
{
|
||||
type = t;
|
||||
message = m;
|
||||
keyword = null;
|
||||
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledMessageDrawer(string t, string m, float top, float down)
|
||||
{
|
||||
type = t;
|
||||
message = m;
|
||||
keyword = null;
|
||||
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public StyledMessageDrawer(string t, string m, string k, float v, float top, float down)
|
||||
{
|
||||
type = t;
|
||||
message = m;
|
||||
keyword = k;
|
||||
value = v;
|
||||
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
if (type == "None")
|
||||
{
|
||||
mType = MessageType.None;
|
||||
}
|
||||
else if (type == "Info")
|
||||
{
|
||||
mType = MessageType.Info;
|
||||
}
|
||||
else if (type == "Warning")
|
||||
{
|
||||
mType = MessageType.Warning;
|
||||
}
|
||||
else if (type == "Error")
|
||||
{
|
||||
mType = MessageType.Error;
|
||||
}
|
||||
|
||||
message = message.Replace("__", ",");
|
||||
|
||||
if (keyword != null)
|
||||
{
|
||||
if (material.HasProperty(keyword))
|
||||
{
|
||||
if (material.GetFloat(keyword) == value)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
|
||||
EditorGUILayout.HelpBox(message, mType);
|
||||
|
||||
GUILayout.Space(down);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
EditorGUILayout.HelpBox(message, mType);
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d01ce91280120de49b931b40f9e16f6b
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,184 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
public class StyledOptionsSliderDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string nameMin = "";
|
||||
public string nameMax = "";
|
||||
public string nameVal = "";
|
||||
public float min = 0;
|
||||
public float max = 0;
|
||||
public float val = 0;
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
bool showAdvancedOptions = false;
|
||||
|
||||
public StyledOptionsSliderDrawer(string nameMin, string nameMax, string nameVal, float min, float max, float val)
|
||||
{
|
||||
this.nameMin = nameMin;
|
||||
this.nameMax = nameMax;
|
||||
this.nameVal = nameVal;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.val = val;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledOptionsSliderDrawer(string nameMin, string nameMax, string nameVal, float min, float max, float val, float top, float down)
|
||||
{
|
||||
this.nameMin = nameMin;
|
||||
this.nameMax = nameMax;
|
||||
this.nameVal = nameVal;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.val = val;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
|
||||
{
|
||||
var internalPropMin = MaterialEditor.GetMaterialProperty(editor.targets, nameMin);
|
||||
var internalPropMax = MaterialEditor.GetMaterialProperty(editor.targets, nameMax);
|
||||
var internalPropVal = MaterialEditor.GetMaterialProperty(editor.targets, nameVal);
|
||||
|
||||
if (internalPropMin.displayName != null && internalPropMax.displayName != null && internalPropVal.displayName != null)
|
||||
{
|
||||
var stylePopup = new GUIStyle(EditorStyles.popup)
|
||||
{
|
||||
fontSize = 9,
|
||||
};
|
||||
|
||||
var styleButton = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
var internalValueMin = internalPropMin.floatValue;
|
||||
var internalValueMax = internalPropMax.floatValue;
|
||||
var internalValueVal = internalPropVal.floatValue;
|
||||
Vector4 propVector = prop.vectorValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
if (propVector.w == 2)
|
||||
{
|
||||
propVector.x = min;
|
||||
propVector.y = max;
|
||||
propVector.z = internalValueVal;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (internalValueMin <= internalValueMax)
|
||||
{
|
||||
propVector.w = 0;
|
||||
}
|
||||
else if (internalValueMin > internalValueMax)
|
||||
{
|
||||
propVector.w = 1;
|
||||
}
|
||||
|
||||
if (propVector.w == 0)
|
||||
{
|
||||
propVector.x = internalValueMin;
|
||||
propVector.y = internalValueMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
propVector.x = internalValueMax;
|
||||
propVector.y = internalValueMin;
|
||||
}
|
||||
|
||||
propVector.z = val;
|
||||
}
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button(label, styleButton, GUILayout.Width(EditorGUIUtility.labelWidth), GUILayout.Height(18)))
|
||||
{
|
||||
showAdvancedOptions = !showAdvancedOptions;
|
||||
}
|
||||
|
||||
if (propVector.w == 2)
|
||||
{
|
||||
propVector.z = GUILayout.HorizontalSlider(propVector.z, min, max);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.MinMaxSlider(ref propVector.x, ref propVector.y, min, max);
|
||||
}
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
propVector.w = (float)EditorGUILayout.Popup((int)propVector.w, new string[] { "Remap", "Invert", "Simple"}, stylePopup, GUILayout.Width(50));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (showAdvancedOptions)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(" Remap Min", GUILayout.Width(EditorGUIUtility.labelWidth));
|
||||
propVector.x = EditorGUILayout.Slider(propVector.x, min, max);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(" Remap Max", GUILayout.Width(EditorGUIUtility.labelWidth));
|
||||
propVector.y = EditorGUILayout.Slider(propVector.y, min, max);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(" Simple Value", GUILayout.Width(EditorGUIUtility.labelWidth));
|
||||
propVector.z = EditorGUILayout.Slider(propVector.z, min, max);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
if (propVector.w == 0f)
|
||||
{
|
||||
internalValueMin = propVector.x;
|
||||
internalValueMax = propVector.y;
|
||||
internalValueVal = val;
|
||||
}
|
||||
else if (propVector.w == 1f)
|
||||
{
|
||||
internalValueMin = propVector.y;
|
||||
internalValueMax = propVector.x;
|
||||
internalValueVal = val;
|
||||
}
|
||||
else if (propVector.w == 2f)
|
||||
{
|
||||
internalValueMin = min;
|
||||
internalValueMax = max;
|
||||
internalValueVal = propVector.z;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.vectorValue = propVector;
|
||||
internalPropMin.floatValue = internalValueMin;
|
||||
internalPropMax.floatValue = internalValueMax;
|
||||
internalPropVal.floatValue = internalValueVal;
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4bc1ff93a8a28e42954d7469249a7a0
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,143 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
public class StyledRemapSliderDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string nameMin = "";
|
||||
public string nameMax = "";
|
||||
public float min = 0;
|
||||
public float max = 0;
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
bool showAdvancedOptions = false;
|
||||
|
||||
public StyledRemapSliderDrawer(string nameMin, string nameMax, float min, float max)
|
||||
{
|
||||
this.nameMin = nameMin;
|
||||
this.nameMax = nameMax;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledRemapSliderDrawer(string nameMin, string nameMax, float min, float max, float top, float down)
|
||||
{
|
||||
this.nameMin = nameMin;
|
||||
this.nameMax = nameMax;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor)
|
||||
{
|
||||
var internalPropMin = MaterialEditor.GetMaterialProperty(editor.targets, nameMin);
|
||||
var internalPropMax = MaterialEditor.GetMaterialProperty(editor.targets, nameMax);
|
||||
|
||||
if (internalPropMin.displayName != null && internalPropMax.displayName != null)
|
||||
{
|
||||
var stylePopup = new GUIStyle(EditorStyles.popup)
|
||||
{
|
||||
fontSize = 9,
|
||||
};
|
||||
|
||||
var styleButton = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
var internalValueMin = internalPropMin.floatValue;
|
||||
var internalValueMax = internalPropMax.floatValue;
|
||||
Vector4 propVector = prop.vectorValue;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
if (internalValueMin <= internalValueMax)
|
||||
{
|
||||
propVector.w = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
propVector.w = 1;
|
||||
}
|
||||
|
||||
if (propVector.w == 0)
|
||||
{
|
||||
propVector.x = internalValueMin;
|
||||
propVector.y = internalValueMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
propVector.x = internalValueMax;
|
||||
propVector.y = internalValueMin;
|
||||
}
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button(label, styleButton, GUILayout.Width(EditorGUIUtility.labelWidth), GUILayout.Height(18)))
|
||||
{
|
||||
showAdvancedOptions = !showAdvancedOptions;
|
||||
}
|
||||
|
||||
EditorGUILayout.MinMaxSlider(ref propVector.x, ref propVector.y, min, max);
|
||||
|
||||
GUILayout.Space(2);
|
||||
|
||||
propVector.w = (float)EditorGUILayout.Popup((int)propVector.w, new string[] { "Remap", "Invert" }, stylePopup, GUILayout.Width(50));
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (showAdvancedOptions)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(" Remap Min", GUILayout.Width(EditorGUIUtility.labelWidth));
|
||||
propVector.x = EditorGUILayout.Slider(propVector.x, min, max);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Space(-1);
|
||||
GUILayout.Label(" Remap Max", GUILayout.Width(EditorGUIUtility.labelWidth));
|
||||
propVector.y = EditorGUILayout.Slider(propVector.y, min, max);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
if (propVector.w == 0f)
|
||||
{
|
||||
internalValueMin = propVector.x;
|
||||
internalValueMax = propVector.y;
|
||||
}
|
||||
else if (propVector.w == 1f)
|
||||
{
|
||||
internalValueMin = propVector.y;
|
||||
internalValueMax = propVector.x;
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.vectorValue = propVector;
|
||||
internalPropMin.floatValue = internalValueMin;
|
||||
internalPropMax.floatValue = internalValueMax;
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 364f1df7c922ba84fa6fc52fd3900332
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledSpaceDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float space;
|
||||
public string conditions = "";
|
||||
|
||||
public StyledSpaceDrawer(float space)
|
||||
{
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
public StyledSpaceDrawer(float space, string conditions)
|
||||
{
|
||||
this.space = space;
|
||||
this.conditions = conditions;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor materialEditor)
|
||||
{
|
||||
if (conditions == "")
|
||||
{
|
||||
GUILayout.Space(space);
|
||||
}
|
||||
else
|
||||
{
|
||||
Material material = materialEditor.target as Material;
|
||||
|
||||
bool showInspector = false;
|
||||
|
||||
string[] split = conditions.Split(char.Parse(" "));
|
||||
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
if (material.HasProperty(split[i]))
|
||||
{
|
||||
showInspector = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (showInspector)
|
||||
{
|
||||
GUILayout.Space(space);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1f2f57e67392e5b41af1a4cecc3a6c04
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,97 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledTextDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public string text = "";
|
||||
public string alignment = "Center";
|
||||
public string font = "Normal";
|
||||
public float size = 11;
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledTextDrawer(string text)
|
||||
{
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public StyledTextDrawer(string text, string alignment, string font, float size)
|
||||
{
|
||||
this.text = text;
|
||||
this.alignment = alignment;
|
||||
this.font = font;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public StyledTextDrawer(string text, string alignment, string font, float size, float top, float down)
|
||||
{
|
||||
this.text = text;
|
||||
this.alignment = alignment;
|
||||
this.font = font;
|
||||
this.size = size;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
//Material material = materialEditor.target as Material;
|
||||
|
||||
GUIStyle styleLabel = new GUIStyle(EditorStyles.label)
|
||||
{
|
||||
richText = true,
|
||||
alignment = TextAnchor.MiddleCenter,
|
||||
wordWrap = true
|
||||
};
|
||||
|
||||
GUILayout.Space(top);
|
||||
|
||||
if (alignment == "Center")
|
||||
{
|
||||
styleLabel.alignment = TextAnchor.MiddleCenter;
|
||||
|
||||
}
|
||||
else if (alignment == "Left")
|
||||
{
|
||||
styleLabel.alignment = TextAnchor.MiddleLeft;
|
||||
}
|
||||
else if (alignment == "Right")
|
||||
{
|
||||
styleLabel.alignment = TextAnchor.MiddleRight;
|
||||
}
|
||||
|
||||
if (font == "Normal")
|
||||
{
|
||||
styleLabel.fontStyle = FontStyle.Normal;
|
||||
}
|
||||
else if (font == "Bold")
|
||||
{
|
||||
styleLabel.fontStyle = FontStyle.Bold;
|
||||
}
|
||||
else if (font == "Italic")
|
||||
{
|
||||
styleLabel.fontStyle = FontStyle.Italic;
|
||||
}
|
||||
else if (font == "BoldAndItalic")
|
||||
{
|
||||
styleLabel.fontStyle = FontStyle.BoldAndItalic;
|
||||
}
|
||||
|
||||
styleLabel.fontSize = (int)size;
|
||||
|
||||
GUILayout.Label(text, styleLabel);
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e137daebc2f7e0c4aa0ee5c5b140e8fd
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,70 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledTextureDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float size;
|
||||
public float top;
|
||||
public float down;
|
||||
|
||||
public StyledTextureDrawer()
|
||||
{
|
||||
this.size = 50;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledTextureDrawer(float size)
|
||||
{
|
||||
this.size = size;
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledTextureDrawer(float size, float top, float down)
|
||||
{
|
||||
this.size = size;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
Texture tex = null;
|
||||
|
||||
if (prop.textureDimension == UnityEngine.Rendering.TextureDimension.Tex2D)
|
||||
{
|
||||
tex = (Texture2D)EditorGUILayout.ObjectField(prop.displayName, prop.textureValue, typeof(Texture2D), false, GUILayout.Height(50));
|
||||
}
|
||||
|
||||
if (prop.textureDimension == UnityEngine.Rendering.TextureDimension.Cube)
|
||||
{
|
||||
tex = (Cubemap)EditorGUILayout.ObjectField(prop.displayName, prop.textureValue, typeof(Cubemap), false, GUILayout.Height(50));
|
||||
}
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
prop.textureValue = tex;
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab83955dedb2aed428447d90cf62c81b
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledTextureSingleLineDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float top;
|
||||
public float down;
|
||||
|
||||
public StyledTextureSingleLineDrawer()
|
||||
{
|
||||
this.top = 0;
|
||||
this.down = 0;
|
||||
}
|
||||
|
||||
public StyledTextureSingleLineDrawer(float top, float down)
|
||||
{
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
|
||||
materialEditor.TexturePropertySingleLine(new GUIContent(prop.displayName), prop);
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 561b67406eee81948baf13ee752ae801
|
||||
timeCreated: 1544998323
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,94 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledToggleDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float width = 0;
|
||||
|
||||
public StyledToggleDrawer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public StyledToggleDrawer(float width)
|
||||
{
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
//Material material = materialEditor.target as Material;
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
|
||||
EditorGUI.showMixedValue = prop.hasMixedValue;
|
||||
|
||||
if (width == 0)
|
||||
{
|
||||
bool toggle = false;
|
||||
|
||||
if (prop.floatValue > 0.5f)
|
||||
{
|
||||
toggle = true;
|
||||
}
|
||||
|
||||
toggle = EditorGUILayout.Toggle(label, toggle);
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (toggle)
|
||||
{
|
||||
prop.floatValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
prop.floatValue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
GUILayout.Label(label);
|
||||
|
||||
bool toggle = false;
|
||||
|
||||
if (prop.floatValue > 0.5f)
|
||||
{
|
||||
toggle = true;
|
||||
}
|
||||
|
||||
toggle = GUILayout.Toggle(toggle, "", GUILayout.Width(width));
|
||||
|
||||
EditorGUI.showMixedValue = false;
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
if (toggle)
|
||||
{
|
||||
prop.floatValue = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
prop.floatValue = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5699c954b5c9184199293b4ede31d57
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
public class StyledVectorDrawer : MaterialPropertyDrawer
|
||||
{
|
||||
public float space = 0;
|
||||
public float top = 0;
|
||||
public float down = 0;
|
||||
|
||||
public StyledVectorDrawer(float space)
|
||||
{
|
||||
this.space = space;
|
||||
}
|
||||
|
||||
public StyledVectorDrawer(float space, float top, float down)
|
||||
{
|
||||
this.space = space;
|
||||
this.top = top;
|
||||
this.down = down;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor materialEditor)
|
||||
{
|
||||
GUILayout.Space(top);
|
||||
|
||||
if (EditorGUIUtility.currentViewWidth > 344)
|
||||
{
|
||||
materialEditor.VectorProperty(prop, label);
|
||||
GUILayout.Space(-space);
|
||||
}
|
||||
else
|
||||
{
|
||||
materialEditor.VectorProperty(prop, label);
|
||||
GUILayout.Space(2);
|
||||
}
|
||||
|
||||
GUILayout.Space(down);
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ebb397dcd33e7cb48a6c3c5b9d928c05
|
||||
timeCreated: 1542224092
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c99294b7ab0dbac4db54c06fa0da8905
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
//#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomEditor(typeof(StyledMonoBehaviour), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class StyledMonoBehaviourEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29c1ac24df072a744a4bdc6a209772bf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,20 @@
|
||||
//#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
|
||||
namespace Boxophobic.StyledGUI
|
||||
{
|
||||
[CustomEditor(typeof(StyledScriptableObject), true)]
|
||||
[CanEditMultipleObjects]
|
||||
public class StyledScriptableObjectEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.Update();
|
||||
EditorGUI.BeginChangeCheck();
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a0e1a0aaab33f341b20d7d940fe0a06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Imported Assets/BOXOPHOBIC/Utils/Editor/Version.asset
Normal file
15
Assets/Imported Assets/BOXOPHOBIC/Utils/Editor/Version.asset
Normal file
@@ -0,0 +1,15 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 93308045fbb3c5e42ba5ccb66d848632, type: 3}
|
||||
m_Name: Version
|
||||
m_EditorClassIdentifier:
|
||||
data: 900
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a15c57a0379e088458f4b54715babf2b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Imported Assets/BOXOPHOBIC/Utils/Scripts.meta
Normal file
8
Assets/Imported Assets/BOXOPHOBIC/Utils/Scripts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ec3a38b6858ee54685444ad9afdd646
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "Boxophobic.Utils.Scripts",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 825ad574da7360d4e8aea558f272972e
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af52389680e6ba548bc23bad710c1613
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,13 @@
|
||||
// Cristian Pop - https://boxophobic.com/
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace Boxophobic.Utils
|
||||
{
|
||||
[CreateAssetMenu(fileName = "Data", menuName = "BOXOPHOBIC/Settings Data")]
|
||||
public class SettingsData : ScriptableObject
|
||||
{
|
||||
[Space]
|
||||
public string data = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93308045fbb3c5e42ba5ccb66d848632
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9de356a448be7ac49969a9ee3488af2a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user