Skip to content
Merged
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
39 changes: 39 additions & 0 deletions skills/asset-transformer-toolkit/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: asset-transformer-toolkit
description: >-
Imports 3D models and point clouds with Asset Transformer Toolkit (formerly Pixyz), and creates,
edits, and runs RuleSets, Actions, and LODs. Use for Pixyz or Asset Transformer imports, RuleSets,
or ImporterScriptableObjects. Requires toolkit 4.0+.
required_packages:
com.unity.industry.toolkit: ">=4.0.0"
---
### Before you start: check the package version
This skill needs Asset Transformer Toolkit 4.0.0 or later (`com.unity.industry.toolkit`). Earlier versions don't have the `ATTAssistantUtilities` API every workflow below relies on.

1. Read the resolved version of `com.unity.industry.toolkit` from `Packages/packages-lock.json` (fall back to `Packages/manifest.json`).
2. **Not installed:** tell the user this workflow needs Asset Transformer Toolkit 4.0 or later, which is an entitled Unity package they may need access to through their Unity plan, and stop. Don't add it to the manifest yourself.
3. **Installed below 4.0.0:** tell the user which version you found and that 4.0 or later is required, and ask before upgrading. Don't fall back to older APIs, raw C# against internal types, or reflection.
4. **4.0.0 or later:** continue.

### API Reference
Tool functions are provided by `Unity.Pixyz.Plugin4Unity.Editor.AI.ATTAssistantUtilities`. They are documented inline in each reference file below alongside the classes they operate on.

### Technical Notes
Pixyz Plugin is the former name of Asset Transformer Toolkit. Prefer using the term 'Asset Transformer Toolkit' when addressing the user, unless the user is using the term 'Pixyz'
Most classes and code are in the Unity.Pixyz.Plugin4Unity.Editor assembly.
Asset Transformer Toolkit is NOT the same thing as Asset Transformer Studio/Pixyz Studio. NEVER rely on information about Asset Transformer Studio.

### Importers
Asset Transformer Toolkit can import 3D file from outside the project.
When modifying Importers, NEVER assume it should be immediately followed by a reimport. The import process can be very long, so it must only be launched when the user requests it.
Modify fields in Importers using the ScriptableObject API. NEVER use reflection to access or modify Importer fields — reflection is not available.
To create a Pixyz/Asset Transformer Toolkit Importer for importing a file, or to reimport a model using an existing ImporterScriptableObject, read [references/create-importer](references/create-importer.md)

### RuleSets and Actions
Read [references/rulesets-and-actions](references/rulesets-and-actions.md)
Read [api-docs/ruleset-api](api-docs/ruleset-api.md) when the RuleSet API is needed.
Read [api-docs/rule-api](api-docs/rule-api.md) when the Rule API is needed.
Read [api-docs/ruleblock-api](api-docs/ruleblock-api.md) when the RuleBlock API is needed, including `ActionBase.Id` for constructing `RuleBlock` instances.

### Levels of Detail
Read [references/lods](references/lods.md)
154 changes: 154 additions & 0 deletions skills/asset-transformer-toolkit/api-docs/rule-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
## Contents
- [Rule constructors](#rule-constructors) — `Rule()`
- [Rule methods](#rule-methods) — `GetBlock`, `GetBlockIndex`, `RemoveBlockAt`, `RemoveBlock`, `AppendBlock`, `InsertBlock`, `IsLastBlock`
- [Rule properties](#rule-properties) — `Name`, `IsEnabled`, `BlocksCount`, `Blocks`

---

## Rule constructors

The Rule API reference contains the following constructors.

### `Rule()`

This constructor creates an empty Rule with no blocks.

```csharp
public Rule()
```

## Rule methods

The Rule API reference contains the following methods.

### `GetBlock`

This method retrieves the `RuleBlock` at the specified index.

```csharp
public RuleBlock GetBlock(int i)
```

`GetBlock` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `i` | int | required | Zero-based index of the block to retrieve. |

This method returns the `RuleBlock` at the given index.

### `GetBlockIndex`

This method returns the index of the given `RuleBlock` within the Rule.

```csharp
public int GetBlockIndex(RuleBlock block)
```

`GetBlockIndex` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `block` | RuleBlock | required | The `RuleBlock` whose index to find. |

This method returns an `int` index, or `-1` if the block is not found.

### `RemoveBlockAt`

This method removes the `RuleBlock` at the specified index.

```csharp
public void RemoveBlockAt(int index)
```

`RemoveBlockAt` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `index` | int | required | Zero-based index of the block to remove. |

### `RemoveBlock`

This method removes a specific `RuleBlock` instance from the Rule.

```csharp
public void RemoveBlock(RuleBlock block)
```

`RemoveBlock` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `block` | RuleBlock | required | The `RuleBlock` instance to remove. |

### `AppendBlock`

This method adds a `RuleBlock` to the end of the Rule and sets its back-reference to this Rule.

```csharp
public void AppendBlock(RuleBlock block)
```

`AppendBlock` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `block` | RuleBlock | required | The `RuleBlock` instance to append. |

### `InsertBlock`

This method inserts a `RuleBlock` at the specified index, shifting subsequent blocks down. If `index` is beyond the last position, the block is appended instead.

```csharp
public void InsertBlock(RuleBlock block, int index)
```

`InsertBlock` accepts the following parameters.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `block` | RuleBlock | required | The `RuleBlock` instance to insert. |
| `index` | int | required | Zero-based position at which to insert the block. |

## Rule properties

The Rule API reference contains the following properties.

### `Name`

```csharp
public string Name { get; set; }
```

The display name of the Rule. Setting this property notifies the UI.

> **Note:** C# property names are case-sensitive. Use `Name` (capital N) — `name` does not exist and will not compile.

```csharp
rule.Name = "My Rule";
string ruleName = rule.Name;
```

### `IsEnabled`

```csharp
public bool IsEnabled { get; set; }
```

Controls whether the Rule is active within its RuleSet. When `false`, the Rule is skipped during execution. Setting this property notifies the UI.

### `BlocksCount`

```csharp
public int BlocksCount { get; }
```

The number of `RuleBlock` instances currently in the Rule.

### `Blocks`

```csharp
public IEnumerable<RuleBlock> Blocks { get; }
```

An enumerable over all `RuleBlock` instances in the Rule, in execution order.
37 changes: 37 additions & 0 deletions skills/asset-transformer-toolkit/api-docs/ruleblock-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## ActionBase properties

### `Id`

```csharp
public abstract int Id { get; }
```

A unique integer identifier for an action type. Pass this to the `RuleBlock(int actionId)` constructor.

## RuleBlock constructors

The RuleBlock API reference contains the following constructors.

### `RuleBlock(int actionId)`

This constructor creates a RuleBlock that will execute the action identified by `actionId`. The action instance is created lazily on first access.

```csharp
public RuleBlock(int actionId)
```

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `actionId` | int | required | The ID of the action this RuleBlock will trigger. Use `ActionBase.Id` to obtain this value from an action instance. |

## RuleBlock properties

The RuleBlock API reference contains the following properties.

### `IsEnabled`

```csharp
public bool IsEnabled { get; set; }
```

Controls whether this block is active within its Rule. When `false`, the block is skipped during execution.
138 changes: 138 additions & 0 deletions skills/asset-transformer-toolkit/api-docs/ruleset-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
## Contents
- [RuleSet methods](#ruleset-methods) — `GetRule`, `GetRuleIndex`, `RemoveRuleAt`, `RemoveRule`, `InsertRule`, `AppendRule`, `IsValid`
- [RuleSet properties](#ruleset-properties) — `RulesCount`
- [RuleSet utility functions](#ruleset-utility-functions) — `RunRuleSet`

---

## RuleSet methods

The RuleSet API reference contains the following methods.

### `GetRule`

This method retrieves the `Rule` at the specified index.

```csharp
public Rule GetRule(int i)
```

`GetRule` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `i` | int | required | Zero-based index of the rule to retrieve. |

This method returns the `Rule` at the given index.

### `GetRuleIndex`

This method returns the index of the given `Rule` within the RuleSet. Returns `-1` and logs an error if the RuleSet is currently running.

```csharp
public int GetRuleIndex(Rule rule)
```

`GetRuleIndex` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `rule` | Rule | required | The `Rule` whose index to find. |

This method returns an `int` index, or `-1` if the RuleSet is running or the rule is not found.

### `RemoveRuleAt`

This method removes the rule at the specified index. Has no effect and logs an error if the RuleSet is currently running.

```csharp
public void RemoveRuleAt(int index)
```

`RemoveRuleAt` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `index` | int | required | Zero-based index of the rule to remove. |

### `RemoveRule`

This method removes a specific `Rule` instance from the RuleSet. Has no effect and logs an error if the RuleSet is currently running.

```csharp
public void RemoveRule(Rule rule)
```

`RemoveRule` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `rule` | Rule | required | The `Rule` instance to remove. |

### `InsertRule`

This method inserts a `Rule` at the specified index, shifting subsequent rules down. Has no effect and logs an error if the RuleSet is currently running.

```csharp
public void InsertRule(int index, Rule rule, bool notify)
```

`InsertRule` accepts the following parameters.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `index` | int | required | Zero-based position at which to insert the rule. |
| `rule` | Rule | required | The `Rule` instance to insert. |
| `notify` | bool | required | When `true`, notifies the UI that the RuleSet has changed. |

### `AppendRule`

This method adds a `Rule` to the end of the RuleSet. Has no effect and logs an error if the RuleSet is currently running.

```csharp
public void AppendRule(Rule rule)
```

`AppendRule` accepts the following parameter.

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `rule` | Rule | required | The `Rule` instance to append. |

### `IsValid`

This method validates that every enabled action in the RuleSet has valid input. It skips disabled rules.

```csharp
public bool IsValid()
```

This method accepts no parameters. It returns `true` if all enabled actions pass validation, or `false` if any action reports an error.

## RuleSet properties

The RuleSet API reference contains the following properties.

### `RulesCount`

```csharp
public int RulesCount { get; }
```

The number of `Rule` instances currently in the RuleSet.

## RuleSet utility functions

The following functions are from `Unity.Pixyz.Plugin4Unity.Editor.AI.ATTAssistantUtilities`.

### `RunRuleSet`

This function executes all rules in a RuleSet asset against the current scene selection, or the entire scene if nothing is selected.

```csharp
public static void RunRuleSet(string rulesetPath)
```

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `rulesetPath` | string | required | Project-relative path to the RuleSet asset to run. |
Loading
Loading