public static void SetTextMeshProIntegration() { if (IsDefined(TEXDRAW_TMP)) { if (EditorUtility.DisplayDialog("Removing TEXDRAW_TMP", "This will remove TMP integration for all platform. (Files will be keep). Please Rebuild TEXDraw font data after recompilation.", "Proceed", "Cancel")) { TEXPreference.main.defaultMaterial.shader = Shader.Find("TEXDraw/Default/Full"); EditorPrefs.SetBool("TEXDraw_WillProceedTMP", true); SetDefined(TEXDRAW_TMP, false, true); } } else { var respond = EditorUtility.DisplayDialogComplex("Prequirements", "Do you already have imported TextMeshPro in your project?\n" + "(NOTE: TMP Essentials should already be imported if you have installed TMP via Package Manager)", "Yes", "Visit Asset Store", "Cancel"); if (respond == 1) { Help.BrowseURL("https://www.assetstore.unity3d.com/en/#!/content/84126"); } if (respond != 0) { return; } respond = EditorUtility.DisplayDialogComplex("Add TEXDRAW_TMP integration for all platform", "This process will take a moment.\n" + "For your safety, we can automate the whole process. What do you prefer?\n", "Automatic (Recommended)", "Manual", "Abort"); if (respond == 2) { return; } if (respond == 1) { if (EditorUtility.DisplayDialog("TEXDRAW_TMP manual integration", "Manual integration can be done in four steps:\n" + "1. Add TEXDRAW_TMP script definition to all platform (see PlayerSettings)\n" + "2. Importing additional shader pack (see GuideAndExtras) to this project\n" + "3. Render fonts into SDF assets (see TEXPreference)\n" + "4. Change TEXDraw materials to TEXDRAW-TMP shader each\n" + "We can do the first step by clicking OK. See the manual for more detail.", "OK", "Close")) { SetDefined(TEXDRAW_TMP, true, true); } return; } TEXPreference.Initialize(); AssetDatabase.importPackageCompleted += delegate(string name) { EditorPrefs.SetBool("TEXDraw_WillProceedTMP", true); SetDefined(TEXDRAW_TMP, true, true); Debug.Log("Wait a minute. Importing process will began shortly. Look at TEXPreference for the progress."); TEXPreference.main.defaultMaterial.shader = Shader.Find("TEXDraw/TextMeshPro/Distance Field"); }; AssetDatabase.ImportPackage(TEXPreference.main.MainFolderPath + "/GuideAndExtras/TEXDraw-TMP Shader Extensions.unitypackage", false); } }
public static bool ValidateTemplateExist() { TEXPreference.Initialize(); var files = AssetDatabase.FindAssets("Template-", new string[] { TEXPreference.main.MainFolderPath }); return(files.Length > 0); }
public static void SetDefaultTemplate() { TEXPreference.Initialize(); var obj = Selection.activeGameObject; var tex = GetTexDraw(obj); var name = (tex.GetType().Name); var respond = EditorUtility.DisplayDialogComplex("Confirm set as Template", string.Format("Do you want to set selected {0} as a template every time you create a new {0} object?" + "\n(This includes its components and values expect the text itself)\n(This template will only affect project-wide environment)", name) , "Yes", "Yes, but keep the text", "Cancel"); if (respond == 2) { return; } var path = TEXPreference.main.MainFolderPath + "/Template-" + name + ".prefab"; obj = GameObject.Instantiate(obj); if (respond == 0) { GetTexDraw(obj).text = "TEXDraw"; } PrefabUtility.CreatePrefab(path, obj, ReplacePrefabOptions.Default); GameObject.DestroyImmediate(obj, false); }
void OnEnable() { TEXPreference.Initialize(); Undo.undoRedoPerformed += RecordRedrawCallback; matProp = serializedObject.FindProperty("watchedMaterial"); configEditor = CreateEditor(TEXConfiguration.main); if (willFocusOnImport) { FocusOnImporter(); willFocusOnImport = false; } }
protected override void OnEnable() { if (!preference) { TEXPreference.Initialize(); } FixCanvas(canvas); base.OnEnable(); m_TextDirty = true; UpdateSupplements(); Font.textureRebuilt += TextureRebuilted; }
static void CreateCustomGameObject(MenuCommand menuCommand) { TEXPreference.Initialize(); // Create a custom game object GameObject go = new GameObject("TEXDraw 3D"); go.AddComponent <TEXDraw3D>(); // Ensure it gets reparented if this was a context click (otherwise does nothing) GameObjectUtility.SetParentAndAlign(go, menuCommand.context as GameObject); // Register the creation in the undo system Undo.RegisterCreatedObjectUndo(go, "Create " + go.name); Selection.activeObject = go; }
void OnEnable() { if (!preference) { TEXPreference.Initialize(); } Font.textureRebuilt += OnFontRebuild; if (!mesh) { mesh = new Mesh(); mesh.name = assetID; } Redraw(); Repaint(); }
public static void ClearDefaultTemplates() { TEXPreference.Initialize(); if (!EditorUtility.DisplayDialog("Confirm clear Template", "This action will clear every TEXDraw template you made in this project.\n(You actually can do this manually via the root of TEXDraw folder)\n(Can't be undone)", "OK", "Cancel")) { return; } var files = AssetDatabase.FindAssets("Template-", new string[] { TEXPreference.main.MainFolderPath }); foreach (var guid in files) { AssetDatabase.DeleteAsset(AssetDatabase.GUIDToAssetPath(guid)); } }
static void CreateTEXDraw(MenuCommand menuCommand) { TEXPreference.Initialize(); var prefab = AssetDatabase.LoadAssetAtPath <GameObject>(TEXPreference.main.MainFolderPath + "/Template-TEXDraw.prefab"); GameObject go; if (!prefab) { go = new GameObject("TEXDraw"); go.AddComponent <TEXDraw>(); } else { go = GameObject.Instantiate(prefab); go.name = "TEXDraw"; } PlaceUIElementRoot(go, menuCommand); }
// ----------------------------------------------------------------------------------------------------- static TEXEditorMenus() { TEXSupplementEditor.isHelpShown = EditorPrefs.GetBool("TEXDraw_ShowTipOnSupplement", true); if (EditorPrefs.GetBool("TEXDraw_WillProceedTMP", false)) { EditorApplication.delayCall += delegate() { TEXPreferenceEditor.willFocusOnImport = true; TEXPreference.Initialize(); Selection.activeObject = TEXPreference.main; #if TEXDRAW_TMP TexTMPImporter.onRenderingBatch = 2; TexTMPImporter.DoBatchRendering(); #endif EditorPrefs.DeleteKey("TEXDraw_WillProceedTMP"); }; } }
public static void SelectDefaultMaterial() { TEXPreference.Initialize(); Selection.activeObject = TEXPreference.main.defaultMaterial; }
public static void RepaintTEXDraws() { TEXPreference.Initialize(); TEXPreference.main.CallRedraw(); }
public static void ImportMaterial() { TEXPreference.Initialize(); TEXPreference.main.RebuildMaterial(); }
public static void ImportPreference() { TEXPreference.Initialize(); TEXPreference.main.Reload(); }
public static void OpenPreference() { TEXPreference.Initialize(); Selection.activeObject = TEXPreference.main; }