jp.keijiro.klutter-tools 1.0.1 → 2.0.0
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.
- package/Editor/CubeLutImporter.cs +2 -2
- package/Editor/FpsCapperSystem.cs +2 -2
- package/Editor/InspectorUtils.cs +71 -0
- package/Editor/InspectorUtils.cs.meta +2 -0
- package/Editor/PlayerLoopHelper.cs +2 -2
- package/Editor/PreferencesProvider.cs +5 -5
- package/Editor/VfxGraphZoomStepModifier.cs +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ using System.IO;
|
|
|
4
4
|
using UnityEditor.AssetImporters;
|
|
5
5
|
using UnityEngine;
|
|
6
6
|
|
|
7
|
-
namespace
|
|
7
|
+
namespace KlutterTools {
|
|
8
8
|
|
|
9
9
|
#if !KLUTTER_TOOLS_HAS_HDRP
|
|
10
10
|
|
|
@@ -60,4 +60,4 @@ class CubeLutImporter : ScriptedImporter
|
|
|
60
60
|
|
|
61
61
|
#endif
|
|
62
62
|
|
|
63
|
-
} // namespace
|
|
63
|
+
} // namespace KlutterTools
|
|
@@ -2,7 +2,7 @@ using UnityEditor;
|
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
using System.Threading;
|
|
4
4
|
|
|
5
|
-
namespace
|
|
5
|
+
namespace KlutterTools {
|
|
6
6
|
|
|
7
7
|
// FPS Capper player loop sub system
|
|
8
8
|
[InitializeOnLoad]
|
|
@@ -53,4 +53,4 @@ sealed class FpsCapperSystem
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
} // namespace
|
|
56
|
+
} // namespace KlutterTools
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
using UnityEngine;
|
|
2
|
+
using UnityEditor;
|
|
3
|
+
using System.Reflection;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
|
|
6
|
+
namespace KlutterTools.InspectorUtils {
|
|
7
|
+
|
|
8
|
+
// String container providing GUIContent
|
|
9
|
+
public struct LabelString
|
|
10
|
+
{
|
|
11
|
+
GUIContent _guiContent;
|
|
12
|
+
|
|
13
|
+
public static implicit operator GUIContent(LabelString label)
|
|
14
|
+
=> label._guiContent;
|
|
15
|
+
|
|
16
|
+
public static implicit operator LabelString(string text)
|
|
17
|
+
=> new LabelString { _guiContent = new GUIContent(text) };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Auto-scanning serialized property wrapper
|
|
21
|
+
public struct AutoProperty
|
|
22
|
+
{
|
|
23
|
+
SerializedProperty _prop;
|
|
24
|
+
|
|
25
|
+
public SerializedProperty Target
|
|
26
|
+
=> _prop;
|
|
27
|
+
|
|
28
|
+
public AutoProperty(SerializedProperty prop)
|
|
29
|
+
=> _prop = prop;
|
|
30
|
+
|
|
31
|
+
public static implicit operator AutoProperty(SerializedProperty prop)
|
|
32
|
+
=> new AutoProperty(prop);
|
|
33
|
+
|
|
34
|
+
public static implicit operator SerializedProperty(AutoProperty prop)
|
|
35
|
+
=> prop._prop;
|
|
36
|
+
|
|
37
|
+
public static void Scan<T>(T target) where T : UnityEditor.Editor
|
|
38
|
+
{
|
|
39
|
+
var so = target.serializedObject;
|
|
40
|
+
|
|
41
|
+
var allFields = typeof(T).GetFields
|
|
42
|
+
(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
|
|
43
|
+
|
|
44
|
+
var autoProps = allFields.Where(f => f.FieldType == typeof(AutoProperty));
|
|
45
|
+
|
|
46
|
+
foreach (var f in autoProps)
|
|
47
|
+
f.SetValue(target, new AutoProperty(FindProperty(so, f.Name)));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static string GetPropNameBacking(string name)
|
|
51
|
+
=> $"<{name}>k__BackingField";
|
|
52
|
+
|
|
53
|
+
static string GetPropNameCamel(string name)
|
|
54
|
+
=> name.TrimStart('_');
|
|
55
|
+
|
|
56
|
+
static string GetPropNamePascal(string name)
|
|
57
|
+
{
|
|
58
|
+
var trimmed = name.TrimStart('_');
|
|
59
|
+
return char.ToUpper(trimmed[0]) + trimmed.Substring(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static SerializedProperty FindProperty(SerializedObject so, string name)
|
|
63
|
+
=> so.FindProperty(name) ??
|
|
64
|
+
so.FindProperty(GetPropNameCamel(name)) ??
|
|
65
|
+
so.FindProperty(GetPropNamePascal(name)) ??
|
|
66
|
+
so.FindProperty(GetPropNameBacking(name)) ??
|
|
67
|
+
so.FindProperty(GetPropNameBacking(GetPropNameCamel(name))) ??
|
|
68
|
+
so.FindProperty(GetPropNameBacking(GetPropNamePascal(name)));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
} // namespace KlutterTools.InspectorUtils
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using UnityEngine.LowLevel;
|
|
3
3
|
|
|
4
|
-
namespace
|
|
4
|
+
namespace KlutterTools {
|
|
5
5
|
|
|
6
6
|
public static class PlayerLoopHelper
|
|
7
7
|
{
|
|
@@ -31,4 +31,4 @@ public static class PlayerLoopHelper
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
} // namespace
|
|
34
|
+
} // namespace KlutterTools
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
using UnityEditor;
|
|
2
2
|
using UnityEngine;
|
|
3
3
|
|
|
4
|
-
namespace
|
|
4
|
+
namespace KlutterTools {
|
|
5
5
|
|
|
6
6
|
// Preference accessor
|
|
7
7
|
public static class Preferences
|
|
@@ -22,13 +22,13 @@ public static class Preferences
|
|
|
22
22
|
static class Keys
|
|
23
23
|
{
|
|
24
24
|
public const string FpsCapperEnable
|
|
25
|
-
= "
|
|
25
|
+
= "KlutterTools.FpsCapper.Enable";
|
|
26
26
|
|
|
27
27
|
public const string FpsCapperFrameRate
|
|
28
|
-
= "
|
|
28
|
+
= "KlutterTools.FpsCapper.FrameRate";
|
|
29
29
|
|
|
30
30
|
public const string VfxGraphZoomStep
|
|
31
|
-
= "
|
|
31
|
+
= "KlutterTools.VfxGraph.ZoomStep";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -80,4 +80,4 @@ public sealed class PreferencesProvider : SettingsProvider
|
|
|
80
80
|
=> new PreferencesProvider();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
} // namespace
|
|
83
|
+
} // namespace KlutterTools
|
|
@@ -2,7 +2,7 @@ using System;
|
|
|
2
2
|
using System.Reflection;
|
|
3
3
|
using UnityEditor;
|
|
4
4
|
|
|
5
|
-
namespace
|
|
5
|
+
namespace KlutterTools {
|
|
6
6
|
|
|
7
7
|
#if KLUTTER_TOOLS_HAS_VFXGRAPH
|
|
8
8
|
|
|
@@ -44,4 +44,4 @@ public static class VfxGraphZoomStepModifier
|
|
|
44
44
|
|
|
45
45
|
#endif
|
|
46
46
|
|
|
47
|
-
} // namespace
|
|
47
|
+
} // namespace KlutterTools
|