Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add hierarchy icon offset option #30

Merged
merged 1 commit into from
Aug 29, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect)
var loc = LocalizationSetting.GetTable(LocalizationSetting.GetLocale());

const float buttonWidth = 30;
const float xOffsetForOtherTools = 20;
float xOffsetForOtherTools = EditorPrefs.GetFloat(DetailConstants.KeyHierarchyIconOffset, DetailConstants.DefaultHierarchyIconOffset);
selectionRect.xMin += selectionRect.width - buttonWidth - xOffsetForOtherTools;
selectionRect.xMax -= xOffsetForOtherTools;
selectionRect.yMin += 1;
Expand Down
2 changes: 2 additions & 0 deletions Packages/jp.suzuryg.face-emo/Editor/Detail/DetailConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public class DetailConstants
public static readonly string KeyAutoSave = $"{DomainConstants.SystemName}_AutoSave";
public static readonly bool DefaultAutoSave = true;

public static readonly string KeyHierarchyIconOffset = $"{DomainConstants.SystemName}_HierarchyIconOffset";
public static readonly string KeyHideHierarchyIcon = $"{DomainConstants.SystemName}_HideHierarchyIcon";
public static readonly float DefaultHierarchyIconOffset = 20;
public static readonly bool DefaultHideHierarchyIcon = false;

public static readonly string KeyShowClipFieldInGestureTable = $"{DomainConstants.SystemName}_ShowClipFieldInGestureTable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ public class LocalizationTable : ScriptableObject
public string InspectorView_BranchDeleteConfirmation = "Confirm When Deleting Expression";
public string InspectorView_ShowBlinkBlendShapes = "Show Blink Blend Shapes";
public string InspectorView_ShowLipSyncBlendShapes = "Show Lip Sync Blend Shapes";
public string InspectorView_HierarchyIconOffset = "\"Emo\" button position offset";

public string InspectorView_Tooltip_MouthMorphCanceler = "This is used in expressions where the Mouth Morph Canceler is enabled. " +
"During speech, you can prevent disruptions by resetting certain blend shape values to their default values (the values set in the scene).";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ MonoBehaviour:
InspectorView_BranchDeleteConfirmation: "\u8868\u60C5\u306E\u524A\u9664\u6642\u306B\u78BA\u8A8D"
InspectorView_ShowBlinkBlendShapes: "\u307E\u3070\u305F\u304D\u7528\u30B7\u30A7\u30A4\u30D7\u30AD\u30FC\u3092\u8868\u793A\u3059\u308B"
InspectorView_ShowLipSyncBlendShapes: "\u30EA\u30C3\u30D7\u30B7\u30F3\u30AF\u7528\u30B7\u30A7\u30A4\u30D7\u30AD\u30FC\u3092\u8868\u793A\u3059\u308B"
InspectorView_HierarchyIconOffset: "Emo\u30DC\u30BF\u30F3\u4F4D\u7F6E\u306E\u30AA\u30D5\u30BB\u30C3\u30C8"
InspectorView_Tooltip_MouthMorphCanceler: "\u53E3\u5909\u5F62\u30AD\u30E3\u30F3\u30BB\u30EB\u304C\u6709\u52B9\u306B\u306A\u3063\u3066\u3044\u308B\u8868\u60C5\u3067\u4F7F\u7528\u3055\u308C\u307E\u3059\u3002
\u767A\u8A71\u4E2D\u3001\u7279\u5B9A\u306E\u30B7\u30A7\u30A4\u30D7\u30AD\u30FC\u306E\u5024\u3092\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5024\uFF08\u30B7\u30FC\u30F3\u4E0A\u3067\u8A2D\u5B9A\u3057\u305F\u5024\uFF09\u306B\u623B\u3059\u3053\u3068\u3067\u7834\u7DBB\u3092\u9632\u304E\u307E\u3059\u3002"
InspectorView_Tooltip_AddMouthMorphBlendShape: "\u30B7\u30A7\u30A4\u30D7\u30AD\u30FC\u9078\u629E\u6642\u3001\u300CCtrl
Expand Down
11 changes: 11 additions & 0 deletions Packages/jp.suzuryg.face-emo/Editor/Detail/View/InspectorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,17 @@ private void Field_EditorSetting()
ToggleEditorPrefsField(DetailConstants.KeyBranchDeleteConfirmation, DetailConstants.DefaultBranchDeleteConfirmation, _localizationTable.InspectorView_BranchDeleteConfirmation);
ToggleEditorPrefsField(DetailConstants.Key_ExpressionEditor_ShowBlinkBlendShapes, DetailConstants.Default_ExpressionEditor_ShowBlinkBlendShapes, _localizationTable.InspectorView_ShowBlinkBlendShapes);
ToggleEditorPrefsField(DetailConstants.Key_ExpressionEditor_ShowLipSyncBlendShapes, DetailConstants.Default_ExpressionEditor_ShowLipSyncBlendShapes, _localizationTable.InspectorView_ShowLipSyncBlendShapes);

using (new EditorGUILayout.HorizontalScope())
{
var offset = EditorPrefs.GetFloat(DetailConstants.KeyHierarchyIconOffset, DetailConstants.DefaultHierarchyIconOffset);
GUILayout.Label(_localizationTable.InspectorView_HierarchyIconOffset);
var newOffset = EditorGUILayout.FloatField(offset);
if (!Mathf.Approximately(newOffset, offset))
{
EditorPrefs.SetFloat(DetailConstants.KeyHierarchyIconOffset, newOffset);
}
}
}

private static void TogglePropertyField(SerializedProperty serializedProperty, string label, string tooltip = null)
Expand Down