Refactor VRCBoard components and update material properties

This commit is contained in:
2024-10-15 14:58:58 +03:00
parent ea409c627a
commit e25230326b
8 changed files with 477 additions and 686 deletions

View File

@@ -46,7 +46,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
serializationData:
SerializedFormat: 2
SerializedFormat: 0
SerializedBytes:
ReferencedUnityObjects: []
SerializedBytesString:
@@ -57,6 +57,7 @@ MonoBehaviour:
_udonSharpBackingUdonBehaviour: {fileID: 1195327852248355995}
vrcBoardDomain: mydomain.vrcboard.app
periodicUpdateInterval: 60
atlasUrlCount: 100
vrcBoardComponents: []
atlasUrls:
- url: http://mydomain.vrcboard.app/atlas/0
@@ -185,7 +186,7 @@ MonoBehaviour:
AllowCollisionOwnershipTransfer: 0
Reliable: 0
_syncMethod: 0
serializedProgramAsset: {fileID: 11400000, guid: b0a3201f714d46b4cbdb27ef08a99c58,
serializedProgramAsset: {fileID: 11400000, guid: f9597e921c7b6ed43b9c0e546b52af81,
type: 2}
programSource: {fileID: 11400000, guid: c4183376def25d24a8d2963d59ac2cd2, type: 2}
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF

View File

@@ -59,9 +59,12 @@ MonoBehaviour:
_udonSharpBackingUdonBehaviour: {fileID: 9181003179774458621}
manager: {fileID: 0}
uploaderIdOverride:
AlbedoImageId: 1234
EmissionImageId: 1234
NormalImageId:
imageIds:
- 1234
texturePropertyMappings:
- _MainTex
defaultTextures:
- {fileID: 0}
--- !u!33 &2163663917368825931
MeshFilter:
m_ObjectHideFlags: 0
@@ -132,7 +135,7 @@ MonoBehaviour:
AllowCollisionOwnershipTransfer: 0
Reliable: 0
_syncMethod: 1
serializedProgramAsset: {fileID: 11400000, guid: f83f88ce349d298438a783df6b33c10f,
serializedProgramAsset: {fileID: 11400000, guid: 19ae0697d87c22c40b5eceb361997922,
type: 2}
programSource: {fileID: 11400000, guid: ac7f998a74898ea4ead01ba49e49e658, type: 2}
serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAR8AAABfAF8AXwBVAGQAbwBuAFMAaABhAHIAcABCAGUAaABhAHYAaQBvAHUAcgBWAGUAcgBzAGkAbwBuAF8AXwBfACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQACAAAABwUHBQcF

View File

@@ -105,7 +105,7 @@ namespace VRCBoard.Components
if (Application.isPlaying)
{
EditorGUILayout.LabelField("Cannot edit a VRCBoard component while in play mode");
return;
//return;
}
base.OnInspectorGUI();

View File

@@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 16
Data: 10
- Name:
Entry: 7
Data:
@@ -329,19 +329,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: albedoImageId
Data: imageIds
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: albedoImageId
Data: imageIds
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -356,16 +362,22 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 19|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
Data: 2
- Name:
Entry: 7
Data: 20|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
Data: 21|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Image IDs
Data: Uploader Image Mappings
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 22|UnityEngine.HideInInspector, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -386,67 +398,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: emissionImageId
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: emissionImageId
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: normalImageId
Data: texturePropertyMappings
- Name: $v
Entry: 7
Data: 23|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: normalImageId
Data: texturePropertyMappings
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -464,7 +428,13 @@ MonoBehaviour:
Data: 24|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 25|UnityEngine.HideInInspector, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -482,25 +452,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: defaultAlbedo
Data: defaultTextures
- Name: $v
Entry: 7
Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 26|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: defaultAlbedo
Data: defaultTextures
- Name: <UserType>k__BackingField
Entry: 7
Data: 26|System.RuntimeType, mscorlib
Data: 27|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Texture2D, UnityEngine.CoreModule
Data: UnityEngine.Texture2D[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
Data: 27
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -515,16 +485,13 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 28|UnityEngine.HeaderAttribute, UnityEngine.CoreModule
- Name: header
Entry: 1
Data: Defaults
Data: 29|UnityEngine.HideInInspector, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -545,25 +512,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: albedoColor
Data: _mainType
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: albedoColor
Data: _mainType
- Name: <UserType>k__BackingField
Entry: 7
Data: 30|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Color, UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -575,304 +536,10 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 31|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 32|UnityEngine.ColorUsageAttribute, UnityEngine.CoreModule
- Name: showAlpha
Entry: 5
Data: true
- Name: hdr
Entry: 5
Data: true
- Name: minBrightness
Entry: 4
Data: 0
- Name: maxBrightness
Entry: 4
Data: 8
- Name: minExposureValue
Entry: 4
Data: 0.125
- Name: maxExposureValue
Entry: 4
Data: 3
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: defaultEmission
- Name: $v
Entry: 7
Data: 33|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: defaultEmission
- Name: <UserType>k__BackingField
Entry: 9
Data: 26
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: emissionColor
- Name: $v
Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: emissionColor
- Name: <UserType>k__BackingField
Entry: 9
Data: 30
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 37|UnityEngine.ColorUsageAttribute, UnityEngine.CoreModule
- Name: showAlpha
Entry: 5
Data: true
- Name: hdr
Entry: 5
Data: true
- Name: minBrightness
Entry: 4
Data: 0
- Name: maxBrightness
Entry: 4
Data: 8
- Name: minExposureValue
Entry: 4
Data: 0.125
- Name: maxExposureValue
Entry: 4
Data: 3
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: defaultNormal
- Name: $v
Entry: 7
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: defaultNormal
- Name: <UserType>k__BackingField
Entry: 9
Data: 26
- Name: <SystemType>k__BackingField
Entry: 9
Data: 26
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: normalIntensity
- Name: $v
Entry: 7
Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: normalIntensity
- Name: <UserType>k__BackingField
Entry: 7
Data: 41|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 41
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 42|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _mainType
- Name: $v
Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _mainType
- Name: <UserType>k__BackingField
Entry: 9
Data: 15
- Name: <SystemType>k__BackingField
Entry: 9
Data: 15
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -896,7 +563,7 @@ MonoBehaviour:
Data: _uploaderId
- Name: $v
Entry: 7
Data: 45|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _uploaderId
@@ -920,7 +587,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 33|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0

View File

@@ -1,58 +1,31 @@
using UdonSharp;
using System;
using UdonSharp;
using UnityEngine;
using UnityEngine.Serialization;
using VRC.SDK3.Data;
using UnityEditor;
namespace VRCBoard.Components
{
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class VRCBoardImage : VRCBoardBaseComponent
{
[Header("Uploader ID (only applies to images of 'shared' or 'instance' type)")]
public string uploaderIdOverride;
[Header("Image IDs")]
public string albedoImageId;
public string emissionImageId;
public string normalImageId;
[Header("Defaults")]
public Texture2D defaultAlbedo;
[ColorUsageAttribute(true,true)] public Color albedoColor = Color.white;
public Texture2D defaultEmission;
[ColorUsageAttribute(true,true)] public Color emissionColor = Color.white;
public Texture2D defaultNormal;
public float normalIntensity = 1.0f;
[Header("Uploader Image Mappings")]
[HideInInspector] public string[] imageIds = new string[0];
[HideInInspector] public string[] texturePropertyMappings = new string[0];
[HideInInspector] public Texture2D[] defaultTextures = new Texture2D[0];
private string _mainType = "";
private string _uploaderId = "";
protected override void OnRegister()
{
MaterialPropertyBlock _propertyBlock = new MaterialPropertyBlock();
Debug.Log("Registering image component");
if (defaultAlbedo)
_propertyBlock.SetTexture("_MainTexAtlas", defaultAlbedo);
if (defaultEmission)
_propertyBlock.SetTexture("_EmissionMapAtlas", defaultEmission);
if (defaultNormal)
_propertyBlock.SetTexture("_NormalMapAtlas", defaultNormal);
_propertyBlock.SetInteger("_MainTexAtlasIndex", 0);
_propertyBlock.SetInteger("_MainTexAtlasSize", 1);
_propertyBlock.SetInteger("_EmissionMapAtlasIndex", 0);
_propertyBlock.SetInteger("_EmissionMapAtlasSize", 1);
_propertyBlock.SetInteger("_NormalMapAtlasIndex", 0);
_propertyBlock.SetInteger("_NormalMapAtlasSize", 1);
_propertyBlock.SetColor("_EmissionColor", emissionColor);
_propertyBlock.SetFloat("_NormalMapScale", normalIntensity);
_propertyBlock.SetColor("_MainTexColor", albedoColor);
GetComponent<Renderer>().SetPropertyBlock(_propertyBlock);
}
@@ -61,7 +34,8 @@ namespace VRCBoard.Components
string uploaderId = "";
if (string.IsNullOrEmpty(uploaderIdOverride))
{
GetImageAtlasTexture(albedoImageId, null, out Texture2D albedoTexture, out int albedoAtlasPosition, out int albedoAtlasSize, out string albedoType);
string firstImageID = imageIds[0];
GetImageAtlasTexture(firstImageID, null, out Texture2D albedoTexture, out int albedoAtlasPosition, out int albedoAtlasSize, out string albedoType);
if (albedoType == null)
{
Debug.LogError("Failed to get image type for albedo image");
@@ -70,7 +44,7 @@ namespace VRCBoard.Components
_mainType = albedoType;
if (_mainType == "shared")
{
uploaderId = GetRandomUploader(albedoImageId);
uploaderId = GetRandomUploader(firstImageID);
}
else
{
@@ -106,9 +80,11 @@ namespace VRCBoard.Components
Debug.LogError("Failed to get uploader ID");
return;
}
RequestImageLoad(albedoImageId, _uploaderId);
RequestImageLoad(emissionImageId, _uploaderId);
RequestImageLoad(normalImageId, _uploaderId);
for (int i = 0; i < imageIds.Length; i++)
{
string imageId = imageIds[i];
RequestImageLoad(imageId, _uploaderId);
}
}
protected override void OnInitialize()
{
@@ -128,52 +104,110 @@ namespace VRCBoard.Components
{
Debug.Log("Image loaded VRCBoardImage");
Texture2D albedoTexture;
int albedoAtlasPosition;
int albedoAtlasSize;
Texture2D emissionTexture;
int emissionAtlasPosition;
int emissionAtlasSize;
//bool textureSuccess = GetImageAtlasTexture(albedoImageId, _uploaderId, out Texture2D texture, out int atlasPosition, out int atlasSize, out string type1);
Texture2D normalTexture;
int normalAtlasPosition;
int normalAtlasSize;
MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();
bool albedoSuccess = GetImageAtlasTexture(albedoImageId, _uploaderId, out albedoTexture, out albedoAtlasPosition, out albedoAtlasSize, out string type1);
bool emissionSuccess = GetImageAtlasTexture(emissionImageId, _uploaderId, out emissionTexture, out emissionAtlasPosition, out emissionAtlasSize, out string type2);
bool normalSuccess = GetImageAtlasTexture(normalImageId, _uploaderId, out normalTexture, out normalAtlasPosition, out normalAtlasSize, out string type3);
MaterialPropertyBlock _propertyBlock = new MaterialPropertyBlock();
if (albedoSuccess && albedoTexture) {
_propertyBlock.SetTexture("_MainTexAtlas", albedoTexture);
_propertyBlock.SetInteger("_MainTexAtlasIndex", albedoAtlasPosition);
_propertyBlock.SetInteger("_MainTexAtlasSize", albedoAtlasSize);
}
else
for (int i = 0; i < imageIds.Length; i++)
{
return;
if (i >= texturePropertyMappings.Length) continue;
string propertyName = texturePropertyMappings[i];
Texture2D texture = manager.GetTexture2D(_uploaderId, imageIds[i]);
if (texture == null) continue;
if (string.IsNullOrEmpty(propertyName)) continue;
propertyBlock.SetTexture(propertyName, texture);
}
if (emissionSuccess && emissionTexture) {
_propertyBlock.SetTexture("_EmissionMapAtlas", emissionTexture);
_propertyBlock.SetInteger("_EmissionMapAtlasIndex", emissionAtlasPosition);
_propertyBlock.SetInteger("_EmissionMapAtlasSize", emissionAtlasSize);
GetComponent<Renderer>().SetPropertyBlock(propertyBlock);
}
}
#if UNITY_EDITOR && !COMPILER_UDONSHARP
[CustomEditor(typeof(VRCBoardImage), true)]
public class VRCBoardImageComponentEditor : Editor
{
public override void OnInspectorGUI()
{
VRCBoardImage script = (VRCBoardImage)target;
Renderer renderer = script.GetComponent<Renderer>();
Material material = renderer.sharedMaterial;
string[] materialPropertyNames = material.GetPropertyNames(MaterialPropertyType.Texture);
base.OnInspectorGUI();
bool equals =
Equals(script.imageIds.Length, script.defaultTextures.Length) &&
Equals(script.imageIds.Length, script.defaultTextures.Length);
EditorGUILayout.Separator();
GUILayout.BeginVertical("Images", "window");
int newSize = script.imageIds.Length;
GUILayout.BeginHorizontal();
if (GUILayout.Button("+"))
{
newSize++;
}
if (normalSuccess && normalTexture) {
_propertyBlock.SetTexture("_NormalMapAtlas", normalTexture);
_propertyBlock.SetInteger("_NormalMapAtlasIndex", normalAtlasPosition);
_propertyBlock.SetInteger("_NormalMapAtlasSize", normalAtlasSize);
if (GUILayout.Button("-"))
{
newSize--;
}
GUILayout.EndHorizontal();
if (newSize != script.imageIds.Length || !equals)
{
Debug.Log("Resized arrays to"+newSize);
Array.Resize(ref script.imageIds, newSize);
Array.Resize(ref script.texturePropertyMappings, newSize);
Array.Resize(ref script.defaultTextures, newSize);
}
MaterialPropertyBlock propertyBlock = new MaterialPropertyBlock();
for (int i = 0; i < script.imageIds.Length; i++)
{
EditorGUILayout.Space();
GUILayout.BeginVertical("Image "+i, "window");
string imageId = script.imageIds[i];
string propertyName = script.texturePropertyMappings[i];
Texture2D defaultImage = script.defaultTextures[i];
imageId = EditorGUILayout.TextField("Image Id:", imageId);
int selectedIndex = Array.IndexOf(materialPropertyNames, propertyName);
selectedIndex = EditorGUILayout.Popup("Material Property:", selectedIndex, materialPropertyNames);
bool propertyExists = Array.Exists(materialPropertyNames, materialProperty => materialProperty == propertyName);
if (propertyExists)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Default Texture:");
defaultImage = EditorGUILayout.ObjectField(defaultImage, typeof(Texture2D), false) as Texture2D;
EditorGUILayout.EndHorizontal();
if (defaultImage != null) propertyBlock.SetTexture(propertyName, defaultImage);
script.defaultTextures[i] = defaultImage;
}
_propertyBlock.SetColor("_EmissionColor", emissionColor);
_propertyBlock.SetFloat("_NormalMapScale", normalIntensity);
_propertyBlock.SetColor("_MainTexColor", albedoColor);
script.imageIds[i] = imageId;
if (selectedIndex >= 0 && selectedIndex < materialPropertyNames.Length) script.texturePropertyMappings[i] = materialPropertyNames[selectedIndex];
GUILayout.EndVertical();
}
renderer.SetPropertyBlock(propertyBlock);
EditorGUILayout.EndHorizontal();
GetComponent<Renderer>().SetPropertyBlock(_propertyBlock);
}
}
#endif
}

View File

@@ -8,7 +8,7 @@ Material:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: VRCBoardImage
m_Shader: {fileID: 4800000, guid: 8391ead9ad6feee41a7c2f7f6ccd5f81, type: 3}
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []

View File

@@ -44,25 +44,25 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 22
Data: 23
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: vrcBoardDomain
Data: debugMode
- Name: $v
Entry: 7
Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: vrcBoardDomain
Data: debugMode
- Name: <UserType>k__BackingField
Entry: 7
Data: 3|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String, mscorlib
Data: System.Boolean, mscorlib
- Name:
Entry: 8
Data:
@@ -104,19 +104,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: periodicUpdateInterval
Data: vrcBoardDomain
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: periodicUpdateInterval
Data: vrcBoardDomain
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single, mscorlib
Data: System.String, mscorlib
- Name:
Entry: 8
Data:
@@ -158,19 +158,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: atlasUrlCount
Data: periodicUpdateInterval
- Name: $v
Entry: 7
Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: atlasUrlCount
Data: periodicUpdateInterval
- Name: <UserType>k__BackingField
Entry: 7
Data: 9|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Int32, mscorlib
Data: System.Single, mscorlib
- Name:
Entry: 8
Data:
@@ -212,31 +212,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: vrcBoardComponents
Data: atlasUrlCount
- Name: $v
Entry: 7
Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: vrcBoardComponents
Data: atlasUrlCount
- Name: <UserType>k__BackingField
Entry: 7
Data: 12|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRCBoard.Components.VRCBoardBaseComponent[], Assembly-CSharp
Data: System.Int32, mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 7
Data: 13|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
Entry: 9
Data: 12
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -251,7 +245,7 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -272,25 +266,31 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: atlasUrls
Data: vrcBoardComponents
- Name: $v
Entry: 7
Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 14|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: atlasUrls
Data: vrcBoardComponents
- Name: <UserType>k__BackingField
Entry: 7
Data: 16|System.RuntimeType, mscorlib
Data: 15|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCUrl[], VRCSDKBase
Data: VRCBoard.Components.VRCBoardBaseComponent[], Assembly-CSharp
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
Entry: 7
Data: 16|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Component[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -326,19 +326,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _imageDownloaders
Data: atlasUrls
- Name: $v
Entry: 7
Data: 18|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _imageDownloaders
Data: atlasUrls
- Name: <UserType>k__BackingField
Entry: 7
Data: 19|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Image.VRCImageDownloader[], VRCSDK3
Data: VRC.SDKBase.VRCUrl[], VRCSDKBase
- Name:
Entry: 8
Data:
@@ -356,7 +356,7 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 20|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
@@ -380,19 +380,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _downloadedAtlasTextures
Data: _imageDownloaders
- Name: $v
Entry: 7
Data: 21|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _downloadedAtlasTextures
Data: _imageDownloaders
- Name: <UserType>k__BackingField
Entry: 7
Data: 22|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Texture2D[], UnityEngine.CoreModule
Data: VRC.SDK3.Image.VRCImageDownloader[], VRCSDK3
- Name:
Entry: 8
Data:
@@ -434,19 +434,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _atlasDownloadTimes
Data: _downloadedAtlasTextures
- Name: $v
Entry: 7
Data: 24|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _atlasDownloadTimes
Data: _downloadedAtlasTextures
- Name: <UserType>k__BackingField
Entry: 7
Data: 25|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single[], mscorlib
Data: UnityEngine.Texture2D[], UnityEngine.CoreModule
- Name:
Entry: 8
Data:
@@ -488,19 +488,25 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: customModuleUrls
Data: _atlasDownloadTimes
- Name: $v
Entry: 7
Data: 27|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: customModuleUrls
Data: _atlasDownloadTimes
- Name: <UserType>k__BackingField
Entry: 9
Data: 16
Entry: 7
Data: 28|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Single[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
Data: 28
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -512,10 +518,10 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 28|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 29|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -536,25 +542,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: atlasInfoUrl
Data: customModuleUrls
- Name: $v
Entry: 7
Data: 29|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: atlasInfoUrl
Data: customModuleUrls
- Name: <UserType>k__BackingField
Entry: 7
Data: 30|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCUrl, VRCSDKBase
- Name:
Entry: 8
Data:
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -590,19 +590,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _atlasInfo
Data: atlasInfoUrl
- Name: $v
Entry: 7
Data: 32|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _atlasInfo
Data: atlasInfoUrl
- Name: <UserType>k__BackingField
Entry: 7
Data: 33|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataDictionary, VRCSDK3
Data: VRC.SDKBase.VRCUrl, VRCSDKBase
- Name:
Entry: 8
Data:
@@ -620,7 +620,7 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 34|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
@@ -644,19 +644,73 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: supporterInfoUrl
Data: _atlasInfo
- Name: $v
Entry: 7
Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _atlasInfo
- Name: <UserType>k__BackingField
Entry: 7
Data: 36|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataDictionary, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 36
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: supporterInfoUrl
- Name: $v
Entry: 7
Data: 38|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: supporterInfoUrl
- Name: <UserType>k__BackingField
Entry: 9
Data: 30
Data: 33
- Name: <SystemType>k__BackingField
Entry: 9
Data: 30
Data: 33
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -671,7 +725,7 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 36|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 39|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -695,16 +749,16 @@ MonoBehaviour:
Data: _supporterInfo
- Name: $v
Entry: 7
Data: 37|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 40|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _supporterInfo
- Name: <UserType>k__BackingField
Entry: 9
Data: 33
Data: 36
- Name: <SystemType>k__BackingField
Entry: 9
Data: 33
Data: 36
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -719,7 +773,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 38|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 41|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -743,70 +797,16 @@ MonoBehaviour:
Data: _supporterInfoVrcLookup
- Name: $v
Entry: 7
Data: 39|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 42|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _supporterInfoVrcLookup
- Name: <UserType>k__BackingField
Entry: 9
Data: 33
Data: 36
- Name: <SystemType>k__BackingField
Entry: 9
Data: 33
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 40|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _supporterList
- Name: $v
Entry: 7
Data: 41|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _supporterList
- Name: <UserType>k__BackingField
Entry: 7
Data: 42|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataList, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 42
Data: 36
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -842,19 +842,73 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _perkNodes
Data: _supporterList
- Name: $v
Entry: 7
Data: 44|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _supporterList
- Name: <UserType>k__BackingField
Entry: 7
Data: 45|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDK3.Data.DataList, VRCSDK3
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 45
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 46|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _perkNodes
- Name: $v
Entry: 7
Data: 47|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _perkNodes
- Name: <UserType>k__BackingField
Entry: 9
Data: 42
Data: 45
- Name: <SystemType>k__BackingField
Entry: 9
Data: 42
Data: 45
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -869,7 +923,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
@@ -893,16 +947,16 @@ MonoBehaviour:
Data: _instanceOwnerOverride
- Name: $v
Entry: 7
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _instanceOwnerOverride
- Name: <UserType>k__BackingField
Entry: 9
Data: 3
Data: 6
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
Data: 6
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -917,19 +971,19 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 47|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 50|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 48|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 51|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 49|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 52|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -953,16 +1007,16 @@ MonoBehaviour:
Data: _instanceOwner
- Name: $v
Entry: 7
Data: 50|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 53|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _instanceOwner
- Name: <UserType>k__BackingField
Entry: 9
Data: 3
Data: 6
- Name: <SystemType>k__BackingField
Entry: 9
Data: 3
Data: 6
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -977,19 +1031,19 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
- Name:
Entry: 7
Data: 52|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 55|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 53|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 56|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -1011,72 +1065,18 @@ MonoBehaviour:
- Name: $k
Entry: 1
Data: imageIdDownloadQueue
- Name: $v
Entry: 7
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: imageIdDownloadQueue
- Name: <UserType>k__BackingField
Entry: 7
Data: 55|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.String[], mscorlib
- Name:
Entry: 8
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 55
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _shouldUpdateAtlasInfo
- Name: $v
Entry: 7
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _shouldUpdateAtlasInfo
Data: imageIdDownloadQueue
- Name: <UserType>k__BackingField
Entry: 7
Data: 58|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
Data: System.String[], mscorlib
- Name:
Entry: 8
Data:
@@ -1094,7 +1094,7 @@ MonoBehaviour:
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 59|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
@@ -1118,19 +1118,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _shouldUpdateSupporterInfo
Data: _shouldUpdateAtlasInfo
- Name: $v
Entry: 7
Data: 60|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _shouldUpdateSupporterInfo
Data: _shouldUpdateAtlasInfo
- Name: <UserType>k__BackingField
Entry: 9
Data: 58
Data: 3
- Name: <SystemType>k__BackingField
Entry: 9
Data: 58
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1166,19 +1166,19 @@ MonoBehaviour:
Data:
- Name: $k
Entry: 1
Data: _currentlyDownloadingUrls
Data: _shouldUpdateSupporterInfo
- Name: $v
Entry: 7
Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentlyDownloadingUrls
Data: _shouldUpdateSupporterInfo
- Name: <UserType>k__BackingField
Entry: 9
Data: 16
Data: 3
- Name: <SystemType>k__BackingField
Entry: 9
Data: 16
Data: 3
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -1209,6 +1209,54 @@ MonoBehaviour:
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _currentlyDownloadingUrls
- Name: $v
Entry: 7
Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentlyDownloadingUrls
- Name: <UserType>k__BackingField
Entry: 9
Data: 19
- Name: <SystemType>k__BackingField
Entry: 9
Data: 19
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
- Name:
Entry: 6
Data:
- Name:
Entry: 8
Data:
- Name: <IsSerialized>k__BackingField
Entry: 5
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
- Name:
Entry: 13
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:

View File

@@ -27,6 +27,8 @@ namespace VRCBoard
}
public class VRCBoardManager : UdonSharpBehaviour
{
public bool debugMode = true;
public string vrcBoardDomain = "mydomain.vrcboard.app";
public float periodicUpdateInterval = 60f;
public string VrcBoardBaseUrl => "https://" + vrcBoardDomain + "/";
@@ -511,13 +513,49 @@ namespace VRCBoard
Texture2D texture = result.Result;
int index = GetAtlasIndexFromUrl(url);
if (index == -1) return;
_downloadedAtlasTextures[index] = result.Result;
_downloadedAtlasTextures[index] = texture;
_atlasDownloadTimes[index] = Time.time;
Debug.Log("Downloaded atlas texture " + index);
foreach (var component in vrcBoardComponents)
component._OnImageLoaded(index);
}
public Texture2D GetTexture2D(string uploader, string imageId)
{
bool success = _GetImageAtlasTexture(imageId, uploader, out int atlasIndex, out Texture2D texture,
out int position, out int size, out string type);
if (!success)
{
Debug.LogWarning("[VRCBoard] [GetTexture2D] Failed to get texture for " + uploader);
return null;
}
if (!texture)
{
Debug.LogWarning("[VRCBoard] [GetTexture2D] Failed to get texture for " + uploader);
return null;
}
int blockSize = (int)Mathf.Floor((float)texture.width / (float)size);
int startX = position % size;
int startY = size - (int)Mathf.Floor((float)position / (float)size) - 1;
// Debug.Log("texture startX:" + startX + ", startY:" + startY);
int blockWidth = blockSize;
int blockHeight = blockSize;
Texture2D newTexture = new Texture2D (blockWidth, blockHeight);
Color[] pixels = texture.GetPixels(startX * blockWidth, startY * blockHeight, blockWidth, blockHeight);
newTexture.SetPixels(pixels);
newTexture.wrapMode = TextureWrapMode.Clamp;
newTexture.Apply();
return newTexture;
}
public override void OnImageLoadError(IVRCImageDownload result)
{
base.OnImageLoadError(result);
@@ -532,7 +570,7 @@ namespace VRCBoard
return -1;
}
[PublicAPI] public VRCUrl GetAtlasUrlFromIndex(int index)
private VRCUrl GetAtlasUrlFromIndex(int index)
{
if (index < 0 || index >= atlasUrls.Length || atlasUrls[index] == null)
{
@@ -610,7 +648,7 @@ namespace VRCBoard
string domainInput = EditorGUILayout.TextField("Your VRCBoard Domain", manager.vrcBoardDomain);
bool changed = domainInput != manager.vrcBoardDomain;
int urlCount = EditorGUILayout.IntField("Atlas Url Count [1-1000]", manager.atlasUrlCount);
int urlCount = EditorGUILayout.IntField("Atlas Url Count [10-1000]", manager.atlasUrlCount);
bool urlCountChanged = urlCount != manager.atlasUrlCount;
manager.atlasUrlCount = Math.Clamp(urlCount, 10, 1000);
@@ -625,8 +663,8 @@ namespace VRCBoard
string baseUrl = manager.VrcBoardBaseUrl;
// update the urls
manager.atlasUrls = new VRCUrl[urlCount];
for (int i = 0; i < urlCount; i++)
manager.atlasUrls = new VRCUrl[manager.atlasUrlCount];
for (int i = 0; i < manager.atlasUrlCount; i++)
{
manager.atlasUrls[i] = new VRCUrl(baseUrl + "atlas/" + i);
}