/// <summary> /// 打包日志 - 错误. /// </summary> /// <param name="iEditor">当前编辑器</param> /// <param name="iFormat">格式.</param> /// <param name="iArgs">参数.</param> public static void BuildErrorLog(this UnityEditor.Editor iEditor, string iFormat, params object[] iArgs) { var className = iEditor.GetType().Name; var log = string.Format(iFormat, iArgs); Loger.BuildErrorLog($"{className} {log}"); }
public static void Raise_Editor_finishedDefaultHeaderGUI(UnityEditor.Editor editor) { if (Editor_finishedDefaultHeaderGUI != null) { Editor_finishedDefaultHeaderGUI(editor); } }
/// <summary> /// 日志输出(警告日志) /// </summary> /// <param name="iEditor">当前编辑器</param> /// <param name="iFormat">日志格式</param> /// <param name="iArgs"></param> public static void Warning(this UnityEditor.Editor iEditor, string iFormat, params object[] iArgs) { var className = iEditor.GetType().Name; var log = string.Format(iFormat, iArgs); Loger.Warning($"[{className}] {log}"); }
public Rect GetRect(UnityEditor.Editor editor, int id, Rect current) { if (Event.current.type != EventType.Repaint) { return(current); } bool changed; return(GetRect(editor, id, current, out changed)); }
/************************************************************************************************************************/ /// <inheritdoc/> public override void OnEnable(int index) { base.OnEnable(index); var settings = AnimancerSettings.Instance; if (settings != null) { _SettingsEditor = UnityEditor.Editor.CreateEditor(settings); } }
public UnityEditor.Editor GetEditor(T item) { if (item != this.item) { Dispose(); editor = UnityEditor.Editor.CreateEditor(item); this.item = item; } return(editor); }
public static void VariableNameEditor(this UnityEditor.Editor editor, VariableDeclarationModel variableDeclaration) { var newName = EditorGUILayout.DelayedTextField("Name", variableDeclaration.Title); if (newName == variableDeclaration.Title) { return; } variableDeclaration.SetNameFromUserName(newName); }
/// <summary> /// To be called in the OnDisable of CustomInspectors. /// </summary> /// <param name="defaultEditor">The defaultEditor created in the OnEnable method.</param> public static void DestroyDefaultEditor(UnityEditor.Editor defaultEditor) { // When OnDisable is called, the default editor we created should be destroyed to avoid memory leakage. // Also, make sure to call any required methods like OnDisable MethodInfo disableMethod = defaultEditor.GetType().GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); if (disableMethod != null) { disableMethod.Invoke(defaultEditor, null); } Object.DestroyImmediate(defaultEditor); }
public override void OnFooterGUI(FuzzyOptionNode node, Rect position) { if (editorTarget != value) { editorTarget = value; UEditor.CreateCachedEditor(editorTarget, null, ref editor); } if (editor != null) { editor.DrawPreview(position); } }
private Rect GetRect(UnityEditor.Editor editor, int id, Rect current, out bool changed) { if (!animIDs.ContainsKey(id)) { animIDs.Add(id, current); changed = false; return(current); } var animId = animIDs[id]; if (animId != current) { const float t = 0.1f; if (Mathf.Abs(animId.y - current.y) > 0.5) { current.y = Mathf.Lerp(animId.y, current.y, t); } if (Mathf.Abs(animId.height - current.height) > 0.5) { current.height = Mathf.Lerp(animId.height, current.height, t); } if (Mathf.Abs(animId.x - current.x) > 0.5) { current.x = Mathf.Lerp(animId.x, current.x, t); } if (Mathf.Abs(animId.width - current.width) > 0.5) { current.width = Mathf.Lerp(animId.width, current.width, t); } animIDs[id] = current; changed = true; editor.Repaint(); } else { changed = false; } return(current); }
static AssetList GetInspectorAssets(UnityEditor.Editor inspector) { AssetList result = new AssetList(); if (inspector == null) { return(result); } foreach (UnityEngine.Object obj in inspector.targets) { string assetPath = AssetsPath.GetFullPath(obj); if (string.IsNullOrEmpty(assetPath)) { continue; } result.Add(new Asset(assetPath)); } return(result); }
// IsPreset is an internal API - lets reuse the usable part of this function // 93 is a "magic number" and does not represent a combination of other flags here internal static bool IsPresetEditor(UnityEditor.Editor editor) { return((int)((editor.target as Component).gameObject.hideFlags) == 93); }
internal ListsEditor(UnityEditor.Editor editor, bool showList = false) { MainEditor = editor; ShowList = showList; }
public static void NameEditor(this UnityEditor.Editor editor, ScriptableObject obj) { obj.name = EditorGUILayout.DelayedTextField("Name", obj.name); }
public override void OnDeactivate() { m_CachedEditor = null; m_SettingsWrapper = null; }
internal void SetActiveInspector(UnityEditor.Editor inspector) { mActiveInspector = inspector; }
protected override void CustomOnGUI() { UnityEditor.Editor editor = null; UnityEditor.Editor.CreateCachedEditor(target, null, ref editor); editor.DrawDefaultInspector(); }
/// <summary> /// 打包日志(结束Scope). /// </summary> /// <param name="iEditor">当前编辑器</param> public static void BuildEnd(this UnityEditor.Editor iEditor) { Loger.BuildEnd(); }
/** * CreateCachedEditor didn't exist until 5.0, so recreate it's contents if necessary or pass it on. */ internal static void CreateCachedEditor <T>(UnityEngine.Object[] targetObjects, ref UnityEditor.Editor previousEditor) where T : UnityEditor.Editor { #if UNITY_4_7 if (previousEditor != null && pbUtil.IsEqual(previousEditor.targets, targetObjects)) { return; } if (previousEditor != null) { UnityEngine.Object.DestroyImmediate(previousEditor); } previousEditor = Editor.CreateEditor(targetObjects, typeof(T)); #else UnityEditor.Editor.CreateCachedEditor(targetObjects, typeof(T), ref previousEditor); #endif }
public void OnEnable(UnityEditor.Editor value) { editor = value; }