阶段性完成

This commit is contained in:
SoulliesOfficial
2025-12-08 05:27:53 -05:00
parent ef7b479712
commit f7af60351b
8770 changed files with 15637030 additions and 208354 deletions

View File

@@ -0,0 +1,260 @@
using System.Collections.Generic;
using UnityEngine;
namespace FIMSpace.FEditor
{
public static class FGUI_Finders
{
public static Component FoundAnimator;
private static bool checkForAnim = true;
private static int clicks = 0;
/// <summary>
/// Resetting static finders for new searching
/// </summary>
public static void ResetFinders(bool resetClicks = true)
{
checkForAnim = true;
FoundAnimator = null;
if ( resetClicks ) clicks = 0;
}
/// <summary>
/// Searching for animator in given root object and it's parents
/// If you want to search new aniamtor you have to call ResetFinders()
/// </summary>
/// <returns> Returns true if animator is found, enabled and have controller </returns>
public static bool CheckForAnimator(GameObject root, bool needAnimatorBox = true, bool drawInactiveWarning = true, int clicksTohide = 1)
{
bool working = false;
if (checkForAnim)
{
FoundAnimator = SearchForParentWithAnimator(root);
}
// Drawing animator specific dialogs
if (FoundAnimator)
{
Animation legacy = FoundAnimator as Animation;
Animator mec = FoundAnimator as Animator;
if (legacy) if (legacy.enabled) working = true;
if (mec) // Mecanim found but no controller assigned
{
if (mec.enabled) working = true;
if (mec.runtimeAnimatorController == null)
{
#if UNITY_EDITOR
UnityEditor.EditorGUILayout.HelpBox(" No 'Animator Controller' inside Animator ("+FoundAnimator.transform.name+")", UnityEditor.MessageType.Warning);
#endif
drawInactiveWarning = false;
working = false;
}
}
// Drawing dialogs for warnings
if (needAnimatorBox)
{
if (drawInactiveWarning)
{
if (!working)
{
#if UNITY_EDITOR
GUILayout.Space(-4);
FGUI_Inspector.DrawWarning(" ANIMATOR IS DISABLED! ");
GUILayout.Space(2);
#endif
}
}
}
}
else
{
if (needAnimatorBox)
{
if (clicks < clicksTohide)
{
#if UNITY_EDITOR
GUILayout.Space(-4);
if (FGUI_Inspector.DrawWarning(" ANIMATOR NOT FOUND! ")) clicks++;
GUILayout.Space(2);
#endif
}
}
}
checkForAnim = false;
return working;
}
/// <summary>
/// Searching in first children for animation/animator components
/// If not found then searching in parents
/// </summary>
/// <returns> Returns transform with component or null if not found </returns>
public static Component SearchForParentWithAnimator(GameObject root)
{
Animation animation = root.GetComponentInChildren<Animation>();
if (animation) return animation;
Animator animator = root.GetComponentInChildren<Animator>();
if (animator) return animator;
if (root.transform.parent != null)
{
Transform pr = root.transform.parent;
while (pr != null)
{
animation = pr.GetComponent<Animation>();
if (animation) return animation;
animator = pr.GetComponent<Animator>();
if (animator) return animator;
pr = pr.parent;
}
}
return null;
}
/// <summary>
/// Finding skinned mesh renderer with largest count of bones
/// </summary>
public static SkinnedMeshRenderer GetBoneSearchArray(Transform root)
{
List<SkinnedMeshRenderer> skins = new List<SkinnedMeshRenderer>();
SkinnedMeshRenderer largestSkin = null;
foreach (var t in root.GetComponentsInChildren<Transform>())
{
SkinnedMeshRenderer s = t.GetComponent<SkinnedMeshRenderer>(); if (s) skins.Add(s);
}
// Searching in parent
if (skins.Count == 0)
{
Transform lastParent = root;
while (lastParent != null)
{
if (lastParent.parent == null) break;
lastParent = lastParent.parent;
}
foreach (var t in lastParent.GetComponentsInChildren<Transform>())
{
SkinnedMeshRenderer s = t.GetComponent<SkinnedMeshRenderer>(); if (!skins.Contains(s)) if (s) skins.Add(s);
}
}
if (skins.Count > 1)
{
largestSkin = skins[0];
for (int i = 1; i < skins.Count; i++)
if (skins[i].bones.Length > largestSkin.bones.Length)
largestSkin = skins[i];
}
else
if (skins.Count > 0) largestSkin = skins[0];
if (largestSkin == null) return null;
return largestSkin;
}
/// <summary>
/// Checking if transform is child of choosed root bone parent transform
/// </summary>
public static bool IsChildOf(Transform child, Transform rootParent)
{
Transform tParent = child;
while (tParent != null && tParent != rootParent)
{
tParent = tParent.parent;
}
if (tParent == null) return false; else return true;
}
/// <summary>
/// Checking if transform is child of choosed root bone parent transform
/// </summary>
public static Transform GetLastChild(Transform rootParent)
{
Transform tChild = rootParent;
while (tChild.childCount > 0) tChild = tChild.GetChild(0);
return tChild;
}
/// <summary>
/// Returns true if right keyword exists, false if left, null if unknown
/// </summary>
public static bool? IsRightOrLeft(string name, bool includeNotSure = false)
{
string nameLower = name.ToLower();
if (nameLower.Contains("right")) return true;
if (nameLower.Contains("left")) return false;
if (nameLower.StartsWith("r_")) return true;
if (nameLower.StartsWith("l_")) return false;
if (nameLower.EndsWith("_r")) return true;
if (nameLower.EndsWith("_l")) return false;
if (nameLower.StartsWith("r.")) return true;
if (nameLower.StartsWith("l.")) return false;
if (nameLower.EndsWith(".r")) return true;
if (nameLower.EndsWith(".l")) return false;
if ( includeNotSure)
{
if (nameLower.Contains("r_")) return true;
if (nameLower.Contains("l_")) return false;
if (nameLower.Contains("_r")) return true;
if (nameLower.Contains("_l")) return false;
if (nameLower.Contains("r.")) return true;
if (nameLower.Contains("l.")) return false;
if (nameLower.Contains(".r")) return true;
if (nameLower.Contains(".l")) return false;
}
return null;
}
/// <summary>
/// Returns true if child is on the right of root's relation, false if on the left, null if on the middle
/// </summary>
public static bool? IsRightOrLeft(Transform child, Transform itsRoot)
{
Vector3 transformed = itsRoot.InverseTransformPoint(child.position);
if (transformed.x < 0f) return false; else
if (transformed.x > 0f) return true;
return null;
}
public static bool HaveKey(string text, string[] keys)
{
for (int i = 0; i < keys.Length; i++)
if (text.Contains(keys[i])) return true;
return false;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9278cc1cba95fd6448315443084e3531
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,112 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace FIMSpace.FEditor
{
public static class FGUI_Handles
{
public static void DrawArrow( Vector3 position, Quaternion direction, float scale = 1f, float width = 5f, float stripeLength = 1f )
{
Vector3[] points = new Vector3[8];
// Low base dots
points[0] = new Vector3( -0.12f, 0f, 0f );
points[1] = new Vector3( 0.12f, 0f, 0f );
// Pre tip right triangle dot
points[2] = new Vector3( 0.12f, 0f, 0.4f + 1 * stripeLength );
// Tip right side
points[3] = new Vector3( 0.4f, 0f, 0.32f + 1 * stripeLength );
// Tip
points[4] = new Vector3( 0.0f, 0f, 1f + 1 * stripeLength );
// Tip left side
points[5] = new Vector3( -0.4f, 0f, 0.32f + 1 * stripeLength );
// Pre tip left triangle dot
points[6] = new Vector3( -0.12f, 0f, 0.4f + 1 * stripeLength );
points[7] = points[0];
Matrix4x4 rotation = Matrix4x4.TRS( Vector3.zero, direction, Vector3.one * scale );
for( int i = 0; i < points.Length; i++ )
{
points[i] = rotation.MultiplyPoint( points[i] );
points[i] += position;
}
if( width <= 0f )
Handles.DrawPolyLine( points );
else
Handles.DrawAAPolyLine( width, points );
}
public static void DrawBoneHandle( Vector3 from, Vector3 to, Vector3 forward, float fatness = 1f, float width = 1f, float arrowOffset = 1f, float lineWidth = 1f, float fillAlpha = 0f )
{
Vector3 dir = ( to - from );
float ratio = dir.magnitude / 7f; ratio *= fatness;
float baseRatio = ratio * 0.75f * arrowOffset;
ratio *= width;
Quaternion rot = ( dir == Vector3.zero ? rot = Quaternion.identity : rot = Quaternion.LookRotation( dir, forward ) );
dir.Normalize();
Vector3 p = from + dir * baseRatio;
if( lineWidth <= 1f )
{
Handles.DrawLine( from, to );
Handles.DrawLine( to, p + rot * Vector3.right * ratio );
Handles.DrawLine( from, p + rot * Vector3.right * ratio );
Handles.DrawLine( to, p - rot * Vector3.right * ratio );
Handles.DrawLine( from, p - rot * Vector3.right * ratio );
}
else
{
Handles.DrawAAPolyLine( lineWidth, from, to );
Handles.DrawAAPolyLine( lineWidth, to, p + rot * Vector3.right * ratio );
Handles.DrawAAPolyLine( lineWidth, from, p + rot * Vector3.right * ratio );
Handles.DrawAAPolyLine( lineWidth, to, p - rot * Vector3.right * ratio );
Handles.DrawAAPolyLine( lineWidth, from, p - rot * Vector3.right * ratio );
}
if ( fillAlpha > 0f)
{
Color preC = Handles.color;
Handles.color = new Color( preC.r, preC.g, preC.b, fillAlpha * preC.a );
Handles.DrawAAConvexPolygon( from, p + rot * Vector3.right * ratio, to, p - rot * Vector3.right * ratio, from );
Handles.color = preC;
}
}
public static void DrawBoneHandle( Vector3 from, Vector3 to, float fatness = 1f, bool faceCamera = false, float width = 1f, float arrowOffset = 1f, float lineWidth = 1f, float fillAlpha = 0f )
{
Vector3 forw = ( to - from ).normalized;
if( faceCamera )
{
if( SceneView.lastActiveSceneView != null )
if( SceneView.lastActiveSceneView.camera )
forw = ( to - SceneView.lastActiveSceneView.camera.transform.position ).normalized;
}
DrawBoneHandle( from, to, forw, fatness, width, arrowOffset, lineWidth, fillAlpha );
}
public static void DrawRay( Vector3 pos, Vector3 dir )
{
Handles.DrawLine( pos, pos + dir );
}
public static void DrawDottedRay( Vector3 pos, Vector3 dir, float scale = 2f )
{
Handles.DrawDottedLine( pos, pos + dir, scale );
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 54ee1a4f8e7cca54f868e0a31448d515
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,336 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
namespace FIMSpace.FEditor
{
public static class FGUI_Inspector
{
public static readonly RectOffset ZeroOffset = new RectOffset(0, 0, 0, 0);
public static Object LastObjSelected;
public static GameObject LastGameObjectSelected;
public static void HeaderBox(ref bool foldout, string title, bool frame, Texture icon = null, int height = 20, int iconsSize = 19, bool big = false)
{
if (frame) EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyle); else EditorGUILayout.BeginHorizontal();
string f = FGUI_Resources.GetFoldSimbol(foldout);
GUILayout.Label(new GUIContent(" "), GUILayout.Width(1));
if (icon != null) if (GUILayout.Button(new GUIContent(icon), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconsSize), GUILayout.Height(iconsSize) })) { foldout = !foldout; }
if (GUILayout.Button(f + " " + title + " " + f, big ? FGUI_Resources.HeaderStyleBig : FGUI_Resources.HeaderStyle, GUILayout.Height(height))) foldout = !foldout;
if (icon != null) if (GUILayout.Button(new GUIContent(icon), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconsSize), GUILayout.Height(iconsSize) })) { foldout = !foldout; }
GUILayout.Label(new GUIContent(" "), GUILayout.Width(1));
EditorGUILayout.EndHorizontal();
}
public static void HeaderBox(string title, bool frame, Texture icon = null, int height = 20, int iconsSize = 19, bool big = false)
{
if (frame) EditorGUILayout.BeginHorizontal(FGUI_Resources.HeaderBoxStyle); else EditorGUILayout.BeginHorizontal();
GUILayout.Label(new GUIContent(" "), GUILayout.Width(1));
if (icon != null) if (GUILayout.Button(new GUIContent(icon), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconsSize), GUILayout.Height(iconsSize) })) { }
if (GUILayout.Button(title, big ? FGUI_Resources.HeaderStyleBig : FGUI_Resources.HeaderStyle, GUILayout.Height(height))) { }
if (icon != null) if (GUILayout.Button(new GUIContent(icon), EditorStyles.label, new GUILayoutOption[2] { GUILayout.Width(iconsSize), GUILayout.Height(iconsSize) })) { }
GUILayout.Label(new GUIContent(" "), GUILayout.Width(1));
EditorGUILayout.EndHorizontal();
}
/// <summary>
/// GUILayout.EndVertical(); after foldout
/// </summary>
public static void FoldHeaderStart(ref bool foldout, string title, GUIStyle style = null, Texture icon = null, int height = 22)
{
FoldHeaderStart(ref foldout, new GUIContent(title), FGUI_Resources.FoldStyle, style, icon, height);
}
public static void FoldHeaderStart(ref bool foldout, GUIContent title, GUIStyle textStyle, GUIStyle vertStyle, Texture icon = null, int height = 22)
{
if (vertStyle != null) GUILayout.BeginVertical(vertStyle);
if (GUILayout.Button(new GUIContent(" " + FGUI_Resources.GetFoldSimbol(foldout, 10, "►") + " " + title.text, icon, title.tooltip), textStyle, GUILayout.Height(height))) foldout = !foldout;
}
/// <summary>
/// Header for modules switch / fold
/// </summary>
public static void FoldSwitchableHeaderStart(ref bool enable, ref bool foldout, string title, GUIStyle style = null, Texture icon = null, int height = 22, string tooltip = "", bool big = false)
{
if (style != null) GUILayout.BeginVertical(style);
GUILayout.BeginHorizontal();
if (enable)
{
if (GUILayout.Button(new GUIContent(" " + FGUI_Resources.GetFoldSimbol(foldout, 10, "►") + " " + title, icon, tooltip), big ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle, GUILayout.Height(height))) foldout = !foldout;
enable = EditorGUILayout.Toggle(enable, GUILayout.Width(16));
}
else
{
if (GUILayout.Button(new GUIContent(" " + title, icon, tooltip), big ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle, GUILayout.Height(height))) { enable = true; }
enable = EditorGUILayout.Toggle(enable, GUILayout.Width(16));
}
GUILayout.EndHorizontal();
}
public static void FoldSwitchableHeaderStart(ref bool enable, SerializedProperty toggle, ref bool foldout, string title, GUIStyle style = null, Texture icon = null, int height = 22, string tooltip = "", bool big = false)
{
if (style != null) GUILayout.BeginVertical(style);
GUILayout.BeginHorizontal();
if (enable)
{
if (GUILayout.Button(new GUIContent(" " + FGUI_Resources.GetFoldSimbol(foldout, 10, "►") + " " + title, icon, tooltip), big ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle, GUILayout.Height(height))) foldout = !foldout;
EditorGUILayout.PropertyField(toggle, GUIContent.none, GUILayout.Width(16));
}
else
{
if (GUILayout.Button(new GUIContent(" " + title, icon, tooltip), big ? FGUI_Resources.FoldStyleBig : FGUI_Resources.FoldStyle, GUILayout.Height(height))) { enable = true; }
EditorGUILayout.PropertyField(toggle, GUIContent.none, GUILayout.Width(16));
}
GUILayout.EndHorizontal();
}
public static void DrawSwitchButton(ref bool switcher, Texture icon, Texture pressedIcon = null, string tooltip = "", int width = 20, int height = 20, bool reversePress = false)
{
bool pressed = switcher;
if (reversePress) pressed = !pressed;
Color c = GUI.color;
if (pressed) GUI.color = new Color(.7f, .7f, .7f, 1f);
if (pressedIcon != null && ((pressed && !reversePress) || (!pressed && reversePress)))
{
if (GUILayout.Button(new GUIContent(pressedIcon, tooltip), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) })) switcher = !switcher;
}
else
if (GUILayout.Button(new GUIContent(icon, tooltip), FGUI_Resources.ButtonStyle, new GUILayoutOption[2] { GUILayout.Width(width), GUILayout.Height(height) })) switcher = !switcher;
GUI.color = c;
}
public static void DrawSwitchButton(ref bool enable, string tooltip, Texture icon)
{
Color c = GUI.color;
GUI.color = enable ? new Color(0.9f, 0.9f, 0.9f, 1f) : c;
if (GUILayout.Button(new GUIContent(icon, tooltip), EditorStyles.miniButtonRight, new GUILayoutOption[2] { GUILayout.Width(20), GUILayout.Height(16) })) enable = !enable;
GUI.color = c;
}
/// <returns> Returns true if warning was clicked </returns>
public static bool DrawWarning(string title)
{
bool clicked = false;
EditorGUILayout.BeginVertical(Style(new Color(.6f, .6f, .3f, .075f), 0));
if (GUILayout.Button(new GUIContent(title, EditorGUIUtility.IconContent("console.warnicon.sml").image), EditorStyles.boldLabel)) clicked = true;
//EditorGUILayout.LabelField(new GUIContent(title, EditorGUIUtility.IconContent("console.warnicon.sml").image), EditorStyles.boldLabel);
EditorGUILayout.EndVertical();
return clicked;
}
public static void DrawUILineCommon(int padding = 6, int thickness = 1, float width = 0.975f)
{
DrawUILine(0.35f, 0.35f, thickness, padding, width);
}
public static void DrawUILine(Color color, int thickness = 2, int padding = 10, float width = 1f)
{
Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
float w = rect.width; float off = rect.width - rect.width * width;
rect.height = thickness; rect.y += padding / 2; rect.x -= 2; rect.x += off / 2f; rect.width += 2; rect.width *= width;
EditorGUI.DrawRect(rect, color);
}
public static void DrawUILine(float alpha, float brightness = 0.25f, int thickness = 2, int padding = 10, float width = 1f)
{
Rect rect = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness));
float w = rect.width; float off = rect.width - rect.width * width;
rect.height = thickness; rect.y += padding / 2; rect.x -= 2; rect.x += off / 2f; rect.width += 2; rect.width *= width;
EditorGUI.DrawRect(rect, new Color(brightness, brightness, brightness, alpha));
}
public static void VSpace(int space2019, int spacePre2019)
{
#if UNITY_2019_3_OR_NEWER
GUILayout.Space(space2019);
#else
GUILayout.Space(spacePre2019);
#endif
}
private static bool displayedDPIWarning = false;
public static GUIStyle Style(Color bgColor, int off = -1)
{
GUIStyle newStyle = new GUIStyle(GUI.skin.box);
if (off < 0) { if (Screen.dpi != 120) newStyle.border = new RectOffset(off, off, off, off); else if (!displayedDPIWarning) { Debug.Log("<b>[HEY! UNITY DEVELOPER!]</b> It seems you have setted up incorrect DPI settings for unity editor. Check <b>Unity.exe -> Properties -> Compatibility -> Change DPI Settings -> Replace Scaling -> System / System (Upgraded)</b> And restart Unity Editor."); displayedDPIWarning = true; } }
else newStyle.border = new RectOffset(off, off, off, off);
Color[] solidColor = new Color[1] { bgColor };
Texture2D bg = new Texture2D(1, 1);
bg.SetPixels(solidColor); bg.Apply();
newStyle.normal.background = bg;
return newStyle;
}
public static GUIStyle Style(RectOffset padding)
{
GUIStyle newStyle = new GUIStyle();
newStyle.padding = padding;
return newStyle;
}
public static GUIStyle Style(RectOffset padding, RectOffset margin, Color bgColor, Vector4 off, int zeroBorder = 0)
{
GUIStyle newStyle = new GUIStyle(GUI.skin.box);
bool g = false;
if (off.x < 0) { if (Screen.dpi == 120) { if (!displayedDPIWarning) { Debug.Log("<b>[HEY! UNITY DEVELOPER!]</b> It seems you have setted up incorrect DPI settings for unity editor. Check <b>Unity.exe -> Properties -> Compatibility -> Change DPI Settings -> Replace Scaling -> System / System (Upgraded)</b> And restart Unity Editor."); displayedDPIWarning = true; } } else g = true; } else g = true;
if (g) newStyle.border = new RectOffset((int)off.x, (int)off.y, (int)off.z, (int)off.w);
newStyle.margin = margin;
newStyle.padding = padding;
Texture2D bg;
if (zeroBorder < 1)
{
bg = new Texture2D(1, 1);
bg.SetPixels(new Color[1] { bgColor }); bg.Apply();
}
else
{
int s = 16;
bg = new Texture2D(s, s);
bg.filterMode = FilterMode.Point;
Color[] c = new Color[s * s];
for (int x = 0; x < s; x++)
{
for (int y = 0; y < s; y++)
{
if (x < zeroBorder || x >= (s - zeroBorder) || y < zeroBorder || y >= (s - zeroBorder))
c[x + y * s] = Color.clear;
else
c[x + y * s] = bgColor;
}
}
bg.SetPixels(c); bg.Apply();
}
newStyle.normal.background = bg;
return newStyle;
}
public static void BeginHorizontal(GUIStyle style, Color color, bool bgColor = true)
{
Color c = bgColor ? GUI.backgroundColor : GUI.color;
if (bgColor) GUI.backgroundColor = color; else GUI.color = color;
EditorGUILayout.BeginHorizontal(style);
if (bgColor) GUI.backgroundColor = c; else GUI.color = c;
}
public static void BeginVertical(GUIStyle style, Color color, bool bgColor = true)
{
Color c = bgColor ? GUI.backgroundColor : GUI.color;
if (bgColor) GUI.backgroundColor = color; else GUI.color = color;
EditorGUILayout.BeginVertical(style);
if (bgColor) GUI.backgroundColor = c; else GUI.color = c;
}
public static void DrawBackToGameObjectButton()
{
if (LastGameObjectSelected == null) return;
if (GUILayout.Button("<- Go Back To " + LastGameObjectSelected.name, GUILayout.Height(26))) Selection.activeObject = LastGameObjectSelected;
}
public static void DrawBackToObjectButton()
{
if (LastObjSelected == null) return;
if (GUILayout.Button("<- Go Back To " + LastObjSelected.name, GUILayout.Height(26))) Selection.activeObject = LastObjSelected;
}
/// <summary>
/// Reading custom inspector editor drawer for the provided unity monoBehaviour or scriptable object.
/// Can be used for Editor.CreateEditor(this, GetCustomEditorType)
/// </summary>
public static System.Type GetCustomEditorType(UnityEngine.Object uObject)
{
System.Type behaviourType = uObject.GetType();
foreach (var customEditor in System.Attribute.GetCustomAttributes(behaviourType, typeof(CustomEditor), true))
{
var editor = customEditor as CustomEditor;
if (editor != null && editor.GetType().IsAssignableFrom(typeof(Editor)))
{
return editor.GetType();
}
}
return null;
}
/// <summary> Generates Editor for provided unity object </summary>
public static UnityEditor.Editor GetEditorOf(UnityEngine.Object obj)
{
System.Type customEditorType = GetCustomEditorType(obj);
if (customEditorType != null)
return Editor.CreateEditor(obj, customEditorType);
else
return Editor.CreateEditor(obj);
}
public static void DrawObjectProperties(SerializedObject obj, int skipFirstProperties = 0)
{
var props = obj.GetIterator();
props.NextVisible(true);
for (int s = 0; s < skipFirstProperties; s++)
{
if (props.NextVisible(false) == false) return; // No more properties
}
while (props.NextVisible(false))
{
EditorGUILayout.PropertyField(props);
}
}
public static void UnfocusControl()
{
#if UNITY_EDITOR
GUI.FocusControl(null);
#endif
}
public static readonly Color Color_RemoveRed = new Color(1f, 0.6f, 0.6f, 1f);
public static void RedGUIBackground()
{
GUI.backgroundColor = Color_RemoveRed;
}
public static void RestoreGUIBackground()
{
GUI.backgroundColor = Color.white;
}
public static void RestoreGUIColor()
{
GUI.color = Color.white;
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a8ec8a411bbdc9b448c43610751e0379
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 209616
packageName: Ragdoll Animator
packageVersion: 1.2.4
assetPath: Assets/FImpossible Creations/Shared Tools/GUI Helpers/FGUI_Inspector.cs
uploadId: 614850

View File

@@ -0,0 +1,429 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace FIMSpace.FEditor
{
public static class FGUI_Resources
{
/// Background Icons ----------------------------------------------------
public static GUIStyle HeaderBoxStyle { get { if (__headerBoxStyle != null) return __headerBoxStyle; __headerBoxStyle = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FHelpBox"); __headerBoxStyle.normal.background = bg; __headerBoxStyle.border = new RectOffset(6, 6, 6, 6); return __headerBoxStyle; } }
private static GUIStyle __headerBoxStyle = null;
private static GUIStyle GenerateButtonStyle( string bg, string hover, string press, int lr = 3, int ud = 2 )
{
var s = new GUIStyle( EditorStyles.label );
s.fixedHeight = 0;
s.imagePosition = ImagePosition.ImageLeft;
s.alignment = TextAnchor.MiddleCenter;
s.border = new RectOffset( lr, lr, ud, ud );
s.padding = new RectOffset( 1, 1, 3, 3 );
s.margin = new RectOffset( 0, 0, 0, 0 );
s.normal.background = Resources.Load<Texture2D>( bg );
s.hover.background = Resources.Load<Texture2D>( hover );
s.focused.background = s.hover.background;
s.active.background = Resources.Load<Texture2D>( press );
return s;
}
public static GUIStyle BUTTON2Style
{
get
{
if (__bt2s != null) return __bt2s; __bt2s = new GUIStyle(EditorStyles.miniButton);
__bt2s.fixedHeight = 0;
__bt2s.normal.background = Resources.Load<Texture2D>("Fimp/Backgrounds/FBG1");
__bt2s.onNormal.background = __bt2s.normal.background;
__bt2s.active.background = Resources.Load<Texture2D>("Fimp/Backgrounds/FBG1P");
__bt2s.onActive.background = __bt2s.active.background;
__bt2s.hover.background = Resources.Load<Texture2D>("Fimp/Backgrounds/FBG1H");
__bt2s.onHover.background = __bt2s.hover.background;
__bt2s.border = new RectOffset(1, 1, 1, 1);
__bt2s.contentOffset = new Vector2(0, 1);
return __bt2s;
}
}
public static GUIStyle BUTTON2StyleU
{
get
{
if( __bt2su != null ) return __bt2su;
__bt2su = new GUIStyle( BUTTON2Style );
__bt2su.imagePosition = ImagePosition.ImageAbove;
__bt2su.contentOffset = new Vector2(0,2);
return __bt2su;
}
}
public static GUIStyle BUTTON3Style
{
get
{
if (__bt3s != null) return __bt3s; __bt3s = new GUIStyle(EditorStyles.miniButton);
__bt3s.fixedHeight = 0;
__bt3s.normal.background = Resources.Load<Texture2D>("Fimp/Backgrounds/FBG2");
__bt3s.border = new RectOffset(0, 0, 0, 0);
__bt3s.contentOffset = new Vector2(0, 0);
return __bt3s;
}
}
private static GUIStyle __bt2s = null;
private static GUIStyle __bt2su = null;
private static GUIStyle __bt3s = null;
public static GUIStyle HeaderBoxStyleH { get { if (__headerBoxStyleH != null) return __headerBoxStyleH; __headerBoxStyleH = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FHelpBoxH"); __headerBoxStyleH.normal.background = bg; __headerBoxStyleH.border = new RectOffset(6, 6, 6, 6); return __headerBoxStyleH; } }
private static GUIStyle __headerBoxStyleH = null;
public static GUIStyle ViewBoxStyle { get { if (__viewBoxStyle != null) return __viewBoxStyle; __viewBoxStyle = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FViewBox"); __viewBoxStyle.normal.background = bg; __viewBoxStyle.border = new RectOffset(6, 6, 6, 6); __viewBoxStyle.padding = new RectOffset(0, 0, 0, 5); return __viewBoxStyle; } }
private static GUIStyle __viewBoxStyle = null;
public static GUIStyle FrameBoxStyle { get { if (__frameBoxStyle != null) return __frameBoxStyle; __frameBoxStyle = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FFrameBox"); __frameBoxStyle.normal.background = bg; __frameBoxStyle.border = new RectOffset(6, 6, 6, 6); __frameBoxStyle.padding = new RectOffset(1, 1, 1, 1); return __frameBoxStyle; } }
private static GUIStyle __frameBoxStyle = null;
public static GUIStyle BGBoxStyle { get { if (__bgBoxStyle != null) return __bgBoxStyle; __bgBoxStyle = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FBGBox"); __bgBoxStyle.normal.background = bg; __bgBoxStyle.border = new RectOffset(6, 6, 6, 6); __bgBoxStyle.padding = new RectOffset(1, 1, 1, 1); return __bgBoxStyle; } }
private static GUIStyle __bgBoxStyle = null;
public static GUIStyle BGInBoxStyle { get { if (__inBoxStyle != null) return __inBoxStyle; __inBoxStyle = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FInBox"); __inBoxStyle.normal.background = bg; __inBoxStyle.border = new RectOffset(4, 4, 4, 4); __inBoxStyle.padding = new RectOffset(8, 6, 5, 5); __inBoxStyle.margin = new RectOffset(0, 0, 0, 0); return __inBoxStyle; } }
private static GUIStyle __inBoxStyle = null;
public static GUIStyle BGInBoxStyleH { get { if (__inBoxStyleH != null) return __inBoxStyleH; __inBoxStyleH = new GUIStyle(EditorStyles.helpBox); Texture2D bg = Resources.Load<Texture2D>("Fimp/Backgrounds/FInBoxH"); __inBoxStyleH.normal.background = bg; __inBoxStyleH.border = new RectOffset(4, 4, 4, 4); __inBoxStyleH.padding = new RectOffset(8, 6, 5, 5); __inBoxStyleH.margin = new RectOffset(0, 0, 0, 0); return __inBoxStyleH; } }
private static GUIStyle __inBoxStyleH = null;
public static GUIStyle BGInBoxBlankStyle { get { if (__inBoxBlankStyle != null) return __inBoxBlankStyle; __inBoxBlankStyle = new GUIStyle(); __inBoxBlankStyle.padding = BGInBoxStyle.padding; __inBoxBlankStyle.margin = BGInBoxStyle.margin; return __inBoxBlankStyle; } }
private static GUIStyle __inBoxBlankStyle = null;
public static GUIStyle BGInBoxLightStyle { get { if (__inBoxLightStyle != null) return __inBoxLightStyle; __inBoxLightStyle = new GUIStyle(BGInBoxStyle); __inBoxLightStyle.normal.background = Resources.Load<Texture2D>("Fimp/Backgrounds/FInBoxLight"); return __inBoxLightStyle; } }
private static GUIStyle __inBoxLightStyle = null;
public static GUIStyle ButtonStyle
{
get
{
if( __buttStyle != null ) return __buttStyle;
__buttStyle = GenerateButtonStyle( "Fimp/Backgrounds/Fbutton", "Fimp/Backgrounds/FbuttonHover", "Fimp/Backgrounds/FbuttonPress");
return __buttStyle;
}
}
private static GUIStyle __buttStyle = null;
public static GUIStyle ButtonStyleR { get { if( __buttStyler != null ) return __buttStyler; __buttStyler = new GUIStyle( ButtonStyle ); __buttStyler.richText = true; return __buttStyler; } }
private static GUIStyle __buttStyler = null;
/// Text Styles ----------------------------------------------------
#if UNITY_2019_3_OR_NEWER
public static GUIStyle HeaderStyle { get { if (__headerStyle != null) return __headerStyle; __headerStyle = new GUIStyle(EditorStyles.boldLabel); __headerStyle.richText = true; __headerStyle.padding = new RectOffset(0, 0, 0, 0); __headerStyle.margin = __headerStyle.padding; __headerStyle.alignment = TextAnchor.MiddleCenter; __headerStyle.active.textColor = Color.white; return __headerStyle; } }
private static GUIStyle __headerStyle = null;
public static GUIStyle HeaderStyleBig { get { if (__headerStyleBig != null) return __headerStyleBig; __headerStyleBig = new GUIStyle(HeaderStyle); __headerStyleBig.fontSize = 17; __headerStyleBig.fontStyle = FontStyle.Normal; return __headerStyle; } }
private static GUIStyle __headerStyleBig = null;
#else
public static GUIStyle HeaderStyle { get { if (__headerStyle != null) return __headerStyle; __headerStyle = new GUIStyle(EditorStyles.boldLabel); __headerStyle.richText = true; __headerStyle.padding = new RectOffset(0, 0, 1, 0); __headerStyle.margin = __headerStyle.padding; __headerStyle.alignment = TextAnchor.MiddleCenter; __headerStyle.active.textColor = Color.white; return __headerStyle; } }
private static GUIStyle __headerStyle = null;
public static GUIStyle HeaderStyleBig { get { if (__headerStyleBig != null) return __headerStyleBig; __headerStyleBig = new GUIStyle(HeaderStyle); __headerStyleBig.fontSize = 17; return __headerStyle; } }
private static GUIStyle __headerStyleBig = null;
#endif
#if UNITY_2019_3_OR_NEWER
public static GUIStyle FoldStyle { get { if (__foldStyle != null) return __foldStyle; __foldStyle = new GUIStyle(EditorStyles.boldLabel); __foldStyle.richText = true; __foldStyle.padding = new RectOffset(0, 0, 0, 0); __foldStyle.margin = __foldStyle.padding; __foldStyle.alignment = TextAnchor.MiddleLeft; __foldStyle.active.textColor = Color.white; return __foldStyle; } }
private static GUIStyle __foldStyle = null;
public static GUIStyle FoldStyleBig { get { if (__foldStyleBig != null) return __foldStyleBig; __foldStyleBig = new GUIStyle(FoldStyle); __foldStyleBig.fontSize = 16; __foldStyleBig.fontStyle = FontStyle.Normal; return __foldStyleBig; } }
private static GUIStyle __foldStyleBig = null;
#else
public static GUIStyle FoldStyle { get { if (__foldStyle != null) return __foldStyle; __foldStyle = new GUIStyle(EditorStyles.boldLabel); __foldStyle.richText = true; __foldStyle.padding = new RectOffset(0, 0, 1, 0); __foldStyle.margin = __foldStyle.padding; __foldStyle.alignment = TextAnchor.MiddleLeft; __foldStyle.active.textColor = Color.white; return __foldStyle; } }
private static GUIStyle __foldStyle = null;
public static GUIStyle FoldStyleBig { get { if (__foldStyleBig != null) return __foldStyleBig; __foldStyleBig = new GUIStyle(FoldStyle); __foldStyleBig.fontSize = 16; return __foldStyleBig; } }
private static GUIStyle __foldStyleBig = null;
#endif
/// Icons ----------------------------------------------------
public static Texture2D Tex_GearSetup { get { if (__texSetup != null) return __texSetup; __texSetup = Resources.Load<Texture2D>("Fimp/Icons/FGearSetup"); return __texSetup; } }
private static Texture2D __texSetup = null;
public static Texture2D Tex_Optimization { get { if (__texOptim != null) return __texOptim; __texOptim = Resources.Load<Texture2D>("Fimp/Icons/FOptimization"); return __texOptim; } }
private static Texture2D __texOptim = null;
public static Texture2D Tex_Sliders { get { if (__texSld != null) return __texSld; __texSld = Resources.Load<Texture2D>("Fimp/Icons/FSliders"); return __texSld; } }
private static Texture2D __texSld = null;
public static Texture2D Tex_GearMain { get { if (__texMain != null) return __texMain; __texMain = Resources.Load<Texture2D>("Fimp/Icons/FGearMain"); return __texMain; } }
private static Texture2D __texMain = null;
public static Texture2D Tex_Add { get { if (__texAdd != null) return __texAdd; __texAdd = Resources.Load<Texture2D>("Fimp/Icons/FAdd"); return __texAdd; } }
private static Texture2D __texAdd = null;
public static Texture2D Tex_Gear { get { if (__texGear != null) return __texGear; __texGear = Resources.Load<Texture2D>("Fimp/Icons/FGear"); return __texGear; } }
private static Texture2D __texGear = null;
public static Texture2D Tex_Expose { get { if (__texExpose != null) return __texExpose; __texExpose = Resources.Load<Texture2D>("Fimp/Icons/FExpose"); return __texExpose; } }
private static Texture2D __texExpose = null;
public static Texture2D Tex_Knob { get { if (__texKnob != null) return __texKnob; __texKnob = Resources.Load<Texture2D>("Fimp/Icons/FKnob"); return __texKnob; } }
private static Texture2D __texKnob = null;
public static Texture2D Tex_Repair { get { if (__texRepair != null) return __texRepair; __texRepair = Resources.Load<Texture2D>("Fimp/Icons/FRepair"); return __texRepair; } }
private static Texture2D __texRepair = null;
public static Texture2D Tex_Physics { get { if (__texPhysics != null) return __texPhysics; __texPhysics = Resources.Load<Texture2D>("Fimp/Icons/FPhysics"); return __texPhysics; } }
private static Texture2D __texPhysics = null;
public static Texture2D Tex_Tweaks { get { if (__texTweaks != null) return __texTweaks; __texTweaks = Resources.Load<Texture2D>("Fimp/Icons/FTweaks"); return __texTweaks; } }
private static Texture2D __texTweaks = null;
public static Texture2D Tex_Extension { get { if (__texExt != null) return __texExt; __texExt = Resources.Load<Texture2D>("Fimp/Icons/FExtension"); return __texExt; } }
private static Texture2D __texExt = null;
public static Texture2D Tex_Module { get { if (__texModls != null) return __texModls; __texModls = Resources.Load<Texture2D>("Fimp/Icons/FModule"); return __texModls; } }
private static Texture2D __texModls = null;
public static Texture2D Tex_Limits { get { if (__texLimts != null) return __texLimts; __texLimts = Resources.Load<Texture2D>("Fimp/Icons/FLimits"); return __texLimts; } }
private static Texture2D __texLimts = null;
public static Texture2D Tex_ExportIcon { get { if (_texExportIc != null) return _texExportIc; _texExportIc = Resources.Load<Texture2D>("Fimp/Icons/FExport"); return _texExportIc; } }
private static Texture2D _texExportIc = null;
public static Texture2D Tex_Load { get { if (__texLoadIc != null) return __texLoadIc; __texLoadIc = Resources.Load<Texture2D>("Fimp/Icons/FLoad"); return __texLoadIc; } }
private static Texture2D __texLoadIc = null;
/// Misc Icons ----------------------------------------------------
public static Texture2D Tex_ArrowUp { get { if (__texArrUp != null) return __texArrUp; __texArrUp = Resources.Load<Texture2D>("Fimp/Misc Icons/FArrowUp"); return __texArrUp; } }
private static Texture2D __texArrUp = null;
public static Texture2D Tex_ArrowDown { get { if (__texArrD != null) return __texArrD; __texArrD = Resources.Load<Texture2D>("Fimp/Misc Icons/FArrowDown"); return __texArrD; } }
private static Texture2D __texArrD = null;
public static Texture2D Tex_ArrowLeft { get { if (__texArrL != null) return __texArrL; __texArrL = Resources.Load<Texture2D>("Fimp/Misc Icons/FArrowLeft"); return __texArrL; } }
private static Texture2D __texArrL = null;
public static Texture2D Tex_ArrowRight { get { if (__texArrR != null) return __texArrR; __texArrR = Resources.Load<Texture2D>("Fimp/Misc Icons/FArrowRight"); return __texArrR; } }
private static Texture2D __texArrR = null;
public static Texture2D Tex_AB { get { if (__texAB != null) return __texAB; __texAB = Resources.Load<Texture2D>("Fimp/Misc Icons/FABSwitch"); return __texAB; } }
private static Texture2D __texAB = null;
public static Texture2D Tex_FilterBy { get { if (__filtr != null) return __filtr; __filtr = Resources.Load<Texture2D>("Fimp/Misc Icons/FFilter"); return __filtr; } }
private static Texture2D __filtr = null;
public static Texture2D Tex_Gizmos { get { if (__texGizm != null) return __texGizm; __texGizm = Resources.Load<Texture2D>("Fimp/Misc Icons/FGizmos"); return __texGizm; } }
private static Texture2D __texGizm = null;
public static Texture2D Tex_GizmosOff { get { if (__texGizmOff != null) return __texGizmOff; __texGizmOff = Resources.Load<Texture2D>("Fimp/Misc Icons/FGizmosOff"); return __texGizmOff; } }
private static Texture2D __texGizmOff = null;
public static Texture2D Tex_Manual { get { if (__texManual != null) return __texManual; __texManual = Resources.Load<Texture2D>("Fimp/Misc Icons/FManual"); return __texManual; } }
private static Texture2D __texManual = null;
public static Texture2D Tex_Website { get { if (__texWeb != null) return __texWeb; __texWeb = Resources.Load<Texture2D>("Fimp/Misc Icons/FWebsite"); return __texWeb; } }
private static Texture2D __texWeb = null;
public static Texture2D Tex_Tutorials { get { if (__texTutorials != null) return __texTutorials; __texTutorials = Resources.Load<Texture2D>("Fimp/Misc Icons/FTutorials"); return __texTutorials; } }
private static Texture2D __texTutorials = null;
public static Texture2D Tex_Default { get { if (__texDef != null) return __texDef; __texDef = Resources.Load<Texture2D>("Fimp/Misc Icons/FDefault"); return __texDef; } }
private static Texture2D __texDef = null;
public static Texture2D Tex_HierSwitch { get { if (__hierSwitch != null) return __hierSwitch; __hierSwitch = Resources.Load<Texture2D>("Fimp/Misc Icons/FHierarchySwitch"); return __hierSwitch; } }
private static Texture2D __hierSwitch = null;
public static Texture2D Tex_Rectangle { get { if (__texRect != null) return __texRect; __texRect = Resources.Load<Texture2D>("Fimp/Misc Icons/FRect"); return __texRect; } }
private static Texture2D __texRect = null;
public static Texture2D Tex_RightFold { get { if (__texRightFold != null) return __texRightFold; __texRightFold = Resources.Load<Texture2D>("Fimp/Misc Icons/FRightFolded"); return __texRightFold; } }
private static Texture2D __texRightFold = null;
public static Texture2D Tex_LeftFold { get { if (__texLeftFold != null) return __texLeftFold; __texLeftFold = Resources.Load<Texture2D>("Fimp/Misc Icons/FLeftFolded"); return __texLeftFold; } }
private static Texture2D __texLeftFold = null;
public static Texture2D Tex_UpFold { get { if (__texUpFold != null) return __texUpFold; __texUpFold = Resources.Load<Texture2D>("Fimp/Misc Icons/FUpFolded"); return __texUpFold; } }
private static Texture2D __texUpFold = null;
public static Texture2D Tex_DownFold { get { if (__texDownFold != null) return __texDownFold; __texDownFold = Resources.Load<Texture2D>("Fimp/Misc Icons/FUnfolded"); return __texDownFold; } }
private static Texture2D __texDownFold = null;
public static Texture2D Tex_RightFoldGray { get { if (__texRightFoldG != null) return __texRightFoldG; __texRightFoldG = Resources.Load<Texture2D>("Fimp/Misc Icons/FGRightFolded"); return __texRightFoldG; } }
private static Texture2D __texRightFoldG = null;
public static Texture2D Tex_LeftFoldGray { get { if (__texLeftFoldG != null) return __texLeftFoldG; __texLeftFoldG = Resources.Load<Texture2D>("Fimp/Misc Icons/FGLeftFolded"); return __texLeftFoldG; } }
private static Texture2D __texLeftFoldG = null;
public static Texture2D Tex_UpFoldGray { get { if (__texUpFoldG != null) return __texUpFoldG; __texUpFoldG = Resources.Load<Texture2D>("Fimp/Misc Icons/FGUpFolded"); return __texUpFoldG; } }
private static Texture2D __texUpFoldG = null;
public static Texture2D Tex_DownFoldGray { get { if (__texDownFoldG != null) return __texDownFoldG; __texDownFoldG = Resources.Load<Texture2D>("Fimp/Misc Icons/FGUnfolded"); return __texDownFoldG; } }
private static Texture2D __texDownFoldG = null;
public static Texture2D TexWaitIcon { get { if (__texWaitIcon != null) return __texWaitIcon; __texWaitIcon = Resources.Load<Texture2D>("Fimp/Misc Icons/FWait"); return __texWaitIcon; } }
private static Texture2D __texWaitIcon = null;
public static Texture2D Tex_Random { get { if (__texRand != null) return __texRand; __texRand = Resources.Load<Texture2D>("Fimp/Misc Icons/FRandom"); return __texRand; } }
private static Texture2D __texRand = null;
public static Texture2D TexListViewIcon { get { if (__texLstView != null) return __texLstView; __texLstView = Resources.Load<Texture2D>("Fimp/Misc Icons/SPR_ListView"); return __texLstView; } }
private static Texture2D __texLstView = null;
/// GUI Contents
public static GUIContent GUIC_FoldGrayLeft { get { if (__guicFoldGrL != null) return __guicFoldGrL; __guicFoldGrL = new GUIContent(Tex_LeftFoldGray); return __guicFoldGrL; } }
private static GUIContent __guicFoldGrL = null;
public static GUIContent GUIC_FoldGrayRight { get { if (__guicFoldGrR != null) return __guicFoldGrR; __guicFoldGrR = new GUIContent(Tex_RightFoldGray); return __guicFoldGrR; } }
private static GUIContent __guicFoldGrR = null;
public static GUIContent GUIC_FoldGrayDown { get { if (__guicFoldGrD != null) return __guicFoldGrD; __guicFoldGrD = new GUIContent(Tex_DownFoldGray); return __guicFoldGrD; } }
private static GUIContent __guicFoldGrD = null;
public static GUIContent GUIC_FoldGrayUp { get { if (__guicFoldGrU != null) return __guicFoldGrU; __guicFoldGrU = new GUIContent(Tex_UpFoldGray); return __guicFoldGrU; } }
private static GUIContent __guicFoldGrU = null;
public static GUIContent GUIC_Info { get { if (__guicInfo != null) return __guicInfo; __guicInfo = new GUIContent(Tex_Info, "Click to display info dialog."); return __guicInfo; } }
private static GUIContent __guicInfo = null;
public static GUIContent GUIC_More { get { if (__guicMore != null) return __guicMore; __guicMore = new GUIContent(Tex_MoreMenu, "Click to display more options menu"); return __guicMore; } }
private static GUIContent __guicMore = null;
public static GUIContent GUIC_Remove { get { if (__guicRemv != null) return __guicRemv; __guicRemv = new GUIContent(Tex_Remove, "Click to remove element"); return __guicRemv; } }
private static GUIContent __guicRemv = null;
public static GUIContent GUIC_Save { get { if (__guicSave != null) return __guicSave; __guicSave = new GUIContent(Tex_Save, "Click to save file in project files."); return __guicSave; } }
private static GUIContent __guicSave = null;
/// Small Icons ----------------------------------------------------
public static Texture2D Tex_Info { get { if (__texInfo != null) return __texInfo; __texInfo = Resources.Load<Texture2D>("Fimp/Small Icons/Finfo"); return __texInfo; } }
private static Texture2D __texInfo = null;
public static Texture2D Tex_Save { get { if (__texSave != null) return __texSave; __texSave = Resources.Load<Texture2D>("Fimp/Icons/FSave"); return __texSave; } }
private static Texture2D __texSave = null;
public static Texture2D Tex_Warning { get { if (__texWarning != null) return __texWarning; __texWarning = Resources.Load<Texture2D>("Fimp/Small Icons/FWarning"); return __texWarning; } }
private static Texture2D __texWarning = null;
public static Texture2D Tex_Error { get { if (__texError != null) return __texError; __texError = Resources.Load<Texture2D>("Fimp/Small Icons/FError"); return __texError; } }
private static Texture2D __texError = null;
public static Texture2D Tex_Bone { get { if (__texBone != null) return __texBone; __texBone = Resources.Load<Texture2D>("Fimp/Small Icons/FBone"); return __texBone; } }
private static Texture2D __texBone = null;
public static Texture2D TexMotionIcon { get { if (__texMotIcon != null) return __texMotIcon; __texMotIcon = Resources.Load<Texture2D>("Fimp/Small Icons/Motion"); return __texMotIcon; } }
private static Texture2D __texMotIcon = null;
public static Texture2D TexAddIcon { get { if (__texAddIcon != null) return __texAddIcon; __texAddIcon = Resources.Load<Texture2D>("Fimp/Small Icons/Additional"); return __texAddIcon; } }
private static Texture2D __texAddIcon = null;
public static Texture2D TexTargetingIcon { get { if (__texTargIcon != null) return __texTargIcon; __texTargIcon = Resources.Load<Texture2D>("Fimp/Small Icons/Target"); return __texTargIcon; } }
private static Texture2D __texTargIcon = null;
public static Texture2D Tex_Window { get { if (__texWndIcn != null) return __texWndIcn; __texWndIcn = Resources.Load<Texture2D>("Fimp/Small Icons/FWindow"); return __texWndIcn; } }
private static Texture2D __texWndIcn = null;
public static Texture2D TexBehaviourIcon { get { if (__texBehIcon != null) return __texBehIcon; __texBehIcon = Resources.Load<Texture2D>("Fimp/Small Icons/Behaviour"); return __texBehIcon; } }
private static Texture2D __texBehIcon = null;
public static Texture2D TexSmallOptimizeIcon { get { if (__texSmOptimizeIcon != null) return __texSmOptimizeIcon; __texSmOptimizeIcon = Resources.Load<Texture2D>("Fimp/Small Icons/Optimize"); return __texSmOptimizeIcon; } }
private static Texture2D __texSmOptimizeIcon = null;
public static Texture2D Tex_MiniGear { get { if (__texSGear != null) return __texSGear; __texSGear = Resources.Load<Texture2D>("Fimp/Small Icons/MiniGear"); return __texSGear; } }
private static Texture2D __texSGear = null;
public static Texture2D Tex_Debug { get { if (__texDebg != null) return __texDebg; __texDebg = Resources.Load<Texture2D>("Fimp/Small Icons/FDebug"); return __texDebg; } }
private static Texture2D __texDebg = null;
public static Texture2D Tex_Customize { get { if (__texCstm != null) return __texCstm; __texCstm = Resources.Load<Texture2D>("Fimp/Small Icons/FCustomize"); return __texCstm; } }
private static Texture2D __texCstm = null;
public static Texture2D Tex_Refresh { get { if (__texRefresh != null) return __texRefresh; __texRefresh = Resources.Load<Texture2D>("Fimp/Small Icons/FRefresh"); return __texRefresh; } }
private static Texture2D __texRefresh = null;
public static Texture2D Tex_MiniMotion { get { if (__texMiniMotion != null) return __texMiniMotion; __texMiniMotion = Resources.Load<Texture2D>("Fimp/Small Icons/MiniMotion"); return __texMiniMotion; } }
private static Texture2D __texMiniMotion = null;
public static Texture2D Tex_HiddenIcon { get { if (__texHiddenIcon != null) return __texHiddenIcon; __texHiddenIcon = Resources.Load<Texture2D>("Fimp/Small Icons/FHidden"); return __texHiddenIcon; } }
private static Texture2D __texHiddenIcon = null;
public static Texture2D Tex_Collider { get { if (__texColl != null) return __texColl; __texColl = Resources.Load<Texture2D>("Fimp/Small Icons/FCollider"); return __texColl; } }
private static Texture2D __texColl = null;
public static Texture2D Tex_Curve { get { if (__texCurve != null) return __texCurve; __texCurve = Resources.Load<Texture2D>("Fimp/Small Icons/FCurve"); return __texCurve; } }
private static Texture2D __texCurve = null;
public static Texture2D Tex_Remove { get { if (__texRemove != null) return __texRemove; __texRemove = Resources.Load<Texture2D>("Fimp/Small Icons/FRemove"); return __texRemove; } }
private static Texture2D __texRemove = null;
public static Texture2D Tex_Drag { get { if (__texDrag != null) return __texDrag; __texDrag = Resources.Load<Texture2D>("Fimp/Small Icons/FDragAndDrop"); return __texDrag; } }
private static Texture2D __texDrag = null;
public static Texture2D Tex_Rename { get { if (__texRename != null) return __texRename; __texRename = Resources.Load<Texture2D>("Fimp/Small Icons/FRename"); return __texRename; } }
private static Texture2D __texRename = null;
public static Texture2D Tex_Distance { get { if (__texDistanc != null) return __texDistanc; __texDistanc = Resources.Load<Texture2D>("Fimp/Small Icons/FDistance"); return __texDistanc; } }
private static Texture2D __texDistanc = null;
public static Texture2D Tex_Movement { get { if (__texMovement != null) return __texMovement; __texMovement = Resources.Load<Texture2D>("Fimp/Small Icons/FMovement"); return __texMovement; } }
private static Texture2D __texMovement = null;
public static Texture2D Tex_Rotation { get { if (__texRotation != null) return __texRotation; __texRotation = Resources.Load<Texture2D>("Fimp/Small Icons/FRotation"); return __texRotation; } }
private static Texture2D __texRotation = null;
public static Texture2D Tex_Connections { get { if (__texConns != null) return __texConns; __texConns = Resources.Load<Texture2D>("Fimp/Small Icons/Connections"); return __texConns; } }
private static Texture2D __texConns = null;
public static Texture2D Tex_MoreMenu { get { if (__texMoreMnu != null) return __texMoreMnu; __texMoreMnu = Resources.Load<Texture2D>("Fimp/Small Icons/FMore"); return __texMoreMnu; } }
private static Texture2D __texMoreMnu = null;
public static Texture2D Tex_Preview { get { if (__texPrev != null) return __texPrev; __texPrev = Resources.Load<Texture2D>("Fimp/Small Icons/Preview"); return __texPrev; } }
private static Texture2D __texPrev = null;
public static Texture2D Tex_Variables { get { if (__texVars != null) return __texVars; __texVars = Resources.Load<Texture2D>("Fimp/Small Icons/Variables"); return __texVars; } }
private static Texture2D __texVars = null;
public static Texture2D Tex_VariablesArrows { get { if (__texVarsArr != null) return __texVarsArr; __texVarsArr = Resources.Load<Texture2D>("Fimp/Small Icons/Variables2"); return __texVarsArr; } }
private static Texture2D __texVarsArr = null;
public static Texture2D Tex_Prepare { get { if (__texPrep != null) return __texPrep; __texPrep = Resources.Load<Texture2D>("Fimp/Small Icons/FPrepare"); return __texPrep; } }
private static Texture2D __texPrep = null;
public static Texture2D Tex_Anchor { get { if( __texAnchor != null ) return __texAnchor; __texAnchor = Resources.Load<Texture2D>( "Fimp/Small Icons/Anchor" ); return __texAnchor; } }
private static Texture2D __texAnchor = null;
public static Texture2D Tex_FAnimator { get { if( __texFAnimator != null ) return __texFAnimator; __texFAnimator = Resources.Load<Texture2D>( "Fimp/Small Icons/Fanimator" ); return __texFAnimator; } }
private static Texture2D __texFAnimator = null;
public static Texture2D Tex_FCorrect { get { if( __texFCorrect != null ) return __texFCorrect; __texFCorrect = Resources.Load<Texture2D>( "Fimp/Small Icons/FCorrect" ); return __texFCorrect; } }
private static Texture2D __texFCorrect = null;
public static Texture2D Tex_Symmetry { get { if( __texSymm != null ) return __texSymm; __texSymm = Resources.Load<Texture2D>( "Fimp/Small Icons/Symmetry" ); return __texSymm; } }
private static Texture2D __texSymm = null;
// Additional ----------------------------
public static Texture2D Tex_SearchNumeric { get { if (__texSearchNum != null) return __texSearchNum; __texSearchNum = Resources.Load<Texture2D>("Fimp/Additional/SPR_SearchNumeric"); return __texSearchNum; } }
private static Texture2D __texSearchNum = null;
public static Texture2D Tex_SearchDirectory { get { if (__texSearchDir != null) return __texSearchDir; __texSearchDir = Resources.Load<Texture2D>("Fimp/Additional/SPR_SearchDirectory"); return __texSearchDir; } }
private static Texture2D __texSearchDir = null;
static Dictionary<string, Texture2D> _Icons = null;
/// <summary> Loading texture and remembering reference in the dictionary </summary>
public static Texture FindIcon(string path)
{
if (_Icons == null) _Icons = new Dictionary<string, Texture2D>();
Texture2D iconTex = null;
if (_Icons.TryGetValue(path, out iconTex))
{
if (iconTex == null) _Icons.Remove(path);
else return iconTex;
}
if (iconTex == null)
{
iconTex = Resources.Load<Texture2D>(path);
_Icons.Add(path, iconTex);
}
return iconTex;
}
public static GUIStyle GetTextStyle(int size, bool bold, TextAnchor align)
{
GUIStyle s = new GUIStyle(EditorStyles.label);
s.fontSize = size;
if (bold) s.fontStyle = FontStyle.Bold;
s.alignment = align;
return s;
}
public static string GetFoldSimbol(bool foldout = false, int size = 8, string hidden = "▲")
{
// ►
#if UNITY_2019_3_OR_NEWER
if (EditorGUIUtility.isProSkin)
{
if (foldout) return "<size=" + size + "><color=#90909099>▼</color></size>";
else
return "<size=" + size + "><color=#90909099>" + hidden + "</color></size>";
}
else
{
if (foldout) return "<size=" + (size) + "><color=#50505099>▼</color></size>";
else
return "<size=" + (size) + "><color=#50505099>" + hidden + "</color></size>";
}
#else
if (EditorGUIUtility.isProSkin)
{
if (foldout) return "<size=" + (size + 2) + "><color=#80808088>▼</color></size>";
else
return "<size=" + (size + 2) + "><color=#80808088>" + hidden + "</color></size>";
}
else
{
if (foldout) return "<size=" + (size + 2) + "><color=#50505099>▼</color></size>";
else
return "<size=" + (size + 2) + "><color=#50505099>" + hidden + "</color></size>";
}
#endif
}
public static string GetFoldSimbol(bool foldout, bool rightArrow)
{
if (foldout) { return "▼"; } else { if (rightArrow) return "►"; else return "▲"; }
}
public static GUIContent GetFoldSimbolTex(bool foldout, bool rightArrow)
{
if (foldout) { return GUIC_FoldGrayDown; } else { if (rightArrow) return GUIC_FoldGrayRight; else return GUIC_FoldGrayUp; }
}
}
}
#endif

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6f89c942959dde942a72b1fc7327aaf2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 285638
packageName: Ragdoll Animator 2
packageVersion: 1.0.1
assetPath: Assets/FImpossible Creations/Shared Tools/GUI Helpers/FGUI_Resources.cs
uploadId: 673504