MetaView.uxml

This commit is contained in:
ousttrue
2025-03-25 01:23:49 +09:00
parent 18b16ddc46
commit 53fd0abba9
7 changed files with 157 additions and 41 deletions

View File

@@ -2,12 +2,13 @@
<ui:Template name="EmotionElement" src="project://database/Assets/VRM10_Samples/VRM10Viewer/UIToolkit/EmotionElement.uxml?fileID=9197481963319205126&amp;guid=e877eb3dcb0d99e4a99d40156a476bce&amp;type=3#EmotionElement" />
<ui:Template name="ExpressionElement" src="project://database/Assets/VRM10_Samples/VRM10Viewer/UIToolkit/ExpressionElement.uxml?fileID=9197481963319205126&amp;guid=f16ec41d6ac2e364f92a4de67b3f972a&amp;type=3#ExpressionElement" />
<ui:Template name="MetaView" src="project://database/Assets/VRM10_Samples/VRM10Viewer/UIToolkit/MetaView.uxml?fileID=9197481963319205126&amp;guid=fc89bbe262d980f4a9695319d2f9ed75&amp;type=3#MetaView" />
<Style src="project://database/Assets/VRM10_Samples/VRM10Viewer/UIToolkit/ui.uss?fileID=7433441132597879392&amp;guid=ab1324f1eed77164986baf384bafef2f&amp;type=3#ui" />
<ui:VisualElement style="flex-grow: 1; flex-direction: row;">
<ui:VisualElement name="left" style="flex-grow: 0; background-color: rgba(255, 255, 255, 0.35); flex-shrink: 0; width: 200px;">
<ui:Toggle label="Show BoxMan" name="ShowBoxMan" value="true" style="flex-direction: row-reverse;" />
<ui:Label tabindex="-1" text="Model" parse-escape-sequences="true" display-tooltip-when-elided="true" name="__Model__" style="-unity-font-style: bold; -unity-text-align: upper-center;" />
<ui:Toggle label="Use CustomPbrMaterial" name="UseCustomPbrMaterial" value="true" style="flex-direction: row-reverse;" />
<ui:Toggle label="Use CustomMToonMaterial" name="UseCustomMToonMaterial" style="flex-direction: row-reverse;" />
<ui:Toggle label="Use CustomPbr" name="UseCustomPbrMaterial" value="true" style="flex-direction: row-reverse;" />
<ui:Toggle label="Use CustomMToon" name="UseCustomMToonMaterial" style="flex-direction: row-reverse;" />
<ui:Button text="Open Model" parse-escape-sequences="true" display-tooltip-when-elided="true" name="OpenModel" />
<ui:Label tabindex="-1" text="ImportOption" parse-escape-sequences="true" display-tooltip-when-elided="true" name="__ImportOption__" style="-unity-font-style: bold; -unity-text-align: upper-center;" />
<ui:Toggle label="Use Async" name="UseAsync" style="flex-direction: row-reverse;" />

View File

@@ -1,15 +1,23 @@
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" xsi="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<Style src="project://database/Assets/VRM10_Samples/VRM10Viewer/UIToolkit/ui.uss?fileID=7433441132597879392&amp;guid=ab1324f1eed77164986baf384bafef2f&amp;type=3#ui" />
<ui:VisualElement style="flex-grow: 1;">
<MetaView>
<ui:Label tabindex="-1" text="Model Information" parse-escape-sequences="true" display-tooltip-when-elided="true" style="-unity-font-style: bold; -unity-text-align: upper-center;" />
<ui:TextField picking-mode="Ignore" label="name" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="version" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="author" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="copyright" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="contact" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="reference" value="filler text" focusable="false" readonly="true" />
<ui:TextField picking-mode="Ignore" label="name" value="filler text" focusable="false" readonly="true" name="MetaName" />
<ui:TextField picking-mode="Ignore" label="version" value="filler text" focusable="false" readonly="true" name="MetaVersion" />
<ui:TextField picking-mode="Ignore" label="author" value="filler text" focusable="false" readonly="true" name="MetaAuthor" />
<ui:TextField picking-mode="Ignore" label="copyright" value="filler text" focusable="false" readonly="true" name="MetaCopyright" />
<ui:TextField picking-mode="Ignore" label="contact" value="filler text" focusable="false" readonly="true" name="MetaContact" />
<ui:TextField picking-mode="Ignore" label="reference" value="filler text" focusable="false" readonly="true" name="MetaReference" />
<TextureElement name="Thumbnail" style="width: 200px; height: 200px; flex-shrink: 0; align-self: center;" />
<ui:Label tabindex="-1" text="Avatar Permission" parse-escape-sequences="true" display-tooltip-when-elided="true" style="-unity-font-style: bold; -unity-text-align: upper-center;" />
<ui:TextField picking-mode="Ignore" label="Allowed" value="filler text" focusable="false" readonly="true" name="PermissionAllowed" />
<ui:TextField picking-mode="Ignore" label="Violent" value="filler text" focusable="false" readonly="true" name="PermissionViolent" />
<ui:TextField picking-mode="Ignore" label="Sexual" value="filler text" focusable="false" readonly="true" name="PermissionSexual" />
<ui:TextField picking-mode="Ignore" label="Commercial" value="filler text" focusable="false" readonly="true" name="PermissionCommercial" />
<ui:Label tabindex="-1" text="Redistribution" parse-escape-sequences="true" display-tooltip-when-elided="true" style="-unity-font-style: bold; -unity-text-align: upper-center;" />
<ui:TextField picking-mode="Ignore" label="License" value="filler text" focusable="false" readonly="true" name="MetaLicense" />
<ui:TextField picking-mode="Ignore" label="Distribution" value="filler text" focusable="false" readonly="true" name="MetaDistribution" />
</MetaView>
</ui:VisualElement>
</ui:UXML>

View File

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
class TextureElement : VisualElement
{
public TextureElement()
{
}
public new class UxmlFactory : UxmlFactory<TextureElement, UxmlTraits> { }
public new class UxmlTraits : VisualElement.UxmlTraits
{
UxmlStringAttributeDescription m_texture = new UxmlStringAttributeDescription { name = "texture" };
public override IEnumerable<UxmlChildElementDescription> uxmlChildElementsDescription
{
get { yield break; }
}
public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc)
{
base.Init(ve, bag, cc);
}
}
}

View File

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

View File

@@ -1,3 +1,4 @@
using System;
using UniGLTF;
using UniGLTF.SpringBoneJobs.Blittables;
using UnityEngine;
@@ -35,6 +36,22 @@ namespace UniVRM10.VRM10Viewer
Toggle m_useSpringboneScaling;
Toggle m_showBoxMan;
// meta
TextField m_metaName;
TextField m_metaVersion;
TextField m_metaAuthor;
TextField m_metaCopyright;
TextField m_metaContact;
TextField m_metaReference;
TextureElement m_metaThumbnail;
TextField m_metaPermissionAllowed;
TextField m_metaPermissionViolent;
TextField m_metaPermissionSexual;
TextField m_metaPermissionCommercial;
TextField m_metaLicense;
TextField m_metaDistribution;
void QueryOrAssert<T>(out T dst, VisualElement root, string name) where T : VisualElement
{
dst = root.Q<T>(name);
@@ -72,6 +89,21 @@ namespace UniVRM10.VRM10Viewer
QueryOrAssert(out m_useSpringboneScaling, root, "UseSpringboneScaling");
QueryOrAssert(out m_showBoxMan, root, "ShowBoxMan");
// meta
QueryOrAssert(out m_metaName, root, "MetaName");
QueryOrAssert(out m_metaVersion, root, "MetaVersion");
QueryOrAssert(out m_metaAuthor, root, "MetaAuthor");
QueryOrAssert(out m_metaCopyright, root, "MetaCopyright");
QueryOrAssert(out m_metaContact, root, "MetaContact");
QueryOrAssert(out m_metaReference, root, "MetaReference");
QueryOrAssert(out m_metaThumbnail, root, "Thumbnail");
QueryOrAssert(out m_metaPermissionAllowed, root, "PermissionAllowed");
QueryOrAssert(out m_metaPermissionViolent, root, "PermissionViolent");
QueryOrAssert(out m_metaPermissionSexual, root, "PermissionSexual");
QueryOrAssert(out m_metaPermissionCommercial, root, "PermissionCommercial");
QueryOrAssert(out m_metaLicense, root, "MetaLicense");
QueryOrAssert(out m_metaDistribution, root, "MetaDistribution");
// m_autoEmotion = gameObject.AddComponent<VRM10AutoExpression>();
// m_autoBlink = gameObject.AddComponent<VRM10Blinker>();
// m_autoLipsync = gameObject.AddComponent<VRM10AIUEO>();
@@ -257,43 +289,54 @@ namespace UniVRM10.VRM10Viewer
public void UpdateMeta(Texture2D thumbnail, UniGLTF.Extensions.VRMC_vrm.Meta meta, Migration.Vrm0Meta meta0)
{
// m_thumbnail.texture = thumbnail;
if (meta != null)
try
{
m_textModelTitle.text = meta.Name;
// m_textModelVersion.text = meta.Version;
// m_textModelAuthor.text = meta.Authors[0];
// m_textModelCopyright.text = meta.CopyrightInformation;
// m_textModelContact.text = meta.ContactInformation;
// if (meta.References != null && meta.References.Count > 0)
// {
// m_textModelReference.text = meta.References[0];
// }
// m_textPermissionAllowed.text = meta.AvatarPermission.ToString();
// m_textPermissionViolent.text = meta.AllowExcessivelyViolentUsage.ToString();
// m_textPermissionSexual.text = meta.AllowExcessivelySexualUsage.ToString();
// m_textPermissionCommercial.text = meta.CommercialUsage.ToString();
// // m_textPermissionOther.text = meta.OtherPermissionUrl;
m_metaThumbnail.style.backgroundImage = thumbnail;
if (meta != null)
{
m_metaName.value = meta.Name;
m_metaVersion.value = meta.Version;
m_metaAuthor.value = meta.Authors[0];
m_metaCopyright.value = meta.CopyrightInformation;
m_metaContact.value = meta.ContactInformation;
if (meta.References != null && meta.References.Count > 0)
{
m_metaReference.value = meta.References[0];
}
else
{
m_metaReference.value = "";
}
m_metaPermissionAllowed.value = meta.AvatarPermission.ToString();
m_metaPermissionViolent.value = meta.AllowExcessivelyViolentUsage.ToString();
m_metaPermissionSexual.value = meta.AllowExcessivelySexualUsage.ToString();
m_metaPermissionCommercial.value = meta.CommercialUsage.ToString();
m_metaLicense.value = meta.LicenseUrl;
m_metaDistribution.value = meta.Modification.ToString();
}
if (meta0 != null)
{
m_metaName.value = meta0.title;
m_metaVersion.value = meta0.version;
m_metaAuthor.value = meta0.author;
m_metaContact.value = meta0.contactInformation;
m_metaReference.value = meta0.reference;
m_metaPermissionAllowed.value = meta0.allowedUser.ToString();
m_metaPermissionViolent.value = meta0.violentUsage.ToString();
m_metaPermissionSexual.value = meta0.sexualUsage.ToString();
m_metaPermissionCommercial.value = meta0.commercialUsage.ToString();
m_metaLicense.value = meta0.licenseType.ToString();
m_metaDistribution.value = "";
}
// // m_textDistributionLicense.text = meta.ModificationLicense.ToString();
// m_textDistributionOther.text = meta.OtherLicenseUrl;
}
if (meta0 != null)
catch (Exception ex)
{
// m_textModelTitle.text = meta0.title;
// m_textModelVersion.text = meta0.version;
// m_textModelAuthor.text = meta0.author;
// m_textModelContact.text = meta0.contactInformation;
// m_textModelReference.text = meta0.reference;
// m_textPermissionAllowed.text = meta0.allowedUser.ToString();
// m_textPermissionViolent.text = meta0.violentUsage.ToString();
// m_textPermissionSexual.text = meta0.sexualUsage.ToString();
// m_textPermissionCommercial.text = meta0.commercialUsage.ToString();
// m_textPermissionOther.text = meta0.otherPermissionUrl;
// // m_textDistributionLicense.text = meta0.ModificationLicense.ToString();
// m_textDistributionOther.text = meta0.otherLicenseUrl;
Debug.LogException(ex);
}
}
}

View File

@@ -0,0 +1,14 @@
.unity-text-field {
font-size: 12px;
margin: 0;
}
.unity-text-field__input {
padding: 0;
}
.unity-button {
padding: 0;
}
.unity-label {
min-width: 60px;
padding: 0;
}

View File

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