diff --git a/en/.buildinfo b/en/.buildinfo index d96e4d05b..055fc2483 100644 --- a/en/.buildinfo +++ b/en/.buildinfo @@ -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 diff --git a/en/.doctrees/environment.pickle b/en/.doctrees/environment.pickle index 204e0a343..349b8a287 100644 Binary files a/en/.doctrees/environment.pickle and b/en/.doctrees/environment.pickle differ diff --git a/en/.doctrees/gltf/0_82_glb_import.doctree b/en/.doctrees/gltf/0_82_glb_import.doctree index 53a6e6ce5..0d0f43f41 100644 Binary files a/en/.doctrees/gltf/0_82_glb_import.doctree and b/en/.doctrees/gltf/0_82_glb_import.doctree differ diff --git a/en/.doctrees/gltf/how_to_customize_material_import.doctree b/en/.doctrees/gltf/how_to_customize_material_import.doctree new file mode 100644 index 000000000..5ac7a561d Binary files /dev/null and b/en/.doctrees/gltf/how_to_customize_material_import.doctree differ diff --git a/en/.doctrees/gltf/index.doctree b/en/.doctrees/gltf/index.doctree index f7b6a188c..cc9deefa5 100644 Binary files a/en/.doctrees/gltf/index.doctree and b/en/.doctrees/gltf/index.doctree differ diff --git a/en/.doctrees/implementation/index.doctree b/en/.doctrees/implementation/index.doctree index 88e0434ba..55a13bff4 100644 Binary files a/en/.doctrees/implementation/index.doctree and b/en/.doctrees/implementation/index.doctree differ diff --git a/en/.doctrees/implementation/scripted_importer.doctree b/en/.doctrees/implementation/scripted_importer.doctree new file mode 100644 index 000000000..bfaed7707 Binary files /dev/null and b/en/.doctrees/implementation/scripted_importer.doctree differ diff --git a/en/_sources/gltf/0_82_glb_import.md.txt b/en/_sources/gltf/0_82_glb_import.md.txt index 23c961b42..cab05c296 100644 --- a/en/_sources/gltf/0_82_glb_import.md.txt +++ b/en/_sources/gltf/0_82_glb_import.md.txt @@ -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 をカスタマイズする ` ## 3. インスタンスを使用する diff --git a/en/_sources/gltf/how_to_customize_material_import.md.txt b/en/_sources/gltf/how_to_customize_material_import.md.txt new file mode 100644 index 000000000..b78f2b75f --- /dev/null +++ b/en/_sources/gltf/how_to_customize_material_import.md.txt @@ -0,0 +1,21 @@ +# Import 時に生成される Material をカスタマイズする + +`IMaterialDescriptorGenerator` を実装することで import 時に適用されるマテリアルを差し替えることができます。 + +## materialGenerator で URP 用のマテリアルをロードする + +URP マテリアルを生成するようにカスタムする例です。 + + + +```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; + } +} +``` diff --git a/en/_sources/gltf/index.md.txt b/en/_sources/gltf/index.md.txt index c1332b2ad..b8893ffa0 100644 --- a/en/_sources/gltf/index.md.txt +++ b/en/_sources/gltf/index.md.txt @@ -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 ``` diff --git a/en/_sources/implementation/index.md.txt b/en/_sources/implementation/index.md.txt index 19087e53f..15fb976a7 100644 --- a/en/_sources/implementation/index.md.txt +++ b/en/_sources/implementation/index.md.txt @@ -8,4 +8,5 @@ texture_manipulation coordinate fast_spring_bone first_person +scripted_importer ``` diff --git a/en/_sources/implementation/scripted_importer.md.txt b/en/_sources/implementation/scripted_importer.md.txt new file mode 100644 index 000000000..a28ea7111 --- /dev/null +++ b/en/_sources/implementation/scripted_importer.md.txt @@ -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 の扱い diff --git a/en/_sources/vrm0/sample/FirstPersonSample.md.txt b/en/_sources/vrm0/sample/FirstPersonSample.md.txt index a3626bff6..7cebf1f3d 100644 --- a/en/_sources/vrm0/sample/FirstPersonSample.md.txt +++ b/en/_sources/vrm0/sample/FirstPersonSample.md.txt @@ -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: +``` diff --git a/en/_sources/vrm0/sample/RuntimeExporterSample.md.txt b/en/_sources/vrm0/sample/RuntimeExporterSample.md.txt index 537fc5e0d..7bcbad88d 100644 --- a/en/_sources/vrm0/sample/RuntimeExporterSample.md.txt +++ b/en/_sources/vrm0/sample/RuntimeExporterSample.md.txt @@ -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: +``` diff --git a/en/_sources/vrm0/sample/SimpleViewer.md.txt b/en/_sources/vrm0/sample/SimpleViewer.md.txt index 96166e296..7ad55aeba 100644 --- a/en/_sources/vrm0/sample/SimpleViewer.md.txt +++ b/en/_sources/vrm0/sample/SimpleViewer.md.txt @@ -1,3 +1,10 @@ # SimpleViewer Runtime ローダーのサンプルです。 + +```{gitinclude} c89e Assets/VRM_Samples/SimpleViewer/ViewerUI.cs +:language: csharp +:linenos: +:caption: +:emphasize-lines" 434-485 +``` diff --git a/en/_static/custom.css b/en/_static/custom.css new file mode 100644 index 000000000..8aa6c288f --- /dev/null +++ b/en/_static/custom.css @@ -0,0 +1,3 @@ +.wy-nav-content { + max-width: 1200px !important; +} diff --git a/en/gltf/0_36_update.html b/en/gltf/0_36_update.html index bdb5143fc..de4f00a25 100644 --- a/en/gltf/0_36_update.html +++ b/en/gltf/0_36_update.html @@ -19,7 +19,7 @@ - + @@ -45,13 +45,14 @@
  • Implementation note
  • glTF
  • VRM
  • @@ -123,7 +124,7 @@