Skip to content

Commit

Permalink
move comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hybridherbst committed Jan 2, 2024
1 parent b19712b commit 82c5748
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 29 deletions.
28 changes: 28 additions & 0 deletions Runtime/Scripts/Plugins/Core/GltfPlugin.cs
Expand Up @@ -3,6 +3,34 @@

namespace UnityGLTF.Plugins
{
// When a plugin is registered with the default settings (the scriptable object in the project),
// it will be active "by default" when someone uses those default settings.
// e.g. it's used when someone uses the built-in editor methods for exporting objects.
// When using the API, one needs to manually register wanted plugins and configure them
// (can get the default settings and modify them).

// Plugins can contain any number of extensions, but are encouraged to specify in the description
// which extensions are imported/exported with that plugin.
// Theoretically there could be multiple plugins operating on the same extension in different ways, in
// which case we currently can't warn about conflicts; they would all run.
// If plugins were required to list the extensions they operate on, we could warn about conflicts.

// Plugins are ScriptableObjects which are added to the default GLTFSettings scriptable object.
// Their public serialized fields are exposed in the inspector, and they can be enabled/disabled.
// Plugins replace both GLTFSceneExporter.* static callbacks and GLTFSceneExporter.ExportOptions callbacks
// to allow for more control.

// Example cases where separate plugins operate on the same data:
// - exporting UI as custom extension vs. baking UI to mesh
// - exporting Audio in a custom extension vs. using KHR_audio
// - exporting LODs as custom extension vs. using MSFT_lod
// - exporting particle systems as custom extension vs. baking to mesh

// Plugins can either be added manually to ExportOptions.plugins / ImportContext.plugins
// or advertise themselves via a static callback which allows configuring their settings in the inspector.
// For each new instance of GLTFSceneExporter, new instances of plugins are created.
// For each new instance of GLTFSceneImporter, new instances of plugins are created.

public abstract class GltfPlugin: ScriptableObject
{
public abstract string DisplayName { get; }
Expand Down
39 changes: 10 additions & 29 deletions Runtime/Scripts/Plugins/MaterialExtensionsExport.cs
Expand Up @@ -5,34 +5,6 @@

namespace UnityGLTF.Plugins
{
// When a plugin is registered with the default settings (the scriptable object in the project),
// it will be active "by default" when someone uses those default settings.
// e.g. it's used when someone uses the built-in editor methods for exporting objects.
// When using the API, one needs to manually register wanted plugins and configure them
// (can get the default settings and modify them).

// Plugins can contain any number of extensions, but are encouraged to specify in the description
// which extensions are imported/exported with that plugin.
// Theoretically there could be multiple plugins operating on the same extension in different ways, in
// which case we currently can't warn about conflicts; they would all run.
// If plugins were required to list the extensions they operate on, we could warn about conflicts.

// Plugins are ScriptableObjects which are added to the default GLTFSettings scriptable object.
// Their public serialized fields are exposed in the inspector, and they can be enabled/disabled.
// Plugins replace both GLTFSceneExporter.* static callbacks and GLTFSceneExporter.ExportOptions callbacks
// to allow for more control.

// Example cases where separate plugins operate on the same data:
// - exporting UI as custom extension vs. baking UI to mesh
// - exporting Audio in a custom extension vs. using KHR_audio
// - exporting LODs as custom extension vs. using MSFT_lod
// - exporting particle systems as custom extension vs. baking to mesh

// Plugins can either be added manually to ExportOptions.plugins / ImportContext.plugins
// or advertise themselves via a static callback which allows configuring their settings in the inspector.
// For each new instance of GLTFSceneExporter, new instances of plugins are created.
// For each new instance of GLTFSceneImporter, new instances of plugins are created.

public class MaterialExtensionsExport: GltfExportPlugin
{
public bool KHR_materials_ior = true;
Expand All @@ -49,7 +21,16 @@ public override GltfExportPluginContext CreateInstance(ExportContext context)
}

public override string DisplayName => "KHR_materials_* PBR Next Extensions";
public override string Description => "Exports various glTF PBR Material model extensions.";
public override string Description =>
@"Exports various glTF PBR Material model extensions. Supported extensions:
- KHR_materials_ior
- KHR_materials_transmission
- KHR_materials_volume
- KHR_materials_iridescence
- KHR_materials_specular
- KHR_materials_clearcoat
- KHR_materials_emissive_strength
";
}

public class MaterialExtensionsExportContext: GltfExportPluginContext
Expand Down

0 comments on commit 82c5748

Please sign in to comment.