File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ using UnityEditor ;
2+ using UnityEngine ;
3+ using UnityEngine . UIElements ;
4+
5+ namespace VRLabs . ModularShaderSystem . UI
6+ {
7+ public class PropertyAttributeAttribute : PropertyAttribute
8+ {
9+ }
10+ /// <summary>
11+ /// Inspector drawer for <see cref="Variable"/>.
12+ /// </summary>
13+ [ CustomPropertyDrawer ( typeof ( PropertyAttributeAttribute ) ) ]
14+ public class PropertyAttributeDrawer : PropertyDrawer
15+ {
16+ public override VisualElement CreatePropertyGUI ( SerializedProperty property )
17+ {
18+ var root = new VisualElement ( ) ;
19+
20+ var value = new TextField ( ) ;
21+ value . SetValueWithoutNotify ( property . stringValue ) ;
22+ root . Add ( value ) ;
23+
24+ /*value.RegisterValueChangedCallback(evt =>
25+ {
26+ property.stringValue = evt.newValue;
27+ property.serializedObject.ApplyModifiedProperties();
28+ });*/
29+ value . RegisterCallback < FocusOutEvent > ( evt =>
30+ {
31+ string v = value . value ;
32+ if ( v [ v . Length - 1 ] == ']' )
33+ {
34+ v = v . Remove ( v . Length - 1 , 1 ) ;
35+ }
36+ if ( v [ 0 ] == '[' )
37+ {
38+ v = v . Remove ( 0 , 1 ) ;
39+ }
40+ property . stringValue = v ;
41+ value . SetValueWithoutNotify ( property . stringValue ) ;
42+ property . serializedObject . ApplyModifiedProperties ( ) ;
43+ } ) ;
44+
45+ /*customTypeField.style.display = ((VariableType)typeField.value) == VariableType.Custom ? DisplayStyle.Flex : DisplayStyle.None;
46+
47+ typeField.RegisterValueChangedCallback(e =>
48+ {
49+ customTypeField.style.display = ((VariableType)e.newValue) == VariableType.Custom ? DisplayStyle.Flex : DisplayStyle.None;
50+ });*/
51+
52+ return root ;
53+ }
54+ }
55+ }
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using UnityEngine ;
4+ using VRLabs . ModularShaderSystem . UI ;
45
56namespace VRLabs . ModularShaderSystem
67{
@@ -55,6 +56,7 @@ public class Property : IEquatable<Property>
5556 /// <summary>
5657 /// List of attributes for the shader property.
5758 /// </summary>
59+ [ PropertyAttribute ]
5860 public List < string > Attributes ;
5961
6062 /// <summary>
You can’t perform that action at this time.
0 commit comments