jp.keijiro.klutter-tools 2.3.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,6 +18,14 @@ public static class Preferences
|
|
|
18
18
|
{ get => EditorPrefs.GetFloat(Keys.VfxGraphZoomStep, 1);
|
|
19
19
|
set => EditorPrefs.SetFloat(Keys.VfxGraphZoomStep, value); }
|
|
20
20
|
|
|
21
|
+
public static bool VfxGraphChangeFont
|
|
22
|
+
{ get => EditorPrefs.GetBool(Keys.VfxGraphChangeFont, false);
|
|
23
|
+
set => EditorPrefs.SetBool(Keys.VfxGraphChangeFont, value); }
|
|
24
|
+
|
|
25
|
+
public static int VfxGraphFontSize
|
|
26
|
+
{ get => EditorPrefs.GetInt(Keys.VfxGraphFontSize, 12);
|
|
27
|
+
set => EditorPrefs.SetInt(Keys.VfxGraphFontSize, value); }
|
|
28
|
+
|
|
21
29
|
// Preference keys
|
|
22
30
|
static class Keys
|
|
23
31
|
{
|
|
@@ -29,6 +37,12 @@ public static class Preferences
|
|
|
29
37
|
|
|
30
38
|
public const string VfxGraphZoomStep
|
|
31
39
|
= "KlutterTools.VfxGraph.ZoomStep";
|
|
40
|
+
|
|
41
|
+
public const string VfxGraphChangeFont
|
|
42
|
+
= "KlutterTools.VfxGraph.ChangeFont";
|
|
43
|
+
|
|
44
|
+
public const string VfxGraphFontSize
|
|
45
|
+
= "KlutterTools.VfxGraph.FontSize";
|
|
32
46
|
}
|
|
33
47
|
}
|
|
34
48
|
|
|
@@ -52,21 +66,40 @@ public sealed class PreferencesProvider : SettingsProvider
|
|
|
52
66
|
var fc_enable = Preferences.FpsCapperEnable;
|
|
53
67
|
var fc_frameRate = Preferences.FpsCapperFrameRate;
|
|
54
68
|
var vg_zoomStep = Preferences.VfxGraphZoomStep;
|
|
69
|
+
var vg_changeFont = Preferences.VfxGraphChangeFont;
|
|
70
|
+
var vg_fontSize = Preferences.VfxGraphFontSize;
|
|
55
71
|
|
|
56
72
|
GUILayout.Label("FPS Capper", EditorStyles.boldLabel);
|
|
57
73
|
fc_enable = EditorGUILayout.Toggle("Enable", fc_enable);
|
|
58
|
-
|
|
74
|
+
using (new EditorGUI.DisabledScope(!fc_enable))
|
|
75
|
+
{
|
|
76
|
+
EditorGUI.indentLevel++;
|
|
77
|
+
fc_frameRate = EditorGUILayout.IntField("Target Frame Rate", fc_frameRate);
|
|
78
|
+
EditorGUI.indentLevel--;
|
|
79
|
+
}
|
|
59
80
|
|
|
60
81
|
GUILayout.Space(h);
|
|
61
82
|
|
|
62
83
|
GUILayout.Label("VFX Graph", EditorStyles.boldLabel);
|
|
63
84
|
vg_zoomStep = EditorGUILayout.FloatField("Zoom Step Scale", vg_zoomStep);
|
|
64
85
|
|
|
86
|
+
vg_changeFont = EditorGUILayout.Toggle("Change Font", vg_changeFont);
|
|
87
|
+
using (new EditorGUI.DisabledScope(!vg_changeFont))
|
|
88
|
+
{
|
|
89
|
+
EditorGUI.indentLevel++;
|
|
90
|
+
vg_fontSize = EditorGUILayout.IntField("Font Size", vg_fontSize);
|
|
91
|
+
EditorGUI.indentLevel--;
|
|
92
|
+
}
|
|
93
|
+
|
|
65
94
|
if (EditorGUI.EndChangeCheck())
|
|
66
95
|
{
|
|
67
96
|
Preferences.FpsCapperEnable = fc_enable;
|
|
68
97
|
Preferences.FpsCapperFrameRate = fc_frameRate;
|
|
69
98
|
Preferences.VfxGraphZoomStep = vg_zoomStep;
|
|
99
|
+
Preferences.VfxGraphChangeFont = vg_changeFont;
|
|
100
|
+
Preferences.VfxGraphFontSize = vg_fontSize;
|
|
101
|
+
|
|
102
|
+
VfxGraphTextEditorModifier.ApplyToAllOpenWindows();
|
|
70
103
|
}
|
|
71
104
|
|
|
72
105
|
GUILayout.EndVertical();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using UnityEngine.UIElements;
|
|
4
|
+
|
|
5
|
+
namespace KlutterTools {
|
|
6
|
+
|
|
7
|
+
#if KLUTTER_TOOLS_HAS_VFXGRAPH
|
|
8
|
+
|
|
9
|
+
[InitializeOnLoad]
|
|
10
|
+
public static class VfxGraphTextEditorModifier
|
|
11
|
+
{
|
|
12
|
+
#region Constructor and event handlers
|
|
13
|
+
|
|
14
|
+
static VfxGraphTextEditorModifier()
|
|
15
|
+
{
|
|
16
|
+
// Subscribe to window focus change events
|
|
17
|
+
EditorWindow.windowFocusChanged += OnWindowFocusChanged;
|
|
18
|
+
|
|
19
|
+
// Double delayCall to wait for VFXTextEditor UI to be fully constructed after domain reload
|
|
20
|
+
EditorApplication.delayCall += () => {
|
|
21
|
+
EditorApplication.delayCall += () => { ApplyToAllOpenWindows(); };
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static void OnWindowFocusChanged()
|
|
26
|
+
=> EditorApplication.delayCall += () =>
|
|
27
|
+
{ CheckAndApplyCustomFont(EditorWindow.focusedWindow); };
|
|
28
|
+
|
|
29
|
+
#endregion
|
|
30
|
+
|
|
31
|
+
#region Public methods
|
|
32
|
+
|
|
33
|
+
public static void ApplyToAllOpenWindows()
|
|
34
|
+
{
|
|
35
|
+
foreach (var window in Resources.FindObjectsOfTypeAll<EditorWindow>())
|
|
36
|
+
CheckAndApplyCustomFont(window);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#endregion
|
|
40
|
+
|
|
41
|
+
#region Font application logic
|
|
42
|
+
|
|
43
|
+
static readonly string TextClassName
|
|
44
|
+
= "unity-text-element--inner-input-field-component";
|
|
45
|
+
|
|
46
|
+
static Font _font;
|
|
47
|
+
|
|
48
|
+
static bool CheckWindowType(EditorWindow window)
|
|
49
|
+
=> window?.GetType()?.Name == "VFXTextEditor";
|
|
50
|
+
|
|
51
|
+
static void ApplyCustomFont(EditorWindow window)
|
|
52
|
+
{
|
|
53
|
+
if (!Preferences.VfxGraphChangeFont) return;
|
|
54
|
+
|
|
55
|
+
var root = window.rootVisualElement;
|
|
56
|
+
var elements = root.Query(className: TextClassName).ToList();
|
|
57
|
+
if (elements.Count == 0) return;
|
|
58
|
+
|
|
59
|
+
if (_font == null)
|
|
60
|
+
_font = Font.CreateDynamicFontFromOSFont
|
|
61
|
+
(new[]{"Courier New"}, Preferences.VfxGraphFontSize);
|
|
62
|
+
|
|
63
|
+
var unityFont = new StyleFont(_font);
|
|
64
|
+
|
|
65
|
+
foreach (var element in elements)
|
|
66
|
+
{
|
|
67
|
+
element.style.unityFontDefinition = StyleKeyword.None;
|
|
68
|
+
element.style.unityFont = unityFont;
|
|
69
|
+
element.style.fontSize = Preferences.VfxGraphFontSize;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
static void CheckAndApplyCustomFont(EditorWindow window)
|
|
74
|
+
{
|
|
75
|
+
if (CheckWindowType(window)) ApplyCustomFont(window);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#endregion
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
} // namespace KlutterTools
|
|
@@ -12,7 +12,7 @@ public static class VfxGraphZoomStepModifier
|
|
|
12
12
|
static VfxGraphZoomStepModifier()
|
|
13
13
|
=> EditorWindow.windowFocusChanged += OnWindowFocusChanged;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
static void OnWindowFocusChanged()
|
|
16
16
|
{
|
|
17
17
|
var target = EditorWindow.focusedWindow;
|
|
18
18
|
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Klutter Tools
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
5
|
**Klutter Tools** is a collection of Unity Editor extensions offering various
|
|
6
6
|
utilities to enhance the editor workflow.
|
|
@@ -23,12 +23,24 @@ in the VFX Graph Editor. It's especially helpful for Mac users with a trackpad,
|
|
|
23
23
|
where scroll gestures can feel overly sensitive and make precise editing
|
|
24
24
|
difficult.
|
|
25
25
|
|
|
26
|
+
### Fixed-pitch font in VFX Graph Text Editor
|
|
27
|
+
|
|
28
|
+
When enabled, this feature switches the font used in the VFX Graph text editor
|
|
29
|
+
(custom HLSL code) to a fixed-pitch typeface and lets you adjust the font size.
|
|
30
|
+
|
|
26
31
|
### .cube LUT file import
|
|
27
32
|
|
|
28
33
|
Adds support for importing `.cube` LUT (Look-Up Table) files, commonly used in
|
|
29
34
|
video editing software. While this feature is natively available in HDRP, it’s
|
|
30
35
|
beneficial for users who want to use it in URP.
|
|
31
36
|
|
|
37
|
+
### Inspector Note
|
|
38
|
+
|
|
39
|
+
**Inspector Note** is an editor-only component that allows attaching comments
|
|
40
|
+
or notes directly to GameObjects in the Inspector. This can be useful for
|
|
41
|
+
leaving reminders, instructions, or context for other developers -- or just
|
|
42
|
+
jotting down your own thoughts.
|
|
43
|
+
|
|
32
44
|
## System Requirements
|
|
33
45
|
|
|
34
46
|
- Unity 6 or later
|