Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ The library is designed to be easy to extend with additional extensions to the g
- [Default Importer Selection](#default-importer-selection)
- [Animation Import](#animation-import)
- [Extensibility](#extensibility)
- [Example for custom plugin](#example-for-custom-plugin)
- [Example for custom export plugin](#example-for-custom-export-plugin)
- [Example for custom import plugin](#example-for-custom-import-plugin)
- [Known Issues](#known-issues)
- [Contributing](#contributing)
- [Unity Package](#unity-package)
Expand Down Expand Up @@ -457,7 +458,7 @@ If your plugin reads/writes custom extension data, you need to also implement `G
> [!WARNING]
> `ShouldNodeExport` callback: Using this callback requires understanding of how glTF works. For example, if you filter out some bones of a skeleton on export, the result might not be valid glTF or might not display what you expect. Use with caution

### Example for custom plugin
### Example for custom export plugin
```csharp
public class MyExportPlugin : GLTFExportPlugin
{
Expand All @@ -480,6 +481,30 @@ public class MyExportPluginContext: GLTFExportPluginContext
}
```

### Example for custom import plugin
```csharp
public class MyImportPlugin: GLTFImportPlugin
{
public override string DisplayName => "My Import Plugin";
public override string Description => "";

public override GLTFImportPluginContext CreateInstance(GLTFImportContext context)
{
return new MyImportPluginContext();
}
}

public class MyImportPluginContext: GLTFImportPluginContext
{
public override void OnAfterImportScene(GLTFScene scene, int sceneIndex, GameObject sceneObject)
{
// Set all to static
var objs = sceneObject.GetComponentsInChildren<Transform>();
foreach (var obj in objs)
obj.gameObject.isStatic = true;
}
}
```

> 🏗️ Under construction. You can take a look at `MaterialVariantsPlugin.cs` for an example.

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
"author": "Khronos Group",
"dependencies": {
"com.unity.nuget.newtonsoft-json": "2.0.0",
"com.unity.modules.audio": "1.0.0",
"com.unity.modules.imageconversion": "1.0.0",
"com.unity.modules.particlesystem": "1.0.0",
"com.unity.shadergraph": "10.0.0",
"com.unity.mathematics": "1.0.0"
},
"samples": [
]
}
}