Skip to content

Commit

Permalink
Merge pull request #29 from VRLabs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
jellejurre authored Sep 1, 2024
2 parents b443275 + 0d114ec commit 63c03f2
Show file tree
Hide file tree
Showing 21 changed files with 8,888 additions and 7,009 deletions.
19 changes: 11 additions & 8 deletions Editor/MarkerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
using UnityEditor.Animations;
using UnityEngine;
using UnityEngine.Animations;
using VRC.Dynamics;
using VRC.SDK3.Avatars.Components;
using VRC.SDK3.Avatars.ScriptableObjects;
using VRC.SDK3.Dynamics.Constraint.Components;
using Vector3 = UnityEngine.Vector3;

namespace VRLabs.Marker
Expand Down Expand Up @@ -267,8 +269,8 @@ private void SetPreviousInstallSettings()
if (descriptor.transform.Find("Marker/Model") == null) useIndexFinger = true;
if ((descriptor.transform.Find("Marker/World/Local") is Transform t) && (t != null))
{
if ((t.GetComponent<ParentConstraint>() is ParentConstraint p) && (p != null))
if ((p.GetSource(6).sourceTransform != null) && (p.GetSource(7).sourceTransform != null))
if ((t.GetComponent<VRCParentConstraint>() is VRCParentConstraint p) && (p != null))
if ((p.Sources[6].SourceTransform != null) && (p.Sources[7].SourceTransform != null))
localSpaceFullBody = 1;
}
}
Expand Down Expand Up @@ -539,7 +541,8 @@ public void Generate()

// constrain cull object to avatar
Transform cull = marker.transform.Find("Cull");
cull.GetComponent<ParentConstraint>().SetSource(0, new ConstraintSource { sourceTransform = descriptor.transform, weight = 1f });
cull.GetComponent<VRCParentConstraint>().Sources[0] = new VRCConstraintSource(descriptor.transform, 1f, Vector3.zero, Vector3.zero);
cull.GetComponent<VRCParentConstraint>().RequestFullNativeUpdate();

if (useIndexFinger)
{
Expand Down Expand Up @@ -573,24 +576,24 @@ public void Generate()

HumanBodyBones[] bones = { HumanBodyBones.Hips, HumanBodyBones.Chest, HumanBodyBones.Head, HumanBodyBones.LeftHand, HumanBodyBones.RightHand,
HumanBodyBones.LeftFoot, HumanBodyBones.RightFoot };
ParentConstraint localConstraint = local.GetComponent<ParentConstraint>();
VRCParentConstraint localConstraint = local.GetComponent<VRCParentConstraint>();

localConstraint.SetSource(0, new ConstraintSource { sourceTransform = avatar.transform, weight = 1f });
localConstraint.Sources[0] = new VRCConstraintSource(avatar.transform, 1f, Vector3.zero, Vector3.zero);
if (localSpace)
{
for (int i = 0; i < 5; i ++)
{
localConstraint.SetSource(i+1, new ConstraintSource { sourceTransform = avatar.GetBoneTransform(bones[i]), weight = 0f });
localConstraint.Sources[i+1] = new VRCConstraintSource(avatar.GetBoneTransform(bones[i]), 0f, Vector3.zero, Vector3.zero);
}
if (localSpaceFullBody == 1)
{
for (int i = 5; i < 7; i++)
{
localConstraint.SetSource(i + 1, new ConstraintSource { sourceTransform = avatar.GetBoneTransform(bones[i]), weight = 0f });
localConstraint.Sources[i + 1] = new VRCConstraintSource(avatar.GetBoneTransform(bones[i]), 0f, Vector3.zero, Vector3.zero);
}
}
}

localConstraint.RequestFullNativeUpdate();
DestroyImmediate(targets.gameObject); // remove the "Targets" container object when finished

// set anything not adjustable to a medium-ish amount
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

[![Generic badge](https://img.shields.io/github/downloads/VRLabs/Marker/total?label=Downloads)](https://github.com/VRLabs/Marker/releases/latest)
[![Generic badge](https://img.shields.io/badge/License-MIT-informational.svg)](https://github.com/VRLabs/Marker/blob/main/LICENSE)
[![Generic badge](https://img.shields.io/badge/Unity-2019.4.31f1-lightblue.svg)](https://unity3d.com/unity/whats-new/2019.4.31)
[![Generic badge](https://img.shields.io/badge/Quest-Partial%20Compatible-yellow?logo=Meta)](https://img.shields.io/badge/Quest-Partial%20Compatible-yellow?logo=Meta)
[![Generic badge](https://img.shields.io/badge/Unity-2022.3.22f1-lightblue?logo=Unity)](https://unity.com/releases/editor/whats-new/2022.3.22)
[![Generic badge](https://img.shields.io/badge/SDK-AvatarSDK3-lightblue.svg)](https://vrchat.com/home/download)

[![Generic badge](https://img.shields.io/discord/706913824607043605?color=%237289da&label=DISCORD&logo=Discord&style=for-the-badge)](https://discord.vrlabs.dev/)
Expand All @@ -17,7 +18,6 @@ A marker for drawing

### ⬇️ [Download Latest Version](https://github.com/VRLabs/Marker/releases/latest)


### 📦 [Add to VRChat Creator Companion](https://vrlabs.dev/packages?package=dev.vrlabs.marker)

</div>
Expand All @@ -42,6 +42,9 @@ When finished adjusting MarkerTarget, copy its transform component to paste its

Click "Finish Setup" to finalize your marker and remove the script from your avatar.

> [!NOTE]
> When building for Quest, you will have to remove unsupported components and shaders. The eraser does not work on Quest so drawings need to be cleared through the expression menu.
## Contributors

[ksivl](https://github.com/ksivl)
Expand Down
Loading

0 comments on commit 63c03f2

Please sign in to comment.