Skip to content

Commit

Permalink
Merge pull request #1202 from anatawa12/visame-skinned-mesh-disabled
Browse files Browse the repository at this point in the history
fix: Avatars with Visame Skinned Mesh disabled will not able to upload
  • Loading branch information
anatawa12 authored Sep 23, 2024
2 parents 17e2308 + 8444fbe commit 82fc5f7
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-PRERELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog].
### Fixed
- Null Reference Exception with newly created VRCAnimatorPlayAudio `#1199`
- Particle System that uses local scale will be broken `#1197`
- Avatars with Visame Skinned Mesh disabled will not able to upload `#1202`

### Security

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog].
### Fixed
- Null Reference Exception with newly created VRCAnimatorPlayAudio `#1199`
- Particle System that uses local scale will be broken `#1197`
- Avatars with Visame Skinned Mesh disabled will not able to upload `#1202`

### Security

Expand Down
62 changes: 41 additions & 21 deletions Editor/APIInternal/ComponentInfos.VRCSDK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,29 @@ protected override void ApplySpecialMapping(T component, MappingSource mappingSo
case VRC_AvatarDescriptor.LipSyncStyle.VisemeBlendShape:
{
var info = mappingSource.GetMappedComponent(component.VisemeSkinnedMesh);
component.VisemeSkinnedMesh = info.MappedComponent;
var removed = false;
foreach (ref var shapeName in component.VisemeBlendShapes.AsSpan())

if (info.MappedComponent == null)
{
if (info.TryMapProperty($"blendShape.{shapeName}", out var mapped)
&& mapped.Component == info.MappedComponent)
shapeName = ParseBlendShapeProperty(mapped.Property);
else
removed = true;
component.VisemeSkinnedMesh = null;
component.lipSync = VRC_AvatarDescriptor.LipSyncStyle.VisemeParameterOnly;
}
else
{
component.VisemeSkinnedMesh = info.MappedComponent;
var removed = false;
foreach (ref var shapeName in component.VisemeBlendShapes.AsSpan())
{
if (info.TryMapProperty($"blendShape.{shapeName}", out var mapped)
&& mapped.Component == info.MappedComponent)
shapeName = ParseBlendShapeProperty(mapped.Property);
else
removed = true;
}

if (removed)
BuildLog.LogError("ApplyObjectMapping:VRCAvatarDescriptor:viseme BlendShape Removed");
}
if (removed)
BuildLog.LogError("ApplyObjectMapping:VRCAvatarDescriptor:viseme BlendShape Removed");

break;
}
case VRC_AvatarDescriptor.LipSyncStyle.VisemeParameterOnly:
Expand Down Expand Up @@ -290,19 +301,28 @@ protected override void ApplySpecialMapping(VRCAvatarDescriptor component, Mappi
case VRCAvatarDescriptor.EyelidType.Blendshapes:
{
var info = mappingSource.GetMappedComponent(component.customEyeLookSettings.eyelidsSkinnedMesh);
component.customEyeLookSettings.eyelidsSkinnedMesh = info.MappedComponent;
var removed = false;
foreach (ref var eyelidsBlendshape in component.customEyeLookSettings.eyelidsBlendshapes.AsSpan())
if (info.MappedComponent == null)
{
if (info.TryMapProperty(VProp.BlendShapeIndex(eyelidsBlendshape), out var mapped)
&& mapped.Component == info.MappedComponent)
eyelidsBlendshape = VProp.ParseBlendShapeIndex(mapped.Property);
else
removed = true;
component.customEyeLookSettings.eyelidsSkinnedMesh = null;
component.customEyeLookSettings.eyelidType = VRCAvatarDescriptor.EyelidType.None;
}
else
{
component.customEyeLookSettings.eyelidsSkinnedMesh = info.MappedComponent;
var removed = false;
foreach (ref var eyelidsBlendshape in component.customEyeLookSettings.eyelidsBlendshapes
.AsSpan())
{
if (info.TryMapProperty(VProp.BlendShapeIndex(eyelidsBlendshape), out var mapped)
&& mapped.Component == info.MappedComponent)
eyelidsBlendshape = VProp.ParseBlendShapeIndex(mapped.Property);
else
removed = true;
}

if (removed)
BuildLog.LogError("ApplyObjectMapping:VRCAvatarDescriptor:eyelids BlendShape Removed");
}

if (removed)
BuildLog.LogError("ApplyObjectMapping:VRCAvatarDescriptor:eyelids BlendShape Removed");
}
break;
default:
Expand Down

0 comments on commit 82fc5f7

Please sign in to comment.