This commit is contained in:
PoChang007
2021-10-22 14:06:09 +00:00
parent dbbd12fa2a
commit b7129df651
64 changed files with 890 additions and 104 deletions

View File

@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f4871ad68640e20558e71a2181f99f7c
config: 6b01d1ddad35071afcba812a6925e9a6
tags: 645f666f9bcd5a90fca523b33c5a78b7

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -97,19 +97,7 @@ async RuntimeGltfInstance Load(GltfData data)
### materialGenerator で URP 用のマテリアルをロードする
`materialGenerator` 引き数(省略可能)を指定することで URP マテリアルを生成するようにカスタムできます。
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
var materialGenerator = new GltfUrpMaterialDescriptorGenerator();
using(var loader = new UniGLTF.ImporterContext(data, materialGenerator: materialGenerator)
{
var instance = await loader.LoadAsync();
return instance;
}
}
```
{doc}`Import 時に生成される Material をカスタマイズする </gltf/how_to_customize_material_import>`
## 3. インスタンスを使用する

View File

@@ -0,0 +1,21 @@
# Import 時に生成される Material をカスタマイズする
`IMaterialDescriptorGenerator` を実装することで import 時に適用されるマテリアルを差し替えることができます。
## materialGenerator で URP 用のマテリアルをロードする
URP マテリアルを生成するようにカスタムする例です。
<https://github.com/vrm-c/UniVRM/issues/1214>
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
IMaterialDescriptorGenerator materialGenerator = new GltfUrpMaterialDescriptorGenerator();
using(var loader = new UniGLTF.ImporterContext(data, materialGenerator: materialGenerator)
{
var instance = await loader.LoadAsync();
return instance;
}
}
```

View File

@@ -12,7 +12,12 @@
:maxdepth: 1
0_82_glb_import
how_to_impl_extension
how_to_customize_material_import
0_36_update
format
```
```{toctree}
:maxdepth: 1
format
how_to_impl_extension
```

View File

@@ -8,4 +8,5 @@ texture_manipulation
coordinate
fast_spring_bone
first_person
scripted_importer
```

View File

@@ -0,0 +1,39 @@
# ScriptedImporter の実装
`v0.68.0` 以降 の `glb/gltf editor importer` と `VRM-1.0 editor importer` の実装で使用している [ScriptedImporter](https://docs.unity3d.com/ja/2019.4/ScriptReference/Experimental.AssetImporters.ScriptedImporter.html) に関して。
> `VRM-1.0` の実装と拡張子がぶつかってしまうので `VRM-0.x` への `ScriptedImporter` 実装はしません
## ScriptedImporter 採用の利点
### Texture の Asset化 が楽
`AssetPostprocessor` だと普通の方法では実装できない Texture のバイト列を出力して Asset 化して、
これを参照する Material をアセット化するということが、
`ScriptedImporter.GetExternalObjectMap` により無理をせずに実装できます。
> UniVRM では抜け道として `EditorApplication.delayCall` を使用しています。
### Import 設定を作れる
`ScriptedImporter` を継承したクラスの `public member` や `[SerializeField]` に情報を保存できます。
```cs
// 例
[ScriptedImporter(1, "cube")]
public class CubeImporter : ScriptedImporter
{
public float m_Scale = 1; // これを Asset の Inspector で変更して Apply すると、新しい設定で再importできる
// 省略
}
```
### ForceText 時に import が低速化するのを回避できる
`ScriptedImporter` の SubAsset にすることで、 `mesh` などがテキスト(yaml)で Asset 化されることを回避できます。
巨大なアセットで差が出ます。
## ScriptedImporter 実装
TODO: ExternalObjectMap の扱い

View File

@@ -8,3 +8,11 @@ VR アプリで FistPerson の設定に合わせて、可視設定を反映す
* その他のカメラ
の描画を例示します。
```{gitinclude} v0.87.0 Assets/VRM_Samples/FirstPersonSample/VRMRuntimeLoader.cs
:language: csharp
:linenos:
:lines: 31-53
:emphasize-lines: 15
:caption:
```

View File

@@ -1,3 +1,10 @@
# RuntimeExporter
VRM を Runtime Export するサンプルです。
```{gitinclude} v0.87.0 Assets/VRM_Samples/RuntimeExporterSample/VRMRuntimeExporter.cs
:language: csharp
:linenos:
:lines: 106-127
:caption:
```

View File

@@ -1,3 +1,10 @@
# SimpleViewer
Runtime ローダーのサンプルです。
```{gitinclude} c89e Assets/VRM_Samples/SimpleViewer/ViewerUI.cs
:language: csharp
:linenos:
:caption:
:emphasize-lines" 434-485
```

3
en/_static/custom.css Normal file
View File

@@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 1200px !important;
}

View File

@@ -19,7 +19,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="glbフォーマット概説" href="format.html" />
<link rel="prev" title="The implementation of glTF extensions(0.63.2)" href="how_to_impl_extension.html" />
<link rel="prev" title="Import 時に生成される Material をカスタマイズする" href="how_to_customize_material_import.html" />
</head>
<body class="wy-body-for-nav">
@@ -45,13 +45,14 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation note</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">GltfUpdate(0.36)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">Changed Storage Position of Texture Name</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">Fix blendshape name</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -123,7 +124,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="how_to_impl_extension.html" class="btn btn-neutral float-left" title="The implementation of glTF extensions(0.63.2)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="how_to_customize_material_import.html" class="btn btn-neutral float-left" title="Import 時に生成される Material をカスタマイズする" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="format.html" class="btn btn-neutral float-right" title="glbフォーマット概説" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

View File

@@ -18,7 +18,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="The implementation of glTF extensions(0.63.2)" href="how_to_impl_extension.html" />
<link rel="next" title="Import 時に生成される Material をカスタマイズする" href="how_to_customize_material_import.html" />
<link rel="prev" title="glTF" href="index.html" />
</head>
@@ -62,9 +62,10 @@
<li class="toctree-l3"><a class="reference internal" href="#id5">3. インスタンスを使用する</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -197,18 +198,7 @@
</section>
<section id="materialgenerator-urp">
<h3>Load URP material by materialGenerator argument<a class="headerlink" href="#materialgenerator-urp" title="Permalink to this headline"></a></h3>
<p>You can load URP materials by setting the <code class="docutils literal notranslate"><span class="pre">materialGenerator</span></code> Argument (optional).</p>
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">RuntimeGltfInstance</span> <span class="nf">Load</span><span class="p">(</span><span class="n">GltfData</span> <span class="n">data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">materialGenerator</span> <span class="p">=</span> <span class="k">new</span> <span class="n">GltfUrpMaterialDescriptorGenerator</span><span class="p">();</span>
<span class="n">using</span><span class="p">(</span><span class="kt">var</span> <span class="n">loader</span> <span class="p">=</span> <span class="k">new</span> <span class="n">UniGLTF</span><span class="p">.</span><span class="n">ImporterContext</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">materialGenerator</span><span class="p">:</span> <span class="n">materialGenerator</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">instance</span> <span class="p">=</span> <span class="k">await</span> <span class="n">loader</span><span class="p">.</span><span class="n">LoadAsync</span><span class="p">();</span>
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p><a class="reference internal" href="how_to_customize_material_import.html"><span class="doc">Import 時に生成される Material をカスタマイズする</span></a></p>
</section>
</section>
<section id="id5">
@@ -231,7 +221,7 @@
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="glTF" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="how_to_impl_extension.html" class="btn btn-neutral float-right" title="The implementation of glTF extensions(0.63.2)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="how_to_customize_material_import.html" class="btn btn-neutral float-right" title="Import 時に生成される Material をカスタマイズする" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -18,7 +18,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="VRM" href="../vrm0/index.html" />
<link rel="next" title="The implementation of glTF extensions(0.63.2)" href="how_to_impl_extension.html" />
<link rel="prev" title="GltfUpdate(0.36)" href="0_36_update.html" />
</head>
@@ -45,7 +45,7 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation note</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">glbフォーマット概説</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">glb形式</a><ul>
@@ -54,6 +54,7 @@
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -233,7 +234,7 @@ glb形式ではJSON部とバイナリ部をひとつのファイルにまとめ
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_36_update.html" class="btn btn-neutral float-left" title="GltfUpdate(0.36)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../vrm0/index.html" class="btn btn-neutral float-right" title="VRM" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="how_to_impl_extension.html" class="btn btn-neutral float-right" title="The implementation of glTF extensions(0.63.2)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -0,0 +1,139 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Import 時に生成される Material をカスタマイズする &mdash; UniVRM Programming Document documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="GltfUpdate(0.36)" href="0_36_update.html" />
<link rel="prev" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../ja/gltf/how_to_customize_material_import.html">日本語</a> [English]
<a href="../index.html" class="icon icon-home"> UniVRM Programming Document
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../build.html">Build Application</a></li>
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation note</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Import 時に生成される Material をカスタマイズする</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#materialgenerator-urp">materialGenerator で URP 用のマテリアルをロードする</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm1/index.html">VRM-1.0(β)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release/index.html">Release</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">UniVRM Programming Document</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">glTF</a> &raquo;</li>
<li>Import 時に生成される Material をカスタマイズする</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/vrm-c/UniVRM/blob/master/docs/gltf/how_to_customize_material_import.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section class="tex2jax_ignore mathjax_ignore" id="import-material">
<h1>Import 時に生成される Material をカスタマイズする<a class="headerlink" href="#import-material" title="Permalink to this headline"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">IMaterialDescriptorGenerator</span></code> を実装することで import 時に適用されるマテリアルを差し替えることができます。</p>
<section id="materialgenerator-urp">
<h2>materialGenerator で URP 用のマテリアルをロードする<a class="headerlink" href="#materialgenerator-urp" title="Permalink to this headline"></a></h2>
<p>URP マテリアルを生成するようにカスタムする例です。</p>
<p><a class="reference external" href="https://github.com/vrm-c/UniVRM/issues/1214">https://github.com/vrm-c/UniVRM/issues/1214</a></p>
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">RuntimeGltfInstance</span> <span class="nf">Load</span><span class="p">(</span><span class="n">GltfData</span> <span class="n">data</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">IMaterialDescriptorGenerator</span> <span class="n">materialGenerator</span> <span class="p">=</span> <span class="k">new</span> <span class="n">GltfUrpMaterialDescriptorGenerator</span><span class="p">();</span>
<span class="n">using</span><span class="p">(</span><span class="kt">var</span> <span class="n">loader</span> <span class="p">=</span> <span class="k">new</span> <span class="n">UniGLTF</span><span class="p">.</span><span class="n">ImporterContext</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">materialGenerator</span><span class="p">:</span> <span class="n">materialGenerator</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">instance</span> <span class="p">=</span> <span class="k">await</span> <span class="n">loader</span><span class="p">.</span><span class="n">LoadAsync</span><span class="p">();</span>
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_82_glb_import.html" class="btn btn-neutral float-left" title="GlbImport(0.82) GltfData" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_36_update.html" class="btn btn-neutral float-right" title="GltfUpdate(0.36)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, VRM Consortium.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@@ -18,8 +18,8 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="GltfUpdate(0.36)" href="0_36_update.html" />
<link rel="prev" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
<link rel="next" title="VRM" href="../vrm0/index.html" />
<link rel="prev" title="glbフォーマット概説" href="format.html" />
</head>
<body class="wy-body-for-nav">
@@ -45,6 +45,9 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation note</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">The implementation of glTF extensions(0.63.2)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#gltf">About GLTF Extensions</a></li>
<li class="toctree-l3"><a class="reference internal" href="#unigltf-extensions">The extensions of UniGLTF</a></li>
@@ -70,8 +73,6 @@
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -566,8 +567,8 @@ enumの場合はデフォルト値が無いので必須です。</p>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_82_glb_import.html" class="btn btn-neutral float-left" title="GlbImport(0.82) GltfData" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_36_update.html" class="btn btn-neutral float-right" title="GltfUpdate(0.36)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="format.html" class="btn btn-neutral float-left" title="glbフォーマット概説" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../vrm0/index.html" class="btn btn-neutral float-right" title="VRM" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -19,7 +19,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
<link rel="prev" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" href="../implementation/first_person.html" />
<link rel="prev" title="ScriptedImporter の実装" href="../implementation/scripted_importer.html" />
</head>
<body class="wy-body-for-nav">
@@ -45,9 +45,10 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation note</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">glTF</a><ul>
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -108,9 +109,14 @@
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l1"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
</ul>
</div>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_impl_extension.html">The implementation of glTF extensions(0.63.2)</a></li>
</ul>
</div>
</section>
@@ -119,7 +125,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../implementation/first_person.html" class="btn btn-neutral float-left" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../implementation/scripted_importer.html" class="btn btn-neutral float-left" title="ScriptedImporter の実装" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_82_glb_import.html" class="btn btn-neutral float-right" title="GlbImport(0.82) GltfData" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

View File

@@ -60,6 +60,7 @@
</li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -56,6 +56,7 @@
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -18,7 +18,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="glTF" href="../gltf/index.html" />
<link rel="next" title="ScriptedImporter の実装" href="scripted_importer.html" />
<link rel="prev" title="FastSpringBoneについて" href="fast_spring_bone.html" />
</head>
@@ -48,6 +48,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
@@ -156,7 +157,7 @@
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="fast_spring_bone.html" class="btn btn-neutral float-left" title="FastSpringBoneについて" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/index.html" class="btn btn-neutral float-right" title="glTF" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="scripted_importer.html" class="btn btn-neutral float-right" title="ScriptedImporter の実装" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -48,6 +48,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
@@ -89,6 +90,7 @@
<li class="toctree-l1"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l1"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l1"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l1"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</div>
</section>

View File

@@ -55,6 +55,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ScriptedImporter の実装 &mdash; UniVRM Programming Document documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="glTF" href="../gltf/index.html" />
<link rel="prev" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" href="first_person.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../ja/implementation/scripted_importer.html">日本語</a> [English]
<a href="../index.html" class="icon icon-home"> UniVRM Programming Document
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../build.html">Build Application</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Implementation note</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="runtime_resource_management.html">Runtime のリソース管理について</a></li>
<li class="toctree-l2"><a class="reference internal" href="texture_manipulation.html">Texture関連</a></li>
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">ScriptedImporter の実装</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">ScriptedImporter 採用の利点</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#texture-asset">Texture の Asset化 が楽</a></li>
<li class="toctree-l4"><a class="reference internal" href="#import">Import 設定を作れる</a></li>
<li class="toctree-l4"><a class="reference internal" href="#forcetext-import">ForceText 時に import が低速化するのを回避できる</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id2">ScriptedImporter 実装</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm1/index.html">VRM-1.0(β)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release/index.html">Release</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">UniVRM Programming Document</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">Implementation note</a> &raquo;</li>
<li>ScriptedImporter の実装</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/vrm-c/UniVRM/blob/master/docs/implementation/scripted_importer.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section class="tex2jax_ignore mathjax_ignore" id="scriptedimporter">
<h1>ScriptedImporter の実装<a class="headerlink" href="#scriptedimporter" title="Permalink to this headline"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">v0.68.0</span></code> 以降 の <code class="docutils literal notranslate"><span class="pre">glb/gltf</span> <span class="pre">editor</span> <span class="pre">importer</span></code><code class="docutils literal notranslate"><span class="pre">VRM-1.0</span> <span class="pre">editor</span> <span class="pre">importer</span></code> の実装で使用している <a class="reference external" href="https://docs.unity3d.com/ja/2019.4/ScriptReference/Experimental.AssetImporters.ScriptedImporter.html">ScriptedImporter</a> に関して。</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">VRM-1.0</span></code> の実装と拡張子がぶつかってしまうので <code class="docutils literal notranslate"><span class="pre">VRM-0.x</span></code> への <code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> 実装はしません</p>
</div></blockquote>
<section id="id1">
<h2>ScriptedImporter 採用の利点<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h2>
<section id="texture-asset">
<h3>Texture の Asset化 が楽<a class="headerlink" href="#texture-asset" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">AssetPostprocessor</span></code> だと普通の方法では実装できない Texture のバイト列を出力して Asset 化して、
これを参照する Material をアセット化するということが、
<code class="docutils literal notranslate"><span class="pre">ScriptedImporter.GetExternalObjectMap</span></code> により無理をせずに実装できます。</p>
<blockquote>
<div><p>UniVRM では抜け道として <code class="docutils literal notranslate"><span class="pre">EditorApplication.delayCall</span></code> を使用しています。</p>
</div></blockquote>
</section>
<section id="import">
<h3>Import 設定を作れる<a class="headerlink" href="#import" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> を継承したクラスの <code class="docutils literal notranslate"><span class="pre">public</span> <span class="pre">member</span></code><code class="docutils literal notranslate"><span class="pre">[SerializeField]</span></code> に情報を保存できます。</p>
<div class="highlight-cs notranslate"><div class="highlight"><pre><span></span>// 例
[ScriptedImporter(1, &quot;cube&quot;)]
public class CubeImporter : ScriptedImporter
{
public float m_Scale = 1; // これを Asset の Inspector で変更して Apply すると、新しい設定で再importできる
// 省略
}
</pre></div>
</div>
</section>
<section id="forcetext-import">
<h3>ForceText 時に import が低速化するのを回避できる<a class="headerlink" href="#forcetext-import" title="Permalink to this headline"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> の SubAsset にすることで、 <code class="docutils literal notranslate"><span class="pre">mesh</span></code> などがテキスト(yaml)で Asset 化されることを回避できます。
巨大なアセットで差が出ます。</p>
</section>
</section>
<section id="id2">
<h2>ScriptedImporter 実装<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h2>
<p>TODO: ExternalObjectMap の扱い</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="first_person.html" class="btn btn-neutral float-left" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/index.html" class="btn btn-neutral float-right" title="glTF" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, VRM Consortium.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@@ -60,6 +60,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">Coordinate conversion</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -19,7 +19,7 @@
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Sample" href="sample/index.html" />
<link rel="prev" title="glbフォーマット概説" href="../gltf/format.html" />
<link rel="prev" title="The implementation of glTF extensions(0.63.2)" href="../gltf/how_to_impl_extension.html" />
</head>
<body class="wy-body-for-nav">
@@ -116,7 +116,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../gltf/format.html" class="btn btn-neutral float-left" title="glbフォーマット概説" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/how_to_impl_extension.html" class="btn btn-neutral float-left" title="The implementation of glTF extensions(0.63.2)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="sample/index.html" class="btn btn-neutral float-right" title="Sample" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

View File

@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f23671d82431d8a3b926f066f8630a68
config: ab4d29f316f052c758b467e1551ec51b
tags: 645f666f9bcd5a90fca523b33c5a78b7

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -97,19 +97,7 @@ async RuntimeGltfInstance Load(GltfData data)
### materialGenerator で URP 用のマテリアルをロードする
`materialGenerator` 引き数(省略可能)を指定することで URP マテリアルを生成するようにカスタムできます。
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
var materialGenerator = new GltfUrpMaterialDescriptorGenerator();
using(var loader = new UniGLTF.ImporterContext(data, materialGenerator: materialGenerator)
{
var instance = await loader.LoadAsync();
return instance;
}
}
```
{doc}`Import 時に生成される Material をカスタマイズする </gltf/how_to_customize_material_import>`
## 3. インスタンスを使用する

View File

@@ -0,0 +1,21 @@
# Import 時に生成される Material をカスタマイズする
`IMaterialDescriptorGenerator` を実装することで import 時に適用されるマテリアルを差し替えることができます。
## materialGenerator で URP 用のマテリアルをロードする
URP マテリアルを生成するようにカスタムする例です。
<https://github.com/vrm-c/UniVRM/issues/1214>
```csharp
async RuntimeGltfInstance Load(GltfData data)
{
IMaterialDescriptorGenerator materialGenerator = new GltfUrpMaterialDescriptorGenerator();
using(var loader = new UniGLTF.ImporterContext(data, materialGenerator: materialGenerator)
{
var instance = await loader.LoadAsync();
return instance;
}
}
```

View File

@@ -12,7 +12,12 @@
:maxdepth: 1
0_82_glb_import
how_to_impl_extension
how_to_customize_material_import
0_36_update
format
```
```{toctree}
:maxdepth: 1
format
how_to_impl_extension
```

View File

@@ -8,4 +8,5 @@ texture_manipulation
coordinate
fast_spring_bone
first_person
scripted_importer
```

View File

@@ -0,0 +1,39 @@
# ScriptedImporter の実装
`v0.68.0` 以降 の `glb/gltf editor importer` と `VRM-1.0 editor importer` の実装で使用している [ScriptedImporter](https://docs.unity3d.com/ja/2019.4/ScriptReference/Experimental.AssetImporters.ScriptedImporter.html) に関して。
> `VRM-1.0` の実装と拡張子がぶつかってしまうので `VRM-0.x` への `ScriptedImporter` 実装はしません
## ScriptedImporter 採用の利点
### Texture の Asset化 が楽
`AssetPostprocessor` だと普通の方法では実装できない Texture のバイト列を出力して Asset 化して、
これを参照する Material をアセット化するということが、
`ScriptedImporter.GetExternalObjectMap` により無理をせずに実装できます。
> UniVRM では抜け道として `EditorApplication.delayCall` を使用しています。
### Import 設定を作れる
`ScriptedImporter` を継承したクラスの `public member` や `[SerializeField]` に情報を保存できます。
```cs
// 例
[ScriptedImporter(1, "cube")]
public class CubeImporter : ScriptedImporter
{
public float m_Scale = 1; // これを Asset の Inspector で変更して Apply すると、新しい設定で再importできる
// 省略
}
```
### ForceText 時に import が低速化するのを回避できる
`ScriptedImporter` の SubAsset にすることで、 `mesh` などがテキスト(yaml)で Asset 化されることを回避できます。
巨大なアセットで差が出ます。
## ScriptedImporter 実装
TODO: ExternalObjectMap の扱い

View File

@@ -8,3 +8,11 @@ VR アプリで FistPerson の設定に合わせて、可視設定を反映す
* その他のカメラ
の描画を例示します。
```{gitinclude} v0.87.0 Assets/VRM_Samples/FirstPersonSample/VRMRuntimeLoader.cs
:language: csharp
:linenos:
:lines: 31-53
:emphasize-lines: 15
:caption:
```

View File

@@ -1,3 +1,10 @@
# RuntimeExporter
VRM を Runtime Export するサンプルです。
```{gitinclude} v0.87.0 Assets/VRM_Samples/RuntimeExporterSample/VRMRuntimeExporter.cs
:language: csharp
:linenos:
:lines: 106-127
:caption:
```

View File

@@ -1,3 +1,10 @@
# SimpleViewer
Runtime ローダーのサンプルです。
```{gitinclude} c89e Assets/VRM_Samples/SimpleViewer/ViewerUI.cs
:language: csharp
:linenos:
:caption:
:emphasize-lines" 434-485
```

3
ja/_static/custom.css Normal file
View File

@@ -0,0 +1,3 @@
.wy-nav-content {
max-width: 1200px !important;
}

View File

@@ -20,7 +20,7 @@
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="glbフォーマット概説" href="format.html" />
<link rel="prev" title="glTF拡張の実装(0.63.2)" href="how_to_impl_extension.html" />
<link rel="prev" title="Import 時に生成される Material をカスタマイズする" href="how_to_customize_material_import.html" />
</head>
<body class="wy-body-for-nav">
@@ -46,13 +46,14 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">実装メモ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">GltfUpdate(0.36)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">テクスチャ名の格納位置の修正</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">ブレンドシェイプ名の格納位置の修正</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -124,7 +125,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="how_to_impl_extension.html" class="btn btn-neutral float-left" title="glTF拡張の実装(0.63.2)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="how_to_customize_material_import.html" class="btn btn-neutral float-left" title="Import 時に生成される Material をカスタマイズする" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="format.html" class="btn btn-neutral float-right" title="glbフォーマット概説" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

View File

@@ -19,7 +19,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="glTF拡張の実装(0.63.2)" href="how_to_impl_extension.html" />
<link rel="next" title="Import 時に生成される Material をカスタマイズする" href="how_to_customize_material_import.html" />
<link rel="prev" title="glTF" href="index.html" />
</head>
@@ -63,9 +63,10 @@
<li class="toctree-l3"><a class="reference internal" href="#id5">3. インスタンスを使用する</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -198,18 +199,7 @@
</section>
<section id="materialgenerator-urp">
<h3>materialGenerator で URP 用のマテリアルをロードする<a class="headerlink" href="#materialgenerator-urp" title="このヘッドラインへのパーマリンク"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">materialGenerator</span></code> 引き数(省略可能)を指定することで URP マテリアルを生成するようにカスタムできます。</p>
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">RuntimeGltfInstance</span> <span class="nf">Load</span><span class="p">(</span><span class="n">GltfData</span> <span class="n">data</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">materialGenerator</span> <span class="p">=</span> <span class="k">new</span> <span class="n">GltfUrpMaterialDescriptorGenerator</span><span class="p">();</span>
<span class="n">using</span><span class="p">(</span><span class="kt">var</span> <span class="n">loader</span> <span class="p">=</span> <span class="k">new</span> <span class="n">UniGLTF</span><span class="p">.</span><span class="n">ImporterContext</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">materialGenerator</span><span class="p">:</span> <span class="n">materialGenerator</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">instance</span> <span class="p">=</span> <span class="k">await</span> <span class="n">loader</span><span class="p">.</span><span class="n">LoadAsync</span><span class="p">();</span>
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<p><a class="reference internal" href="how_to_customize_material_import.html"><span class="doc">Import 時に生成される Material をカスタマイズする</span></a></p>
</section>
</section>
<section id="id5">
@@ -232,7 +222,7 @@
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="index.html" class="btn btn-neutral float-left" title="glTF" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="how_to_impl_extension.html" class="btn btn-neutral float-right" title="glTF拡張の実装(0.63.2)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="how_to_customize_material_import.html" class="btn btn-neutral float-right" title="Import 時に生成される Material をカスタマイズする" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -19,7 +19,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="VRM" href="../vrm0/index.html" />
<link rel="next" title="glTF拡張の実装(0.63.2)" href="how_to_impl_extension.html" />
<link rel="prev" title="GltfUpdate(0.36)" href="0_36_update.html" />
</head>
@@ -46,7 +46,7 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">実装メモ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">glbフォーマット概説</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">glb形式</a><ul>
@@ -55,6 +55,7 @@
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -234,7 +235,7 @@ glb形式ではJSON部とバイナリ部をひとつのファイルにまとめ
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_36_update.html" class="btn btn-neutral float-left" title="GltfUpdate(0.36)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../vrm0/index.html" class="btn btn-neutral float-right" title="VRM" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="how_to_impl_extension.html" class="btn btn-neutral float-right" title="glTF拡張の実装(0.63.2)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -0,0 +1,140 @@
<!DOCTYPE html>
<html class="writer-html5" lang="ja" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Import 時に生成される Material をカスタマイズする &mdash; UniVRM Programming Document ドキュメント</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/translations.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="GltfUpdate(0.36)" href="0_36_update.html" />
<link rel="prev" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
[日本語] <a href="../../en/gltf/how_to_customize_material_import.html">English</a>
<a href="../index.html" class="icon icon-home"> UniVRM Programming Document
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../build.html">アプリケーションのビルド</a></li>
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">実装メモ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">Import 時に生成される Material をカスタマイズする</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#materialgenerator-urp">materialGenerator で URP 用のマテリアルをロードする</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm1/index.html">VRM-1.0(β)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release/index.html">Release</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">UniVRM Programming Document</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">glTF</a> &raquo;</li>
<li>Import 時に生成される Material をカスタマイズする</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/vrm-c/UniVRM/blob/master/docs/gltf/how_to_customize_material_import.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section class="tex2jax_ignore mathjax_ignore" id="import-material">
<h1>Import 時に生成される Material をカスタマイズする<a class="headerlink" href="#import-material" title="このヘッドラインへのパーマリンク"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">IMaterialDescriptorGenerator</span></code> を実装することで import 時に適用されるマテリアルを差し替えることができます。</p>
<section id="materialgenerator-urp">
<h2>materialGenerator で URP 用のマテリアルをロードする<a class="headerlink" href="#materialgenerator-urp" title="このヘッドラインへのパーマリンク"></a></h2>
<p>URP マテリアルを生成するようにカスタムする例です。</p>
<p><a class="reference external" href="https://github.com/vrm-c/UniVRM/issues/1214">https://github.com/vrm-c/UniVRM/issues/1214</a></p>
<div class="highlight-csharp notranslate"><div class="highlight"><pre><span></span><span class="k">async</span> <span class="n">RuntimeGltfInstance</span> <span class="nf">Load</span><span class="p">(</span><span class="n">GltfData</span> <span class="n">data</span><span class="p">)</span>
<span class="p">{</span>
<span class="n">IMaterialDescriptorGenerator</span> <span class="n">materialGenerator</span> <span class="p">=</span> <span class="k">new</span> <span class="n">GltfUrpMaterialDescriptorGenerator</span><span class="p">();</span>
<span class="n">using</span><span class="p">(</span><span class="kt">var</span> <span class="n">loader</span> <span class="p">=</span> <span class="k">new</span> <span class="n">UniGLTF</span><span class="p">.</span><span class="n">ImporterContext</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">materialGenerator</span><span class="p">:</span> <span class="n">materialGenerator</span><span class="p">)</span>
<span class="p">{</span>
<span class="kt">var</span> <span class="n">instance</span> <span class="p">=</span> <span class="k">await</span> <span class="n">loader</span><span class="p">.</span><span class="n">LoadAsync</span><span class="p">();</span>
<span class="k">return</span> <span class="n">instance</span><span class="p">;</span>
<span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_82_glb_import.html" class="btn btn-neutral float-left" title="GlbImport(0.82) GltfData" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_36_update.html" class="btn btn-neutral float-right" title="GltfUpdate(0.36)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, VRM Consortium.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@@ -19,8 +19,8 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="GltfUpdate(0.36)" href="0_36_update.html" />
<link rel="prev" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
<link rel="next" title="VRM" href="../vrm0/index.html" />
<link rel="prev" title="glbフォーマット概説" href="format.html" />
</head>
<body class="wy-body-for-nav">
@@ -46,6 +46,9 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">実装メモ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">glTF</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">glTF拡張の実装(0.63.2)</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#gltf">GLTF 拡張とは</a></li>
<li class="toctree-l3"><a class="reference internal" href="#unigltf-extensions">UniGLTF の extensions</a></li>
@@ -71,8 +74,6 @@
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -568,8 +569,8 @@ enumの場合はデフォルト値が無いので必須です。</p>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="0_82_glb_import.html" class="btn btn-neutral float-left" title="GlbImport(0.82) GltfData" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_36_update.html" class="btn btn-neutral float-right" title="GltfUpdate(0.36)" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="format.html" class="btn btn-neutral float-left" title="glbフォーマット概説" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../vrm0/index.html" class="btn btn-neutral float-right" title="VRM" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -20,7 +20,7 @@
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="GlbImport(0.82) GltfData" href="0_82_glb_import.html" />
<link rel="prev" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" href="../implementation/first_person.html" />
<link rel="prev" title="ScriptedImporter の実装" href="../implementation/scripted_importer.html" />
</head>
<body class="wy-body-for-nav">
@@ -46,9 +46,10 @@
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">実装メモ</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">glTF</a><ul>
<li class="toctree-l2"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l2"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
<li class="toctree-l2"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l2"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
@@ -109,9 +110,14 @@
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="0_82_glb_import.html">GlbImport(0.82) GltfData</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_customize_material_import.html">Import 時に生成される Material をカスタマイズする</a></li>
<li class="toctree-l1"><a class="reference internal" href="0_36_update.html">GltfUpdate(0.36)</a></li>
</ul>
</div>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="format.html">glbフォーマット概説</a></li>
<li class="toctree-l1"><a class="reference internal" href="how_to_impl_extension.html">glTF拡張の実装(0.63.2)</a></li>
</ul>
</div>
</section>
@@ -120,7 +126,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../implementation/first_person.html" class="btn btn-neutral float-left" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../implementation/scripted_importer.html" class="btn btn-neutral float-left" title="ScriptedImporter の実装" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="0_82_glb_import.html" class="btn btn-neutral float-right" title="GlbImport(0.82) GltfData" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>

View File

@@ -61,6 +61,7 @@
</li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -57,6 +57,7 @@
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -19,7 +19,7 @@
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="glTF" href="../gltf/index.html" />
<link rel="next" title="ScriptedImporter の実装" href="scripted_importer.html" />
<link rel="prev" title="FastSpringBoneについて" href="fast_spring_bone.html" />
</head>
@@ -49,6 +49,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
@@ -157,7 +158,7 @@
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="fast_spring_bone.html" class="btn btn-neutral float-left" title="FastSpringBoneについて" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/index.html" class="btn btn-neutral float-right" title="glTF" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
<a href="scripted_importer.html" class="btn btn-neutral float-right" title="ScriptedImporter の実装" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>

View File

@@ -49,6 +49,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
@@ -90,6 +91,7 @@
<li class="toctree-l1"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l1"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l1"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l1"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</div>
</section>

View File

@@ -56,6 +56,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

View File

@@ -0,0 +1,169 @@
<!DOCTYPE html>
<html class="writer-html5" lang="ja" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ScriptedImporter の実装 &mdash; UniVRM Programming Document ドキュメント</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/translations.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="glTF" href="../gltf/index.html" />
<link rel="prev" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" href="first_person.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
[日本語] <a href="../../en/implementation/scripted_importer.html">English</a>
<a href="../index.html" class="icon icon-home"> UniVRM Programming Document
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../build.html">アプリケーションのビルド</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">実装メモ</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="runtime_resource_management.html">Runtime のリソース管理について</a></li>
<li class="toctree-l2"><a class="reference internal" href="texture_manipulation.html">Texture関連</a></li>
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">ScriptedImporter の実装</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">ScriptedImporter 採用の利点</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#texture-asset">Texture の Asset化 が楽</a></li>
<li class="toctree-l4"><a class="reference internal" href="#import">Import 設定を作れる</a></li>
<li class="toctree-l4"><a class="reference internal" href="#forcetext-import">ForceText 時に import が低速化するのを回避できる</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id2">ScriptedImporter 実装</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm0/index.html">VRM</a></li>
<li class="toctree-l1"><a class="reference internal" href="../vrm1/index.html">VRM-1.0(β)</a></li>
<li class="toctree-l1"><a class="reference internal" href="../release/index.html">Release</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">UniVRM Programming Document</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
<li><a href="index.html">実装メモ</a> &raquo;</li>
<li>ScriptedImporter の実装</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/vrm-c/UniVRM/blob/master/docs/implementation/scripted_importer.md" class="fa fa-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section class="tex2jax_ignore mathjax_ignore" id="scriptedimporter">
<h1>ScriptedImporter の実装<a class="headerlink" href="#scriptedimporter" title="このヘッドラインへのパーマリンク"></a></h1>
<p><code class="docutils literal notranslate"><span class="pre">v0.68.0</span></code> 以降 の <code class="docutils literal notranslate"><span class="pre">glb/gltf</span> <span class="pre">editor</span> <span class="pre">importer</span></code><code class="docutils literal notranslate"><span class="pre">VRM-1.0</span> <span class="pre">editor</span> <span class="pre">importer</span></code> の実装で使用している <a class="reference external" href="https://docs.unity3d.com/ja/2019.4/ScriptReference/Experimental.AssetImporters.ScriptedImporter.html">ScriptedImporter</a> に関して。</p>
<blockquote>
<div><p><code class="docutils literal notranslate"><span class="pre">VRM-1.0</span></code> の実装と拡張子がぶつかってしまうので <code class="docutils literal notranslate"><span class="pre">VRM-0.x</span></code> への <code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> 実装はしません</p>
</div></blockquote>
<section id="id1">
<h2>ScriptedImporter 採用の利点<a class="headerlink" href="#id1" title="このヘッドラインへのパーマリンク"></a></h2>
<section id="texture-asset">
<h3>Texture の Asset化 が楽<a class="headerlink" href="#texture-asset" title="このヘッドラインへのパーマリンク"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">AssetPostprocessor</span></code> だと普通の方法では実装できない Texture のバイト列を出力して Asset 化して、
これを参照する Material をアセット化するということが、
<code class="docutils literal notranslate"><span class="pre">ScriptedImporter.GetExternalObjectMap</span></code> により無理をせずに実装できます。</p>
<blockquote>
<div><p>UniVRM では抜け道として <code class="docutils literal notranslate"><span class="pre">EditorApplication.delayCall</span></code> を使用しています。</p>
</div></blockquote>
</section>
<section id="import">
<h3>Import 設定を作れる<a class="headerlink" href="#import" title="このヘッドラインへのパーマリンク"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> を継承したクラスの <code class="docutils literal notranslate"><span class="pre">public</span> <span class="pre">member</span></code><code class="docutils literal notranslate"><span class="pre">[SerializeField]</span></code> に情報を保存できます。</p>
<div class="highlight-cs notranslate"><div class="highlight"><pre><span></span>// 例
[ScriptedImporter(1, &quot;cube&quot;)]
public class CubeImporter : ScriptedImporter
{
public float m_Scale = 1; // これを Asset の Inspector で変更して Apply すると、新しい設定で再importできる
// 省略
}
</pre></div>
</div>
</section>
<section id="forcetext-import">
<h3>ForceText 時に import が低速化するのを回避できる<a class="headerlink" href="#forcetext-import" title="このヘッドラインへのパーマリンク"></a></h3>
<p><code class="docutils literal notranslate"><span class="pre">ScriptedImporter</span></code> の SubAsset にすることで、 <code class="docutils literal notranslate"><span class="pre">mesh</span></code> などがテキスト(yaml)で Asset 化されることを回避できます。
巨大なアセットで差が出ます。</p>
</section>
</section>
<section id="id2">
<h2>ScriptedImporter 実装<a class="headerlink" href="#id2" title="このヘッドラインへのパーマリンク"></a></h2>
<p>TODO: ExternalObjectMap の扱い</p>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="first_person.html" class="btn btn-neutral float-left" title="VRアプリケーションの FirstPerson 設定による Renderer の可視制御" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/index.html" class="btn btn-neutral float-right" title="glTF" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2021, VRM Consortium.</p>
</div>
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>

View File

@@ -61,6 +61,7 @@
<li class="toctree-l2"><a class="reference internal" href="coordinate.html">座標系の変換</a></li>
<li class="toctree-l2"><a class="reference internal" href="fast_spring_bone.html">FastSpringBoneについて</a></li>
<li class="toctree-l2"><a class="reference internal" href="first_person.html">VRアプリケーションの FirstPerson 設定による Renderer の可視制御</a></li>
<li class="toctree-l2"><a class="reference internal" href="scripted_importer.html">ScriptedImporter の実装</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../gltf/index.html">glTF</a></li>

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="検索" href="../search.html" />
<link rel="next" title="Sample" href="sample/index.html" />
<link rel="prev" title="glbフォーマット概説" href="../gltf/format.html" />
<link rel="prev" title="glTF拡張の実装(0.63.2)" href="../gltf/how_to_impl_extension.html" />
</head>
<body class="wy-body-for-nav">
@@ -117,7 +117,7 @@
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="../gltf/format.html" class="btn btn-neutral float-left" title="glbフォーマット概説" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="../gltf/how_to_impl_extension.html" class="btn btn-neutral float-left" title="glTF拡張の実装(0.63.2)" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="sample/index.html" class="btn btn-neutral float-right" title="Sample" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>