Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 24 additions & 17 deletions Assets/RTLTMPro/Scripts/Editor/RTLTextMeshPro3DEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,29 @@ public override void OnInspectorGUI()

base.OnInspectorGUI();

foldout = EditorGUILayout.Foldout(foldout, "RTL Settings", TMP_UIStyleManager.boldFoldout);
DrawRtlSettings();

if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
}

private void DrawRtlSettings()
{
Rect rect = EditorGUILayout.GetControlRect(false, 24);

if (GUI.Button(rect, new GUIContent("<b>RTL Settings</b>"), TMP_UIStyleManager.sectionHeader))
foldout = !foldout;

GUI.Label(rect, (foldout ? k_UiStateLabel[0] : k_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
if (foldout)
{
DrawOptions();

if (GUILayout.Button("Re-Fix"))
m_HavePropertiesChanged = true;

if (EditorGUI.EndChangeCheck())
m_HavePropertiesChanged = true;
}

if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
}

protected void OnChanged()
Expand All @@ -74,16 +81,16 @@ protected void OnChanged()

protected virtual void DrawOptions()
{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
farsiProp.boolValue = GUILayout.Toggle(farsiProp.boolValue, new GUIContent("Farsi"));
forceFixProp.boolValue = GUILayout.Toggle(forceFixProp.boolValue, new GUIContent("Force Fix"));
preserveNumbersProp.boolValue = GUILayout.Toggle(preserveNumbersProp.boolValue, new GUIContent("Preserve Numbers"));


EditorGUILayout.PropertyField(farsiProp, new GUIContent("Farsi"));
EditorGUILayout.PropertyField(forceFixProp, new GUIContent("Force Fix"));
EditorGUILayout.PropertyField(preserveNumbersProp, new GUIContent("Preserve Numbers"));
if (tmpro.richText)
fixTagsProp.boolValue = GUILayout.Toggle(fixTagsProp.boolValue, new GUIContent("FixTags"));

EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(fixTagsProp, new GUIContent("Fix Tags"));

if (EditorGUI.EndChangeCheck())
m_HavePropertiesChanged = true;
}

protected virtual void ListenForZeroWidthNoJoiner()
Expand Down
41 changes: 24 additions & 17 deletions Assets/RTLTMPro/Scripts/Editor/RTLTextMeshProEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,29 @@ public override void OnInspectorGUI()

base.OnInspectorGUI();

foldout = EditorGUILayout.Foldout(foldout, "RTL Settings", TMP_UIStyleManager.boldFoldout);
DrawRtlSettings();

if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
}

private void DrawRtlSettings()
{
Rect rect = EditorGUILayout.GetControlRect(false, 24);

if (GUI.Button(rect, new GUIContent("<b>RTL Settings</b>"), TMP_UIStyleManager.sectionHeader))
foldout = !foldout;

GUI.Label(rect, (foldout ? k_UiStateLabel[0] : k_UiStateLabel[1]), TMP_UIStyleManager.rightLabel);
if (foldout)
{
DrawOptions();

if (GUILayout.Button("Re-Fix"))
m_HavePropertiesChanged = true;

if (EditorGUI.EndChangeCheck())
m_HavePropertiesChanged = true;
}

if (m_HavePropertiesChanged)
OnChanged();

serializedObject.ApplyModifiedProperties();
}

protected void OnChanged()
Expand All @@ -80,16 +87,16 @@ protected void OnChanged()

protected virtual void DrawOptions()
{
EditorGUILayout.BeginHorizontal();
EditorGUI.BeginChangeCheck();
farsiProp.boolValue = GUILayout.Toggle(farsiProp.boolValue, new GUIContent("Farsi"));
forceFixProp.boolValue = GUILayout.Toggle(forceFixProp.boolValue, new GUIContent("Force Fix"));
preserveNumbersProp.boolValue = GUILayout.Toggle(preserveNumbersProp.boolValue, new GUIContent("Preserve Numbers"));


EditorGUILayout.PropertyField(farsiProp, new GUIContent("Farsi"));
EditorGUILayout.PropertyField(forceFixProp, new GUIContent("Force Fix"));
EditorGUILayout.PropertyField(preserveNumbersProp, new GUIContent("Preserve Numbers"));
if (tmpro.richText)
fixTagsProp.boolValue = GUILayout.Toggle(fixTagsProp.boolValue, new GUIContent("FixTags"));

EditorGUILayout.EndHorizontal();
EditorGUILayout.PropertyField(fixTagsProp, new GUIContent("Fix Tags"));

if (EditorGUI.EndChangeCheck())
m_HavePropertiesChanged = true;
}

protected virtual void ListenForZeroWidthNoJoiner()
Expand Down