Browse Source

Installing VRC SDK 2021.06.03.14.57

master
Mobius K 3 months ago
parent
commit
083a7b4e1d
  1. 8
      Assets/Udon.meta
  2. 8
      Assets/Udon/Editor.meta
  3. 8
      Assets/Udon/Editor/External.meta
  4. BIN
      Assets/Udon/Editor/External/VRC.Udon.Compiler.dll
  5. 102
      Assets/Udon/Editor/External/VRC.Udon.Compiler.dll.meta
  6. BIN
      Assets/Udon/Editor/External/VRC.Udon.EditorBindings.dll
  7. 46
      Assets/Udon/Editor/External/VRC.Udon.EditorBindings.dll.meta
  8. BIN
      Assets/Udon/Editor/External/VRC.Udon.Graph.dll
  9. 46
      Assets/Udon/Editor/External/VRC.Udon.Graph.dll.meta
  10. BIN
      Assets/Udon/Editor/External/VRC.Udon.UAssembly.dll
  11. 46
      Assets/Udon/Editor/External/VRC.Udon.UAssembly.dll.meta
  12. BIN
      Assets/Udon/Editor/External/VRC.Udon.VRCGraphModules.dll
  13. 33
      Assets/Udon/Editor/External/VRC.Udon.VRCGraphModules.dll.meta
  14. BIN
      Assets/Udon/Editor/External/VRC.Udon.VRCTypeResolverModules.dll
  15. 33
      Assets/Udon/Editor/External/VRC.Udon.VRCTypeResolverModules.dll.meta
  16. 8
      Assets/Udon/Editor/GraphModules.meta
  17. 48
      Assets/Udon/Editor/GraphModules/VRCInstantiateNodeRegistry.cs
  18. 11
      Assets/Udon/Editor/GraphModules/VRCInstantiateNodeRegistry.cs.meta
  19. 8
      Assets/Udon/Editor/ProgramSources.meta
  20. 8
      Assets/Udon/Editor/ProgramSources/Attributes.meta
  21. 18
      Assets/Udon/Editor/ProgramSources/Attributes/UdonProgramSourceNewMenuAttribute.cs
  22. 11
      Assets/Udon/Editor/ProgramSources/Attributes/UdonProgramSourceNewMenuAttribute.cs.meta
  23. 57
      Assets/Udon/Editor/ProgramSources/SerializedUdonProgramAssetEditor.cs
  24. 11
      Assets/Udon/Editor/ProgramSources/SerializedUdonProgramAssetEditor.cs.meta
  25. 8
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram.meta
  26. 96
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAsset.cs
  27. 11
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAsset.cs.meta
  28. 9
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetEditor.cs
  29. 11
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetEditor.cs.meta
  30. 27
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetImporter.cs
  31. 11
      Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetImporter.cs.meta
  32. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram.meta
  33. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI.meta
  34. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView.meta
  35. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields.meta
  36. 35
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/ByteField.cs
  37. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/ByteField.cs.meta
  38. 34
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/CharField.cs
  39. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/CharField.cs.meta
  40. 37
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/LayerMaskField.cs
  41. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/LayerMaskField.cs.meta
  42. 37
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/QuaternionField.cs
  43. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/QuaternionField.cs.meta
  44. 35
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/VRCUrlField.cs
  45. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/VRCUrlField.cs.meta
  46. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements.meta
  47. 81
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/GraphElementExtension.cs
  48. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/GraphElementExtension.cs.meta
  49. 86
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayEditor.cs
  50. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayEditor.cs.meta
  51. 156
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayInspector.cs
  52. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayInspector.cs.meta
  53. 220
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonComment.cs
  54. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonComment.cs.meta
  55. 48
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonGraphElement.cs
  56. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonGraphElement.cs.meta
  57. 211
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonGroup.cs
  58. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonGroup.cs.meta
  59. 57
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonMinimap.cs
  60. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonMinimap.cs.meta
  61. 1056
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonNode.cs
  62. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonNode.cs.meta
  63. 412
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonPort.cs
  64. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonPort.cs.meta
  65. 6
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonStackNode.cs
  66. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonStackNode.cs.meta
  67. 121
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonVariablesBlackboard.cs
  68. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonVariablesBlackboard.cs.meta
  69. 8
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search.meta
  70. 64
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonFocusedSearchWindow.cs
  71. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonFocusedSearchWindow.cs.meta
  72. 113
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonFullSearchWindow.cs
  73. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonFullSearchWindow.cs.meta
  74. 124
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonPortSearchWindow.cs
  75. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonPortSearchWindow.cs.meta
  76. 183
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonRegistrySearchWindow.cs
  77. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonRegistrySearchWindow.cs.meta
  78. 119
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonSearchManager.cs
  79. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonSearchManager.cs.meta
  80. 187
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonSearchWindowBase.cs
  81. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonSearchWindowBase.cs.meta
  82. 52
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonVariableTypeWindow.cs
  83. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Search/UdonVariableTypeWindow.cs.meta
  84. 38
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/TypeExtension.cs
  85. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/TypeExtension.cs.meta
  86. 174
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonFieldFactory.cs
  87. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonFieldFactory.cs.meta
  88. 1328
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraph.cs
  89. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraph.cs.meta
  90. 29
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphElementData.cs
  91. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphElementData.cs.meta
  92. 144
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphStatus.cs
  93. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphStatus.cs.meta
  94. 58
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphViewSettings.cs
  95. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphViewSettings.cs.meta
  96. 324
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphWindow.cs
  97. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonGraphWindow.cs.meta
  98. 58
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonParameterField.cs
  99. 11
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonParameterField.cs.meta
  100. 191
      Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/UdonParameterProperty.cs

8
Assets/Udon.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c35e495b7f5bf624a938d913b84832d6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0d56ca1c9ac0e3a40a9dbd70dc091818
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/External.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 12df798ac785d6c489de2d1cdb0dc3d4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.Compiler.dll

102
Assets/Udon/Editor/External/VRC.Udon.Compiler.dll.meta

@ -0,0 +1,102 @@
fileFormatVersion: 2
guid: 8b6535096cfa29340897276abbdd015f
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Android: Android
second:
enabled: 0
settings:
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 0
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.EditorBindings.dll

46
Assets/Udon/Editor/External/VRC.Udon.EditorBindings.dll.meta

@ -0,0 +1,46 @@
fileFormatVersion: 2
guid: 585dd63e377866248b16bdba915820ed
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.Graph.dll

46
Assets/Udon/Editor/External/VRC.Udon.Graph.dll.meta

@ -0,0 +1,46 @@
fileFormatVersion: 2
guid: b335798a4f28bec40ba9b3d4a15acee7
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.UAssembly.dll

46
Assets/Udon/Editor/External/VRC.Udon.UAssembly.dll.meta

@ -0,0 +1,46 @@
fileFormatVersion: 2
guid: 21dcba1a47cc8c84381629950b692129
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 0
Exclude Linux: 1
Exclude Linux64: 1
Exclude LinuxUniversal: 1
Exclude OSXUniversal: 1
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.VRCGraphModules.dll

33
Assets/Udon/Editor/External/VRC.Udon.VRCGraphModules.dll.meta

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 161140ecae894b84ba7bdd6e44ff4371
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Udon/Editor/External/VRC.Udon.VRCTypeResolverModules.dll

33
Assets/Udon/Editor/External/VRC.Udon.VRCTypeResolverModules.dll.meta

@ -0,0 +1,33 @@
fileFormatVersion: 2
guid: 19cff77330d183441a69ff6c69e07629
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/GraphModules.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 01bc0e7756b86d9478fc1741ba3e043a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

48
Assets/Udon/Editor/GraphModules/VRCInstantiateNodeRegistry.cs

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using VRC.Udon.Graph.Interfaces;
using VRC.Udon.Graph.Attributes;
using VRC.Udon.Graph.NodeRegistries;
[assembly: UdonGraphNodeRegistry(typeof(VRCInstantiateNodeRegistry), "VRCInstantiateNodeRegistry")]
namespace VRC.Udon.Graph.NodeRegistries
{
public class VRCInstantiateNodeRegistry : BaseNodeRegistry
{
protected override Dictionary<string, INodeRegistry> NextRegistries => _nextRegistries;
private static readonly Dictionary<string, INodeRegistry> _nextRegistries = new Dictionary<string, INodeRegistry>();
protected override Dictionary<string, UdonNodeDefinition> NodeDefinitions => _nodeDefinitions;
private static readonly Dictionary<string, UdonNodeDefinition> _nodeDefinitions = new Dictionary<string, UdonNodeDefinition>
{
{
"VRCInstantiate.__Instantiate__UnityEngineGameObject__UnityEngineGameObject",
new UdonNodeDefinition(
"VRChat Instantiate",
"VRCInstantiate.__Instantiate__UnityEngineGameObject__UnityEngineGameObject",
typeof(UnityEngine.Object),
new []
{
new UdonNodeParameter
{
name = "original",
type = typeof(UnityEngine.GameObject),
parameterType = UdonNodeParameter.ParameterType.IN
},
new UdonNodeParameter
{
name = "clone",
type = typeof(UnityEngine.GameObject),
parameterType = UdonNodeParameter.ParameterType.OUT
}
},
new string[] { },
new string[] { },
new object[] { },
true
)
}
};
}
}

11
Assets/Udon/Editor/GraphModules/VRCInstantiateNodeRegistry.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cac80b40f57c41d4b941dc5059271583
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b7ab300788939046ad8e59c6496b408
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/Attributes.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d15d892e009af0141a17680e9961fcea
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

18
Assets/Udon/Editor/ProgramSources/Attributes/UdonProgramSourceNewMenuAttribute.cs

@ -0,0 +1,18 @@
using System;
namespace VRC.Udon.Editor.ProgramSources.Attributes
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public class UdonProgramSourceNewMenuAttribute : Attribute
{
public Type Type { get; }
public string DisplayName { get; }
public UdonProgramSourceNewMenuAttribute(Type type, string displayName)
{
Type = type;
DisplayName = displayName;
}
}
}

11
Assets/Udon/Editor/ProgramSources/Attributes/UdonProgramSourceNewMenuAttribute.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0e5ced9511d591140b191bbd9e948e61
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

57
Assets/Udon/Editor/ProgramSources/SerializedUdonProgramAssetEditor.cs

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using VRC.Udon.Common.Interfaces;
using VRC.Udon.ProgramSources;
using VRC.Udon.Serialization.OdinSerializer;
namespace VRC.Udon.Editor.ProgramSources
{
[CustomEditor(typeof(SerializedUdonProgramAsset))]
public class SerializedUdonProgramAssetEditor : UnityEditor.Editor
{
private SerializedProperty _serializedProgramBytesStringSerializedProperty;
private SerializedProperty _serializationDataFormatSerializedProperty;
private void OnEnable()
{
_serializedProgramBytesStringSerializedProperty = serializedObject.FindProperty("serializedProgramBytesString");
_serializationDataFormatSerializedProperty = serializedObject.FindProperty("serializationDataFormat");
}
public override void OnInspectorGUI()
{
DrawSerializationDebug();
}
[Conditional("UDON_DEBUG")]
private void DrawSerializationDebug()
{
EditorGUILayout.LabelField($"DataFormat: {(DataFormat)_serializationDataFormatSerializedProperty.enumValueIndex}");
if(string.IsNullOrEmpty(_serializedProgramBytesStringSerializedProperty.stringValue))
{
return;
}
if(_serializationDataFormatSerializedProperty.enumValueIndex == (int)DataFormat.JSON)
{
using(new EditorGUI.DisabledScope(true))
{
EditorGUILayout.TextArea(System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(_serializedProgramBytesStringSerializedProperty.stringValue)));
}
}
else
{
using(new EditorGUI.DisabledScope(true))
{
SerializedUdonProgramAsset serializedUdonProgramAsset = (SerializedUdonProgramAsset)target;
IUdonProgram udonProgram = serializedUdonProgramAsset.RetrieveProgram();
byte[] serializedBytes = SerializationUtility.SerializeValue(udonProgram, DataFormat.JSON, out List<UnityEngine.Object> _);
EditorGUILayout.TextArea(System.Text.Encoding.UTF8.GetString(serializedBytes));
}
}
}
}
}

11
Assets/Udon/Editor/ProgramSources/SerializedUdonProgramAssetEditor.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e1b5b45f24b268b42826fc5c5497dc15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d996418221d6d8c4cb2680022428635d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

96
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAsset.cs

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEditor;
using UnityEngine;
using VRC.Udon.Editor;
using VRC.Udon.Editor.ProgramSources;
using VRC.Udon.Editor.ProgramSources.Attributes;
[assembly: UdonProgramSourceNewMenu(typeof(UdonAssemblyProgramAsset), "Udon Assembly Program Asset")]
namespace VRC.Udon.Editor.ProgramSources
{
[CreateAssetMenu(menuName = "VRChat/Udon/Udon Assembly Program Asset", fileName = "New Udon Assembly Program Asset")]
public class UdonAssemblyProgramAsset : UdonProgramAsset
{
[SerializeField]
protected string udonAssembly = "";
[SerializeField]
protected string assemblyError = null;
public delegate void AssembleDelegate(bool success, string assembly);
public event AssembleDelegate OnAssemble;
protected override void DrawProgramSourceGUI(UdonBehaviour udonBehaviour, ref bool dirty)
{
DrawAssemblyTextArea(!Application.isPlaying, ref dirty);
DrawAssemblyErrorTextArea();
base.DrawProgramSourceGUI(udonBehaviour, ref dirty);
}
protected override void RefreshProgramImpl()
{
AssembleProgram();
}
[PublicAPI]
protected virtual void DrawAssemblyTextArea(bool allowEditing, ref bool dirty)
{
EditorGUILayout.LabelField("Assembly Code", EditorStyles.boldLabel);
if(GUILayout.Button("Copy Assembly To Clipboard"))
{
EditorGUIUtility.systemCopyBuffer = udonAssembly;
}
EditorGUI.BeginChangeCheck();
using(new EditorGUI.DisabledScope(!allowEditing))
{
string newAssembly = EditorGUILayout.TextArea(udonAssembly);
if(EditorGUI.EndChangeCheck())
{
dirty = true;
Undo.RecordObject(this, "Edit Assembly Program Code");
udonAssembly = newAssembly;
UdonEditorManager.Instance.QueueAndRefreshProgram(this);
}
}
}
[PublicAPI]
protected void DrawAssemblyErrorTextArea()
{
if(string.IsNullOrEmpty(assemblyError))
{
return;
}
EditorGUILayout.LabelField("Assembly Error", EditorStyles.boldLabel);
using(new EditorGUI.DisabledScope(true))
{
EditorGUILayout.TextArea(assemblyError);
}
}
[PublicAPI]
protected void AssembleProgram()
{
try
{
program = UdonEditorManager.Instance.Assemble(udonAssembly);
assemblyError = null;
OnAssemble?.Invoke(true, udonAssembly);
}
catch(Exception e)
{
program = null;
assemblyError = e.Message;
Debug.LogException(e);
OnAssemble?.Invoke(false, assemblyError);
}
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAsset.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 22203902d63dec94194fefc3e155c43b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

9
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetEditor.cs

@ -0,0 +1,9 @@
using UnityEditor;
namespace VRC.Udon.Editor.ProgramSources
{
[CustomEditor(typeof(UdonAssemblyProgramAsset))]
public class UdonAssemblyProgramAssetEditor : UdonProgramAssetEditor
{
}
}

11
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetEditor.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3df823f3ab561fc43bcb81286e14b91d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

27
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetImporter.cs

@ -0,0 +1,27 @@
using System.IO;
using JetBrains.Annotations;
using UnityEditor;
using UnityEditor.Experimental.AssetImporters;
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources
{
[ScriptedImporter(1, "uasm")]
[UsedImplicitly]
public class UdonAssemblyProgramAssetImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
UdonAssemblyProgramAsset udonAssemblyProgramAsset = ScriptableObject.CreateInstance<UdonAssemblyProgramAsset>();
SerializedObject serializedUdonAssemblyProgramAsset = new SerializedObject(udonAssemblyProgramAsset);
SerializedProperty udonAssemblyProperty = serializedUdonAssemblyProgramAsset.FindProperty("udonAssembly");
udonAssemblyProperty.stringValue = File.ReadAllText(ctx.assetPath);
serializedUdonAssemblyProgramAsset.ApplyModifiedProperties();
udonAssemblyProgramAsset.RefreshProgram();
ctx.AddObjectToAsset("Imported Udon Assembly Program", udonAssemblyProgramAsset);
ctx.SetMainObject(udonAssemblyProgramAsset);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonAssemblyProgram/UdonAssemblyProgramAssetImporter.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3c0638314c289c24193b47d1c53c9fca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonGraphProgram.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 04c2ed681affa574b89c2f0bc6e24f6e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 684d711700581a34e89f00f67c138275
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f5c8083b2515f384d9d877c7e080b7c6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b19c72abba72afd419003ab8fe1ae7ab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/ByteField.cs

@ -0,0 +1,35 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
#else
using UnityEngine.Experimental.UIElements;
#endif
using System;
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI
{
public class ByteField : BaseField<byte>
{
#if UNITY_2019_3_OR_NEWER
public ByteField():base(null,null)
#else
public ByteField():base()
#endif
{
// Set up styling
AddToClassList("UdonValueField");
// Create Char Editor and listen for changes
TextField field = new TextField();
#if UNITY_2019_3_OR_NEWER
field.RegisterValueChangedCallback(
#else
field.OnValueChanged(
#endif
e =>
value = Convert.ToByte(e.newValue));
Add(field);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/ByteField.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c66f97d5a5a38cb478fd4df11ece7be7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

34
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/CharField.cs

@ -0,0 +1,34 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
#else
using UnityEngine.Experimental.UIElements;
#endif
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI
{
public class CharField : BaseField<char>
{
#if UNITY_2019_3_OR_NEWER
public CharField():base(null,null)
#else
public CharField():base()
#endif
{
// Set up styling
AddToClassList("UdonValueField");
// Create Char Editor and listen for changes
TextField field = new TextField();
field.maxLength = 1;
#if UNITY_2019_3_OR_NEWER
field.RegisterValueChangedCallback(
#else
field.OnValueChanged(
#endif
e =>
value = e.newValue.ToCharArray()[0]);
Add(field);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/CharField.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 602ffcf431b3e4f41a18bd868751439a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

37
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/LayerMaskField.cs

@ -0,0 +1,37 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
using UIElements = UnityEditor.UIElements;
#else
using UnityEngine.Experimental.UIElements;
using UIElements = UnityEditor.Experimental.UIElements;
#endif
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI
{
public class LayerMaskField : BaseField<LayerMask>
{
#if UNITY_2019_3_OR_NEWER
public LayerMaskField() : base(null,null)
#else
public LayerMaskField()
#endif
{
// Set up styling
AddToClassList("UdonValueField");
// Create LayerMask Editor and listen for changes
UIElements.LayerMaskField field = new UIElements.LayerMaskField();
#if UNITY_2019_3_OR_NEWER
field.RegisterValueChangedCallback(e =>
#else
field.OnValueChanged(e =>
#endif
{
this.value = e.newValue;
});
Add(field);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/LayerMaskField.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 42d9183d7c7ce67448d1e010456e36f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

37
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/QuaternionField.cs

@ -0,0 +1,37 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
using UnityEditor.UIElements;
#else
using UnityEngine.Experimental.UIElements;
using UnityEditor.Experimental.UIElements;
#endif
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI
{
public class QuaternionField : BaseField<Quaternion>
{
#if UNITY_2019_3_OR_NEWER
public QuaternionField() :base(null, null)
#else
public QuaternionField()
#endif
{
// Set up styling
AddToClassList("UdonValueField");
// Create Vector4 Editor and listen for changes
Vector4Field field = new Vector4Field();
#if UNITY_2019_3_OR_NEWER
field.RegisterValueChangedCallback(
#else
field.OnValueChanged(
#endif
e =>
value = new Quaternion(e.newValue.x, e.newValue.y, e.newValue.z, e.newValue.w)
);
Add(field);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/QuaternionField.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1c96407d2b7698c4c8a0476efa2c765d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

35
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/VRCUrlField.cs

@ -0,0 +1,35 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
#else
using UnityEngine.Experimental.UIElements;
#endif
using System;
using VRC.SDKBase;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI
{
public class VRCUrlField : BaseField<VRCUrl>
{
#if UNITY_2019_3_OR_NEWER
public VRCUrlField():base(null,null)
#else
public VRCUrlField():base()
#endif
{
// Set up styling
AddToClassList("UdonValueField");
// Create Text Editor and listen for changes
TextField field = new TextField(50, false, false, Char.MinValue);
#if UNITY_2019_3_OR_NEWER
field.RegisterValueChangedCallback(
#else
field.OnValueChanged(
#endif
e =>
value = new VRCUrl(e.newValue)
);
Add(field);
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/Fields/VRCUrlField.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eeb751ae1c234a04291c5039626f3470
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4bfc67435ab3e404c9d54568400b5ab4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

81
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/GraphElementExtension.cs

@ -0,0 +1,81 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
#else
using UnityEngine.Experimental.UIElements;
#endif
using System;
using UnityEditor.SceneManagement;
using UnityEngine;
using VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI.GraphView;
#if UNITY_2019_3_OR_NEWER
namespace UnityEditor.Experimental.GraphView
#else
namespace UnityEditor.Experimental.UIElements.GraphView
#endif
{
public static class GraphElementExtension
{
public static void Reload(this GraphElement element)
{
var evt = new Event()
{
type = EventType.ExecuteCommand,
commandName = UdonGraphCommands.Reload
};
using (var e = ExecuteCommandEvent.GetPooled(evt))
{
element.SendEvent(e);
}
}
public static void Compile(this GraphElement element)
{
var evt = new Event()
{
type = EventType.ExecuteCommand,
commandName = UdonGraphCommands.Compile
};
using (var e = ExecuteCommandEvent.GetPooled(evt))
{
element.SendEvent(e);
}
}
public static string GetUid(this GraphElement element)
{
#if UNITY_2019_3_OR_NEWER
return element.viewDataKey;
#else
return element.persistenceKey;
#endif
}
public static void MarkDirty()
{
if (!EditorApplication.isPlaying)
{
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
}
}
public static Vector2 GetSnappedPosition(Vector2 position)
{
// don't snap at 0 size
var snap = Settings.GridSnapSize;
if (snap == 0) return position;
position.x = (float)Math.Round(position.x / snap) * snap;
position.y = (float)Math.Round(position.y / snap) * snap;
return position;
}
public static Rect GetSnappedRect(Rect rect)
{
rect.position = GetSnappedPosition(rect.position);
return rect;
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/GraphElementExtension.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 469db50616185d04e8a46dcd75db12d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

86
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayEditor.cs

@ -0,0 +1,86 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
#else
using UnityEngine.Experimental.UIElements;
#endif
using System;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI.GraphView
{
public class UdonArrayEditor : VisualElement
{
private IArrayProvider _inspector;
private Button _editArrayButton;
private Action<object> _setValueCallback;
private Type _type;
private object _value;
private bool _inspectorOpen = false;
public UdonArrayEditor(Type t, Action<object> valueChangedAction, object value)
{
_setValueCallback = valueChangedAction;
_value = value;
_type = t.GetElementType();
_editArrayButton = new Button(EditArray)
{
text = "Edit",
name = "array-editor",
};
Add(_editArrayButton);
}
private void EditArray()
{
if (_inspector == null)
{
// Create it new
Type typedArrayInspector = (typeof(UdonArrayInspector<>)).MakeGenericType(_type);
_inspector = (Activator.CreateInstance(typedArrayInspector, null, _value) as IArrayProvider);
AddInspector();
_inspectorOpen = true;
_editArrayButton.text = "Save";
return;
}
else
{
// Update Values when 'Save' is clicked
if(_inspectorOpen)
{
// Update Values
var values = _inspector.GetValues();
_setValueCallback(values);
// Remove Inspector
_inspector.RemoveFromHierarchy();
// Update Button Text
_editArrayButton.text = "Edit";
_inspectorOpen = false;
return;
}
else
{
// Inspector exists, it's just removed
_inspectorOpen = true;
AddInspector();
_editArrayButton.text = "Save";
}
}
}
private void AddInspector()
{
if (parent.GetType() == typeof(UdonPort))
{
parent.parent.Add(_inspector as VisualElement);
}
else
{
Add(_inspector as VisualElement);
}
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayEditor.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7f257a6eeae213a4db991d486cace003
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

156
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayInspector.cs

@ -0,0 +1,156 @@
#if UNITY_2019_3_OR_NEWER
using UnityEngine.UIElements;
using UnityEditor.UIElements;
#else
using UnityEngine.Experimental.UIElements;
using UnityEditor.Experimental.UIElements;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI.GraphView
{
public class UdonArrayInspector<T> : VisualElement, IArrayProvider
{
private ScrollView _scroller;
private List<VisualElement> _fields = new List<VisualElement>();
private IntegerField _sizeField;
private Action<object> _setValueCallback;
public UdonArrayInspector(Action<object> valueChangedAction, object value)
{
_setValueCallback = valueChangedAction;
AddToClassList("input-inspector");
var resizeContainer = new VisualElement()
{
name = "resize-container",
};
resizeContainer.Add(new Label("size"));
_sizeField = new IntegerField();
_sizeField.isDelayed = true;
#if UNITY_2019_3_OR_NEWER
_sizeField.RegisterValueChangedCallback((evt) =>
#else
_sizeField.OnValueChanged((evt) =>
#endif
{
ResizeTo(evt.newValue);
});
resizeContainer.Add(_sizeField);
Add(resizeContainer);
_scroller = new ScrollView()
{
name = "array-scroll",
};
Add(_scroller);
if (value == null)
{
// Can't show if array is empty
_sizeField.value = 0;
return;
}
else
{
IEnumerable<T> values = (value as IEnumerable<T>);
if (values == null)
{
Debug.LogError($"Couldn't convert {value} to {typeof(T).ToString()} Array");
return;
}
// Populate fields and their values from passed-in array
_fields = new List<VisualElement>();
foreach (var item in values)
{
var field = GetValueField(item);
_fields.Add(field);
_scroller.contentContainer.Add(field);
}
_sizeField.value = values.Count();
}
}
private void ResizeTo(int newValue)
{
_sizeField.value = newValue;
// Create from scratch if currentFields are null
if(_fields == null)
{
Debug.Log($"Creating from Scratch");
_fields = new List<VisualElement>();
for (int i = 0; i < newValue; i++)
{
var field = GetValueField(null);
_fields.Add(field);
_scroller.contentContainer.Add(field as VisualElement);
}
return;
}
// Shrink list if new value is less than old one
if(newValue < _fields.Count)
{
for (int i = _fields.Count - 1; i >= newValue; i--)
{
(_fields[i] as VisualElement).RemoveFromHierarchy();
_fields.RemoveAt(i);
}
MarkDirtyRepaint();
return;
}
// Expand list if new value is more than old one.
if(newValue > _fields.Count)
{
int numberToAdd = newValue - _fields.Count;
for (int i = 0; i < numberToAdd; i++)
{
var field = GetValueField(null);
if (field == null)
{
Debug.LogWarning($"Sorry, can't edit object of type {typeof(T).ToString()} yet.");
return;
}
_fields.Add(field);
_scroller.contentContainer.Add(field as VisualElement);
}
MarkDirtyRepaint();
return;
}
}
private VisualElement GetValueField(object value)
{
return UdonFieldFactory.CreateField(typeof(T), value, _setValueCallback);
}
public object GetValues()
{
var result = new List<T>();
for (int i = 0; i < _fields.Count; i++)
{
var f = (_fields[i] as INotifyValueChanged<T>);
result.Add(f.value);
}
return result.ToArray();
}
}
public interface IArrayProvider
{
object GetValues();
void RemoveFromHierarchy(); // in VisualElement
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonArrayInspector.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4f0ade55ae13b6468a765826f1f2540
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

220
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonComment.cs

@ -0,0 +1,220 @@
#if UNITY_2019_3_OR_NEWER
using UnityEditor.Experimental.GraphView;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
using UnityEngine.UIElements.StyleSheets;
#else
using UnityEditor.Experimental.UIElements.GraphView;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleSheets;
#endif
using System;
using UnityEditor;
using UnityEngine;
namespace VRC.Udon.Editor.ProgramSources.UdonGraphProgram.UI.GraphView
{
public class UdonComment : UdonGraphElement, IUdonGraphElementDataProvider
{
private VisualElement _mainContainer;
private Label _label;
private TextField _textField;
private CustomData _customData = new CustomData();
private UdonGraph _graph;
public UdonGroup group;
// Called from Context menu and Reload
public static UdonComment Create(string value, Rect position, UdonGraph graph)
{
var comment = new UdonComment("", graph);
// make sure rect size is not 0
position.width = position.width > 0 ? position.width : 128;
position.height = position.height > 0 ? position.height : 40;
comment._customData.layout = position;
comment._customData.title = value;
comment.UpdateFromData();
graph.MarkSceneDirty();
return comment;
}
public static UdonComment Create(UdonGraphElementData elementData, UdonGraph graph)
{
var comment = new UdonComment(elementData.jsonData, graph);
comment.UpdateFromData();
graph.MarkSceneDirty();
return comment;
}
private UdonComment(string jsonData, UdonGraph graph)
{
title = "Comment";
name = "comment";
_graph = graph;
capabilities |= Capabilities.Selectable | Capabilities.Movable | Capabilities.Deletable |
Capabilities.Resizable;
pickingMode = PickingMode.Ignore;
type = UdonGraphElementType.UdonComment;
if(!string.IsNullOrEmpty(jsonData))
{
EditorJsonUtility.FromJsonOverwrite(jsonData, _customData);
}
_mainContainer = new VisualElement();
_mainContainer.StretchToParentSize();
_mainContainer.AddToClassList("mainContainer");
Add(_mainContainer);
_label = new Label();
_label.RegisterCallback<MouseDownEvent>(OnLabelClick);
_mainContainer.Add(_label);
_textField = new TextField(1000, true, false, '*');
_textField.isDelayed = true;
// Support IME
_textField.RegisterCallback<FocusInEvent>(evt =>{ Input.imeCompositionMode = IMECompositionMode.On;});
_textField.RegisterCallback<FocusOutEvent>(evt =>
{
SetText(_textField.text);
Input.imeCompositionMode = IMECompositionMode.Auto;
SwitchToEditMode(false);
});
#if UNITY_2019_3_OR_NEWER
_textField.RegisterValueChangedCallback((evt) =>
#else
_textField.OnValueChanged((evt) =>
#endif
{
SetText(evt.newValue);
SwitchToEditMode(false);
});
}
private void SaveNewData()
{
_graph.SaveGraphElementData(this);
}
private void UpdateFromData()
{
if(_customData != null)
{
layer = _customData.layer;
if(string.IsNullOrEmpty(_customData.uid))
{
_customData.uid = Guid.NewGuid().ToString();
}
uid = _customData.uid;
SetPosition(_customData.layout);
SetText(_customData.title);
}
}
#if UNITY_2019_3_OR_NEWER
protected override void OnCustomStyleResolved(ICustomStyle style)
{
base.OnCustomStyleResolved(style);
#else
protected override void OnStyleResolved(ICustomStyle style)
{
base.OnStyleResolved(style);
#endif
// Something is forcing style! Resetting a few things here, grrr.
this.style.borderBottomWidth = 1;
var resizer = this.Q(null, "resizer");
if(resizer != null)
{
resizer.style.paddingTop = 0;
resizer.style.paddingLeft = 0;
}
}
public override void SetPosition(Rect newPos)
{
newPos = GraphElementExtension.GetSnappedRect(newPos);
base.SetPosition(newPos);
}
public override void UpdatePresenterPosition()
{
base.UpdatePresenterPosition();
_customData.layout = GraphElementExtension.GetSnappedRect(GetPosition());
SaveNewData();
if (group != null)
{
group.SaveNewData();
}
}
private double lastClickTime;
private const double doubleClickSpeed = 0.5;
private void OnLabelClick(MouseDownEvent evt)
{
var newTime = EditorApplication.timeSinceStartup;
if(newTime - lastClickTime < doubleClickSpeed)
{
SwitchToEditMode(true);
}
lastClickTime = newTime;
}
private void SwitchToEditMode(bool switchingToEdit)
{
if (switchingToEdit)
{
_mainContainer.Remove(_label);
_textField.value = _label.text;
_mainContainer.Add(_textField);
_textField.Focus();
_textField.SelectAll();
}
else
{
_mainContainer.Remove(_textField);
_mainContainer.Add(_label);
}
MarkDirtyRepaint();
}
public void SetText(string value)
{
Undo.RecordObject(_graph.graphProgramAsset, "Rename Comment");
value = value.TrimEnd();
_customData.title = value;
_label.text = value;
SaveNewData();
MarkDirtyRepaint();
}
public UdonGraphElementData GetData()
{
return new UdonGraphElementData(UdonGraphElementType.UdonComment, uid,
EditorJsonUtility.ToJson(_customData));
}
public class CustomData
{
public string uid;
public Rect layout;
public string title = "Comment";
public int layer;
public Color elementTypeColor;
}
}
}

11
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonComment.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7e5916b8dd19e4445a9156a457b82ee4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

48
Assets/Udon/Editor/ProgramSources/UdonGraphProgram/UI/GraphView/GraphElements/UdonGraphElement.cs

@ -0,0 +1,48 @@
#if UNITY_2019_3_OR_NEWER
using UnityEditor.Experimental.GraphView;
#else
using UnityEditor.Experimental.UIElements.GraphView;
#endif
using System;
using UnityEngine;