Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from PoChang007/upgrade_vrmviewer_v0.66
Browse files Browse the repository at this point in the history
Upgrade VRMViewer
  • Loading branch information
ousttrue authored Feb 5, 2021
2 parents 1d29599 + ac2f836 commit 37429c9
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 59 deletions.
8 changes: 4 additions & 4 deletions Assets/VRMViewer/Scripts/AiueoViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ IEnumerator RoutineNest(BlendShapePreset preset, float velocity, float wait)
{
for (var value = 0.0f; value <= 1.0f; value += velocity)
{
BlendShapes.ImmediatelySetValue(preset, value);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(preset), value);
yield return null;
}
BlendShapes.ImmediatelySetValue(preset, 1.0f);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(preset), 1.0f);
yield return new WaitForSeconds(wait);
for (var value = 1.0f; value >= 0; value -= velocity)
{
BlendShapes.ImmediatelySetValue(preset, value);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(preset), value);
yield return null;
}
BlendShapes.ImmediatelySetValue(preset, 0);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(preset), 0);
yield return new WaitForSeconds(wait * 2);
}

Expand Down
8 changes: 4 additions & 4 deletions Assets/VRMViewer/Scripts/BlinkerViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ protected IEnumerator BlinkRoutine()
break;
}

BlendShapes.ImmediatelySetValue(BlendShapePreset.Blink, value);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), value);
yield return null;
}
BlendShapes.ImmediatelySetValue(BlendShapePreset.Blink, 1.0f);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), 1.0f);

// wait...
yield return new WaitForSeconds(m_closingTime);
Expand All @@ -88,10 +88,10 @@ protected IEnumerator BlinkRoutine()
break;
}

BlendShapes.ImmediatelySetValue(BlendShapePreset.Blink, value);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), value);
yield return null;
}
BlendShapes.ImmediatelySetValue(BlendShapePreset.Blink, 0);
BlendShapes.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.Blink), 0);
}
}

Expand Down
8 changes: 4 additions & 4 deletions Assets/VRMViewer/Scripts/TargetMover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ private void LateUpdate()
_vrmModel.GetComponent<VRMLookAtBlendShapeApplyer>().m_notSetValueApply = true;

var blednShapeProxy = _vrmModel.GetComponent<VRMBlendShapeProxy>();
blednShapeProxy.ImmediatelySetValue(BlendShapePreset.LookUp, 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapePreset.LookDown, 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapePreset.LookLeft, 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapePreset.LookRight, 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.LookUp), 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.LookDown), 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.LookLeft), 0.0f);
blednShapeProxy.ImmediatelySetValue(BlendShapeKey.CreateFromPreset(BlendShapePreset.LookRight), 0.0f);
}
}
}
Expand Down
53 changes: 45 additions & 8 deletions Assets/VRMViewer/Scripts/ViewerUI.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections;
using System.IO;
using UniHumanoid;
using UnityEngine;
using UnityEngine.UI;
using VRM;
using SimpleFileBrowser;

namespace VRMViewer
{
Expand Down Expand Up @@ -70,6 +72,9 @@ public class ViewerUI : MonoBehaviour
[SerializeField]
private HumanPoseClip _avatarTPose;

private string _vrmPath = null;
private string _bvhPath = null;

private HumanPoseTransfer _bvhSource;
private HumanPoseTransfer _loadedBvhSourceOnAvatar;
private BvhImporterContext _bvhMotion;
Expand Down Expand Up @@ -183,20 +188,52 @@ private void UIOperation()

private void OnOpenClickedVRM()
{
var path = FileDialogForWindows.FileDialog("open vrm", "vrm");

if (string.IsNullOrEmpty(path)) { return; }
FileBrowser.SetFilters(true, new FileBrowser.Filter("VRM File", ".vrm", ".VRM"));
FileBrowser.SetDefaultFilter(".vrm");
FileBrowser.AddQuickLink("Users", "C:\\Users", null);
StartCoroutine(ShowLoadDialogModel());
if (string.IsNullOrEmpty(_vrmPath)) return;
_errorMessagePanel.gameObject.SetActive(false);
LoadModel(path);
}

private IEnumerator ShowLoadDialogModel()
{
yield return FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.Files);
//Debug.Log(FileBrowser.Success + " " + FileBrowser.Result);
if (FileBrowser.Success)
{
_vrmPath = FileBrowser.Result[0];
LoadModel(_vrmPath);
}
else
{
_vrmPath = null;
}
}

private void OnOpenClickedBVH()
{
var path = FileDialogForWindows.FileDialog("open BVH", "bvh");

if (string.IsNullOrEmpty(path)) { return; }
FileBrowser.SetFilters(true, new FileBrowser.Filter("BVH File", ".bvh", ".BVH", ".txt"));
FileBrowser.SetDefaultFilter(".bvh");
FileBrowser.AddQuickLink("Users", "C:\\Users", null);
StartCoroutine(ShowLoadDialogMotion());
if (string.IsNullOrEmpty(_bvhPath)) return;
_errorMessagePanel.gameObject.SetActive(false);
LoadMotion(path);
}

private IEnumerator ShowLoadDialogMotion()
{
yield return FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.Files);
//Debug.Log(FileBrowser.Success + " " + FileBrowser.Result);
if (FileBrowser.Success)
{
_bvhPath = FileBrowser.Result[0];
LoadMotion(_bvhPath);
}
else
{
_bvhPath = null;
}
}

private void LoadModel(string path)
Expand Down
4 changes: 3 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
MIT License

Copyright (c) 2018 dwango
Copyright (c) 2020 VRM Consortium
Copyright (c) 2018 Masataka SUMI for MToon
Copyright (c) 2016 Süleyman Yasir KULA for UnitySimpleFileBrowser

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 9 additions & 7 deletions Packages/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
"dependencies": {
"com.unity.2d.sprite": "1.0.0",
"com.unity.2d.tilemap": "1.0.0",
"com.unity.ads": "3.4.7",
"com.unity.ads": "3.5.2",
"com.unity.analytics": "3.3.5",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ide.rider": "1.1.4",
"com.unity.ide.vscode": "1.2.1",
"com.unity.ide.vscode": "1.2.3",
"com.unity.multiplayer-hlapi": "1.0.6",
"com.unity.purchasing": "2.0.6",
"com.unity.test-framework": "1.1.16",
"com.unity.purchasing": "2.2.1",
"com.unity.test-framework": "1.1.20",
"com.unity.textmeshpro": "2.0.1",
"com.unity.timeline": "1.2.6",
"com.unity.ugui": "1.0.0",
"com.unity.xr.legacyinputhelpers": "2.1.4",
"com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.58.1",
"com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.58.1",
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.vrmc.vrmshaders": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRMShaders#v0.66.0",
"com.vrmc.unigltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.66.0",
"com.vrmc.univrm": "https://github.com/vrm-c/UniVRM.git?path=/Assets/VRM#v0.66.0",
"com.yasirkula.simplefilebrowser": "https://github.com/yasirkula/UnitySimpleFileBrowser.git",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0",
Expand Down
9 changes: 6 additions & 3 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ PlayerSettings:
useOnDemandResources: 0
accelerometerFrequency: 60
companyName: VRM Consortium
productName: VRM Viewer 0.58.1
productName: VRMViewer_v0.66.0
defaultCursor: {fileID: 0}
cursorHotspot: {x: 0, y: 0}
m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1}
Expand Down Expand Up @@ -124,7 +124,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.58.1
bundleVersion: 0.66.0
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down Expand Up @@ -231,6 +231,7 @@ PlayerSettings:
metalEditorSupport: 1
metalAPIValidation: 1
iOSRenderExtraFrameOnPause: 0
iosCopyPluginsCodeInsteadOfSymlink: 0
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
Expand Down Expand Up @@ -309,7 +310,7 @@ PlayerSettings:
m_BuildTargetGraphicsAPIs: []
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
m_Enabled: 1
m_Enabled: 0
m_Devices:
- Oculus
openGLRequireES31: 0
Expand Down Expand Up @@ -570,6 +571,7 @@ PlayerSettings:
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0
assemblyVersionValidation: 1
gcWBarrierValidation: 0
apiCompatibilityLevelPerPlatform: {}
m_RenderingPath: 1
Expand Down Expand Up @@ -619,6 +621,7 @@ PlayerSettings:
XboxOneCapability: []
XboxOneGameRating: {}
XboxOneIsContentPackage: 0
XboxOneEnhancedXboxCompatibilityMode: 0
XboxOneEnableGPUVariability: 0
XboxOneSockets: {}
XboxOneSplashScreen: {fileID: 0}
Expand Down
41 changes: 41 additions & 0 deletions README.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# UniVRMTest

これは[UniVRM](https://github.com/vrm-c/UniVRM)のテストとサンプル集です。

# License

[MIT License](License.txt)

## VRMViewer

ユーザーがVRMモデル情報を確認できるアプリケーションです。

## ウンロード

1. 本リポジトリの[リリースページ](https://github.com/vrm-c/UniVRMTest/releases)へ移動してください
1. 最新の``VRMViewer_v0.xx.x``をダウンロードしてください

## VRMモデルを読み込む

1. ``VRMViewer_v0.xx.x.exe``を実行してください
1. ``VRMモデル``ボタンをクリックしてください
1. ローカルディレクトリからVRMファイルを選んでください

<img src="doc/VRMViewerInterface.png" width="800">

## ToDo

* [x] モデル情報表示
* [x] コマンドライン引数
* [x] T-Pose・モーションスイッチ
* [x] 目線・正面・ターゲット・カメラ目線
* [x] VRMLookAtBoneApplyer
* [x] VRMLookAtBlendShapeApplyer
* [ ] BlendShape
* [x] AIUEO
* [x] AutoBlink
* [ ] Next, Prev
* [x] 表情リスト
* [x] 一人称表示
* [ ] 頂点数

44 changes: 16 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,43 @@
# UniVRMTest

This is a project for [UniVRM](https://github.com/dwango/UniVRM) build test and samples.
[日本語](README.ja.md)

これは[UniVRM](https://github.com/dwango/UniVRM)のテストとサンプル集です。
UniVRMTest is for [UniVRM](https://github.com/vrm-c/UniVRM) samples and build tests.

# License

The project is released under the [MIT License](License.txt).


## VRMViewer

An application that users can view VRM models.

ユーザーがVRMモデル情報を確認できるアプリケーションです。
VRMViewer is a runtime VRM loader for checking VRM model's information and runtime behaviors.

## Download
###
1. Go to the [releases page](https://github.com/dwango/UniVRMTest/releases)
1. Download the latest version ``VRMViewer-v.1.xx``

###
1. 本リポジトリの[リリースページ](https://github.com/dwango/UniVRMTest/releases)へ移動してください
1. 最新の``VRMViewer-v.1.xx``をダウンロードしてください
1. Go to the [releases page](https://github.com/vrm-c/UniVRMTest/releases)
1. Download the latest version ``VRMViewer_v0.xx.x``

## How to load a VRM file
###
1. Run ``VRMViewer.exe``
1. Click the VRM Model button
1. Select a VRM file from your computer

###
1. ``VRMViewer.exe``を実行してください
1. ``VRMモデル``ボタンをクリックしてください
1. パソコンからVRMファイルを選んでください
1. Run ``VRMViewer_v0.xx.x.exe``
1. Click the VRM Model button
1. Select a VRM file from the local directory

![VRMViewerInterface](doc/VRMViewerInterface.png)
<img src="doc/VRMViewerInterface.png" width="800">

## ToDo

* [x] モデル情報表示 (Model information)
* [x] コマンドライン引数 (Command line arguments)
* [x] T-Pose・モーションスイッチ (T-Pose / Motion switch)
* [x] 目線・正面・ターゲット・カメラ目線 (The model looks straight ahead / looks at target / looks at camera)
* [x] Model information
* [x] Command line arguments
* [x] Switch options for T-Pose / BVH Motion
* [x] Model LookAt: straight ahead / target / camera
* [x] VRMLookAtBoneApplyer
* [x] VRMLookAtBlendShapeApplyer
* [ ] BlendShape
* [x] AIUEO
* [x] AutoBlink
* [ ] Next, Prev
* [x] 表情リスト (Expression list)
* [x] 一人称表示 (Model rendering in first-person mode)
* [ ] 頂点数 (Vertex count)
* [x] Expression list
* [x] Model rendering in first-person mode
* [ ] Vertex count

0 comments on commit 37429c9

Please sign in to comment.