Skip to content

Commit

Permalink
Fixed the old Autolock for PC
Browse files Browse the repository at this point in the history
Still haven't checked the Particles, though.
But the PC version is fixed.

The particles version should be used anymore, IMHO.

Preparing for a prerelease.

Signed-off-by: Voyage <voyage@miouyouyou.fr>
  • Loading branch information
vr-voyage committed Sep 10, 2024
1 parent f9a9ea1 commit 9a612b4
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
3 changes: 2 additions & 1 deletion Editor/Constraints/SetupAvatarConstraints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ private void AttachToAvatar(VRCAvatarDescriptor avatar, MyyAssetsManager runAsse
if (!toAttach.IsPrepared()) continue;

toAttach.AttachHierarchy(avatarCopy.gameObject);
toAttach.FixConstraintSources(avatar.gameObject, avatarCopy.gameObject);
ConstraintsHelpers.FixExternalConstraintSources(avatar.gameObject, avatarCopy.gameObject, toAttach.copy);
//toAttach.FixConstraintSources(avatar.gameObject, avatarCopy.gameObject);
toAttach.SetupStations(stationsProxies);
string variableName = toAttach.animVariableName;

Expand Down
15 changes: 13 additions & 2 deletions Editor/Constraints/SetupObjectConstraints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using UnityEditor.Animations;
using UnityEngine;
using UnityEngine.Animations;
using VRC.Dynamics;
using VRC.SDK3.Avatars.Components;

namespace Myy
Expand Down Expand Up @@ -54,6 +55,7 @@ public SetupObjectConstraints(GameObject go, string variableName, ConstraintsGlo
: base(go, variableName)
{
this.options = options;
additionalHierarchy = new GameObject();
additionalHierarchy.name = worldLockSuffix + "-" + animVariableName;
clips = new AnimationClip[(int)ClipIndex.COUNT];
machines = new AnimatorStateMachine[]
Expand Down Expand Up @@ -267,13 +269,22 @@ public void AttachHierarchy(GameObject avatar)

if (options.disableConstraintsOnLock)
{
var worldLockClip = clips[(int)ClipIndex.WorldLocked];
var notWorldLockClip = clips[(int)ClipIndex.NotWorldLocked];
foreach (var constraint in go.GetComponentsInChildren<IConstraint>())
{
clips[(int)ClipIndex.WorldLocked].SetCurve(
worldLockClip.SetCurve(
lockedObjectPath, constraint.GetType(), "m_Enabled", ConstantCurve(false));
clips[(int)ClipIndex.NotWorldLocked].SetCurve(
notWorldLockClip.SetCurve(
lockedObjectPath, constraint.GetType(), "m_Enabled", ConstantCurve(true));
}
foreach (var vrcConstraint in go.GetComponentsInChildren<VRCConstraintBase>())
{
worldLockClip.SetCurve(
lockedObjectPath, vrcConstraint.GetType(), "m_Enabled", ConstantCurve(false));
notWorldLockClip.SetCurve(
lockedObjectPath, vrcConstraint.GetType(), "m_Enabled", ConstantCurve(true));
}
}

}
Expand Down
4 changes: 2 additions & 2 deletions Editor/TranslationStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static void SetLang(HumanReadableLang language)
[StringID.Label_ResetPositionOnLock] = "Reset object position when unlocked",
[StringID.Label_DefaultToggledOn] = "Show the object by default",
[StringID.VRCMenu_WorldLock] = "Lock in place",
[StringID.VRCMenu_ToggleOn] = "ON"
[StringID.VRCMenu_ToggleOn] = "Show"
};

public static Dictionary<StringID, string> messagesJP = new Dictionary<StringID, string>
Expand Down Expand Up @@ -200,7 +200,7 @@ public static void SetLang(HumanReadableLang language)
[StringID.Label_ResetPositionOnLock] = "固定解除の時、原の位置に戻す",
[StringID.Label_DefaultToggledOn] = "通常にアイテムを表示する",
[StringID.VRCMenu_WorldLock] = "固定",
[StringID.VRCMenu_ToggleOn] = "ON"
[StringID.VRCMenu_ToggleOn] = "出す"
};

public static Dictionary<StringID, string> currentTranslation = messagesJP;
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name" : "io.github.vr-voyage.tools.world-lock-autosetup",
"displayName" : "Voyage's World Lock Autosetup",
"version" : "1.5.0",
"unity" : "2019.4",
"description" : "Tools to automatically equip world locked items on avatars. https://github.com/vr-voyage/vrchat-worldlock-autosetup",
"author" : {
"name" : "Voyage Voyage",
"url" : "https://voyage-vrsns.booth.pm/items/3170932"
},
"vpmDependencies" : {
"com.vrchat.avatars" : "3.7.x"
},
"url" : "https://github.com/vr-voyage/vrchat-worldlock-autosetup",
"legacyFolders" : {
"Assets\\Voyage\\ObjectsFixer" : ""
}
}
"name": "io.github.vr-voyage.tools.world-lock-autosetup",
"displayName": "Voyage's World Lock Autosetup",
"version": "1.4.999",
"unity": "2019.4",
"description": "Tools to automatically equip world locked items on avatars. https://github.com/vr-voyage/vrchat-worldlock-autosetup",
"author": {
"name": "Voyage Voyage",
"url": "https://voyage-vrsns.booth.pm/items/3170932"
},
"vpmDependencies": {
"com.vrchat.avatars": "3.7.x"
},
"url": "https://github.com/vr-voyage/vrchat-worldlock-autosetup",
"legacyFolders": {
"Assets\\Voyage\\ObjectsFixer": ""
}
}

0 comments on commit 9a612b4

Please sign in to comment.