jp.keijiro.klutter-tools 2.0.0 → 2.2.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.
@@ -0,0 +1,41 @@
1
+ using UnityEditor;
2
+ using UnityEngine;
3
+ using UnityEngine.UIElements;
4
+ using UnityEditor.UIElements;
5
+
6
+ namespace KlutterTools {
7
+
8
+ [CustomEditor(typeof(InspectorNote))]
9
+ sealed class InspectorNoteEditor : Editor
10
+ {
11
+ const string AssetPath = "Packages/jp.keijiro.klutter-tools/Editor/InspectorNoteEditor.uxml";
12
+
13
+ public override VisualElement CreateInspectorGUI()
14
+ {
15
+ var uxml = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>(AssetPath);
16
+
17
+ var doc = uxml.Instantiate();
18
+ doc.dataSource = target;
19
+
20
+ var showEditorProp = serializedObject.FindProperty("_showEditor");
21
+ var noteEditor = doc.Q("note-editor");
22
+ var doneButton = doc.Q<Button>("done-button");
23
+
24
+ if (!showEditorProp.boolValue)
25
+ noteEditor.style.display = DisplayStyle.None;
26
+
27
+ noteEditor.TrackPropertyValue(showEditorProp, prop => {
28
+ noteEditor.style.display =
29
+ prop.boolValue ? DisplayStyle.Flex : DisplayStyle.None;
30
+ });
31
+
32
+ doneButton.clicked += () => {
33
+ showEditorProp.boolValue = false;
34
+ serializedObject.ApplyModifiedProperties();
35
+ };
36
+
37
+ return doc;
38
+ }
39
+ }
40
+
41
+ } // namespace KlutterTools
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: e6f486fe863134a12b4cb75f8b248f90
@@ -0,0 +1,13 @@
1
+ <ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
2
+ <ui:VisualElement data-source-type="KlutterTools.InspectorNote, KlutterTools.Runtime" name="note" style="margin-top: 10px; margin-right: 6px; margin-bottom: 2px; margin-left: 0; padding-top: 6px; padding-right: 6px; padding-bottom: 6px; padding-left: 6px; border-top-left-radius: 4px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px;">
3
+ <ui:Label text="Note Body" binding-path="_noteText" style="white-space: normal;" />
4
+ <Bindings>
5
+ <ui:DataBinding property="style.backgroundColor" data-source-path="_backgroundColor" binding-mode="ToTarget" />
6
+ </Bindings>
7
+ </ui:VisualElement>
8
+ <ui:VisualElement name="note-editor" style="margin-top: 10px;">
9
+ <ui:TextField binding-path="_noteText" multiline="true" style="white-space: normal;" />
10
+ <uie:ColorField label="Background" binding-path="_backgroundColor" style="margin-top: 4px; margin-bottom: 4px;" />
11
+ <ui:Button text="Done" name="done-button" />
12
+ </ui:VisualElement>
13
+ </ui:UXML>
@@ -0,0 +1,10 @@
1
+ fileFormatVersion: 2
2
+ guid: c8294822f0f064673868d67ecdf56c88
3
+ ScriptedImporter:
4
+ internalIDToNameTable: []
5
+ externalObjects: {}
6
+ serializedVersion: 2
7
+ userData:
8
+ assetBundleName:
9
+ assetBundleVariant:
10
+ script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
Binary file
@@ -0,0 +1,156 @@
1
+ fileFormatVersion: 2
2
+ guid: 30c8908d55ef34874b50013fd7e60446
3
+ TextureImporter:
4
+ internalIDToNameTable: []
5
+ externalObjects: {}
6
+ serializedVersion: 13
7
+ mipmaps:
8
+ mipMapMode: 0
9
+ enableMipMap: 0
10
+ sRGBTexture: 1
11
+ linearTexture: 0
12
+ fadeOut: 0
13
+ borderMipMap: 0
14
+ mipMapsPreserveCoverage: 0
15
+ alphaTestReferenceValue: 0.5
16
+ mipMapFadeDistanceStart: 1
17
+ mipMapFadeDistanceEnd: 3
18
+ bumpmap:
19
+ convertToNormalMap: 0
20
+ externalNormalMap: 0
21
+ heightScale: 0.25
22
+ normalMapFilter: 0
23
+ flipGreenChannel: 0
24
+ isReadable: 0
25
+ streamingMipmaps: 0
26
+ streamingMipmapsPriority: 0
27
+ vTOnly: 0
28
+ ignoreMipmapLimit: 0
29
+ grayScaleToAlpha: 0
30
+ generateCubemap: 6
31
+ cubemapConvolution: 0
32
+ seamlessCubemap: 0
33
+ textureFormat: 1
34
+ maxTextureSize: 2048
35
+ textureSettings:
36
+ serializedVersion: 2
37
+ filterMode: 1
38
+ aniso: 1
39
+ mipBias: 0
40
+ wrapU: 1
41
+ wrapV: 1
42
+ wrapW: 0
43
+ nPOTScale: 0
44
+ lightmap: 0
45
+ compressionQuality: 50
46
+ spriteMode: 0
47
+ spriteExtrude: 1
48
+ spriteMeshType: 1
49
+ alignment: 0
50
+ spritePivot: {x: 0.5, y: 0.5}
51
+ spritePixelsToUnits: 100
52
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
53
+ spriteGenerateFallbackPhysicsShape: 1
54
+ alphaUsage: 1
55
+ alphaIsTransparency: 1
56
+ spriteTessellationDetail: -1
57
+ textureType: 2
58
+ textureShape: 1
59
+ singleChannelComponent: 0
60
+ flipbookRows: 1
61
+ flipbookColumns: 1
62
+ maxTextureSizeSet: 0
63
+ compressionQualitySet: 0
64
+ textureFormatSet: 0
65
+ ignorePngGamma: 0
66
+ applyGammaDecoding: 0
67
+ swizzle: 50462976
68
+ cookieLightType: 0
69
+ platformSettings:
70
+ - serializedVersion: 4
71
+ buildTarget: DefaultTexturePlatform
72
+ maxTextureSize: 2048
73
+ resizeAlgorithm: 0
74
+ textureFormat: -1
75
+ textureCompression: 0
76
+ compressionQuality: 50
77
+ crunchedCompression: 0
78
+ allowsAlphaSplitting: 0
79
+ overridden: 0
80
+ ignorePlatformSupport: 0
81
+ androidETC2FallbackOverride: 0
82
+ forceMaximumCompressionQuality_BC6H_BC7: 0
83
+ - serializedVersion: 4
84
+ buildTarget: Standalone
85
+ maxTextureSize: 2048
86
+ resizeAlgorithm: 0
87
+ textureFormat: -1
88
+ textureCompression: 1
89
+ compressionQuality: 50
90
+ crunchedCompression: 0
91
+ allowsAlphaSplitting: 0
92
+ overridden: 0
93
+ ignorePlatformSupport: 0
94
+ androidETC2FallbackOverride: 0
95
+ forceMaximumCompressionQuality_BC6H_BC7: 0
96
+ - serializedVersion: 4
97
+ buildTarget: Android
98
+ maxTextureSize: 2048
99
+ resizeAlgorithm: 0
100
+ textureFormat: -1
101
+ textureCompression: 1
102
+ compressionQuality: 50
103
+ crunchedCompression: 0
104
+ allowsAlphaSplitting: 0
105
+ overridden: 0
106
+ ignorePlatformSupport: 0
107
+ androidETC2FallbackOverride: 0
108
+ forceMaximumCompressionQuality_BC6H_BC7: 0
109
+ - serializedVersion: 4
110
+ buildTarget: WebGL
111
+ maxTextureSize: 2048
112
+ resizeAlgorithm: 0
113
+ textureFormat: -1
114
+ textureCompression: 1
115
+ compressionQuality: 50
116
+ crunchedCompression: 0
117
+ allowsAlphaSplitting: 0
118
+ overridden: 0
119
+ ignorePlatformSupport: 0
120
+ androidETC2FallbackOverride: 0
121
+ forceMaximumCompressionQuality_BC6H_BC7: 0
122
+ - serializedVersion: 4
123
+ buildTarget: iOS
124
+ maxTextureSize: 2048
125
+ resizeAlgorithm: 0
126
+ textureFormat: -1
127
+ textureCompression: 1
128
+ compressionQuality: 50
129
+ crunchedCompression: 0
130
+ allowsAlphaSplitting: 0
131
+ overridden: 0
132
+ ignorePlatformSupport: 0
133
+ androidETC2FallbackOverride: 0
134
+ forceMaximumCompressionQuality_BC6H_BC7: 0
135
+ spriteSheet:
136
+ serializedVersion: 2
137
+ sprites: []
138
+ outline: []
139
+ customData:
140
+ physicsShape: []
141
+ bones: []
142
+ spriteID:
143
+ internalID: 0
144
+ vertices: []
145
+ indices:
146
+ edges: []
147
+ weights: []
148
+ secondaryTextures: []
149
+ spriteCustomMetadata:
150
+ entries: []
151
+ nameFileIdTable: {}
152
+ mipmapLimitGroupName:
153
+ pSDRemoveMatte: 0
154
+ userData:
155
+ assetBundleName:
156
+ assetBundleVariant:
@@ -44,9 +44,12 @@ public struct AutoProperty
44
44
  var autoProps = allFields.Where(f => f.FieldType == typeof(AutoProperty));
45
45
 
46
46
  foreach (var f in autoProps)
47
- f.SetValue(target, new AutoProperty(FindProperty(so, f.Name)));
47
+ f.SetValue(target, new AutoProperty(FindProperty(so, ResolveNesting(f.Name))));
48
48
  }
49
49
 
50
+ static string ResolveNesting(string name)
51
+ => name.Replace("__", ".");
52
+
50
53
  static string GetPropNameBacking(string name)
51
54
  => $"<{name}>k__BackingField";
52
55
 
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "KlutterTools.Editor",
3
3
  "rootNamespace": "",
4
- "references": [],
4
+ "references": [
5
+ "GUID:606dc61d41d874577bdfdc9a83bcb696"
6
+ ],
5
7
  "includePlatforms": [
6
8
  "Editor"
7
9
  ],
@@ -0,0 +1,27 @@
1
+ using UnityEngine;
2
+
3
+ namespace KlutterTools {
4
+
5
+ [AddComponentMenu("Miscellaneous/Note")]
6
+ public sealed class InspectorNote : MonoBehaviour
7
+ {
8
+ #if UNITY_EDITOR
9
+
10
+ #pragma warning disable CS0414
11
+
12
+ [SerializeField] string _noteText =
13
+ "To edit the note, select \"Toggle Note Editor\" from the inspector context menu.";
14
+
15
+ [SerializeField] bool _showEditor = false;
16
+
17
+ [SerializeField] Color _backgroundColor = new Color(0.15f, 0.15f, 0.15f, 1);
18
+
19
+ #pragma warning restore CS0414
20
+
21
+ [ContextMenu("Toggle Note Editor")]
22
+ void ToggleNoteEditor() => _showEditor = !_showEditor;
23
+
24
+ #endif
25
+ }
26
+
27
+ } // namespace KlutterTools
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 21721932ed30c48dba1da51b0969cfe9
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {fileID: 2800000, guid: 30c8908d55ef34874b50013fd7e60446, type: 3}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,3 @@
1
+ {
2
+ "name": "KlutterTools.Runtime"
3
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 606dc61d41d874577bdfdc9a83bcb696
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Runtime.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 0cd0456f85e6e43c3816567db0b14944
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Keijiro Takahashi",
6
6
  "license": "Unlicense",
7
7
  "dependencies": { },
8
- "version": "2.0.0",
8
+ "version": "2.2.0",
9
9
  "unity": "6000.0",
10
10
  "keywords": [ "unity" ]
11
11
  }