private void OnGUI() { EZEditorGUIUtility.WindowTitle(this); typeName = EditorGUILayout.TextField("Type Name", typeName); bindingFlags = (BindingFlags)EditorGUILayout.EnumFlagsField(bindingFlags); if (GUILayout.Button("Get Type Info")) { GetTypeInfo(); } if (type != null) { scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); DrawInfo(ref foldouts[0], "Fields", fieldList); DrawInfo(ref foldouts[2], "Properties", propertyList); DrawInfo(ref foldouts[1], "Methods", methodList); DrawInfo(ref foldouts[3], "Enum Names", enumNameList); EditorGUILayout.EndScrollView(); } else { EditorGUILayout.HelpBox("Not a valid type", MessageType.Info); } }
private void OnGUI() { EZEditorGUIUtility.WindowTitle(this); EditorGUILayout.Space(); EditorGUILayout.LabelField("Format", format); EditorGUILayout.BeginHorizontal(); timeText = EditorGUILayout.DelayedTextField("Date Time", timeText); if (GUILayout.Button("Parse")) { try { time = DateTime.Parse(timeText); } catch (Exception e) { Debug.LogException(e); } } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Now")) { GetCurrentTime(); GUI.FocusControl(null); } EditorGUILayout.Space(); DrawLabel("ToLongDateString", time.ToLongDateString()); DrawLabel("ToShortDateString", time.ToShortDateString()); DrawLabel("ToLongTimeString", time.ToLongTimeString()); DrawLabel("ToShortTimeString", time.ToShortTimeString()); EditorGUILayout.Space(); DrawLabel("Kind", time.Kind.ToString()); DrawLabel("Year", time.Year.ToString()); DrawLabel("Month", time.Month.ToString()); DrawLabel("Day", time.Day.ToString()); DrawLabel("Hour", time.Hour.ToString()); DrawLabel("Minute", time.Minute.ToString()); DrawLabel("Second", time.Second.ToString()); DrawLabel("Millisecond", time.Millisecond.ToString()); EditorGUILayout.Space(); DrawLabel("DayOfWeek", time.DayOfWeek.ToString()); DrawLabel("DayOfYear", time.DayOfYear.ToString()); DrawLabel("TimeOfDay", time.TimeOfDay.ToString()); DrawLabel("Ticks", time.Ticks.ToString()); EditorGUILayout.Space(); DrawLabel("ToBinary", time.ToBinary().ToString()); DrawLabel("ToFileTime", time.ToFileTime().ToString()); DrawLabel("ToFileTimeUtc", time.ToFileTimeUtc().ToString()); DrawLabel("ToLocalTime", time.ToLocalTime().ToString()); DrawLabel("ToOADate", time.ToOADate().ToString()); DrawLabel("ToUniversalTime", time.ToUniversalTime().ToString()); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); if (materials.Length == 0) { EditorGUILayout.HelpBox("No Material Selected", MessageType.Info); return; } if (GUILayout.Button("Optimize Properties")) { for (int i = 0; i < materials.Length; i++) { Material material = materials[i]; SerializedObject serializedObject = new SerializedObject(material); SerializedProperty m_SavedProperties = serializedObject.FindProperty("m_SavedProperties"); SerializedProperty m_TexEnvs = m_SavedProperties.FindPropertyRelative("m_TexEnvs"); SerializedProperty m_Floats = m_SavedProperties.FindPropertyRelative("m_Floats"); SerializedProperty m_Colors = m_SavedProperties.FindPropertyRelative("m_Colors"); EZShaderGUIUtility.OptimizeProperties(material, m_TexEnvs, m_Floats, m_Colors); } } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < materials.Length; i++) { Material material = materials[i]; SerializedObject serializedObject = new SerializedObject(material); GUI.enabled = false; EditorGUILayout.ObjectField(material, typeof(Material), true); GUI.enabled = true; EditorGUI.indentLevel++; EditorGUILayout.LabelField("Keywords", EditorStyles.boldLabel); SerializedProperty m_ShaderKeywords = serializedObject.FindProperty("m_ShaderKeywords"); EZShaderGUIUtility.KeywordsGUI(material, m_ShaderKeywords); SerializedProperty m_SavedProperties = serializedObject.FindProperty("m_SavedProperties"); SerializedProperty m_TexEnvs = m_SavedProperties.FindPropertyRelative("m_TexEnvs"); SerializedProperty m_Floats = m_SavedProperties.FindPropertyRelative("m_Floats"); SerializedProperty m_Colors = m_SavedProperties.FindPropertyRelative("m_Colors"); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Extra Properties", EditorStyles.boldLabel); if (GUILayout.Button("Optimize")) { EZShaderGUIUtility.OptimizeProperties(material, m_TexEnvs, m_Floats, m_Colors); } EditorGUILayout.EndHorizontal(); EZShaderGUIUtility.ExtraPropertiesGUI(material, m_TexEnvs, m_Floats, m_Colors); serializedObject.ApplyModifiedProperties(); EditorGUI.indentLevel--; } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); DrawConfig(); EditorGUILayout.Space(); DrawButton(); EditorGUILayout.Space(); DrawPreview(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); bool wideMode = EditorGUIUtility.wideMode; EditorGUIUtility.wideMode = true; EditorGUI.BeginChangeCheck(); target = EditorGUILayout.ObjectField("Target", target, typeof(Object), true); if (EditorGUI.EndChangeCheck()) { if (target != null) { serializedObject = new SerializedObject(target); } else { serializedObject = null; } } enterChildren = EditorGUILayout.Toggle("Enter Children", enterChildren); showInvisible = EditorGUILayout.Toggle("Show Invisible", showInvisible); EditorGUILayout.Space(); EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel); // change scene will destroy target if (target != null && serializedObject != null) { scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); serializedObject.Update(); SerializedProperty sp = serializedObject.GetIterator(); sp.Next(true); EditorGUIUtility.labelWidth = EditorGUIUtility.currentViewWidth / 2; if (showInvisible) { do { PropertyField(sp); }while (sp.Next(enterChildren)); } else { do { PropertyField(sp); }while (sp.NextVisible(enterChildren)); } EditorGUIUtility.labelWidth = 0; serializedObject.ApplyModifiedProperties(); EditorGUILayout.EndScrollView(); } EditorGUIUtility.wideMode = wideMode; }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); if (GUILayout.Button("Clear")) { keywordInfoDict.Clear(); } EditorGUILayout.Space(); keywordStringFromWarning = EditorGUILayout.TextArea(keywordStringFromWarning, GUILayout.Height(80)); if (GUILayout.Button("Get Keywords")) { GetKeywords(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); bool changed = false; int index = 0; foreach (var pair in keywordInfoDict) { KeywordInfo keywordInfo = pair.Value; EditorGUILayout.BeginHorizontal(); keywordInfo.foldout = EditorGUILayout.Foldout(keywordInfo.foldout, index++.ToString("000 ") + keywordInfo.keyword); EditorGUILayout.LabelField("Count:" + keywordInfo.materials.Count, GUILayout.Width(80)); EditorGUILayout.LabelField("IsGlobal:" + keywordInfo.isGlobal, GUILayout.Width(120)); if (GUILayout.Button("Delete", GUILayout.Width(80))) { foreach (Material mat in keywordInfo.materials) { mat.DisableKeyword(keywordInfo.keyword); EditorUtility.SetDirty(mat); } Shader.DisableKeyword(keywordInfo.keyword); changed = true; } EditorGUILayout.EndHorizontal(); if (keywordInfo.foldout) { EditorGUI.indentLevel++; foreach (Material mat in keywordInfo.materials) { EditorGUILayout.ObjectField(mat, typeof(Material), true); } EditorGUI.indentLevel--; } } if (changed) { GetKeywords(); } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); if (GUILayout.Button("Refresh")) { RefreshGuid(); } EditorGUILayout.PrefixLabel("System Guid"); EditorGUILayout.TextArea(systemGuid.ToString()); EditorGUILayout.PrefixLabel("Unity Guid"); EditorGUILayout.TextArea(unityGuid.ToString()); }
private void OnGUI() { EZEditorGUIUtility.WindowTitle(this); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); rootTransform1 = (Transform)EditorGUILayout.ObjectField("Transform 1", rootTransform1, typeof(Transform), true); if (EditorGUI.EndChangeCheck()) { pathMap1.Clear(); if (rootTransform1 != null) { GetChildPath("", rootTransform1, pathMap1); } } EditorGUI.BeginChangeCheck(); rootTransform2 = (Transform)EditorGUILayout.ObjectField("Transform 2", rootTransform2, typeof(Transform), true); if (EditorGUI.EndChangeCheck()) { pathMap2.Clear(); if (rootTransform2 != null) { GetChildPath("", rootTransform2, pathMap2); } } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Copy TRS")) { rootTransform1.CopyTRSFrom(rootTransform2, true); } EditorGUILayout.Space(); colorNormal = GUI.backgroundColor; scrollPostion = EditorGUILayout.BeginScrollView(scrollPostion); EditorGUILayout.BeginHorizontal(); if (rootTransform1 != null) { EditorGUILayout.BeginVertical(); DrawTransformHierachy(rootTransform1, pathMap1, pathMap2); EditorGUILayout.EndVertical(); } if (rootTransform2 != null) { EditorGUILayout.BeginVertical(); DrawTransformHierachy(rootTransform2, pathMap2, pathMap1); EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < texts.Length; i++) { Text text = texts[i]; EditorGUILayout.BeginHorizontal(); GUI.enabled = false; EditorGUILayout.ObjectField(text.gameObject, typeof(GameObject), true); GUI.enabled = true; text.font = (Font)EditorGUILayout.ObjectField(text.font, typeof(Font), true); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); EditorGUILayout.LabelField("Input", EditorStyles.boldLabel); inputString = EditorGUILayout.TextArea(inputString, GUILayout.MinHeight(height)); EditorGUILayout.LabelField("Regex", EditorStyles.boldLabel); regexString = EditorGUILayout.TextArea(regexString, GUILayout.MinHeight(height)); EditorGUILayout.LabelField("Matches", EditorStyles.boldLabel); try { if (string.IsNullOrEmpty(regexString)) { return; } foreach (Match match in Regex.Matches(inputString, regexString)) { #if UNITY_2018_1_OR_NEWER && NET_4_6 EditorGUILayout.LabelField(string.Format("Match:\tIndex: {0}\tName: {1}\tValue: {2}", match.Index, match.Name, match.Value)); #else EditorGUILayout.LabelField(string.Format("Match:\tIndex: {0}\tValue: {1}", match.Index, match.Value)); #endif EditorGUI.indentLevel++; foreach (Group group in match.Groups) { #if UNITY_2018_1_OR_NEWER && NET_4_6 EditorGUILayout.LabelField(string.Format("Group:\tIndex: {0}\tName: {1}\tValue: {2}", group.Index, group.Name, group.Value)); #else EditorGUILayout.LabelField(string.Format("Group:\tIndex: {0}\tValue: {1}", group.Index, group.Value)); #endif EditorGUI.indentLevel++; foreach (Capture capture in group.Captures) { EditorGUILayout.LabelField(string.Format("Capture:\tIndex: {0}\tValue: {1}", capture.Index, capture.Value)); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } } catch { } }
private void OnGUI() { EZEditorGUIUtility.WindowTitle(this as EditorWindow); EditorGUILayout.LabelField("Factors", EditorStyles.boldLabel); useHDR = EditorGUILayout.Toggle("Use HDR", useHDR); { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Source Color"); EditorGUILayout.LabelField("Destination Color"); EditorGUILayout.EndHorizontal(); } { EditorGUILayout.BeginHorizontal(); srcColor = EditorGUILayout.ColorField(GUIContent.none, srcColor); dstColor = EditorGUILayout.ColorField(GUIContent.none, dstColor); EditorGUILayout.EndHorizontal(); } { EditorGUILayout.BeginHorizontal(); EditorGUILayout.EndHorizontal(); } float width = Mathf.Max(50, EditorGUIUtility.currentViewWidth / 4 - 5); EditorGUILayout.Space(); EditorGUILayout.LabelField("Results", EditorStyles.boldLabel); DrawResultsSingleLine(width, "Add", "Minus", "Multiply", "Divide"); DrawResultsSingleLine(width, "Opacity", "Darken", "Lighten", "Screen"); DrawResultsSingleLine(width, "ColorBurn", "ColorDodge", "LinearBurn", "LinearDodge"); DrawResultsSingleLine(width, "Overlay", "HardLight", "SoftLight", "VividLight"); DrawResultsSingleLine(width, "LinearLight", "PinLight", "HardMix", "Difference"); DrawResultsSingleLine(width, "Exclusion"); DrawResultsSingleLine(width, "HSVBlend_H", "HSVBlend_S", "HSVBlend_V", "HSVBlend_HS"); if (GUI.changed) { CalculateAll(); } }
private void OnGUI() { EZEditorGUIUtility.WindowTitle(this); EditorGUILayout.ObjectField("Target", target, typeof(Object), false); EditorGUILayout.EnumPopup("Prefab Asset Type", prefabAssetType); EditorGUILayout.ObjectField("Original Object", originalObject, typeof(Object), false); correspondingObjectsFoldout = EditorGUILayout.Foldout(correspondingObjectsFoldout, "Corresponding Objects"); if (correspondingObjectsFoldout) { EditorGUI.indentLevel++; for (int i = 0; i < correspondingObjects.Count; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField(i.ToString("00"), correspondingObjects[i], typeof(Object), false); float width = (EditorGUIUtility.currentViewWidth - EditorGUIUtility.labelWidth) / 2; EditorGUILayout.ObjectField(correspondingAssets[i], typeof(Object), false, GUILayout.Width(width)); EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; } }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); EditorGUILayout.ObjectField("Target", target, typeof(Object), true); EditorGUILayout.BeginHorizontal(); if (dependenciesRecursive != EditorGUILayout.Toggle("Show Recursive Dependencies", dependenciesRecursive)) { dependenciesRecursive = !dependenciesRecursive; Refresh(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); if (dependenciesFoldout = EditorGUILayout.Foldout(dependenciesFoldout, "Asset Dependencies")) { EditorGUI.indentLevel++; for (int i = 0; i < dependencies.Count; i++) { if (dependencies[i] == target) { continue; // dependencies contains target itself } EditorGUILayout.ObjectField(dependencies[i], typeof(Object), true); } EditorGUI.indentLevel--; } if (referencesFoldout = EditorGUILayout.Foldout(referencesFoldout, "Scene References")) { EditorGUI.indentLevel++; foreach (Object obj in sceneReferences) { EditorGUILayout.ObjectField(obj, typeof(Object), true); } EditorGUI.indentLevel--; } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); if (materials.Length == 0) { EditorGUILayout.HelpBox("No Material Selected", MessageType.Info); return; } if (GUILayout.Button("Optimize Properties")) { for (int i = 0; i < materials.Length; i++) { EZShaderGUIUtility.OptimizeProperties(materials[i], texEnvs[i], floats[i], colors[i]); serializedMaterials[i].ApplyModifiedProperties(); } } propertyName1 = EditorGUILayout.TextField("Copy From", propertyName1); propertyName2 = EditorGUILayout.TextField("To", propertyName2); GUI.enabled = !(string.IsNullOrEmpty(propertyName1) || string.IsNullOrEmpty(propertyName2) || propertyName1 == propertyName2); if (GUILayout.Button("Copy Property")) { for (int i = 0; i < materials.Length; i++) { Material material = materials[i]; for (int j = 0; j < texEnvs[i].arraySize; j++) { SerializedProperty property1 = texEnvs[i].GetArrayElementAtIndex(j); if (property1.FindPropertyRelative("first").stringValue == propertyName1) { Undo.RecordObject(material, "Copy Material Properties"); SerializedProperty texture = property1.FindPropertyRelative("second.m_Texture"); SerializedProperty scale = property1.FindPropertyRelative("second.m_Scale"); SerializedProperty offset = property1.FindPropertyRelative("second.m_Offset"); material.SetTexture(propertyName2, texture.objectReferenceValue as Texture); material.SetTextureScale(propertyName2, scale.vector2Value); material.SetTextureOffset(propertyName2, offset.vector2Value); serializedMaterials[i].Update(); } } for (int j = 0; j < floats[i].arraySize; j++) { Undo.RecordObject(material, "Copy Material Properties"); SerializedProperty property1 = floats[i].GetArrayElementAtIndex(j); if (property1.FindPropertyRelative("first").stringValue == propertyName1) { SerializedProperty second = property1.FindPropertyRelative("second"); material.SetFloat(propertyName2, second.floatValue); } } for (int j = 0; j < colors[i].arraySize; j++) { Undo.RecordObject(material, "Copy Material Properties"); SerializedProperty property1 = colors[i].GetArrayElementAtIndex(j); if (property1.FindPropertyRelative("first").stringValue == propertyName1) { SerializedProperty second = property1.FindPropertyRelative("second"); material.SetVector(propertyName2, second.colorValue); } } serializedMaterials[i].Update(); } } GUI.enabled = true; scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < materials.Length; i++) { EditorGUI.indentLevel++; serializedMaterials[i].Update(); GUI.enabled = false; EditorGUILayout.ObjectField(materials[i], typeof(Material), true); GUI.enabled = true; EZShaderGUIUtility.PropertiesGUI(materials[i], texEnvs[i], floats[i], colors[i], MaterialPropertyFilter.All); EZShaderGUIUtility.KeywordsGUI(materials[i], shaderKeywords[i]); serializedMaterials[i].ApplyModifiedProperties(); EditorGUI.indentLevel--; } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); Material selection = Selection.activeObject as Material; EditorGUILayout.Space(); if (selection != null) { EditorGUILayout.ObjectField("Selection", selection, typeof(Material), true); EditorGUI.indentLevel++; for (int i = 0; i < selection.shaderKeywords.Length; i++) { string keyword = selection.shaderKeywords[i]; EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(keyword); if (GUILayout.Button("Delete")) { selection.DisableKeyword(keyword); EditorUtility.SetDirty(selection); } EditorGUILayout.EndHorizontal(); } EditorGUI.indentLevel--; EditorGUILayout.Space(); } if (GUILayout.Button("Get All Keywords")) { GetAllMaterials(); GetAllKeywordRenderence(); } scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); bool changed = false; int index = 0; foreach (var pair in keywordReference) { EditorGUILayout.BeginHorizontal(); keywordFoldout[pair.Key] = EditorGUILayout.Foldout(keywordFoldout[pair.Key], index++.ToString("00 ") + pair.Key); if (GUILayout.Button("Delete")) { foreach (Material mat in pair.Value) { mat.DisableKeyword(pair.Key); EditorUtility.SetDirty(mat); } changed = true; } EditorGUILayout.EndHorizontal(); if (keywordFoldout[pair.Key]) { EditorGUI.indentLevel++; foreach (Material mat in pair.Value) { EditorGUILayout.ObjectField(mat, typeof(Material), true); } EditorGUI.indentLevel--; } } if (changed) { GetAllKeywordRenderence(); } EditorGUILayout.EndScrollView(); }
protected void OnGUI() { EZEditorGUIUtility.WindowTitle(this); #if UNITY_EDITOR_WIN && NET_STANDARD_2_0 EditorGUILayout.HelpBox("Api Compatibility Level Not Supported", MessageType.Error); #elif UNITY_EDITOR_WIN if (GUILayout.Button("Refresh")) { Refresh(); } EditorGUILayout.Space(); scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition); for (int i = 0; i < pairList.Count; i++) { EditorGUILayout.BeginHorizontal(); string key = pairList[i].key; ValueType type = pairList[i].type; if (type == ValueType.String) { EditorGUILayout.LabelField("string", new GUILayoutOption[] { GUILayout.Width(40), }); string input = EditorGUILayout.DelayedTextField(key, PlayerPrefs.GetString(key)); if (input != PlayerPrefs.GetString(key)) { PlayerPrefs.SetString(key, input); } } else if (type == ValueType.Int) { EditorGUILayout.LabelField("int", new GUILayoutOption[] { GUILayout.Width(40), }); int input = EditorGUILayout.DelayedIntField(key, PlayerPrefs.GetInt(key)); if (input != PlayerPrefs.GetInt(key)) { PlayerPrefs.SetInt(key, input); } } else if (type == ValueType.Float) { EditorGUILayout.LabelField("float", new GUILayoutOption[] { GUILayout.Width(40), }); float input = EditorGUILayout.DelayedFloatField(key, PlayerPrefs.GetFloat(key)); if (input != PlayerPrefs.GetFloat(key)) { PlayerPrefs.SetFloat(key, input); } } else { EditorGUILayout.TextField(key, "Unknown Type"); } if (GUILayout.Button("Delete", new GUILayoutOption[] { GUILayout.Width(80), })) { PlayerPrefs.DeleteKey(key); Refresh(); } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Delete All")) { PlayerPrefs.DeleteAll(); Refresh(); } EditorGUILayout.EndScrollView(); #else EditorGUILayout.HelpBox("Platform Not Supported", MessageType.Error); #endif }