static AssetDeleteResult OnWillDeleteAsset(string path, RemoveAssetOptions opt)
        {
            if (AssetDatabase.GetMainAssetTypeAtPath(path) == typeof(FontAsset))
                TextResourceManager.RebuildFontAssetCache();

            return AssetDeleteResult.DidNotDelete;
        }
Ejemplo n.º 2
0
        static void ClearFontAssetData(MenuCommand command)
        {
            FontAsset fontAsset = command.context as FontAsset;

            if (fontAsset == null)
            {
                return;
            }

            if (Selection.activeObject != fontAsset)
            {
                Selection.activeObject = fontAsset;
            }

            fontAsset.ClearFontAssetData(true);
            TextResourceManager.RebuildFontAssetCache();

            TextEventManager.ON_FONT_PROPERTY_CHANGED(true, fontAsset);
        }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            string evt_cmd = Event.current.commandName;

            float labelWidth = EditorGUIUtility.labelWidth;
            float fieldWidth = EditorGUIUtility.fieldWidth;

            // TextMeshPro Font Info Panel
            EditorGUI.indentLevel = 0;

            // FONT ASSET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultFontAssetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropFontAsset, Styles.defaultFontAssetLabel);
            EditorGUILayout.PropertyField(m_PropDefaultFontAssetPath, Styles.defaultFontAssetPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // FONT ASSET FALLBACK(s)
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.fallbackFontAssetsLabel, EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            m_FontAssetFallbackList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                TextResourceManager.RebuildFontAssetCache();
            }

            GUILayout.Label(Styles.fallbackMaterialSettingsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropMatchMaterialPreset, Styles.matchMaterialPresetLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // MISSING GLYPHS
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.dynamicFontSystemSettingsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            //EditorGUILayout.PropertyField(m_GetFontFeaturesAtRuntime, Styles.getFontFeaturesAtRuntime);
            EditorGUILayout.PropertyField(m_PropMissingGlyphCharacter, Styles.missingGlyphLabel);
            EditorGUILayout.PropertyField(m_PropClearDynamicDataOnBuild, Styles.clearDynamicDataOnBuildLabel);
            EditorGUILayout.PropertyField(m_PropDisplayWarnings, Styles.disableWarningsLabel);
            //EditorGUILayout.PropertyField(m_DynamicAtlasTextureManager, Styles.dynamicAtlasTextureManager);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // TEXT OBJECT DEFAULT PROPERTIES

            /*
             * EditorGUILayout.BeginVertical(EditorStyles.helpBox);
             * GUILayout.Label(Styles.containerDefaultSettingsLabel, EditorStyles.boldLabel);
             * EditorGUI.indentLevel = 1;
             *
             * EditorGUILayout.PropertyField(m_PropDefaultTextMeshProTextContainerSize, Styles.textMeshProLabel);
             * EditorGUILayout.PropertyField(m_PropDefaultTextMeshProUITextContainerSize, Styles.textMeshProUiLabel);
             * EditorGUILayout.PropertyField(m_PropEnableRaycastTarget, Styles.enableRaycastTarget);
             * EditorGUILayout.PropertyField(m_PropAutoSizeTextContainer, Styles.autoSizeContainerLabel);
             * EditorGUI.indentLevel = 0;
             *
             * EditorGUILayout.Space();
             *
             * GUILayout.Label(Styles.textComponentDefaultSettingsLabel, EditorStyles.boldLabel);
             * EditorGUI.indentLevel = 1;
             * EditorGUILayout.PropertyField(m_PropDefaultFontSize, Styles.defaultFontSize);
             *
             * EditorGUILayout.BeginHorizontal();
             * {
             *  EditorGUILayout.PrefixLabel(Styles.autoSizeRatioLabel);
             *  EditorGUIUtility.labelWidth = 32;
             *  EditorGUIUtility.fieldWidth = 10;
             *
             *  EditorGUI.indentLevel = 0;
             *  EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMinRatio, Styles.minLabel);
             *  EditorGUILayout.PropertyField(m_PropDefaultAutoSizeMaxRatio, Styles.maxLabel);
             *  EditorGUI.indentLevel = 1;
             * }
             * EditorGUILayout.EndHorizontal();
             *
             * EditorGUIUtility.labelWidth = labelWidth;
             * EditorGUIUtility.fieldWidth = fieldWidth;
             *
             * EditorGUILayout.PropertyField(m_PropWordWrapping, Styles.wordWrappingLabel);
             * EditorGUILayout.PropertyField(m_PropKerning, Styles.kerningLabel);
             *
             * EditorGUILayout.PropertyField(m_PropExtraPadding, Styles.extraPaddingLabel);
             * EditorGUILayout.PropertyField(m_PropTintAllSprites, Styles.tintAllSpritesLabel);
             *
             * EditorGUILayout.PropertyField(m_PropParseEscapeCharacters, Styles.parseEscapeCharactersLabel);
             *
             * EditorGUI.indentLevel = 0;
             *
             * EditorGUILayout.Space();
             * EditorGUILayout.EndVertical();
             */

            // SPRITE ASSET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultSpriteAssetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropSpriteAsset, Styles.defaultSpriteAssetLabel);
            EditorGUILayout.PropertyField(m_PropMissingSpriteCharacterUnicode, Styles.missingSpriteCharacterUnicodeLabel);
            //EditorGUILayout.PropertyField(m_PropEnableEmojiSupport, Styles.enableEmojiSupportLabel);
            //EditorGUILayout.PropertyField(m_PropSpriteRelativeScaling, Styles.spriteRelativeScale);
            EditorGUILayout.PropertyField(m_PropSpriteAssetPath, Styles.spriteAssetsPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // SPRITE ASSET FALLBACK(s)
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.fallbackSpriteAssetsLabel, EditorStyles.boldLabel);
            m_SpriteAssetFallbackList.DoLayoutList();

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // STYLE SHEET
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.defaultStyleSheetLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(m_PropStyleSheet, Styles.defaultStyleSheetLabel);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();

                TextStyleSheet styleSheet = m_PropStyleSheet.objectReferenceValue as TextStyleSheet;
                if (styleSheet != null)
                {
                    styleSheet.RefreshStyles();
                }
            }
            EditorGUILayout.PropertyField(m_PropStyleSheetsResourcePath, Styles.styleSheetResourcePathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // COLOR GRADIENT PRESETS
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.colorGradientPresetsLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropColorGradientPresetsPath, Styles.colorGradientsPathLabel);
            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            EditorGUILayout.Space();

            // LINE BREAKING RULE
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            GUILayout.Label(Styles.lineBreakingLabel, EditorStyles.boldLabel);
            EditorGUI.indentLevel = 1;
            EditorGUILayout.PropertyField(m_PropUnicodeLineBreakingRules);
            //EditorGUILayout.Space();
            //GUILayout.Label(Styles.koreanSpecificRules, EditorStyles.boldLabel);
            //EditorGUILayout.PropertyField(m_PropUseModernHangulLineBreakingRules, new GUIContent("Use Modern Line Breaking", "Determines if traditional or modern line breaking rules will be used to control line breaking. Traditional line breaking rules use the Leading and Following Character rules whereas Modern uses spaces for line breaking."));

            EditorGUI.indentLevel = 0;

            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();

            if (serializedObject.ApplyModifiedProperties() || evt_cmd == k_UndoRedo)
            {
                EditorUtility.SetDirty(target);
                TextEventManager.ON_TMP_SETTINGS_CHANGED();
            }
        }