Skip to content

Commit

Permalink
Fixed issue/1 and made the editor sections of enhancement and state with
Browse files Browse the repository at this point in the history
data the same
  • Loading branch information
MMMaellon committed Jun 7, 2024
1 parent 03e8b96 commit 75a1267
Show file tree
Hide file tree
Showing 12 changed files with 137 additions and 227 deletions.
7 changes: 4 additions & 3 deletions Assets/MMMaellon/ExampleScene/ExampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,8 @@ MonoBehaviour:
attachToSelf: 1
attachToOthers: 1
attachToAvatarBones: 1
allowedBones: 00000000
_allowedBones: 00000000
allowedBones: 25000000
_allowedBones: 25000000
--- !u!114 &657008252
MonoBehaviour:
m_ObjectHideFlags: 2
Expand Down Expand Up @@ -1660,7 +1660,7 @@ Transform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1301493001
MonoBehaviour:
m_ObjectHideFlags: 2
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
Expand Down Expand Up @@ -21662,6 +21662,7 @@ MonoBehaviour:
- VRC.Udon.UdonBehaviour
portraitCameraPositionOffset: {x: 0, y: 0, z: 0}
portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139}
NavigationAreas: []
--- !u!64 &7606902903243430482
MeshCollider:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MonoBehaviour:
Data:
- Name:
Entry: 12
Data: 23
Data: 22
- Name:
Entry: 7
Data:
Expand Down Expand Up @@ -806,72 +806,18 @@ MonoBehaviour:
- Name:
Entry: 7
Data:
- Name: $k
Entry: 1
Data: _allowedBones
- Name: $v
Entry: 7
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _allowedBones
- Name: <UserType>k__BackingField
Entry: 9
Data: 40
- Name: <SystemType>k__BackingField
Entry: 9
Data: 40
- 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: 44|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 1
- Name:
Entry: 7
Data: 45|UnityEngine.HideInInspector, UnityEngine.CoreModule
- 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: data
- Name: $v
Entry: 7
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 43|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: data
- Name: <UserType>k__BackingField
Entry: 7
Data: 47|System.RuntimeType, mscorlib
Data: 44|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: MMMaellon.LightSync.AttachToPlayerData, com.mmmaellon.lightsync
Expand All @@ -895,7 +841,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 48|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 45|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -919,13 +865,13 @@ MonoBehaviour:
Data: attachTargets
- Name: $v
Entry: 7
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 46|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: attachTargets
- Name: <UserType>k__BackingField
Entry: 7
Data: 50|System.RuntimeType, mscorlib
Data: 47|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCPlayerApi[], VRCSDKBase
Expand All @@ -934,7 +880,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 50
Data: 47
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -949,7 +895,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 51|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
Expand All @@ -973,13 +919,13 @@ MonoBehaviour:
Data: attachTarget
- Name: $v
Entry: 7
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 49|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: attachTarget
- Name: <UserType>k__BackingField
Entry: 7
Data: 53|System.RuntimeType, mscorlib
Data: 50|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: VRC.SDKBase.VRCPlayerApi, VRCSDKBase
Expand All @@ -988,7 +934,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 53
Data: 50
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -1003,7 +949,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 54|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 51|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -1027,16 +973,16 @@ MonoBehaviour:
Data: _allPlayers
- Name: $v
Entry: 7
Data: 55|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 52|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _allPlayers
- Name: <UserType>k__BackingField
Entry: 9
Data: 50
Data: 47
- Name: <SystemType>k__BackingField
Entry: 9
Data: 50
Data: 47
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -1051,7 +997,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 56|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 53|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -1075,7 +1021,7 @@ MonoBehaviour:
Data: _currentPlayerDistance
- Name: $v
Entry: 7
Data: 57|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 54|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _currentPlayerDistance
Expand All @@ -1099,7 +1045,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 55|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -1123,13 +1069,13 @@ MonoBehaviour:
Data: _centeredVector
- Name: $v
Entry: 7
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 56|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _centeredVector
- Name: <UserType>k__BackingField
Entry: 7
Data: 60|System.RuntimeType, mscorlib
Data: 57|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: UnityEngine.Vector3, UnityEngine.CoreModule
Expand All @@ -1138,7 +1084,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 60
Data: 57
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -1153,7 +1099,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 61|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 58|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -1177,16 +1123,16 @@ MonoBehaviour:
Data: _projectedTarget
- Name: $v
Entry: 7
Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 59|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: _projectedTarget
- Name: <UserType>k__BackingField
Entry: 9
Data: 60
Data: 57
- Name: <SystemType>k__BackingField
Entry: 9
Data: 60
Data: 57
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -1201,7 +1147,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 60|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand All @@ -1225,16 +1171,16 @@ MonoBehaviour:
Data: localPlayer
- Name: $v
Entry: 7
Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 61|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: localPlayer
- Name: <UserType>k__BackingField
Entry: 9
Data: 53
Data: 50
- Name: <SystemType>k__BackingField
Entry: 9
Data: 53
Data: 50
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
Expand All @@ -1249,7 +1195,7 @@ MonoBehaviour:
Data: false
- Name: _fieldAttributes
Entry: 7
Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 62|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ public class AttachToPlayer : LightSyncEnhancementWithData
//For displaying in the editor only
[HideInInspector]
public HumanBodyBones[] _allowedBones = { 0 };
#else
//For displaying in the editor only
[HideInInspector]
public int[] _allowedBones = { 0 };
#endif

AttachToPlayerData data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ public virtual void Reset()

public virtual void AutoSetup()
{
Debug.LogWarning("past wait");
if (!sync)
{
Debug.LogWarning("no sync");
sync = GetComponent<LightSync>();
}
Debug.LogWarning("end");
}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

using System.Collections.Generic;
using UnityEngine;
using VRC.SDKBase;
using UnityEditor;
using UnityEngine.Rendering.VirtualTexturing;

namespace MMMaellon.LightSync
{
Expand All @@ -13,7 +10,6 @@ public abstract class LightSyncEnhancementWithData : LightSyncEnhancement
[HideInInspector]
public LightSyncEnhancementData enhancementData;

// public abstract LightSyncEnhancementData CreateDataObject(GameObject dataObject);
public abstract void OnDataObjectCreation(LightSyncEnhancementData enhancementData);
public abstract void OnDataDeserialization();
public abstract string GetDataTypeName();
Expand Down Expand Up @@ -50,16 +46,21 @@ public virtual void CreateDataObject()
return;
}
GameObject dataObject = new(name + "_enhancementData");
dataObject.transform.SetParent(transform, false);
enhancementData = dataObject.AddComponent(dataType).GetComponent<LightSyncEnhancementData>();
if (enhancementData)
{
enhancementData.enhancement = this;
}
}
if (enhancementData)
{
enhancementData.gameObject.name = name + "_enhancementData";
GameObject dataObject = enhancementData.gameObject;
if (sync.unparentInternalObjects && dataObject.transform.parent != null)
{
dataObject.transform.SetParent(null, false);
}
else if (!sync.unparentInternalObjects && dataObject.transform.parent != transform)
{
dataObject.transform.SetParent(transform, false);
}
dataObject.name = name + "_enhancementData";
enhancementData.enhancement = this;
enhancementData.RefreshHideFlags();
OnDataObjectCreation(enhancementData);
}
Expand Down
Loading

0 comments on commit 75a1267

Please sign in to comment.