mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-25 15:47:26 -05:00
VRM10MainView
This commit is contained in:
parent
5ebaa1e3ec
commit
8302d6240c
8
Assets/UI Toolkit.meta
Normal file
8
Assets/UI Toolkit.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e8058c904a4a5db409f80cf8e431db00
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/UI Toolkit/UnityThemes.meta
Normal file
8
Assets/UI Toolkit/UnityThemes.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 38f3ae23a3f1f114ab237169eac0400d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1 @@
|
|||
@import url("unity-theme://default");
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7ef82646a4b7c43409ba39b532f3a687
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 12388, guid: 0000000000000000e000000000000000, type: 0}
|
||||
disableValidation: 0
|
||||
39
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.asset
Normal file
39
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.asset
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
%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: 19101, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: MainView
|
||||
m_EditorClassIdentifier:
|
||||
themeUss: {fileID: -4733365628477956816, guid: 7ef82646a4b7c43409ba39b532f3a687,
|
||||
type: 3}
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_ScaleMode: 1
|
||||
m_ReferenceSpritePixelsPerUnit: 100
|
||||
m_Scale: 1
|
||||
m_ReferenceDpi: 96
|
||||
m_FallbackDpi: 96
|
||||
m_ReferenceResolution: {x: 1200, y: 800}
|
||||
m_ScreenMatchMode: 0
|
||||
m_Match: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
m_ClearDepthStencil: 1
|
||||
m_ClearColor: 0
|
||||
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
|
||||
m_DynamicAtlasSettings:
|
||||
m_MinAtlasSize: 64
|
||||
m_MaxAtlasSize: 4096
|
||||
m_MaxSubTextureSize: 64
|
||||
m_ActiveFilters: -1
|
||||
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
|
||||
textSettings: {fileID: 0}
|
||||
8
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.asset.meta
Normal file
8
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.asset.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 39a830a275e09594f9eaac0b54c35b23
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.uxml
Normal file
8
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.uxml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
|
||||
<ui:VisualElement name="left" style="flex-grow: 0; min-width: 200px; background-color: rgba(255, 255, 255, 0.35);">
|
||||
<ui:Button text="Open Model" parse-escape-sequences="true" display-tooltip-when-elided="true" name="OpenModel" />
|
||||
</ui:VisualElement>
|
||||
<ui:VisualElement name="right" style="flex-grow: 1;" />
|
||||
</ui:VisualElement>
|
||||
</ui:UXML>
|
||||
10
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.uxml.meta
Normal file
10
Assets/VRM10_Samples/VRM10Viewer/UI/MainView.uxml.meta
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bd4bcd408afc8ad46b67bed616d73d58
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}
|
||||
35
Assets/VRM10_Samples/VRM10Viewer/UI/VRM10MainView.cs
Normal file
35
Assets/VRM10_Samples/VRM10Viewer/UI/VRM10MainView.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
namespace UniVRM10.VRM10Viewer
|
||||
{
|
||||
public class VRM10MainView : MonoBehaviour
|
||||
{
|
||||
[Header("Material")]
|
||||
[SerializeField]
|
||||
Material m_pbrOpaqueMaterial = default;
|
||||
[SerializeField]
|
||||
Material m_pbrAlphaBlendMaterial = default;
|
||||
[SerializeField]
|
||||
Material m_mtoonMaterialOpaque = default;
|
||||
[SerializeField]
|
||||
Material m_mtoonMaterialAlphaBlend = default;
|
||||
|
||||
VRM10ViewerController m_controller;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
m_controller = new VRM10ViewerController(
|
||||
(m_mtoonMaterialOpaque != null && m_mtoonMaterialAlphaBlend != null) ? new TinyMToonrMaterialImporter(m_mtoonMaterialOpaque, m_mtoonMaterialAlphaBlend) : null,
|
||||
(m_pbrOpaqueMaterial != null && m_pbrAlphaBlendMaterial != null) ? new TinyPbrMaterialImporter(m_pbrOpaqueMaterial, m_pbrAlphaBlendMaterial) : null
|
||||
);
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
{
|
||||
m_controller.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/VRM10_Samples/VRM10Viewer/UI/VRM10MainView.cs.meta
Normal file
11
Assets/VRM10_Samples/VRM10Viewer/UI/VRM10MainView.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ce3555915b1cabf43a72ad94373270e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -45,9 +45,13 @@ namespace UniVRM10.VRM10Viewer
|
|||
m_loaded = null;
|
||||
}
|
||||
m_loaded = value;
|
||||
m_onLoaded(m_loaded);
|
||||
if (OnLoaded != null)
|
||||
{
|
||||
OnLoaded(m_loaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
public event Action<Loaded> OnLoaded;
|
||||
|
||||
IVrm10Animation m_src = default;
|
||||
public IVrm10Animation TPose;
|
||||
|
|
@ -65,19 +69,23 @@ namespace UniVRM10.VRM10Viewer
|
|||
TPose = new Vrm10TPose(m_src.ControlRig.Item1.GetRawHipsPosition());
|
||||
}
|
||||
}
|
||||
Action<Loaded> m_onLoaded;
|
||||
VrmMetaInformationCallback m_updateMeta;
|
||||
|
||||
public event VrmMetaInformationCallback OnUpdateMeta;
|
||||
void RaiseUpdateMeta(Texture2D thumbnail, UniGLTF.Extensions.VRMC_vrm.Meta vrm10Meta, Migration.Vrm0Meta vrm0Meta)
|
||||
{
|
||||
if (OnUpdateMeta != null)
|
||||
{
|
||||
OnUpdateMeta(thumbnail, vrm10Meta, vrm0Meta);
|
||||
}
|
||||
}
|
||||
|
||||
public VRM10ViewerController(
|
||||
TinyMToonrMaterialImporter tinyMToon,
|
||||
TinyPbrMaterialImporter tinyPbr,
|
||||
VrmMetaInformationCallback updateMeta,
|
||||
Action<Loaded> onLoaded
|
||||
TinyPbrMaterialImporter tinyPbr
|
||||
)
|
||||
{
|
||||
m_mtoonImporter = tinyMToon;
|
||||
m_pbrImporter = tinyPbr;
|
||||
m_onLoaded = onLoaded;
|
||||
m_updateMeta = updateMeta;
|
||||
}
|
||||
|
||||
public void ShowBoxMan(bool show)
|
||||
|
|
@ -253,7 +261,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
showMeshes: false,
|
||||
awaitCaller: GetIAwaitCaller(opts.UseAsync),
|
||||
materialGenerator: GetMaterialDescriptorGenerator(opts),
|
||||
vrmMetaInformationCallback: m_updateMeta,
|
||||
vrmMetaInformationCallback: RaiseUpdateMeta,
|
||||
ct: cancellationToken,
|
||||
springboneRuntime: opts.UseSpringboneSingelton ? new Vrm10FastSpringboneRuntime() : new Vrm10FastSpringboneRuntimeStandalone());
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
|
|
|
|||
|
|
@ -497,9 +497,10 @@ namespace UniVRM10.VRM10Viewer
|
|||
{
|
||||
m_controller = new(
|
||||
(m_mtoonMaterialOpaque != null && m_mtoonMaterialAlphaBlend != null) ? new TinyMToonrMaterialImporter(m_mtoonMaterialOpaque, m_mtoonMaterialAlphaBlend) : null,
|
||||
(m_pbrOpaqueMaterial != null && m_pbrAlphaBlendMaterial != null) ? new TinyPbrMaterialImporter(m_pbrOpaqueMaterial, m_pbrAlphaBlendMaterial) : null,
|
||||
m_texts.UpdateMeta,
|
||||
OnLoaded);
|
||||
(m_pbrOpaqueMaterial != null && m_pbrAlphaBlendMaterial != null) ? new TinyPbrMaterialImporter(m_pbrOpaqueMaterial, m_pbrAlphaBlendMaterial) : null
|
||||
);
|
||||
m_controller.OnUpdateMeta += m_texts.UpdateMeta;
|
||||
m_controller.OnLoaded += OnLoaded;
|
||||
|
||||
// URP かつ WebGL で有効にする
|
||||
m_useCustomMToonMaterial.isOn = Application.platform == RuntimePlatform.WebGLPlayer && GraphicsSettings.renderPipelineAsset != null;
|
||||
|
|
|
|||
|
|
@ -3990,6 +3990,55 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 263338843}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!1 &268016453
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 268016455}
|
||||
- component: {fileID: 268016454}
|
||||
m_Layer: 0
|
||||
m_Name: MainView
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &268016454
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 268016453}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_PanelSettings: {fileID: 11400000, guid: 39a830a275e09594f9eaac0b54c35b23, type: 2}
|
||||
m_ParentUI: {fileID: 0}
|
||||
sourceAsset: {fileID: 9197481963319205126, guid: bd4bcd408afc8ad46b67bed616d73d58,
|
||||
type: 3}
|
||||
m_SortingOrder: 0
|
||||
--- !u!4 &268016455
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 268016453}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1 &279721863
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -37521,7 +37570,8 @@ SceneRoots:
|
|||
- {fileID: 322182885}
|
||||
- {fileID: 802105004}
|
||||
- {fileID: 2141451818}
|
||||
- {fileID: 1787938566}
|
||||
- {fileID: 204388504}
|
||||
- {fileID: 1407428958}
|
||||
- {fileID: 1150163685}
|
||||
- {fileID: 1787938566}
|
||||
- {fileID: 268016455}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user