Skip to content

Commit

Permalink
Avatarlight will now use Constraints if SDK is not present, otherwise…
Browse files Browse the repository at this point in the history
… use VRCConstraints
  • Loading branch information
Melioli committed Sep 4, 2024
1 parent 13d48fb commit a98dac3
Show file tree
Hide file tree
Showing 7 changed files with 304 additions and 7 deletions.
248 changes: 248 additions & 0 deletions Resources/Prefabs/AvatarLight Default.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &656005006880332676
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3588317102343359374}
- component: {fileID: 5705298529629539922}
m_Layer: 0
m_Name: Container
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3588317102343359374
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 656005006880332676}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1477816925444639861}
m_Father: {fileID: 5911144295518134131}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1773428102 &5705298529629539922
ParentConstraint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 656005006880332676}
m_Enabled: 1
serializedVersion: 2
m_Weight: 1
m_TranslationAtRest: {x: 0, y: 0, z: 0}
m_RotationAtRest: {x: 0, y: 0, z: 0}
m_TranslationOffsets:
- {x: 0, y: 0, z: 0}
m_RotationOffsets:
- {x: 0, y: 0, z: 0}
m_AffectTranslationX: 1
m_AffectTranslationY: 1
m_AffectTranslationZ: 1
m_AffectRotationX: 1
m_AffectRotationY: 1
m_AffectRotationZ: 1
m_Active: 1
m_IsLocked: 1
m_Sources:
- sourceTransform: {fileID: 550315850286599067}
weight: 1
--- !u!1 &3783984998393350927
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 550315850286599067}
m_Layer: 0
m_Name: ResetTransform
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &550315850286599067
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3783984998393350927}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5911144295518134131}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &3973343453313246528
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1477816925444639861}
- component: {fileID: 7076472833812128175}
m_Layer: 0
m_Name: AvatarLight
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1477816925444639861
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3973343453313246528}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0.92387956, z: 0.38268343, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 3588317102343359374}
m_LocalEulerAnglesHint: {x: 45, y: -180, z: 0}
--- !u!108 &7076472833812128175
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3973343453313246528}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 0.001
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: 0
m_CustomResolution: -1
m_Strength: 0
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 0
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &6824191666380778572
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5911144295518134131}
- component: {fileID: 8293358521548247872}
m_Layer: 0
m_Name: AvatarLight Default
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &5911144295518134131
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6824191666380778572}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3588317102343359374}
- {fileID: 550315850286599067}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1773428102 &8293358521548247872
ParentConstraint:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6824191666380778572}
m_Enabled: 1
serializedVersion: 2
m_Weight: 1
m_TranslationAtRest: {x: 0, y: 0, z: 0}
m_RotationAtRest: {x: 0, y: 0, z: 0}
m_TranslationOffsets:
- {x: 0, y: 0, z: 0}
m_RotationOffsets:
- {x: 0, y: 0, z: 0}
m_AffectTranslationX: 1
m_AffectTranslationY: 1
m_AffectTranslationZ: 1
m_AffectRotationX: 1
m_AffectRotationY: 1
m_AffectRotationZ: 1
m_Active: 1
m_IsLocked: 1
m_Sources:
- sourceTransform: {fileID: 9125341631496859093, guid: 46aee70ad8bfa8c4988e7753ca8b3318, type: 3}
weight: 1
5 changes: 2 additions & 3 deletions Editor.meta → ...s/Prefabs/AvatarLight Default.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ GameObject:
- component: {fileID: 3113995390418817931}
- component: {fileID: 3243659202921157059}
m_Layer: 0
m_Name: AvatarLight
m_Name: AvatarLight VRC
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand Down
File renamed without changes.
33 changes: 33 additions & 0 deletions Resources/Prefabs/WorldTransform.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &207951403773396125
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9125341631496859093}
m_Layer: 0
m_Name: WorldTransform
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9125341631496859093
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 207951403773396125}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
7 changes: 7 additions & 0 deletions Resources/Prefabs/WorldTransform.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 13 additions & 3 deletions Scripts/Editor/Manager/Utilities/HoyoToonSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ private static void AddAvatarLight()
return;
}

var avatarLightPrefab = Resources.Load<GameObject>("Prefabs/AvatarLight");
#if VRC_SDK_VRCSDK3
var avatarLightPrefab = Resources.Load<GameObject>("Prefabs/AvatarLight VRC");
if (avatarLightPrefab == null)
{
EditorUtility.DisplayDialog("Error", "AvatarLight prefab not found in Resources/Prefabs.", "OK");
HoyoToonLogs.WarningDebug("AvatarLight prefab not found in Resources/Prefabs.");
EditorUtility.DisplayDialog("Error", "AvatarLight VRC prefab not found in Resources/Prefabs.", "OK");
HoyoToonLogs.WarningDebug("AvatarLight VRC prefab not found in Resources/Prefabs.");
return;
}
#else
var avatarLightPrefab = Resources.Load<GameObject>("Prefabs/AvatarLight Default");
if (avatarLightPrefab == null)
{
EditorUtility.DisplayDialog("Error", "AvatarLight Default prefab not found in Resources/Prefabs.", "OK");
HoyoToonLogs.WarningDebug("AvatarLight Default prefab not found in Resources/Prefabs.");
return;
}
#endif

var avatarLight = UnityEngine.Object.Instantiate(avatarLightPrefab, selectedObject.transform);
avatarLight.name = "AvatarLight";
Expand Down

0 comments on commit a98dac3

Please sign in to comment.