Merge remote-tracking branch 'origin/main' into 000/plugin

This commit is contained in:
bd_ 2023-09-17 22:01:26 +09:00
commit b55fa356db
82 changed files with 1473 additions and 1916 deletions

View File

@ -18,10 +18,10 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Checkout logo assets - name: Checkout logo assets
uses: actions/checkout@v3 uses: actions/checkout@v4
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
with: with:
repository: bdunderscore/modular-avatar-images repository: bdunderscore/modular-avatar-images

View File

@ -30,10 +30,10 @@ jobs:
with: with:
node-version: 18 node-version: 18
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
ref: ${{ inputs.ref || github.ref }} ref: ${{ inputs.ref || github.ref }}
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
repository: bdunderscore/modular-avatar-images repository: bdunderscore/modular-avatar-images
path: modular-avatar-images path: modular-avatar-images

View File

@ -0,0 +1,56 @@
name: Export GameCI license
on:
workflow_dispatch: {}
jobs:
export:
runs-on: ubuntu-latest
steps:
- name: Setup
run: |
sudo apt-get -y install gnupg
gpg --import <<EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQGNBGT9rngBDAC92NQAEUXfPlYHESpYjovuSjTwxZBy8R1NR/8czcEnnNUSo09z
ygzyRpgvxar5wL00WNY3cF03vXURJCV2FQYrsJEt0zAEQ+hTxwpVFcGjGr4ttI4+
HW/kDXeWgH/Fk72eiv6KwmTSVEnjMQAGMOnpPgPxh9Brj0n3wQjp9WinEwRX2gFn
gSoOQy6tLWtyLD6rYHDvAZ5FpSuuLqZfc3miHPcrs62IpeE6MaC4FGy7QLCnkL3X
JBKYY4Y3/nsiNUv+I2U8laJ1CkUDZfoJ/t6XP35n4PCD/phOxa5E96hrGQqlIrnL
vdYWVlZL/Wv+v7v/9taXcQUrqeKudFar2xFkH+LmBs6NRJUf84zRWpJhOTYS7Owo
JqJX1GSeZjDbUc/pDX6RIz6iG/cjcCbooLwCtu/oCGJtznVD/bBxnmdmP20UK4Zd
JuaG05/FbSM+dtBpAQ68yejloCngPuIYZYcvRi3l/rDl6+IwjsFEzg02yr8Cx6bQ
d/gKL3W54Gn4Q5sAEQEAAbQXYmRfYmRfIDxiZF9AbmFkZW5hLmRldj6JAdQEEwEK
AD4WIQQgqEPycUKGtLegx/izugd8bgW0LgUCZP2ueAIbAwUJA8JnAAULCQgHAgYV
CgkICwIEFgIDAQIeAQIXgAAKCRCzugd8bgW0LnZkDACXHH2lIGemnMvpF+vfUlWt
24CYbitrkNyEzFXf+Ya4XssL/9vacXhlPvW04vYRpZAPcqTZxuziLKWTigkymj+k
ufRfhK9+XbZQHp10rLiG53o/SM8azXyYFH6PrFJERPD6O1hbTwwfcpfKN3GiNQCM
1Oe1Ao/orI/hIViRlMrD8xEjNgZB/5FDzGIYZxsRzjX0Psm+Xmh92DueCf9oVFXe
et1wPaxqzP7+YqvrzgTLVksEtieYiauElsEpGcVobVGupKI2K4Du+j2yffPPQJyU
fSjw1Xdlpho2ZQu21bMXpl3vQswnkyrfBAIEqd6EsTZFk8B8Xv99U4Jy7fUouf8l
8QlCOWIDv0z2mt5OKqGhQuEbKKTmTRIBWnBIfDsE0tZSmInVbChPfefGRTP3Jj2W
0Y66yc4rIN560wnwB7yMccgC/hISBb1jsZCW+c87NSDkUz3dgwWVCJQ1sOb5L7Sc
ZpfWffOxPewWUjOwTpPXmjoj5YPvGvcC+73gKIgdVn25AY0EZP2ueAEMAMZTMq8X
B5I+QsNGkim/bOORflezCPDJYc2ivpdxdiEKSwyj5s9NTJ/huwi/6wnfZ1/EY7L1
NOg5MP7V6OXsiQd+i/KNq1pl24UsmAJr4bfVM1D6Kkgg8iC3pBqabFWAQ6Vlh0TK
lXAcUGC7VO4BGmdDGp+f9n4tOa7ieDiH0LIsKkj/nVa2chPnvycruNtgOLQ3iusy
7DhlacdKFN56n1/somuhfk0t6bIEI3b0d4c2Htu81Xtpm8bkzhwmm9fw6bTBjTjh
UtFraj2vmybfujqqofh0FHDz8BJsrZYkQtKmnBGR+9HWGiWuEVx2lQHj4xN/7E8d
I+liA+sJtPON3lfBybsEkTx0GwPmwvZ2LnC7dCx8v/aMQMPy7AsnP2SxAkKPKJc7
hIeAkobTbQjBHuk+PelimnvUdmdPg+RR4eUDmpCOlRib6x3WKnadOafsO96hAoUg
kbcwwlML3TQSauBVbov1ZlLYtXpCQalX0DwdGWvHDHFTXSyvY0IJ36vCFwARAQAB
iQG8BBgBCgAmFiEEIKhD8nFChrS3oMf4s7oHfG4FtC4FAmT9rngCGwwFCQPCZwAA
CgkQs7oHfG4FtC4cVwv/QHDqWDfJXXRArbsn+n/xofgnt1sB2KwvRaA/DQpI5zk8
AFXbqwPClIf+8kvTgGEgDdIBAmLcj5ZEqbu5Y25sbSlNY4Kbk1nYSwan3Jwpakgo
04zwPiThLO0kboJ+dsu4TUX8qN1hYRcgomHDe1DocVsvX4Bp+JA809+iCk5FKD95
OKeeo++Ulyzigf49qUe70HkqI+LYo4S5nN+EyiqMrcjh4NXDgJkPxt/rCClQVbVi
zotM3zo5iqy8sV/GsVzIr6LapxIvfIvrgcchShwLMhl7xy9WhaASdzv/+VnJZrmQ
6i6gqZ6fHz/RPeEWdoMU+OojoiQHpjyVsLv8Vj4pilzVKdqofTQ6tyMv6i37C7SJ
6OqdaNUCVlM4iFCjm8fg/L+LXIIhmjhdmXtaPDgYwwwcpK2n5IcItp526+6Bu2Wt
VhTIRf5zG/qTj/r3P+jrApgbtDpaJST/hrRaqCYiOxkJU2krrrBy9ttq9h4lSiiZ
6nL+CD9YfkV6cDH7BWlz
=So9v
-----END PGP PUBLIC KEY BLOCK-----
EOF
echo "foo" | gpg --encrypt -a --recipient bd_@nadena.dev

View File

@ -49,7 +49,7 @@ jobs:
permissions: permissions:
checks: write checks: write
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- uses: anatawa12/sh-actions/resolve-vpm-packages@master - uses: anatawa12/sh-actions/resolve-vpm-packages@master

View File

@ -0,0 +1,21 @@
using modular_avatar_tests;
using nadena.dev.modular_avatar.core;
using NUnit.Framework;
public class AvatarObjectReferenceTest : TestBase
{
[Test]
public void whenFakeArmaturePresent_bindsToRealArmature()
{
var root = CreateRoot("root");
var fake_armature = CreateChild(root, "Armature");
var real_armature = CreateChild(root, "Armature");
var hips = CreateChild(real_armature, "Hips");
var reference = new AvatarObjectReference();
reference.referencePath = "Armature";
Assert.AreEqual(real_armature, reference.Get(root.transform));
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bb23d6c06929440e999c855d3b9f70fc
timeCreated: 1694775902

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1058b5946fb23674cad310b1f4bd5b61 guid: 8caa5ed1b0324604cb456b0d5d7a92fb
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: adf82baccd885794cb63be6da2bf289e
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -0,0 +1,116 @@
fileFormatVersion: 2
guid: 9bb00a795610e1f4998410320612d6bd
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework;
using VRC.SDK3.Avatars.Components;
namespace modular_avatar_tests
{
public class ExpressionMenuFixupTests : TestBase
{
[Test]
public void testExpMenuFixup()
{
var avatar = CreatePrefab("ExpressionsMenuFixupTestAvatar.prefab");
AvatarProcessor.ProcessAvatar(avatar);
var descriptor = avatar.GetComponent<VRCAvatarDescriptor>();
var expMenu = descriptor.expressionsMenu;
Assert.AreEqual(3, expMenu.controls.Count);
Assert.AreEqual("testparam", expMenu.controls[0].parameter.name);
Assert.AreEqual(256, expMenu.controls[0].icon.height);
Assert.AreEqual(192, expMenu.controls[0].icon.width);
Assert.AreEqual("", expMenu.controls[1].parameter.name);
Assert.AreEqual(192, expMenu.controls[1].icon.height);
Assert.AreEqual(256, expMenu.controls[1].icon.width);
Assert.AreEqual("testparam", expMenu.controls[2].subParameters[0].name);
Assert.AreEqual("", expMenu.controls[2].subParameters[1].name);
foreach (var label in expMenu.controls[2].labels)
{
Assert.LessOrEqual(label.icon.width, 256);
Assert.LessOrEqual(label.icon.height, 256);
}
}
}
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d75fcaecb8b9e7f4bbe783e5f4c9838a guid: 9c1bfdcd79a862e40a2c896f18ae0ca0
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -0,0 +1,322 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &6204877465042736622
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6776946804248067904}
- component: {fileID: 5187824885137632139}
- component: {fileID: 1283586302596586804}
- component: {fileID: 3838643251041431458}
m_Layer: 0
m_Name: ExpressionsMenuFixupTestAvatar
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6776946804248067904
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6204877465042736622}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 20.384737, y: 1.6344047, z: 3.1785903}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &5187824885137632139
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6204877465042736622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 542108242, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3}
m_Name:
m_EditorClassIdentifier:
Name:
ViewPosition: {x: 0, y: 1.6, z: 0.2}
Animations: 0
ScaleIPD: 1
lipSync: 0
lipSyncJawBone: {fileID: 0}
lipSyncJawClosed: {x: 0, y: 0, z: 0, w: 1}
lipSyncJawOpen: {x: 0, y: 0, z: 0, w: 1}
VisemeSkinnedMesh: {fileID: 0}
MouthOpenBlendShapeName: Facial_Blends.Jaw_Down
VisemeBlendShapes: []
unityVersion:
portraitCameraPositionOffset: {x: 0, y: 0, z: 0}
portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139}
networkIDs: []
customExpressions: 1
expressionsMenu: {fileID: 11400000, guid: f2f0d7df290a6bc48bcb1efe964c6281, type: 2}
expressionParameters: {fileID: 11400000, guid: 16746f1009cf9ae4fb8391d44dc8257a,
type: 2}
enableEyeLook: 0
customEyeLookSettings:
eyeMovement:
confidence: 0.5
excitement: 0.5
leftEye: {fileID: 0}
rightEye: {fileID: 0}
eyesLookingStraight:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyesLookingUp:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyesLookingDown:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyesLookingLeft:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyesLookingRight:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyelidType: 0
upperLeftEyelid: {fileID: 0}
upperRightEyelid: {fileID: 0}
lowerLeftEyelid: {fileID: 0}
lowerRightEyelid: {fileID: 0}
eyelidsDefault:
upper:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
lower:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyelidsClosed:
upper:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
lower:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyelidsLookingUp:
upper:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
lower:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyelidsLookingDown:
upper:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
lower:
linked: 1
left: {x: 0, y: 0, z: 0, w: 0}
right: {x: 0, y: 0, z: 0, w: 0}
eyelidsSkinnedMesh: {fileID: 0}
eyelidsBlendshapes:
customizeAnimationLayers: 0
baseAnimationLayers:
- isEnabled: 0
type: 0
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
- isEnabled: 0
type: 4
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
- isEnabled: 0
type: 5
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
specialAnimationLayers:
- isEnabled: 0
type: 6
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
- isEnabled: 0
type: 7
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
- isEnabled: 0
type: 8
animatorController: {fileID: 0}
mask: {fileID: 0}
isDefault: 1
AnimationPreset: {fileID: 0}
animationHashSet: []
autoFootsteps: 1
autoLocomotion: 1
collider_head:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_torso:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_footR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_footL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_handR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_handL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerIndexL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerMiddleL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerRingL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerLittleL:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerIndexR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerMiddleR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerRingR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
collider_fingerLittleR:
isMirrored: 1
state: 0
transform: {fileID: 0}
radius: 0
height: 0
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 1}
--- !u!114 &1283586302596586804
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6204877465042736622}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -1427037861, guid: 4ecd63eff847044b68db9453ce219299, type: 3}
m_Name:
m_EditorClassIdentifier:
launchedFromSDKPipeline: 0
completedSDKPipeline: 0
blueprintId:
contentType: 0
assetBundleUnityVersion:
fallbackStatus: 0
--- !u!95 &3838643251041431458
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6204877465042736622}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ca344e99cdd379947ab3e8e5b346428c guid: 188009d5762353447bb0a11e779c1abb
TextScriptImporter: PrefabImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:

View File

@ -0,0 +1,20 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -1506855854, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3}
m_Name: parameters
m_EditorClassIdentifier:
parameters:
- name: testparam
valueType: 0
saved: 1
defaultValue: 0
networkSynced: 1

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f4e8a9c940ed84943bb0433246ec42bb guid: 16746f1009cf9ae4fb8391d44dc8257a
folderAsset: yes NativeFormatImporter:
DefaultImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 11400000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -0,0 +1,55 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -340790334, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3}
m_Name: test menu
m_EditorClassIdentifier:
controls:
- name: retain
icon: {fileID: 2800000, guid: adf82baccd885794cb63be6da2bf289e, type: 3}
type: 101
parameter:
name: testparam
value: 1
style: 0
subMenu: {fileID: 0}
subParameters: []
labels: []
- name: redact
icon: {fileID: 2800000, guid: 9bb00a795610e1f4998410320612d6bd, type: 3}
type: 101
parameter:
name: redact
value: 1
style: 0
subMenu: {fileID: 0}
subParameters: []
labels: []
- name: New Control
icon: {fileID: 0}
type: 201
parameter:
name:
value: 1
style: 0
subMenu: {fileID: 0}
subParameters:
- name: testparam
- name: redact
labels:
- name:
icon: {fileID: 2800000, guid: 9bb00a795610e1f4998410320612d6bd, type: 3}
- name:
icon: {fileID: 2800000, guid: adf82baccd885794cb63be6da2bf289e, type: 3}
- name:
icon: {fileID: 2800000, guid: 9bb00a795610e1f4998410320612d6bd, type: 3}
- name:
icon: {fileID: 2800000, guid: adf82baccd885794cb63be6da2bf289e, type: 3}

View File

@ -1,7 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1a7454bc513adb84d9ae85ed7e7268ba guid: f2f0d7df290a6bc48bcb1efe964c6281
TextScriptImporter: NativeFormatImporter:
externalObjects: {} externalObjects: {}
mainObjectFileID: 11400000
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,4 +1,5 @@
using modular_avatar_tests; using System.Linq;
using modular_avatar_tests;
using nadena.dev.modular_avatar.core.editor; using nadena.dev.modular_avatar.core.editor;
using NUnit.Framework; using NUnit.Framework;
using UnityEngine; using UnityEngine;
@ -38,4 +39,22 @@ public class GameObjectGC : TestBase
Assert.True(bone2 != null); Assert.True(bone2 != null);
Assert.True(bone3 == null); Assert.True(bone3 == null);
} }
[Test]
public void RetainArmatureHack()
{
var fake_humanoid = CreatePrefab("FakeHumanoid.prefab");
var avdesc = fake_humanoid.GetComponent<VRCAvatarDescriptor>();
var armature = new GameObject();
armature.name = "Armature";
armature.transform.parent = fake_humanoid.transform;
armature.transform.SetSiblingIndex(0);
new GCGameObjectsPass(new BuildContext(avdesc), fake_humanoid).OnPreprocessAvatar();
AvatarProcessor.ProcessAvatar(fake_humanoid);
Assert.AreEqual(2,
avdesc.GetComponentsInChildren<Transform>().Count(t => t.gameObject.name == "Armature"));
}
} }

View File

@ -1,7 +0,0 @@
Copyright (c) 2016 Adam Reeve
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 1417544c34d9a4f4aacebf76247940a9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 65d82c6541a90644390df2caa29c2209
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,191 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright
owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities
that control, are controlled by, or are under common control with that entity.
For the purposes of this definition, "control" means (i) the power, direct or
indirect, to cause the direction or management of such entity, whether by
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including
but not limited to software source code, documentation source, and configuration
files.
"Object" form shall mean any form resulting from mechanical transformation or
translation of a Source form, including but not limited to compiled object code,
generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made
available under the License, as indicated by a copyright notice that is included
in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that
is based on (or derived from) the Work and for which the editorial revisions,
annotations, elaborations, or other modifications represent, as a whole, an
original work of authorship. For the purposes of this License, Derivative Works
shall not include works that remain separable from, or merely link (or bind by
name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version
of the Work and any modifications or additions to that Work or Derivative Works
thereof, that is intentionally submitted to Licensor for inclusion in the Work
by the copyright owner or by an individual or Legal Entity authorized to submit
on behalf of the copyright owner. For the purposes of this definition,
"submitted" means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems, and
issue tracking systems that are managed by, or on behalf of, the Licensor for
the purpose of discussing and improving the Work, but excluding communication
that is conspicuously marked or otherwise designated in writing by the copyright
owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
of whom a Contribution has been received by Licensor and subsequently
incorporated within the Work.
2. Grant of Copyright License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the Work and such
Derivative Works in Source or Object form.
3. Grant of Patent License.
Subject to the terms and conditions of this License, each Contributor hereby
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to make, have
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
such license applies only to those patent claims licensable by such Contributor
that are necessarily infringed by their Contribution(s) alone or by combination
of their Contribution(s) with the Work to which such Contribution(s) was
submitted. If You institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
Contribution incorporated within the Work constitutes direct or contributory
patent infringement, then any patent licenses granted to You under this License
for that Work shall terminate as of the date such litigation is filed.
4. Redistribution.
You may reproduce and distribute copies of the Work or Derivative Works thereof
in any medium, with or without modifications, and in Source or Object form,
provided that You meet the following conditions:
You must give any other recipients of the Work or Derivative Works a copy of
this License; and
You must cause any modified files to carry prominent notices stating that You
changed the files; and
You must retain, in the Source form of any Derivative Works that You distribute,
all copyright, patent, trademark, and attribution notices from the Source form
of the Work, excluding those notices that do not pertain to any part of the
Derivative Works; and
If the Work includes a "NOTICE" text file as part of its distribution, then any
Derivative Works that You distribute must include a readable copy of the
attribution notices contained within such NOTICE file, excluding those notices
that do not pertain to any part of the Derivative Works, in at least one of the
following places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if provided along
with the Derivative Works; or, within a display generated by the Derivative
Works, if and wherever such third-party notices normally appear. The contents of
the NOTICE file are for informational purposes only and do not modify the
License. You may add Your own attribution notices within Derivative Works that
You distribute, alongside or as an addendum to the NOTICE text from the Work,
provided that such additional attribution notices cannot be construed as
modifying the License.
You may add Your own copyright statement to Your modifications and may provide
additional or different license terms and conditions for use, reproduction, or
distribution of Your modifications, or for any such Derivative Works as a whole,
provided Your use, reproduction, and distribution of the Work otherwise complies
with the conditions stated in this License.
5. Submission of Contributions.
Unless You explicitly state otherwise, any Contribution intentionally submitted
for inclusion in the Work by You to the Licensor shall be under the terms and
conditions of this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify the terms of
any separate license agreement you may have executed with Licensor regarding
such Contributions.
6. Trademarks.
This License does not grant permission to use the trade names, trademarks,
service marks, or product names of the Licensor, except as required for
reasonable and customary use in describing the origin of the Work and
reproducing the content of the NOTICE file.
7. Disclaimer of Warranty.
Unless required by applicable law or agreed to in writing, Licensor provides the
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
including, without limitation, any warranties or conditions of TITLE,
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
solely responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your exercise of
permissions under this License.
8. Limitation of Liability.
In no event and under no legal theory, whether in tort (including negligence),
contract, or otherwise, unless required by applicable law (such as deliberate
and grossly negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special, incidental,
or consequential damages of any character arising as a result of this License or
out of the use or inability to use the Work (including but not limited to
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
any and all other commercial damages or losses), even if such Contributor has
been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability.
While redistributing the Work or Derivative Works thereof, You may choose to
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
other liability obligations and/or rights consistent with this License. However,
in accepting such obligations, You may act only on Your own behalf and on Your
sole responsibility, not on behalf of any other Contributor, and only if You
agree to indemnify, defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason of your
accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work
To apply the Apache License to your work, attach the following boilerplate
notice, with the fields enclosed by brackets "[]" replaced with your own
identifying information. (Don't include the brackets!) The text should be
enclosed in the appropriate comment syntax for the file format. We also
recommend that a file or class name and description of purpose be included on
the same "printed page" as the copyright notice for easier identification within
third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 0c56563958a156145b708466db0e35cc
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,23 +0,0 @@
The MIT License (MIT)
Copyright (c) 2020 Kurai András
Copyright (c) 2022-Present VRChat Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 598e678340a8c6e4e9a3debcdc6a9579
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: cfc1421f162f0354d8a64d569417d9c9
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 702a5a2579f8edf43b5e7bfb2f52e2c6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,19 +0,0 @@
Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Antoine Aubry and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 3547422b181c5af49901e93c1122bbdd
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 9fd667e0ec0d1d84c9e17dad407f2272
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,33 +0,0 @@
fileFormatVersion: 2
guid: 140aba2a5b760e94cb3ed9f39a52610a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5da3ddd939264fc40a113d615f3ca77a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,422 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using VRC.PackageManagement.Core.Types.Packages;
namespace VRC.PackageManagement.PackageMaker
{
public class PackageMakerWindow : EditorWindow
{
// VisualElements
private VisualElement _rootView;
private TextField _targetAssetFolderField;
private TextField _packageIDField;
private Button _actionButton;
private EnumField _targetVRCPackageField;
private static string _projectDir;
private PackageMakerWindowData _windowData;
private void LoadDataFromSave()
{
if (!string.IsNullOrWhiteSpace(_windowData.targetAssetFolder))
{
_targetAssetFolderField.SetValueWithoutNotify(_windowData.targetAssetFolder);
}
_packageIDField.SetValueWithoutNotify(_windowData.packageID);
_targetVRCPackageField.SetValueWithoutNotify(_windowData.relatedPackage);
RefreshActionButtonState();
}
private void OnEnable()
{
_projectDir = Directory.GetParent(Application.dataPath).FullName;
Refresh();
}
[MenuItem("VRChat SDK/Utilities/Package Maker")]
public static void ShowWindow()
{
PackageMakerWindow wnd = GetWindow<PackageMakerWindow>();
wnd.titleContent = new GUIContent("Package Maker");
}
[MenuItem("Assets/Export VPM as UnityPackage")]
private static void ExportAsUnityPackage()
{
var foldersToExport = new List<string>();
StringBuilder exportFilename = new StringBuilder("exported");
foreach (string guid in Selection.assetGUIDs)
{
string selectedFolder = AssetDatabase.GUIDToAssetPath(guid);
var manifestPath = Path.Combine(selectedFolder, VRCPackageManifest.Filename);
var manifest = VRCPackageManifest.GetManifestAtPath(manifestPath);
if (manifest == null)
{
Debug.LogWarning(
$"Could not read valid Package Manifest at {manifestPath}. You need to create this first to export a VPM Package.");
continue;
}
exportFilename.Append($"-{manifest.Id}-{manifest.Version}");
foldersToExport.Add(selectedFolder);
}
exportFilename.Append(".unitypackage");
var exportDir = Path.Combine(Directory.GetCurrentDirectory(), "Exports");
Directory.CreateDirectory(exportDir);
AssetDatabase.ExportPackage
(
foldersToExport.ToArray(),
Path.Combine(exportDir, exportFilename.ToString()),
ExportPackageOptions.Recurse | ExportPackageOptions.Interactive
);
}
private void Refresh()
{
if (_windowData == null)
{
_windowData = PackageMakerWindowData.GetOrCreate();
}
if (_rootView == null) return;
if (_windowData != null)
{
LoadDataFromSave();
}
}
private void RefreshActionButtonState()
{
_actionButton.SetEnabled(
StringIsValidAssetFolder(_windowData.targetAssetFolder) &&
!string.IsNullOrWhiteSpace(_windowData.packageID)
);
}
/// <summary>
/// Unity calls the CreateGUI method automatically when the window needs to display
/// </summary>
private void CreateGUI()
{
if (_windowData == null)
{
_windowData = PackageMakerWindowData.GetOrCreate();
}
_rootView = rootVisualElement;
_rootView.name = "root-view";
_rootView.styleSheets.Add((StyleSheet) Resources.Load("PackageMakerWindowStyle"));
// Create Target Asset folder and register for drag and drop events
_rootView.Add(CreateTargetFolderElement());
_rootView.Add(CreatePackageIDElement());
_rootView.Add(CreateTargetVRCPackageElement());
_rootView.Add(CreateActionButton());
Refresh();
}
public enum VRCPackageEnum
{
None = 0,
Worlds = 1,
Avatars = 2,
Base = 3,
UdonSharp = 4,
}
private VisualElement CreateTargetVRCPackageElement()
{
_targetVRCPackageField = new EnumField("Related VRChat Package", VRCPackageEnum.None);
_targetVRCPackageField.RegisterValueChangedCallback(OnTargetVRCPackageChanged);
var box = new Box();
box.Add(_targetVRCPackageField);
return box;
}
private void OnTargetVRCPackageChanged(ChangeEvent<Enum> evt)
{
_windowData.relatedPackage = (VRCPackageEnum) evt.newValue;
_windowData.Save();
}
private VisualElement CreateActionButton()
{
_actionButton = new Button(OnActionButtonPressed)
{
text = "Convert Assets to Package",
name = "action-button"
};
return _actionButton;
}
private void OnActionButtonPressed()
{
bool result = EditorUtility.DisplayDialog("One-Way Conversion",
$"This process will move the assets from {_windowData.targetAssetFolder} into a new Package with the id {_windowData.packageID} and give it references to {_windowData.relatedPackage}.",
"Ok", "Wait, not yet.");
if (result)
{
string newPackageFolderPath = Path.Combine(_projectDir, "Packages", _windowData.packageID);
Directory.CreateDirectory(newPackageFolderPath);
var fullTargetAssetFolder = Path.Combine(_projectDir, _windowData.targetAssetFolder);
DoMigration(fullTargetAssetFolder, newPackageFolderPath);
ForceRefresh();
}
}
public static void ForceRefresh()
{
MethodInfo method = typeof(UnityEditor.PackageManager.Client).GetMethod("Resolve",
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
if (method != null)
method.Invoke(null, null);
AssetDatabase.Refresh();
}
private VisualElement CreatePackageIDElement()
{
var box = new Box()
{
name = "package-name-box"
};
_packageIDField = new TextField("Package ID", 255, false, false, '*');
_packageIDField.RegisterValueChangedCallback(OnPackageIDChanged);
box.Add(_packageIDField);
box.Add(new Label("Lowercase letters, numbers and dots only.")
{
name = "description",
tooltip =
"Standard practice is reverse domain notation like com.vrchat.packagename. Needs to be unique across VRChat, so if you don't own a domain you can try your username.",
});
return box;
}
private Regex packageIdRegex = new Regex("[^a-z0-9.]");
private void OnPackageIDChanged(ChangeEvent<string> evt)
{
if (evt.newValue != null)
{
string newId = packageIdRegex.Replace(evt.newValue, "-");
_packageIDField.SetValueWithoutNotify(newId);
_windowData.packageID = newId;
_windowData.Save();
}
RefreshActionButtonState();
}
private VisualElement CreateTargetFolderElement()
{
var targetFolderBox = new Box()
{
name = "editor-target-box"
};
_targetAssetFolderField = new TextField("Target Folder");
_targetAssetFolderField.RegisterCallback<DragEnterEvent>(OnTargetAssetFolderDragEnter,
TrickleDown.TrickleDown);
_targetAssetFolderField.RegisterCallback<DragLeaveEvent>(OnTargetAssetFolderDragLeave,
TrickleDown.TrickleDown);
_targetAssetFolderField.RegisterCallback<DragUpdatedEvent>(OnTargetAssetFolderDragUpdated,
TrickleDown.TrickleDown);
_targetAssetFolderField.RegisterCallback<DragPerformEvent>(OnTargetAssetFolderDragPerform,
TrickleDown.TrickleDown);
_targetAssetFolderField.RegisterCallback<DragExitedEvent>(OnTargetAssetFolderDragExited,
TrickleDown.TrickleDown);
_targetAssetFolderField.RegisterValueChangedCallback(OnTargetAssetFolderValueChanged);
targetFolderBox.Add(_targetAssetFolderField);
targetFolderBox.Add(new Label("Drag and Drop an Assets Folder to Convert Above") {name = "description"});
return targetFolderBox;
}
#region TargetAssetFolder Field Events
private bool StringIsValidAssetFolder(string targetFolder)
{
return !string.IsNullOrWhiteSpace(targetFolder) && AssetDatabase.IsValidFolder(targetFolder);
}
private void OnTargetAssetFolderValueChanged(ChangeEvent<string> evt)
{
string targetFolder = evt.newValue;
if (StringIsValidAssetFolder(targetFolder))
{
_windowData.targetAssetFolder = evt.newValue;
_windowData.Save();
RefreshActionButtonState();
}
else
{
_targetAssetFolderField.SetValueWithoutNotify(evt.previousValue);
}
}
private void OnTargetAssetFolderDragExited(DragExitedEvent evt)
{
DragAndDrop.visualMode = DragAndDropVisualMode.None;
}
private void OnTargetAssetFolderDragPerform(DragPerformEvent evt)
{
var targetFolder = DragAndDrop.paths[0];
if (!string.IsNullOrWhiteSpace(targetFolder) && AssetDatabase.IsValidFolder(targetFolder))
{
_targetAssetFolderField.value = targetFolder;
}
else
{
Debug.LogError($"Could not accept {targetFolder}. Needs to be a folder within the project");
}
}
private void OnTargetAssetFolderDragUpdated(DragUpdatedEvent evt)
{
if (DragAndDrop.paths.Length == 1)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
DragAndDrop.AcceptDrag();
}
else
{
DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
}
}
private void OnTargetAssetFolderDragLeave(DragLeaveEvent evt)
{
DragAndDrop.visualMode = DragAndDropVisualMode.None;
}
private void OnTargetAssetFolderDragEnter(DragEnterEvent evt)
{
if (DragAndDrop.paths.Length == 1)
{
DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
DragAndDrop.AcceptDrag();
}
}
#endregion
#region Migration Logic
private void DoMigration(string corePath, string targetDir)
{
EditorUtility.DisplayProgressBar("Migrating Package", "Creating Starter Package", 0.1f);
// Convert PackageType enum to VRC Package ID string
string packageType = null;
switch (_windowData.relatedPackage)
{
case VRCPackageEnum.Avatars:
packageType = "com.vrchat.avatars";
break;
case VRCPackageEnum.Base:
packageType = "com.vrchat.base";
break;
case VRCPackageEnum.Worlds:
packageType = "com.vrchat.clientsim"; // we want ClientSim too, need to specify that for now
break;
case VRCPackageEnum.UdonSharp:
packageType = "com.vrchat.udonsharp";
break;
}
string parentDir = new DirectoryInfo(targetDir)?.Parent.FullName;
Core.Utilities.CreateStarterPackage(_windowData.packageID, parentDir, packageType);
var allFiles = GetAllFiles(corePath).ToList();
MoveFilesToPackageDir(allFiles, corePath, targetDir);
// Clear target asset folder since it should no longer exist
_windowData.targetAssetFolder = "";
}
private static IEnumerable<string> GetAllFiles(string path)
{
var excludedPaths = new List<string>()
{
"Editor.meta"
};
return Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)
.Where(
s => excludedPaths.All(entry => !s.Contains(entry))
);
}
public static void MoveFilesToPackageDir(List<string> files, string pathBase, string targetDir)
{
EditorUtility.DisplayProgressBar("Migrating Package", "Moving Package Files", 0f);
float totalFiles = files.Count;
for (int i = 0; i < files.Count; i++)
{
try
{
EditorUtility.DisplayProgressBar("Migrating Package", "Moving Package Files", i / totalFiles);
var file = files[i];
string simplifiedPath = file.Replace($"{pathBase}\\", "");
string dest = null;
if (simplifiedPath.Contains("Editor\\"))
{
// Remove extra 'Editor' subfolders
dest = simplifiedPath.Replace("Editor\\", "");
dest = Path.Combine(targetDir, "Editor", dest);
}
else
{
// Make complete path to Runtime folder
dest = Path.Combine(targetDir, "Runtime", simplifiedPath);
}
string targetEnclosingDir = Path.GetDirectoryName(dest);
Directory.CreateDirectory(targetEnclosingDir);
var sourceFile = Path.Combine(pathBase, simplifiedPath);
File.Move(sourceFile, dest);
}
catch (Exception e)
{
Debug.LogError($"Error moving {files[i]}: {e.Message}");
continue;
}
}
Directory.Delete(pathBase, true); // cleans up leftover folders since only files are moved
EditorUtility.ClearProgressBar();
}
// Important while we're doing copy-and-rename in order to rename paths with "Assets" without renaming paths with "Sample Assets"
public static string ReplaceFirst(string text, string search, string replace)
{
int pos = text.IndexOf(search);
if (pos < 0)
{
return text;
}
return text.Substring(0, pos) + replace + text.Substring(pos + search.Length);
}
#endregion
}
}

View File

@ -1,44 +0,0 @@
using System.IO;
using UnityEditor;
using UnityEngine;
using VRC.PackageManagement.PackageMaker;
public class PackageMakerWindowData : ScriptableObject
{
public static string defaultAssetPath = Path.Combine("Assets", "PackageMakerWindowData.asset");
public string targetAssetFolder;
public string packageID;
public PackageMakerWindow.VRCPackageEnum relatedPackage;
public static PackageMakerWindowData GetOrCreate()
{
var existingData = AssetDatabase.AssetPathToGUID(defaultAssetPath);
if (string.IsNullOrWhiteSpace(existingData))
{
return Create();
}
else
{
var saveData = AssetDatabase.LoadAssetAtPath<PackageMakerWindowData>(defaultAssetPath);
if (saveData == null)
{
Debug.LogError($"Could not load saved data but the save file exists. Resetting.");
return Create();
}
return saveData;
}
}
public static PackageMakerWindowData Create()
{
var saveData = CreateInstance<PackageMakerWindowData>();
AssetDatabase.CreateAsset(saveData, defaultAssetPath);
AssetDatabase.SaveAssets();
return saveData;
}
public void Save()
{
AssetDatabase.SaveAssets();
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0adae93375f5d5840a30b6e47f324172
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0aa72fa778aef5b4cb5fa177c19d3636
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,199 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Serilog;
using Serilog.Sinks.Unity3D;
using UnityEditor;
using UnityEngine;
using VRC.PackageManagement.Core;
using VRC.PackageManagement.Core.Types;
using VRC.PackageManagement.Core.Types.Packages;
using Version = VRC.PackageManagement.Core.Types.VPMVersion.Version;
namespace VRC.PackageManagement.Resolver
{
[InitializeOnLoad]
public class Resolver
{
private const string _projectLoadedKey = "PROJECT_LOADED";
private static string _projectDir;
public static string ProjectDir
{
get
{
if (_projectDir != null)
{
return _projectDir;
}
try
{
_projectDir = new DirectoryInfo(Assembly.GetExecutingAssembly().Location).Parent.Parent.Parent
.FullName;
return _projectDir;
}
catch (Exception)
{
return "";
}
}
}
static Resolver()
{
SetupLogging();
if (!SessionState.GetBool(_projectLoadedKey, false))
{
#pragma warning disable 4014
CheckResolveNeeded();
#pragma warning restore 4014
}
}
private static void SetupLogging()
{
VRCLibLogger.SetLoggerDirectly(
new LoggerConfiguration()
.MinimumLevel.Information()
.WriteTo.Unity3D()
.CreateLogger()
);
}
private static async Task CheckResolveNeeded()
{
SessionState.SetBool(_projectLoadedKey, true);
//Wait for project to finish compiling
while (EditorApplication.isCompiling || EditorApplication.isUpdating)
{
await Task.Delay(250);
}
try
{
if (string.IsNullOrWhiteSpace(ProjectDir))
{
return;
}
if (VPMProjectManifest.ResolveIsNeeded(ProjectDir))
{
Debug.Log($"Resolve needed.");
var result = EditorUtility.DisplayDialog("VRChat Package Management",
$"This project requires some VRChat Packages which are not in the project yet.\n\nPress OK to download and install them.",
"OK", "Show Me What's Missing");
if (result)
{
ResolveStatic(ProjectDir);
}
else
{
ResolverWindow.ShowWindow();
}
}
}
catch (Exception)
{
// Unity says we can't open windows from this function so it throws an exception but also works fine.
}
}
public static bool VPMManifestExists()
{
return VPMProjectManifest.Exists(ProjectDir, out _);
}
public static void CreateManifest()
{
VPMProjectManifest.Load(ProjectDir);
ResolverWindow.Refresh();
}
public static void ResolveManifest()
{
ResolveStatic(ProjectDir);
}
public static void ResolveStatic(string dir)
{
// Todo: calculate and show actual progress
EditorUtility.DisplayProgressBar($"Getting all VRChat Packages", "Downloading and Installing...", 0.5f);
VPMProjectManifest.Resolve(ProjectDir);
EditorUtility.ClearProgressBar();
ForceRefresh();
}
public static List<string> GetAllVersionsOf(string id)
{
var project = new UnityProject(ProjectDir);
var versions = new List<string>();
foreach (var provider in Repos.GetAll)
{
var packagesWithVersions = provider.GetAllWithVersions();
foreach (var packageVersionList in packagesWithVersions)
{
foreach (var package in packageVersionList.Value.VersionsDescending)
{
if (package.Id != id)
continue;
if (Version.TryParse(package.Version, out var result))
{
if (!versions.Contains(package.Version))
versions.Add(package.Version);
}
}
}
}
// Sort packages in project to the top
var sorted = from entry in versions orderby project.VPMProvider.HasPackage(entry) descending select entry;
return sorted.ToList<string>();
}
public static List<string> GetAffectedPackageList(IVRCPackage package)
{
List<string> list = new List<string>();
var project = new UnityProject(ProjectDir);
if (Repos.GetAllDependencies(package, out Dictionary<string, string> dependencies, null))
{
foreach (KeyValuePair<string, string> item in dependencies)
{
project.VPMProvider.Refresh();
if (project.VPMProvider.GetPackage(item.Key, item.Value) == null)
{
IVRCPackage d = Repos.GetPackageWithVersionMatch(item.Key, item.Value);
if (d != null)
{
list.Add(d.Id + " " + d.Version + "\n");
}
}
}
return list;
}
return null;
}
public static void ForceRefresh()
{
MethodInfo method = typeof(UnityEditor.PackageManager.Client).GetMethod("Resolve",
BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
if (method != null)
method.Invoke(null, null);
AssetDatabase.Refresh();
}
}
}

View File

@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: f872e3586f8b4f06bab3c9facd14f6e6
timeCreated: 1659048476

View File

@ -1,292 +0,0 @@
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine;
using UnityEngine.UIElements;
using VRC.PackageManagement.Core;
using VRC.PackageManagement.Core.Types;
using VRC.PackageManagement.Core.Types.Packages;
using Version = VRC.PackageManagement.Core.Types.VPMVersion.Version;
namespace VRC.PackageManagement.Resolver
{
public class ResolverWindow : EditorWindow
{
// VisualElements
private static VisualElement _rootView;
private static Button _refreshButton;
private static Button _createButton;
private static Button _resolveButton;
private static Box _manifestInfo;
private static Label _manifestLabel;
private static bool _isUpdating;
private static Color _colorPositive = Color.green;
private static Color _colorNegative = new Color(1, 0.3f, 0.3f);
[MenuItem("VRChat SDK/Utilities/Package Resolver")]
public static void ShowWindow()
{
ResolverWindow wnd = GetWindow<ResolverWindow>();
wnd.titleContent = new GUIContent("Package Resolver");
}
public static void Refresh()
{
if (_rootView == null || string.IsNullOrWhiteSpace(Resolver.ProjectDir)) return;
_manifestInfo.SetEnabled(!_isUpdating);
_refreshButton.SetEnabled(!_isUpdating);
_manifestLabel.text = (_isUpdating ? "Working ..." : "Required Packages");
_manifestInfo.Clear();
_manifestInfo.Add(_manifestLabel);
bool needsResolve = VPMProjectManifest.ResolveIsNeeded(Resolver.ProjectDir);
string resolveStatus = needsResolve ? "Please press \"Resolve\" to Download them." : "All of them are in the project.";
// check for vpm dependencies
if (!Resolver.VPMManifestExists())
{
TextElement noManifestText = new TextElement();
noManifestText.text = "No VPM Manifest";
noManifestText.style.color = _colorNegative;
_manifestInfo.Add(noManifestText);
}
else
{
var manifest = VPMProjectManifest.Load(Resolver.ProjectDir);
var project = new UnityProject(Resolver.ProjectDir);
// Here is where we detect if all dependencies are installed
var allDependencies = (manifest.locked != null && manifest.locked.Count > 0)
? manifest.locked
: manifest.dependencies;
foreach (var pair in allDependencies)
{
var id = pair.Key;
var version = pair.Value.version;
IVRCPackage package = project.VPMProvider.GetPackage(id, version);
_manifestInfo.Add(CreateDependencyRow(id, version, project, (package != null)));
}
}
_resolveButton.SetEnabled(needsResolve);
Resolver.ForceRefresh();
}
/// <summary>
/// Unity calls the CreateGUI method automatically when the window needs to display
/// </summary>
private void CreateGUI()
{
_rootView = rootVisualElement;
_rootView.name = "root-view";
_rootView.styleSheets.Add((StyleSheet)Resources.Load("ResolverWindowStyle"));
// Main Container
var container = new Box()
{
name = "buttons"
};
_rootView.Add(container);
// Create Button
if (!Resolver.VPMManifestExists())
{
_createButton = new Button(Resolver.CreateManifest)
{
text = "Create",
name = "create-button-base"
};
container.Add(_createButton);
}
else
{
_resolveButton = new Button(Resolver.ResolveManifest)
{
text = "Resolve All",
name = "resolve-button-base"
};
container.Add(_resolveButton);
}
// Manifest Info
_manifestInfo = new Box()
{
name = "manifest-info",
};
_manifestLabel = (new Label("Required Packages") { name = "manifest-header" });
_rootView.Add(_manifestInfo);
// Refresh Button
var refreshBox = new Box();
_refreshButton = new Button(Refresh)
{
text = "Refresh",
name = "refresh-button-base"
};
refreshBox.Add(_refreshButton);
_rootView.Add(refreshBox);
Refresh();
}
private static VisualElement CreateDependencyRow(string id, string version, UnityProject project, bool havePackage)
{
// Table
VisualElement row = new Box() { name = "package-box" };
VisualElement column1 = new Box() { name = "package-box" };
VisualElement column2 = new Box() { name = "package-box" };
VisualElement column3 = new Box() { name = "package-box" };
VisualElement column4 = new Box() { name = "package-box" };
column1.style.minWidth = 200;
column2.style.minWidth = 100;
column3.style.minWidth = 100;
column4.style.minWidth = 100;
row.Add(column1);
row.Add(column2);
row.Add(column3);
row.Add(column4);
// Package Name + Status
TextElement text = new TextElement { text = $"{id} {version} " };
column1.Add(text);
if (!havePackage)
{
TextElement missingText = new TextElement { text = "MISSING" };
missingText.style.color = _colorNegative;
missingText.style.display = (_isUpdating ? DisplayStyle.None : DisplayStyle.Flex);
column2.Add(missingText);
}
// Version Popup
var choices = new List<string>();
foreach (string n in Resolver.GetAllVersionsOf(id))
{
choices.Add(n);
}
var popupField = new PopupField<string>(choices, 0);
popupField.value = choices[0];
popupField.style.display = (_isUpdating ? DisplayStyle.None : DisplayStyle.Flex);
column3.Add(popupField);
// Button
Button updateButton = new Button() { text = "Update" };
if (havePackage)
RefreshUpdateButton(updateButton, version, choices[0]);
else
RefreshMissingButton(updateButton);
updateButton.clicked += (() =>
{
IVRCPackage package = Repos.GetPackageWithVersionMatch(id, popupField.value);
// Check and warn on Dependencies if Updating or Downgrading
if (Version.TryParse(version, out var currentVersion) &&
Version.TryParse(popupField.value, out var newVersion))
{
Dictionary<string, string> dependencies = new Dictionary<string, string>();
StringBuilder dialogMsg = new StringBuilder();
List<string> affectedPackages = Resolver.GetAffectedPackageList(package);
for (int v = 0; v < affectedPackages.Count; v++)
{
dialogMsg.Append(affectedPackages[v]);
}
if (affectedPackages.Count > 1)
{
dialogMsg.Insert(0, "This will update multiple packages:\n\n");
dialogMsg.AppendLine("\nAre you sure?");
if (EditorUtility.DisplayDialog("Package Has Dependencies", dialogMsg.ToString(), "OK", "Cancel"))
OnUpdatePackageClicked(project, package);
}
else
{
OnUpdatePackageClicked(project, package);
}
}
});
column4.Add(updateButton);
popupField.RegisterCallback<ChangeEvent<string>>((evt) =>
{
if (havePackage)
RefreshUpdateButton(updateButton, version, evt.newValue);
else
RefreshMissingButton(updateButton);
});
return row;
}
private static void RefreshUpdateButton(Button button, string currentVersion, string highestAvailableVersion)
{
if (currentVersion == highestAvailableVersion)
{
button.style.display = DisplayStyle.None;
}
else
{
button.style.display = (_isUpdating ? DisplayStyle.None : DisplayStyle.Flex);
if (Version.TryParse(currentVersion, out var currentVersionObject) &&
Version.TryParse(highestAvailableVersion, out var highestAvailableVersionObject))
{
if (currentVersionObject < highestAvailableVersionObject)
{
SetButtonColor(button, _colorPositive);
button.text = "Update";
}
else
{
SetButtonColor(button, _colorNegative);
button.text = "Downgrade";
}
}
}
}
private static void RefreshMissingButton(Button button)
{
button.text = "Resolve";
SetButtonColor(button, Color.white);
button.style.display = (_isUpdating ? DisplayStyle.None : DisplayStyle.Flex);
}
private static void SetButtonColor(Button button, Color color)
{
button.style.color = color;
color.a = 0.25f;
button.style.borderRightColor =
button.style.borderLeftColor =
button.style.borderTopColor =
button.style.borderBottomColor =
color;
}
private static async void OnUpdatePackageClicked(UnityProject project, IVRCPackage package)
{
_isUpdating = true;
Refresh();
await Task.Delay(500);
await Task.Run(() => project.UpdateVPMPackage(package));
_isUpdating = false;
Refresh();
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 32d2636186ee0834fa1dc2287750dd32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8700b619eebc09545b4aaf4f69a2bf79
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,16 +0,0 @@
.unity-box {
margin: 10px;
padding:10px;
}
.unity-box #description {
margin: 10px 0 10px 0;
white-space: normal;
}
#action-button {
font-size: 20px;
-unity-font-style: bold;
padding: 10px;
margin:10px;
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 8dfe8fb3b6d0f3e4693553ecc1cb23dd
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0

View File

@ -1,25 +0,0 @@
.unity-box {
margin:2px;
padding:10px;
border-width:0px;
}
#package-box {
margin:2px;
padding:10px;
border-width:0px;
flex-direction:row;
max-height:20px;
min-height:20px;
height:20px;
padding-top:0px;
padding-bottom:0px;
margin-top:0px;
margin-bottom:0px;
align-items:center;
}
#manifest-header {
font-size: 20px;
margin-bottom: 10px;
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 346f7a547766ecb4396d15f585a15133
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0}
disableValidation: 0

View File

@ -1,15 +0,0 @@
{
"name": "com.vrchat.core.vpm-resolver.Editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d1e8c2ba944807d4a9213e2de6930a0b
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,11 +0,0 @@
# VRCHAT INC.
### VRCHAT DISTRO LICENSE FILE
Version: February 24, 2022
**SUMMARY OF TERMS:** Any materials subject to this Distro Asset License may be distributed by you, with or without modifications, on a non-commercial basis (i.e., at no charge), in accordance with the full terms of the Materials License Agreement.
This Distro License File is a "License File" as defined in the VRChat Materials License Agreement, found at https://hello.vrchat.com/legal/sdk (or any successor link designated by VRChat) (as may be revised from time to time, the "Materials License Agreement").
This Distro License File applies to all the files in the Folder containing this Distro License File and those in all Child Folders within that Folder (except with respect to files in any Child Folder that contains a different License File) (such files, other than this Distro License File, the "Covered Files"). All capitalized terms used but not otherwise defined in this Distro License File have the meanings provided in the Materials License Agreement.
This Distro License File only provides a summary of the terms applicable to the Covered Files. To understand your rights and obligations and the full set of terms that apply to use of the Covered Files, please see the relevant sections of the Materials License Agreement, including terms applicable to Distro Materials.

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 7727f888edf4714448d5a0287deec6dd
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,17 +0,0 @@
{
"name": "com.vrchat.core.vpm-resolver",
"displayName": "VRChat Package Resolver Tool",
"version": "0.1.19",
"unity": "2019.4",
"description": "Tool to Download VPM Packages",
"vrchatVersion": "2022.1.1",
"author": {
"name": "VRChat",
"email": "developer@vrchat.com",
"url": "https://github.com/vrchat/packages"
},
"url": "",
"dependencies": {
"com.unity.nuget.newtonsoft-json": "2.0.2"
}
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 6b02e2915ebf04e4ea94e503d73e7411
PackageManifestImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,6 +9,7 @@
"com.unity.textmeshpro": "2.1.6", "com.unity.textmeshpro": "2.1.6",
"com.unity.timeline": "1.2.18", "com.unity.timeline": "1.2.18",
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.unity.xr.oculus.android": "2.38.6",
"com.unity.xr.oculus.standalone": "2.38.4", "com.unity.xr.oculus.standalone": "2.38.4",
"com.unity.xr.openvr.standalone": "2.0.5", "com.unity.xr.openvr.standalone": "2.0.5",
"de.thryrallo.vrc.avatar-performance-tools": "https://github.com/Thryrallo/VRC-Avatar-Performance-Tools.git", "de.thryrallo.vrc.avatar-performance-tools": "https://github.com/Thryrallo/VRC-Avatar-Performance-Tools.git",

View File

@ -101,20 +101,6 @@ namespace nadena.dev.modular_avatar.core.editor
foreach (var control in newMenu.controls) foreach (var control in newMenu.controls)
{ {
if (Util.ValidateExpressionMenuIcon(control.icon) != Util.ValidateExpressionMenuIconResult.Success)
control.icon = null;
for (int i = 0; i < control.labels.Length; i++)
{
var label = control.labels[i];
var labelResult = Util.ValidateExpressionMenuIcon(label.icon);
if (labelResult != Util.ValidateExpressionMenuIconResult.Success)
{
label.icon = null;
control.labels[i] = label;
}
}
if (control.type == VRCExpressionsMenu.Control.ControlType.SubMenu) if (control.type == VRCExpressionsMenu.Control.ControlType.SubMenu)
{ {
control.subMenu = CloneMenu(control.subMenu); control.subMenu = CloneMenu(control.subMenu);

View File

@ -1,15 +1,121 @@
using UnityEditor; using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using UnityEditor;
using UnityEngine; using UnityEngine;
using Object = UnityEngine.Object;
using static nadena.dev.modular_avatar.core.editor.Localization;
namespace nadena.dev.modular_avatar.core.editor namespace nadena.dev.modular_avatar.core.editor
{ {
public class EasySetupOutfit internal class ESOErrorWindow : EditorWindow
{
private string header;
private string[] messageGroups;
private static readonly GUIStyle buttonStyle, labelStyle;
private const float SeparatorSize = 6f;
static ESOErrorWindow()
{
buttonStyle = EditorStyles.miniButtonRight;
labelStyle = EditorStyles.label;
labelStyle.wordWrap = true;
buttonStyle.fixedWidth = 40f;
buttonStyle.fixedHeight = EditorGUIUtility.singleLineHeight * 1.5f;
}
private void OnEnable()
{
}
internal static void Show(
string header,
string[] messageGroups
)
{
var window = CreateInstance<ESOErrorWindow>();
window.titleContent = new GUIContent("Setup Outfit");
window.header = header;
window.messageGroups = messageGroups;
// Compute required window size
var height = 0f;
var width = 450f;
height += SeparatorSize;
height += EditorStyles.helpBox.CalcHeight(new GUIContent(header), width);
foreach (var message in messageGroups)
{
height += 6f; // TODO: constant
height += labelStyle.CalcHeight(new GUIContent(message), width);
}
height += buttonStyle.fixedHeight;
height += SeparatorSize;
window.minSize = new Vector2(width, height);
window.ShowModal();
}
private void OnGUI()
{
EditorGUILayout.Space(SeparatorSize);
EditorGUILayout.HelpBox(header, MessageType.Error);
foreach (var message in messageGroups)
{
EditorGUILayout.Space(SeparatorSize);
EditorGUILayout.LabelField(message);
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("OK", buttonStyle))
{
Close();
}
EditorGUILayout.EndHorizontal();
var finalRect = GUILayoutUtility.GetRect(SeparatorSize, SeparatorSize, GUILayout.ExpandWidth(true));
var size = this.minSize;
size.y = finalRect.position.y + finalRect.height;
if (size.y > 10)
{
if (Vector2.Distance(this.minSize, size) > 1f)
{
this.minSize = size;
}
if (Vector2.Distance(this.maxSize, size) > 1f)
{
this.maxSize = size;
}
}
}
}
internal class EasySetupOutfit
{ {
private const int PRIORITY = 49; private const int PRIORITY = 49;
private static string[] errorMessageGroups;
private static string errorHeader;
[MenuItem("GameObject/ModularAvatar/Setup Outfit", false, PRIORITY)] [MenuItem("GameObject/ModularAvatar/Setup Outfit", false, PRIORITY)]
static void SetupOutfit(MenuCommand cmd) static void SetupOutfit(MenuCommand cmd)
{ {
if (!ValidateSetupOutfit())
{
ESOErrorWindow.Show(errorHeader, errorMessageGroups);
return;
}
if (!FindBones(cmd.context, if (!FindBones(cmd.context,
out var avatarRoot, out var avatarHips, out var outfitHips) out var avatarRoot, out var avatarHips, out var outfitHips)
) return; ) return;
@ -18,14 +124,15 @@ namespace nadena.dev.modular_avatar.core.editor
var avatarArmature = avatarHips.transform.parent; var avatarArmature = avatarHips.transform.parent;
var outfitArmature = outfitHips.transform.parent; var outfitArmature = outfitHips.transform.parent;
if (outfitArmature.GetComponent<ModularAvatarMergeArmature>() == null) var merge = outfitArmature.GetComponent<ModularAvatarMergeArmature>();
if (merge == null)
{ {
var merge = Undo.AddComponent<ModularAvatarMergeArmature>(outfitArmature.gameObject); merge = Undo.AddComponent<ModularAvatarMergeArmature>(outfitArmature.gameObject);
merge.mergeTarget = new AvatarObjectReference(); merge.mergeTarget = new AvatarObjectReference();
merge.mergeTarget.referencePath = RuntimeUtil.RelativePath(avatarRoot, avatarArmature.gameObject); merge.mergeTarget.referencePath = RuntimeUtil.RelativePath(avatarRoot, avatarArmature.gameObject);
merge.InferPrefixSuffix(); merge.InferPrefixSuffix();
HeuristicBoneMapper.RenameBonesByHeuristic(merge);
} }
HeuristicBoneMapper.RenameBonesByHeuristic(merge);
if (outfitRoot != null if (outfitRoot != null
&& outfitRoot.GetComponent<ModularAvatarMeshSettings>() == null && outfitRoot.GetComponent<ModularAvatarMeshSettings>() == null
@ -109,7 +216,7 @@ namespace nadena.dev.modular_avatar.core.editor
else if (Vector3.Distance(bounds.center, skinnedMeshRenderer.bounds.center) > 0.01f else if (Vector3.Distance(bounds.center, skinnedMeshRenderer.bounds.center) > 0.01f
|| Vector3.Distance(bounds.extents, skinnedMeshRenderer.bounds.extents) > 0.01f) || Vector3.Distance(bounds.extents, skinnedMeshRenderer.bounds.extents) > 0.01f)
{ {
bounds = ModularAvatarMeshSettings.DEFAULT_BOUNDS; bounds = TransformBounds(rootBone, ModularAvatarMeshSettings.DEFAULT_BOUNDS);
} }
} }
@ -117,13 +224,28 @@ namespace nadena.dev.modular_avatar.core.editor
} }
} }
[MenuItem("GameObject/ModularAvatar/Setup Outfit", true, PRIORITY)] private static Bounds TransformBounds(Transform rootBone, Bounds bounds)
{
bounds.extents = bounds.extents / (Vector3.Dot(rootBone.lossyScale, Vector3.one) / 3);
return bounds;
}
static bool ValidateSetupOutfit() static bool ValidateSetupOutfit()
{ {
if (Selection.objects.Length == 0) return false; errorHeader = S("setup_outfit.err.header.notarget");
errorMessageGroups = new string[] { S("setup_outfit.err.unknown") };
if (Selection.objects.Length == 0)
{
errorMessageGroups = new string[] { S("setup_outfit.err.no_selection") };
return false;
}
foreach (var obj in Selection.objects) foreach (var obj in Selection.objects)
{ {
errorHeader = S_f("setup_outfit.err.header", obj.name);
if (!(obj is GameObject gameObj)) return false; if (!(obj is GameObject gameObj)) return false;
var xform = gameObj.transform; var xform = gameObj.transform;
@ -137,17 +259,28 @@ namespace nadena.dev.modular_avatar.core.editor
// refusing to run if we detect multiple avatar descriptors above the current object (or if we're run on // refusing to run if we detect multiple avatar descriptors above the current object (or if we're run on
// the avdesc object itself) // the avdesc object itself)
var nearestAvatar = RuntimeUtil.FindAvatarInParents(xform); var nearestAvatar = RuntimeUtil.FindAvatarInParents(xform);
if (nearestAvatar == null || nearestAvatar.transform == xform) return false; if (nearestAvatar == null || nearestAvatar.transform == xform)
{
errorMessageGroups = new string[]
{S_f("setup_outfit.err.multiple_avatar_descriptors", xform.gameObject.name)};
return false;
}
var parent = nearestAvatar.transform.parent; var parent = nearestAvatar.transform.parent;
if (parent != null && RuntimeUtil.FindAvatarInParents(parent) != null) return false; if (parent != null && RuntimeUtil.FindAvatarInParents(parent) != null)
{
errorMessageGroups = new string[]
{
S_f("setup_outfit.err.no_avatar_descriptor", xform.gameObject.name)
};
return false;
}
} }
return true; return true;
} }
private static bool FindBones(Object obj, out GameObject avatarRoot, out GameObject avatarHips, private static bool FindBones(Object obj, out GameObject avatarRoot, out GameObject avatarHips, out GameObject outfitHips)
out GameObject outfitHips)
{ {
avatarHips = outfitHips = null; avatarHips = outfitHips = null;
var outfitRoot = obj as GameObject; var outfitRoot = obj as GameObject;
@ -155,12 +288,46 @@ namespace nadena.dev.modular_avatar.core.editor
? RuntimeUtil.FindAvatarInParents(outfitRoot.transform)?.gameObject ? RuntimeUtil.FindAvatarInParents(outfitRoot.transform)?.gameObject
: null; : null;
if (outfitRoot == null || avatarRoot == null) return false; if (outfitRoot == null || avatarRoot == null) return false;
var avatarAnimator = avatarRoot.GetComponent<Animator>(); var avatarAnimator = avatarRoot.GetComponent<Animator>();
if (avatarAnimator == null) return false; if (avatarAnimator == null)
{
errorMessageGroups = new string[]
{
S("setup_outfit.err.no_animator")
};
return false;
}
avatarHips = avatarAnimator.GetBoneTransform(HumanBodyBones.Hips)?.gameObject; var avatarBoneMappings = GetAvatarBoneMappings(avatarAnimator);
if (avatarHips == null) return false; if (!avatarBoneMappings.ContainsKey(HumanBodyBones.Hips))
{
errorMessageGroups = new string[]
{
S("setup_outfit.err.no_hips")
};
return false;
}
// We do an explicit search for the hips bone rather than invoking the animator, as we want to control
// traversal order.
foreach (var maybeHips in avatarRoot.GetComponentsInChildren<Transform>())
{
if (maybeHips.name == avatarBoneMappings[HumanBodyBones.Hips] && !maybeHips.IsChildOf(outfitRoot.transform))
{
avatarHips = maybeHips.gameObject;
break;
}
}
if (avatarHips == null)
{
errorMessageGroups = new string[]
{
S("setup_outfit.err.no_hips")
};
return false;
}
var outfitAnimator = outfitRoot.GetComponent<Animator>(); var outfitAnimator = outfitRoot.GetComponent<Animator>();
if (outfitAnimator != null) if (outfitAnimator != null)
@ -168,22 +335,70 @@ namespace nadena.dev.modular_avatar.core.editor
outfitHips = outfitAnimator.GetBoneTransform(HumanBodyBones.Hips)?.gameObject; outfitHips = outfitAnimator.GetBoneTransform(HumanBodyBones.Hips)?.gameObject;
} }
var hipsCandidates = new List<string>();
if (outfitHips == null) if (outfitHips == null)
{ {
// Heuristic search - usually there'll be root -> Armature -> (single child) Hips // Heuristic search - usually there'll be root -> Armature -> (single child) Hips.
// First, look for an exact match.
foreach (Transform child in outfitRoot.transform) foreach (Transform child in outfitRoot.transform)
{ {
foreach (Transform tempHip in child) foreach (Transform tempHip in child)
{ {
if (tempHip.name.Contains(avatarHips.name)) if (tempHip.name.Contains(avatarBoneMappings[HumanBodyBones.Hips]))
{ {
outfitHips = tempHip.gameObject; outfitHips = tempHip.gameObject;
} }
} }
} }
hipsCandidates.Add(avatarBoneMappings[HumanBodyBones.Hips]);
// If that doesn't work out, we'll check for heuristic bone mapper mappings.
foreach (var hbm in HeuristicBoneMapper.BoneToNameMap[HumanBodyBones.Hips])
{
if (hipsCandidates[0] != hbm)
{
hipsCandidates.Add(hbm);
}
}
foreach (Transform child in outfitRoot.transform)
{
foreach (Transform tempHip in child)
{
foreach (var candidate in hipsCandidates)
{
if (HeuristicBoneMapper.NormalizeName(tempHip.name).Contains(candidate))
{
outfitHips = tempHip.gameObject;
}
}
}
}
}
if (outfitHips == null)
{
errorMessageGroups = new string[]
{
S("setup_outfit.err.no_outfit_hips"),
string.Join("\n", hipsCandidates.Select(c => "・ " + c).ToArray())
};
} }
return avatarHips != null && outfitHips != null; return avatarHips != null && outfitHips != null;
} }
private static ImmutableDictionary<HumanBodyBones, string> GetAvatarBoneMappings(Animator avatarAnimator)
{
var avatarHuman = avatarAnimator.avatar?.humanDescription.human ?? new HumanBone[0];
return avatarHuman
.Where(hb => !string.IsNullOrEmpty(hb.boneName))
.Select(hb => new KeyValuePair<HumanBodyBones, string>(
(HumanBodyBones) Enum.Parse(typeof(HumanBodyBones), hb.humanName.Replace(" ", "")),
hb.boneName
))
.ToImmutableDictionary();
}
} }
} }

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 597d4035b7eb43e180a013ceac128a84
timeCreated: 1694687629

View File

@ -0,0 +1,136 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using VRC.SDK3.Avatars.ScriptableObjects;
namespace nadena.dev.modular_avatar.core.editor
{
internal class FixupExpressionsMenuPass
{
internal static void FixupExpressionsMenu(BuildContext context)
{
var expressionsMenu = context.AvatarDescriptor.expressionsMenu;
if (expressionsMenu == null) return;
var parameters = context.AvatarDescriptor.expressionParameters?.parameters
?? new VRCExpressionParameters.Parameter[0];
var parameterNames = parameters.Select(p=> p.name).ToImmutableHashSet();
if (!Util.IsTemporaryAsset(expressionsMenu))
{
expressionsMenu = context.CloneMenu(expressionsMenu);
context.AvatarDescriptor.expressionsMenu = expressionsMenu;
}
// Walk menu recursively
var visitedMenus = new HashSet<VRCExpressionsMenu>();
var iconMapping = new Dictionary<Texture2D, Texture2D>();
VisitMenu(expressionsMenu);
void VisitMenu(VRCExpressionsMenu menu)
{
if (!visitedMenus.Add(menu)) return;
foreach (var control in menu.controls)
{
if (control.parameter != null &&
!string.IsNullOrEmpty(control.parameter.name) &&
!parameterNames.Contains(control.parameter.name))
{
control.parameter.name = "";
}
foreach (var subParam in control.subParameters ?? Array.Empty<VRCExpressionsMenu.Control.Parameter>())
{
if (subParam != null &&
!string.IsNullOrEmpty(subParam.name) &&
!parameterNames.Contains(subParam.name))
{
subParam.name = "";
}
}
if (control.icon != null)
{
if (!iconMapping.TryGetValue(control.icon, out var newIcon))
{
iconMapping[control.icon] = newIcon = MaybeScaleIcon(context, control.icon);
}
control.icon = newIcon;
}
if (control.labels != null)
{
for (int i = 0; i < control.labels.Length; i++)
{
var label = control.labels[i];
if (label.icon != null)
{
if (!iconMapping.TryGetValue(label.icon, out var newIcon))
{
iconMapping[label.icon] = newIcon = MaybeScaleIcon(context, label.icon);
}
label.icon = newIcon;
control.labels[i] = label;
}
}
}
}
}
}
#if UNITY_ANDROID
private const TextureFormat TargetFormat = TextureFormat.ASTC_4x4;
#else
private const TextureFormat TargetFormat = TextureFormat.DXT5;
#endif
private static Texture2D MaybeScaleIcon(BuildContext context, Texture2D original)
{
if (original.width <= 256 && original.height <= 256 && IsCompressedFormat(original.format))
{
return original;
}
var newRatio = Math.Min(256f / original.width, 256f / original.height);
var newWidth = Math.Min(256, Mathf.RoundToInt(original.width * newRatio));
var newHeight = Math.Min(256, Mathf.RoundToInt(original.height * newRatio));
var newTex = new Texture2D(newWidth, newHeight, TextureFormat.RGBA32, true);
context.SaveAsset(newTex);
var tmpRenderTex = RenderTexture.GetTemporary(newWidth, newHeight, 0, RenderTextureFormat.ARGB32);
var originalActiveRenderTex = RenderTexture.active;
try
{
Graphics.Blit(original, tmpRenderTex);
RenderTexture.active = tmpRenderTex;
newTex.ReadPixels(new Rect(0, 0, newWidth, newHeight), 0, 0);
newTex.Apply();
EditorUtility.CompressTexture(newTex, TargetFormat, TextureCompressionQuality.Normal);
return newTex;
}
finally
{
RenderTexture.active = originalActiveRenderTex;
RenderTexture.ReleaseTemporary(tmpRenderTex);
}
}
private static bool IsCompressedFormat(TextureFormat format)
{
var name = format.ToString();
return name.StartsWith("DXT") || name.StartsWith("ASTC");
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1020bef86d91452ba6b138c249d25bb5
timeCreated: 1694688050

View File

@ -10,6 +10,146 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
private static readonly Regex PAT_END_NUMBER = new Regex(@"[_\.][0-9]+"); private static readonly Regex PAT_END_NUMBER = new Regex(@"[_\.][0-9]+");
private static readonly ImmutableDictionary<HumanBodyBones, ImmutableList<HumanBodyBones>> BoneChildren =
ImmutableDictionary<HumanBodyBones, ImmutableList<HumanBodyBones>>.Empty
.Add(HumanBodyBones.Hips, ImmutableList.Create(
HumanBodyBones.LeftUpperLeg,
HumanBodyBones.RightUpperLeg,
HumanBodyBones.Spine
))
.Add(HumanBodyBones.LeftUpperLeg, ImmutableList.Create(
HumanBodyBones.LeftLowerLeg
))
.Add(HumanBodyBones.RightUpperLeg, ImmutableList.Create(
HumanBodyBones.RightLowerLeg
))
.Add(HumanBodyBones.LeftLowerLeg, ImmutableList.Create(
HumanBodyBones.LeftFoot
))
.Add(HumanBodyBones.RightLowerLeg, ImmutableList.Create(
HumanBodyBones.RightFoot
))
.Add(HumanBodyBones.LeftFoot, ImmutableList.Create(
HumanBodyBones.LeftToes
))
.Add(HumanBodyBones.RightFoot, ImmutableList.Create(
HumanBodyBones.RightToes
))
.Add(HumanBodyBones.Spine, ImmutableList.Create(
HumanBodyBones.Chest,
HumanBodyBones.UpperChest
))
.Add(HumanBodyBones.Chest, ImmutableList.Create(
HumanBodyBones.Neck,
HumanBodyBones.LeftShoulder,
HumanBodyBones.RightShoulder
))
.Add(HumanBodyBones.UpperChest, ImmutableList.Create(
HumanBodyBones.Neck,
HumanBodyBones.LeftShoulder,
HumanBodyBones.RightShoulder
))
.Add(HumanBodyBones.Neck, ImmutableList.Create(
HumanBodyBones.Head
))
.Add(HumanBodyBones.Head, ImmutableList.Create(
HumanBodyBones.LeftEye,
HumanBodyBones.RightEye,
HumanBodyBones.Jaw
))
.Add(HumanBodyBones.LeftShoulder, ImmutableList.Create(
HumanBodyBones.LeftUpperArm
))
.Add(HumanBodyBones.RightShoulder, ImmutableList.Create(
HumanBodyBones.RightUpperArm
))
.Add(HumanBodyBones.LeftUpperArm, ImmutableList.Create(
HumanBodyBones.LeftLowerArm
))
.Add(HumanBodyBones.RightUpperArm, ImmutableList.Create(
HumanBodyBones.RightLowerArm
))
.Add(HumanBodyBones.LeftLowerArm, ImmutableList.Create(
HumanBodyBones.LeftHand
))
.Add(HumanBodyBones.RightLowerArm, ImmutableList.Create(
HumanBodyBones.RightHand
))
.Add(HumanBodyBones.LeftHand, ImmutableList.Create(
HumanBodyBones.LeftThumbProximal,
HumanBodyBones.LeftIndexProximal,
HumanBodyBones.LeftMiddleProximal,
HumanBodyBones.LeftRingProximal,
HumanBodyBones.LeftLittleProximal
))
.Add(HumanBodyBones.RightHand, ImmutableList.Create(
HumanBodyBones.RightThumbProximal,
HumanBodyBones.RightIndexProximal,
HumanBodyBones.RightMiddleProximal,
HumanBodyBones.RightRingProximal,
HumanBodyBones.RightLittleProximal
))
.Add(HumanBodyBones.LeftThumbProximal, ImmutableList.Create(
HumanBodyBones.LeftThumbIntermediate
))
.Add(HumanBodyBones.RightThumbProximal, ImmutableList.Create(
HumanBodyBones.RightThumbIntermediate
))
.Add(HumanBodyBones.LeftThumbIntermediate, ImmutableList.Create(
HumanBodyBones.LeftThumbDistal
))
.Add(HumanBodyBones.RightThumbIntermediate, ImmutableList.Create(
HumanBodyBones.RightThumbDistal
))
.Add(HumanBodyBones.LeftIndexProximal, ImmutableList.Create(
HumanBodyBones.LeftIndexIntermediate
))
.Add(HumanBodyBones.RightIndexProximal, ImmutableList.Create(
HumanBodyBones.RightIndexIntermediate
))
.Add(HumanBodyBones.LeftIndexIntermediate, ImmutableList.Create(
HumanBodyBones.LeftIndexDistal
))
.Add(HumanBodyBones.RightIndexIntermediate, ImmutableList.Create(
HumanBodyBones.RightIndexDistal
))
.Add(HumanBodyBones.LeftMiddleProximal, ImmutableList.Create(
HumanBodyBones.LeftMiddleIntermediate
))
.Add(HumanBodyBones.RightMiddleProximal, ImmutableList.Create(
HumanBodyBones.RightMiddleIntermediate
))
.Add(HumanBodyBones.LeftMiddleIntermediate, ImmutableList.Create(
HumanBodyBones.LeftMiddleDistal
))
.Add(HumanBodyBones.RightMiddleIntermediate, ImmutableList.Create(
HumanBodyBones.RightMiddleDistal
))
.Add(HumanBodyBones.LeftRingProximal, ImmutableList.Create(
HumanBodyBones.LeftRingIntermediate
))
.Add(HumanBodyBones.RightRingProximal, ImmutableList.Create(
HumanBodyBones.RightRingIntermediate
))
.Add(HumanBodyBones.LeftRingIntermediate, ImmutableList.Create(
HumanBodyBones.LeftRingDistal
))
.Add(HumanBodyBones.RightRingIntermediate, ImmutableList.Create(
HumanBodyBones.RightRingDistal
))
.Add(HumanBodyBones.LeftLittleProximal, ImmutableList.Create(
HumanBodyBones.LeftLittleIntermediate
))
.Add(HumanBodyBones.RightLittleProximal, ImmutableList.Create(
HumanBodyBones.RightLittleIntermediate
))
.Add(HumanBodyBones.LeftLittleIntermediate, ImmutableList.Create(
HumanBodyBones.LeftLittleDistal
))
.Add(HumanBodyBones.RightLittleIntermediate, ImmutableList.Create(
HumanBodyBones.RightLittleDistal
));
// This list is originally from https://github.com/HhotateA/AvatarModifyTools/blob/d8ae75fed8577707253d6b63a64d6053eebbe78b/Assets/HhotateA/AvatarModifyTool/Editor/EnvironmentVariable.cs#L81-L139 // This list is originally from https://github.com/HhotateA/AvatarModifyTools/blob/d8ae75fed8577707253d6b63a64d6053eebbe78b/Assets/HhotateA/AvatarModifyTool/Editor/EnvironmentVariable.cs#L81-L139
// Copyright (c) 2021 @HhotateA_xR // Copyright (c) 2021 @HhotateA_xR
// Licensed under the MIT License // Licensed under the MIT License
@ -359,15 +499,31 @@ namespace nadena.dev.modular_avatar.core.editor
var target = config.mergeTarget.Get(RuntimeUtil.FindAvatarInParents(config.transform)); var target = config.mergeTarget.Get(RuntimeUtil.FindAvatarInParents(config.transform));
if (target == null) return; if (target == null) return;
bool changedSuffix = false;
var newSuffix = config.suffix;
if (config.prefix == "" && config.suffix == "")
{
newSuffix = ".1";
changedSuffix = true;
}
Traverse(config.transform, target.transform); Traverse(config.transform, target.transform);
config.suffix = newSuffix;
if (changedSuffix)
{
Undo.RecordObject(config, "Applying heuristic mapping");
PrefabUtility.RecordPrefabInstancePropertyModifications(config);
}
void Traverse(Transform src, Transform dst) void Traverse(Transform src, Transform dst)
{ {
var mappings = AssignBoneMappings(config, src.gameObject, dst.gameObject); var mappings = AssignBoneMappings(config, src.gameObject, dst.gameObject);
foreach (var pair in mappings) foreach (var pair in mappings)
{ {
var newName = config.prefix + pair.Value.gameObject.name + config.suffix; var newName = config.prefix + pair.Value.gameObject.name + newSuffix;
var srcGameObj = pair.Key.gameObject; var srcGameObj = pair.Key.gameObject;
var oldName = srcGameObj.name; var oldName = srcGameObj.name;

View File

@ -92,6 +92,18 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
return S(key, key); return S(key, key);
} }
public static string S_f(string key, params string[] format)
{
try
{
return string.Format(S(key, key), format);
}
catch (FormatException e)
{
return S(key, key) + "(" + string.Join(", ", format) + ")";
}
}
public static string S(string key, string defValue) public static string S(string key, string defValue)
{ {

View File

@ -151,5 +151,14 @@
"animation_gen.duplicate_binding": "Controls from different control groups are trying to animate the same parameter. Parameter: {0}", "animation_gen.duplicate_binding": "Controls from different control groups are trying to animate the same parameter. Parameter: {0}",
"animation_gen.multiple_defaults": "Multiple default menu items were found in the same control group.", "animation_gen.multiple_defaults": "Multiple default menu items were found in the same control group.",
"menuitem.misc.add_item": "Add menu item", "menuitem.misc.add_item": "Add menu item",
"replace_object.target_object": "Object to replace" "replace_object.target_object": "Object to replace",
"setup_outfit.err.header.notarget": "Setup outfit failed",
"setup_outfit.err.header": "Setup Outfit failed to process {0}",
"setup_outfit.err.unknown": "Unknown error",
"setup_outfit.err.no_selection": "No object selected.",
"setup_outfit.err.multiple_avatar_descriptors": "Multiple avatar descriptors found in {0} and its parents.",
"setup_outfit.err.no_avatar_descriptor": "No avatar descriptor found in {0} or its parents.",
"setup_outfit.err.no_animator": "Your avatar does not have an Animator component.",
"setup_outfit.err.no_hips": "Your avatar does not have a Hips bone. Setup Outfit only works on humanoid avatars.",
"setup_outfit.err.no_outfit_hips": "Unable to identify the Hips object for the outfit. Searched for objects containing the following names:"
} }

View File

@ -149,5 +149,14 @@
"animation_gen.duplicate_binding": "別々のコントロールグループから、同じパラメーターが操作されています。パラメーター:{0}", "animation_gen.duplicate_binding": "別々のコントロールグループから、同じパラメーターが操作されています。パラメーター:{0}",
"animation_gen.multiple_defaults": "同じコントロールグループに初期設定に指定されたメニューアイテムが複数あります。", "animation_gen.multiple_defaults": "同じコントロールグループに初期設定に指定されたメニューアイテムが複数あります。",
"menuitem.misc.add_item": "メニューアイテムを追加", "menuitem.misc.add_item": "メニューアイテムを追加",
"replace_object.target_object": "上書き先" "replace_object.target_object": "上書き先",
"setup_outfit.err.header.notarget": "Setup outfit の処理が失敗しました",
"setup_outfit.err.header": "Setup outfit が「{0}」を処理中に失敗しました。",
"setup_outfit.err.unknown": "原因不明のエラーが発生しました。",
"setup_outfit.err.no_selection": "オブジェクトが選択されていません。",
"setup_outfit.err.multiple_avatar_descriptors": "「{}」とその親に、複数のavatar descriptorを発見しました。",
"setup_outfit.err.no_avatar_descriptor": "「{}」とその親に、avatar descriptorが見つかりませんでした。",
"setup_outfit.err.no_animator": "アバターにAnimatorコンポーネントがありません。",
"setup_outfit.err.no_hips": "アバターにHipsボーンがありません。なお、Setup Outfitはヒューマイドアバター以外には対応していません。",
"setup_outfit.err.no_outfit_hips": "衣装のHipsボーンを発見できませんでした。以下の名前を含むボーンを探しました"
} }

View File

@ -418,6 +418,34 @@ namespace nadena.dev.modular_avatar.core.editor
throw new Exception("Cannot merge prefab instances or prefab assets"); throw new Exception("Cannot merge prefab instances or prefab assets");
} }
if (mergedSrcBone == newParent
&& (
Vector3.SqrMagnitude(mergedSrcBone.transform.localScale - src.transform.localScale) > 0.00001f
|| Quaternion.Angle(mergedSrcBone.transform.localRotation, src.transform.localRotation) > 0.00001f
|| Vector3.SqrMagnitude(mergedSrcBone.transform.localPosition - src.transform.localPosition) > 0.00001f
)
&& src.GetComponent<IConstraint>() != null
)
{
// Constraints are sensitive to changes in local reference frames in some cases. In this case we'll
// inject a dummy object in between in order to retain the local parent scale of the retargeted bone.
var objName = src.gameObject.name + "$ConstraintRef " + Guid.NewGuid();
var constraintScaleRef = new GameObject(objName);
constraintScaleRef.transform.SetParent(src.transform.parent);
constraintScaleRef.transform.localPosition = Vector3.zero;
constraintScaleRef.transform.localRotation = Quaternion.identity;
constraintScaleRef.transform.localScale = Vector3.one;
constraintScaleRef.transform.SetParent(newParent.transform, true);
mergedSrcBone = constraintScaleRef;
BoneDatabase.AddMergedBone(mergedSrcBone.transform);
BoneDatabase.RetainMergedBone(mergedSrcBone.transform);
PathMappings.MarkTransformLookthrough(mergedSrcBone);
thisPassAdded.Add(mergedSrcBone.transform);
}
src.transform.SetParent(mergedSrcBone.transform, true); src.transform.SetParent(mergedSrcBone.transform, true);
if (config.mangleNames) if (config.mangleNames)
{ {

View File

@ -243,7 +243,7 @@ namespace nadena.dev.modular_avatar.core.editor
{ {
// Sometimes meshes have no root bone set. This is usually not ideal, but let's make sure we don't // Sometimes meshes have no root bone set. This is usually not ideal, but let's make sure we don't
// choke on the scale computation below. // choke on the scale computation below.
scaleBone = renderer.bones[0]; scaleBone = renderer.transform;
} }
renderer.bones = newBones; renderer.bones = newBones;
@ -252,12 +252,15 @@ namespace nadena.dev.modular_avatar.core.editor
dst.bindposes = newBindPoses; dst.bindposes = newBindPoses;
renderer.sharedMesh = dst; renderer.sharedMesh = dst;
} }
var newRootBone = _boneDatabase.GetRetargetedBone(rootBone, true); var newRootBone = _boneDatabase.GetRetargetedBone(rootBone, true);
var newScaleBone = _boneDatabase.GetRetargetedBone(scaleBone, true); if (newRootBone == null)
{
newRootBone = renderer.transform;
}
var oldLossyScale = scaleBone.transform.lossyScale; var oldLossyScale = scaleBone.transform.lossyScale;
var newLossyScale = newScaleBone.transform.lossyScale; var newLossyScale = newRootBone.transform.lossyScale;
var bounds = renderer.localBounds; var bounds = renderer.localBounds;
bounds.extents = new Vector3( bounds.extents = new Vector3(
@ -265,10 +268,8 @@ namespace nadena.dev.modular_avatar.core.editor
bounds.extents.y * oldLossyScale.y / newLossyScale.y, bounds.extents.y * oldLossyScale.y / newLossyScale.y,
bounds.extents.z * oldLossyScale.z / newLossyScale.z bounds.extents.z * oldLossyScale.z / newLossyScale.z
); );
bounds.center = new Vector3( bounds.center = newRootBone.transform.InverseTransformPoint(
bounds.center.x * oldLossyScale.x / newLossyScale.x, scaleBone.transform.TransformPoint(bounds.center)
bounds.center.y * oldLossyScale.y / newLossyScale.y,
bounds.center.z * oldLossyScale.z / newLossyScale.z
); );
renderer.localBounds = bounds; renderer.localBounds = bounds;

View File

@ -99,6 +99,28 @@ namespace nadena.dev.modular_avatar.core.editor
MarkObject(t.gameObject); MarkObject(t.gameObject);
} }
} }
// https://github.com/bdunderscore/modular-avatar/issues/308
// If we have duplicate Armature bones, retain them all in order to deal with some horrible hacks that are
// in use in the wild.
try
{
var trueArmature = animator?.GetBoneTransform(HumanBodyBones.Hips)?.parent;
if (trueArmature != null)
{
foreach (Transform t in _root.transform)
{
if (t.name == trueArmature.name)
{
MarkObject(t.gameObject);
}
}
}
}
catch (MissingComponentException e)
{
// No animator? weird. Move on.
}
} }
private void MarkPhysBone(VRCPhysBone pb) private void MarkPhysBone(VRCPhysBone pb)

View File

@ -43,7 +43,27 @@ namespace nadena.dev.modular_avatar.core
return _cachedReference; return _cachedReference;
} }
return (_cachedReference = avatar.transform.Find(referencePath)?.gameObject); _cachedReference = avatar.transform.Find(referencePath)?.gameObject;
if (_cachedReference == null) return null;
// https://github.com/bdunderscore/modular-avatar/issues/308
// Some avatars have multiple "Armature" objects in order to confuse VRChat into changing the avatar eye
// position. We need to be smarter than VRChat and find the "true" armature in this case.
var targetName = _cachedReference.name;
var parent = _cachedReference.transform.parent;
if (targetName == "Armature" && parent != null && _cachedReference.transform.childCount == 0)
{
foreach (Transform possibleTarget in parent)
{
if (possibleTarget.gameObject.name == targetName && possibleTarget.childCount > 0)
{
_cachedReference = possibleTarget.gameObject;
break;
}
}
}
return _cachedReference;
} }
public void Set(GameObject target) public void Set(GameObject target)

View File

@ -1,7 +1,7 @@
{ {
"name": "nadena.dev.modular-avatar", "name": "nadena.dev.modular-avatar",
"displayName": "Modular Avatar", "displayName": "Modular Avatar",
"version": "1.7.4", "version": "1.7.6",
"unity": "2019.4", "unity": "2019.4",
"description": "A suite of tools for assembling your avatar out of reusable components", "description": "A suite of tools for assembling your avatar out of reusable components",
"author": { "author": {

View File

@ -3,26 +3,19 @@
"com.vrchat.avatars": { "com.vrchat.avatars": {
"version": "3.2.0" "version": "3.2.0"
}, },
"com.vrchat.core.vpm-resolver": {
"version": "0.1.19"
},
"vrchat.blackstartx.gesture-manager": { "vrchat.blackstartx.gesture-manager": {
"version": "3.8.4" "version": "3.8.4"
} }
}, },
"locked": { "locked": {
"com.vrchat.avatars": { "com.vrchat.avatars": {
"version": "3.2.0", "version": "3.3.0",
"dependencies": { "dependencies": {
"com.vrchat.base": "3.2.0" "com.vrchat.base": "3.3.0"
} }
}, },
"com.vrchat.base": { "com.vrchat.base": {
"version": "3.2.0", "version": "3.3.0",
"dependencies": {}
},
"com.vrchat.core.vpm-resolver": {
"version": "0.1.19",
"dependencies": {} "dependencies": {}
}, },
"vrchat.blackstartx.gesture-manager": { "vrchat.blackstartx.gesture-manager": {

View File

@ -0,0 +1,7 @@
{
"m_Name": "Settings",
"m_Path": "ProjectSettings/Packages/com.unity.testtools.codecoverage/Settings.json",
"m_Dictionary": {
"m_DictionaryValues": []
}
}

View File

@ -176,7 +176,7 @@ PlayerSettings:
applicationIdentifier: {} applicationIdentifier: {}
buildNumber: {} buildNumber: {}
AndroidBundleVersionCode: 1 AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 19 AndroidMinSdkVersion: 25
AndroidTargetSdkVersion: 0 AndroidTargetSdkVersion: 0
AndroidPreferredInstallLocation: 1 AndroidPreferredInstallLocation: 1
aotOptions: aotOptions:
@ -184,7 +184,7 @@ PlayerSettings:
iPhoneStrippingLevel: 0 iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0 iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0 ForceInternetPermission: 0
ForceSDCardPermission: 0 ForceSDCardPermission: 1
CreateWallpaper: 0 CreateWallpaper: 0
APKExpansionFiles: 0 APKExpansionFiles: 0
keepLoadedShadersAlive: 0 keepLoadedShadersAlive: 0
@ -250,7 +250,7 @@ PlayerSettings:
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.vrchat.template.base@1.0.0 templatePackageId: com.vrchat.template.base@1.0.0
templateDefaultScene: Assets/VRCWelcome.unity templateDefaultScene: Assets/VRCWelcome.unity
AndroidTargetArchitectures: 1 AndroidTargetArchitectures: 2
AndroidTargetDevices: 0 AndroidTargetDevices: 0
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
@ -313,7 +313,7 @@ PlayerSettings:
- m_BuildTarget: LuminSupport - m_BuildTarget: LuminSupport
m_GraphicsJobs: 0 m_GraphicsJobs: 0
- m_BuildTarget: AndroidPlayer - m_BuildTarget: AndroidPlayer
m_GraphicsJobs: 0 m_GraphicsJobs: 1
- m_BuildTarget: WebGLSupport - m_BuildTarget: WebGLSupport
m_GraphicsJobs: 0 m_GraphicsJobs: 0
m_BuildTargetGraphicsJobMode: m_BuildTargetGraphicsJobMode:
@ -347,6 +347,12 @@ PlayerSettings:
- None - None
- OpenVR - OpenVR
- Oculus - Oculus
- m_BuildTarget: Android
m_Enabled: 1
m_Devices:
- None
- OpenVR
- Oculus
openGLRequireES31: 0 openGLRequireES31: 0
openGLRequireES31AEP: 0 openGLRequireES31AEP: 0
openGLRequireES32: 0 openGLRequireES32: 0
@ -623,7 +629,7 @@ PlayerSettings:
webGLWasmStreaming: 0 webGLWasmStreaming: 0
scriptingDefineSymbols: scriptingDefineSymbols:
1: VRC_SDK_VRCSDK3;UNITY_POST_PROCESSING_STACK_V2 1: VRC_SDK_VRCSDK3;UNITY_POST_PROCESSING_STACK_V2
7: UNITY_POST_PROCESSING_STACK_V2 7: UNITY_POST_PROCESSING_STACK_V2;VRC_SDK_VRCSDK3
13: UNITY_POST_PROCESSING_STACK_V2 13: UNITY_POST_PROCESSING_STACK_V2
14: UNITY_POST_PROCESSING_STACK_V2 14: UNITY_POST_PROCESSING_STACK_V2
19: UNITY_POST_PROCESSING_STACK_V2 19: UNITY_POST_PROCESSING_STACK_V2
@ -637,17 +643,20 @@ PlayerSettings:
33: UNITY_POST_PROCESSING_STACK_V2 33: UNITY_POST_PROCESSING_STACK_V2
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: {} scriptingBackend: {}
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration:
Android: 1
Standalone: 1
managedStrippingLevel: {} managedStrippingLevel: {}
incrementalIl2cppBuild: {} incrementalIl2cppBuild: {}
suppressCommonWarnings: 1 suppressCommonWarnings: 1
allowUnsafeCode: 0 allowUnsafeCode: 0
additionalIl2CppArgs: additionalIl2CppArgs: --compiler-flags="" --linker-flags=""
scriptingRuntimeVersion: 1 scriptingRuntimeVersion: 1
gcIncremental: 1 gcIncremental: 1
assemblyVersionValidation: 1 assemblyVersionValidation: 1
gcWBarrierValidation: 0 gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: apiCompatibilityLevelPerPlatform:
Android: 3
Standalone: 3 Standalone: 3
m_RenderingPath: 1 m_RenderingPath: 1
m_MobileRenderingPath: 1 m_MobileRenderingPath: 1

View File

@ -4,13 +4,13 @@
QualitySettings: QualitySettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 5 serializedVersion: 5
m_CurrentQuality: 3 m_CurrentQuality: 2
m_QualitySettings: m_QualitySettings:
- serializedVersion: 2 - serializedVersion: 2
name: VRC Low name: VRC Low
pixelLightCount: 4 pixelLightCount: 4
shadows: 2 shadows: 2
shadowResolution: 2 shadowResolution: 1
shadowProjection: 1 shadowProjection: 1
shadowCascades: 2 shadowCascades: 2
shadowDistance: 75 shadowDistance: 75
@ -58,7 +58,7 @@ QualitySettings:
skinWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 4 antiAliasing: 2
softParticles: 1 softParticles: 1
softVegetation: 1 softVegetation: 1
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1
@ -86,43 +86,6 @@ QualitySettings:
shadows: 2 shadows: 2
shadowResolution: 3 shadowResolution: 3
shadowProjection: 1 shadowProjection: 1
shadowCascades: 2
shadowDistance: 75
shadowNearPlaneOffset: 2
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0
skinWeights: 4
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 4
softParticles: 1
softVegetation: 1
realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1
vSyncCount: 0
lodBias: 2
maximumLODLevel: 0
streamingMipmapsActive: 0
streamingMipmapsAddAllCameras: 1
streamingMipmapsMemoryBudget: 512
streamingMipmapsRenderersPerFrame: 512
streamingMipmapsMaxLevelReduction: 2
streamingMipmapsMaxFileIORequests: 1024
particleRaycastBudget: 4096
asyncUploadTimeSlice: 2
asyncUploadBufferSize: 128
asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms:
- Android
- serializedVersion: 2
name: VRC Ultra
pixelLightCount: 8
shadows: 2
shadowResolution: 3
shadowProjection: 1
shadowCascades: 4 shadowCascades: 4
shadowDistance: 150 shadowDistance: 150
shadowNearPlaneOffset: 2 shadowNearPlaneOffset: 2

View File

@ -11,6 +11,7 @@
"LIL_FEATURE_SHADOW": true, "LIL_FEATURE_SHADOW": true,
"LIL_FEATURE_RECEIVE_SHADOW": true, "LIL_FEATURE_RECEIVE_SHADOW": true,
"LIL_FEATURE_SHADOW_3RD": true, "LIL_FEATURE_SHADOW_3RD": true,
"LIL_FEATURE_SHADOW_LUT": true,
"LIL_FEATURE_EMISSION_1ST": true, "LIL_FEATURE_EMISSION_1ST": true,
"LIL_FEATURE_EMISSION_2ND": true, "LIL_FEATURE_EMISSION_2ND": true,
"LIL_FEATURE_ANIMATE_EMISSION_UV": true, "LIL_FEATURE_ANIMATE_EMISSION_UV": true,
@ -34,6 +35,8 @@
"LIL_FEATURE_AUDIOLINK_VERTEX": true, "LIL_FEATURE_AUDIOLINK_VERTEX": true,
"LIL_FEATURE_AUDIOLINK_LOCAL": true, "LIL_FEATURE_AUDIOLINK_LOCAL": true,
"LIL_FEATURE_DISSOLVE": true, "LIL_FEATURE_DISSOLVE": true,
"LIL_FEATURE_IDMASK": true,
"LIL_FEATURE_DITHER": true,
"LIL_FEATURE_ENCRYPTION": false, "LIL_FEATURE_ENCRYPTION": false,
"LIL_FEATURE_ANIMATE_OUTLINE_UV": true, "LIL_FEATURE_ANIMATE_OUTLINE_UV": true,
"LIL_FEATURE_OUTLINE_TONE_CORRECTION": true, "LIL_FEATURE_OUTLINE_TONE_CORRECTION": true,
@ -99,6 +102,7 @@
"LIL_OPTIMIZE_USE_FORWARDADD_SHADOW": false, "LIL_OPTIMIZE_USE_FORWARDADD_SHADOW": false,
"LIL_OPTIMIZE_USE_VERTEXLIGHT": true, "LIL_OPTIMIZE_USE_VERTEXLIGHT": true,
"LIL_OPTIMIZE_USE_LIGHTMAP": false, "LIL_OPTIMIZE_USE_LIGHTMAP": false,
"LIL_OPTIMIZE_DEFFERED": false,
"isLocked": false, "isLocked": false,
"isDebugOptimize": false, "isDebugOptimize": false,
"isOptimizeInTestBuild": false, "isOptimizeInTestBuild": false,
@ -109,6 +113,12 @@
"defaultBeforeExposureLimit": 10000.0, "defaultBeforeExposureLimit": 10000.0,
"defaultMonochromeLighting": 0.0, "defaultMonochromeLighting": 0.0,
"defaultlilDirectionalLightStrength": 1.0, "defaultlilDirectionalLightStrength": 1.0,
"mainLightModeName": "",
"outlineLightModeName": "",
"preLightModeName": "",
"furLightModeName": "",
"furPreLightModeName": "",
"gemPreLightModeName": "",
"presetSkin": { "presetSkin": {
"instanceID": 0 "instanceID": 0
}, },

View File

@ -26,7 +26,7 @@
"react-loadable": "^5.5.0", "react-loadable": "^5.5.0",
"react-medium-image-zoom": "^5.1.8", "react-medium-image-zoom": "^5.1.8",
"react-modal": "^3.16.1", "react-modal": "^3.16.1",
"react-player": "^2.12.0" "react-player": "^2.13.0"
}, },
"devDependencies": { "devDependencies": {
"@docusaurus/module-type-aliases": "2.4.1", "@docusaurus/module-type-aliases": "2.4.1",

View File

@ -7385,7 +7385,7 @@ __metadata:
react-loadable: ^5.5.0 react-loadable: ^5.5.0
react-medium-image-zoom: ^5.1.8 react-medium-image-zoom: ^5.1.8
react-modal: ^3.16.1 react-modal: ^3.16.1
react-player: ^2.12.0 react-player: ^2.13.0
typescript: ^5.2.2 typescript: ^5.2.2
languageName: unknown languageName: unknown
linkType: soft linkType: soft
@ -8812,9 +8812,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"react-player@npm:^2.12.0": "react-player@npm:^2.13.0":
version: 2.12.0 version: 2.13.0
resolution: "react-player@npm:2.12.0" resolution: "react-player@npm:2.13.0"
dependencies: dependencies:
deepmerge: ^4.0.0 deepmerge: ^4.0.0
load-script: ^1.0.0 load-script: ^1.0.0
@ -8823,7 +8823,7 @@ __metadata:
react-fast-compare: ^3.0.1 react-fast-compare: ^3.0.1
peerDependencies: peerDependencies:
react: ">=16.6.0" react: ">=16.6.0"
checksum: 77d3e55ed67cd9c1e2300a990d8015d270072daad41f8a0750c32748f3fbfbc5bd2a2f06e78ac6828c2260b84537b9571d0abac31d3e888b74a3dccb59a56365 checksum: 7e0e69e0ac37227ab5bfdda73991d4f5d4741585562f3ad9cfb787ae2c427510b69ddf6ef3f23f319d699b790af852fca57f3e9b1dae94f385d545a3db200d67
languageName: node languageName: node
linkType: hard linkType: hard