-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
221 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2023 chocopoi | ||
* | ||
* This file is part of DressingFramework. | ||
* | ||
* DressingFramework is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* | ||
* DressingFramework is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with DressingFramework. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#if DK_VRCSDK3A | ||
using UnityEditor; | ||
using UnityEditor.Animations; | ||
using VRC.SDK3.Avatars.Components; | ||
|
||
namespace Chocopoi.DressingFramework.Animations.VRChat | ||
{ | ||
public class VRCAnimUtils | ||
{ | ||
public static AnimatorController GetAnimLayerAnimator(VRCAvatarDescriptor.CustomAnimLayer animLayer) | ||
{ | ||
return !animLayer.isDefault && animLayer.animatorController != null && animLayer.animatorController is AnimatorController controller ? | ||
controller : | ||
GetDefaultLayerAnimator(animLayer.type); | ||
} | ||
|
||
public static AnimatorController GetDefaultLayerAnimator(VRCAvatarDescriptor.AnimLayerType animLayerType) | ||
{ | ||
string defaultControllerName = null; | ||
switch (animLayerType) | ||
{ | ||
case VRCAvatarDescriptor.AnimLayerType.Base: | ||
defaultControllerName = "LocomotionLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.Additive: | ||
defaultControllerName = "IdleLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.Action: | ||
defaultControllerName = "ActionLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.Gesture: | ||
defaultControllerName = "HandsLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.FX: | ||
defaultControllerName = "FaceLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.Sitting: | ||
defaultControllerName = "SittingLayer"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.IKPose: | ||
defaultControllerName = "UtilityIKPose"; | ||
break; | ||
case VRCAvatarDescriptor.AnimLayerType.TPose: | ||
defaultControllerName = "UtilityTPose"; | ||
break; | ||
} | ||
|
||
if (defaultControllerName == null) | ||
{ | ||
return null; | ||
} | ||
|
||
var controller = AssetDatabase.LoadAssetAtPath<AnimatorController>("Packages/com.vrchat.avatars/Samples/AV3 Demo Assets/Animation/Controllers/vrc_AvatarV3" + defaultControllerName + ".controller"); | ||
if (controller == null) | ||
{ | ||
controller = AssetDatabase.LoadAssetAtPath<AnimatorController>("Assets/VRCSDK/Examples3/Animation/Controllers/vrc_AvatarV3" + defaultControllerName + ".controller"); | ||
} | ||
return controller; | ||
} | ||
} | ||
} | ||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters