# IOInterface

> Class

Inheritance

* [object](https://learn.microsoft.com/dotnet/api/system.object)
* [Interface](./api_interface)
* IOInterface

***

Inherited Members

* [Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\))

* [Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\))

* [GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)

* [GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype)

* [MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone)

* [ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)

* [ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

***

Namespace: UnityEngine.Pixyz.IO

```csharp
public class IOInterface : Interface
```

## Methods

### GetLastError

```csharp
public static string GetLastError()
```

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### ConfigureFunctionLogger

```csharp
[HandleProcessCorruptedStateExceptions]
public void ConfigureFunctionLogger(string functionName, bool enableFunction, bool enableParameters, bool enableExecutionTime)
```

Parameters

| Type                                                           | Name                | Description |
| -------------------------------------------------------------- | ------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | functionName        |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableFunction      |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableParameters    |             |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | enableExecutionTime |             |

### AddAssetPaths

Add directory paths to search assets in.

```csharp
[HandleProcessCorruptedStateExceptions]
public void AddAssetPaths(StringList path)
```

Parameters

| Type                            | Name | Description       |
| ------------------------------- | ---- | ----------------- |
| [StringList](./core_stringlist) | path | The paths to add. |

### ClearAssetPaths

Clear all asset paths.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ClearAssetPaths()
```

### FindInDirectories

Find the final path. This will search for the file in asset paths.

```csharp
[HandleProcessCorruptedStateExceptions]
public string FindInDirectories(string filePath)
```

Parameters

| Type                                                           | Name     | Description                             |
| -------------------------------------------------------------- | -------- | --------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | filePath | The (relative) file path to search for. |

Returns

| Type                                                           | Description |
| -------------------------------------------------------------- | ----------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) |             |

### GetAssetPaths

Get user defined paths to find assets.

```csharp
[HandleProcessCorruptedStateExceptions]
public StringList GetAssetPaths()
```

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [StringList](./core_stringlist) |             |

### SetAssetPaths

Replace paths to find assets.

```csharp
[HandleProcessCorruptedStateExceptions]
public void SetAssetPaths(StringList assetPaths)
```

Parameters

| Type                            | Name       | Description      |
| ------------------------------- | ---------- | ---------------- |
| [StringList](./core_stringlist) | assetPaths | The asset paths. |

### ApplyAutoTessellate

Handle auto tessellate options on given part, need to be complete.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ApplyAutoTessellate(uint part)
```

Parameters

| Type                                                         | Name | Description                  |
| ------------------------------------------------------------ | ---- | ---------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | part | Part to be auto tessellated. |

### ExportScene

Export a file.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ExportScene(string fileName, uint root = 0)
```

Parameters

| Type                                                           | Name     | Description                                  |
| -------------------------------------------------------------- | -------- | -------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | fileName | Path of the file to export.                  |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | root     | Identifier of the root occurrence to export. |

### ExportSelection

Export the selection to a file.

```csharp
[HandleProcessCorruptedStateExceptions]
public void ExportSelection(string fileName, bool keepIntermediaryNodes = false)
```

Parameters

| Type                                                           | Name                  | Description                               |
| -------------------------------------------------------------- | --------------------- | ----------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | fileName              | Path of the file to export.               |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | keepIntermediaryNodes | If true, intermerdiary hierarchy is kept. |

### GetExportFormats

Give all the format name and their extensions that can be exported in Pixyz.

```csharp
[HandleProcessCorruptedStateExceptions]
public FormatList GetExportFormats(bool forRuntimeOS = true)
```

Parameters

| Type                                                          | Name         | Description                               |
| ------------------------------------------------------------- | ------------ | ----------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | forRuntimeOS | Get format for the current OS or for all. |

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [FormatList](./core_formatlist) |             |

### GetFormatsDescriptions

Give all the formats description that can be imported/exported in Pixyz.

```csharp
[HandleProcessCorruptedStateExceptions]
public FileFormatList GetFormatsDescriptions(bool forRuntimeOS = true)
```

Parameters

| Type                                                          | Name         | Description                               |
| ------------------------------------------------------------- | ------------ | ----------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | forRuntimeOS | Get format for the current OS or for all. |

Returns

| Type                                  | Description |
| ------------------------------------- | ----------- |
| [FileFormatList](./io_fileformatlist) |             |

### GetImportFormats

Give all the format name and their extensions that can be imported in Pixyz.

```csharp
[HandleProcessCorruptedStateExceptions]
public FormatList GetImportFormats(bool forRuntimeOS = true)
```

Parameters

| Type                                                          | Name         | Description                                                                      |
| ------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | forRuntimeOS | If true, gets formats for the current OS. If false, gets for all supported OSes. |

Returns

| Type                            | Description |
| ------------------------------- | ----------- |
| [FormatList](./core_formatlist) |             |

### ImportFiles

Import files.

```csharp
[HandleProcessCorruptedStateExceptions]
public OccurrenceList ImportFiles(FilesList fileNames, uint root = 0)
```

Parameters

| Type                                                         | Name      | Description                               |
| ------------------------------------------------------------ | --------- | ----------------------------------------- |
| [FilesList](./io_fileslist)                                  | fileNames | List of files's paths to import.          |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | root      | Identifier of the destination occurrence. |

Returns

| Type                                     | Description |
| ---------------------------------------- | ----------- |
| [OccurrenceList](./scene_occurrencelist) |             |

### ImportPicture

Imports a picture and applies is at as a texture on a 3D plane created in the scene.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ImportPicture(string filename, uint root = 0)
```

Parameters

| Type                                                           | Name     | Description                               |
| -------------------------------------------------------------- | -------- | ----------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | filename | Path of the file to import.               |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | root     | Identifier of the destination occurrence. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ImportRemote3mxFile

Import a remote 3mx file.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ImportRemote3mxFile(string filePath, string origin = "", uint root = 0)
```

Parameters

| Type                                                           | Name     | Description                               |
| -------------------------------------------------------------- | -------- | ----------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | filePath | The path of the temp file.                |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | origin   | Remote origin of the file.                |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | root     | Identifier of the destination occurrence. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ImportScene

Import a file.

```csharp
[HandleProcessCorruptedStateExceptions]
public uint ImportScene(string fileName, uint root = 0)
```

Parameters

| Type                                                           | Name     | Description                               |
| -------------------------------------------------------------- | -------- | ----------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | fileName | Path of the file to import.               |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)   | root     | Identifier of the destination occurrence. |

Returns

| Type                                                         | Description |
| ------------------------------------------------------------ | ----------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) |             |

### ListVariants

List all variants if file.

```csharp
[HandleProcessCorruptedStateExceptions]
public VariantNameList ListVariants(string fileName)
```

Parameters

| Type                                                           | Name     | Description                 |
| -------------------------------------------------------------- | -------- | --------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | fileName | Path of the file to import. |

Returns

| Type                                    | Description |
| --------------------------------------- | ----------- |
| [VariantNameList](./io_variantnamelist) |             |

### LoadReferencedData

Load partial model.

```csharp
[HandleProcessCorruptedStateExceptions]
public void LoadReferencedData(uint component, bool recursively)
```

Parameters

| Type                                                          | Name        | Description                 |
| ------------------------------------------------------------- | ----------- | --------------------------- |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32)  | component   | The component to load.      |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | recursively | Load it recursively or not. |

### UnloadReferencedData

Unload partial model.

```csharp
[HandleProcessCorruptedStateExceptions]
public void UnloadReferencedData(uint component)
```

Parameters

| Type                                                         | Name      | Description              |
| ------------------------------------------------------------ | --------- | ------------------------ |
| [uint](https://learn.microsoft.com/dotnet/api/system.uint32) | component | The component to unload. |

### RegisterIOCallbacks

Register import and export callbacks.

```csharp
[HandleProcessCorruptedStateExceptions]
public void RegisterIOCallbacks(string name, IOInterface.importFileCallback importCallback, IOInterface.exportFileCallback exportCallback, FileFormatList fileFormats)
```

Parameters

| Type                                                               | Name           | Description                                          |
| ------------------------------------------------------------------ | -------------- | ---------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string)     | name           | Callback name.                                       |
| [IOInterface.importFileCallback](./iointerface_importfilecallback) | importCallback | Callback that import a file.                         |
| [IOInterface.exportFileCallback](./iointerface_exportfilecallback) | exportCallback | Callback that exports to a file.                     |
| [FileFormatList](./io_fileformatlist)                              | fileFormats    | Gives the extension and parameters to Import/Export. |

### SplitPointCloud

```csharp
[HandleProcessCorruptedStateExceptions]
public void SplitPointCloud(FilePathList files, string outputDirectory, double minVoxSize, bool useKDTree, AABB aabb = null, double density = -1)
```

Parameters

| Type                                                           | Name            | Description                                          |
| -------------------------------------------------------------- | --------------- | ---------------------------------------------------- |
| [FilePathList](./core_filepathlist)                            | files           | Path of the point cloud files to process.            |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | outputDirectory | Output directory.                                    |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | minVoxSize      | Size of minimum leaves (mm).                         |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean)  | useKDTree       | If true, uses a kd\_tree, otherwise, uses an octree. |
| [AABB](./geom_aabb)                                            | aabb            | Global scene aabb.                                   |
| [double](https://learn.microsoft.com/dotnet/api/system.double) | density         | Point cloud density (-1 to compute).                 |

### GetExtensionPriority

Get the priority of an extension from the pixyz importer.

```csharp
[HandleProcessCorruptedStateExceptions]
public PriorityImportLevel GetExtensionPriority(string extensionName)
```

Parameters

| Type                                                           | Name          | Description                |
| -------------------------------------------------------------- | ------------- | -------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | extensionName | The name of the extension. |

Returns

| Type                                            | Description |
| ----------------------------------------------- | ----------- |
| [PriorityImportLevel](./io_priorityimportlevel) |             |
