# IRiUVEditor Interface Reference

Inherits IDispatch, and IDispatch.

List of all members.

## Public Member Functions
HRESULT | Open ([in] BSTR bszSelection)
HRESULT | ClearBackground ([in] BSTR bszPreferencesNode)
HRESULT | ConvertToEditable ([in] BSTR bszSelection)
HRESULT | SliceSelection ([in] BSTR senderControl)
HRESULT | WeldSelection ([in] BSTR senderControl)
HRESULT | SetTool ([in] BSTR senderControl,[in] BSTR tool)
HRESULT | SetSelectionElement ([in] BSTR senderControl,[in] BSTR element)
HRESULT | ExportTexture ([in] BSTR senderControl,[in] BSTR filename,[in] BOOL wiring)
HRESULT | ImportTexture ([in] BSTR senderControl,[in] BSTR filename)
HRESULT | EditTexture ([in] BSTR senderControl,[in] BSTR filename)
HRESULT | ToggleMaterial ([in] BSTR senderControl,[in] int direction)
HRESULT | Heal ([in] BSTR senderControl)
HRESULT | SyncUV ([in] BSTR senderControl,[in] RtDWORD source_set,[in] RtDWORD dest_set)
HRESULT | RelaxUV ([in] BSTR senderControl,[in] RtDWORD iterations)
HRESULT | Unwrap ([in] BSTR senderControl)
HRESULT | ToggleUvProjection ([in] BSTR bszProjection,[in] BSTR bszSelection)
HRESULT | Flatten (BSTR bszSenderControl)
HRESULT | FlipSelection (BSTR bszSenderControl, BSTR bszMode)
HRESULT | ShowPreferencesPanel (BSTR bszFullName)
HRESULT | Test ()
HRESULT | Open ([in] BSTR bszSelection)
HRESULT | ClearBackground ([in] BSTR bszPreferencesNode)
HRESULT | ConvertToEditable ([in] BSTR bszSelection)
HRESULT | SliceSelection ([in] BSTR senderControl)
HRESULT | WeldSelection ([in] BSTR senderControl)
HRESULT | SetTool ([in] BSTR senderControl,[in] BSTR tool)
HRESULT | SetSelectionElement ([in] BSTR senderControl,[in] BSTR element)
HRESULT | ExportTexture ([in] BSTR senderControl,[in] BSTR filename,[in] BOOL wiring)
HRESULT | ImportTexture ([in] BSTR senderControl,[in] BSTR filename)
HRESULT | EditTexture ([in] BSTR senderControl,[in] BSTR filename)
HRESULT | ToggleMaterial ([in] BSTR senderControl,[in] int direction)
HRESULT | Heal ([in] BSTR senderControl)
HRESULT | SyncUV ([in] BSTR senderControl,[in] RtDWORD source_set,[in] RtDWORD dest_set)
HRESULT | RelaxUV ([in] BSTR senderControl,[in] RtDWORD iterations)
HRESULT | Unwrap ([in] BSTR senderControl)
HRESULT | Test ()

## Detailed Description

The IRiUVEditor interface provides methods to perform various UVEditor operations.
Root-level name in the scripting engine's name space: UVEditor

## Member Function Documentation

HRESULT IRiUVEditor::Open | ( | [in] BSTR | bszSelection | ) |

Opens UV editor window. Only one UV editor window is supported at a time.

Parameters:

  | bszSelection | [in] Full name of selected object to display in editor. Can be blank, in such case first object of current selection is used.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.Open('Project/Space 3D/Cube');

HRESULT IRiUVEditor::ClearBackground | ( | [in] BSTR | bszPreferencesNode | ) |

Clears auxiliary background texture in UV editor, as well as in preferences panel.

Parameters:

  | bszPreferencesNode | [in] Full name of preferences node where background texture is set.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.ClearBackground('Preferences/UV Editor preferences');

HRESULT IRiUVEditor::ConvertToEditable | ( | [in] BSTR | bszSelection | ) |

Converts current selection into editable node, by adding an editable mesh modifier.

- This is necessary for any object, which is displayed or edited in UV editor.
- Called automatically when the UV editor opens, or new object is selected.
- You should never need to call this directly.

Parameters:

  | bszSelection | [in] Selected object to process. Can be blank, in such case first object of current selection is used.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.ConvertToEditable('');

HRESULT IRiUVEditor::SliceSelection | ( | [in] BSTR | senderControl | ) |

Slices the UV selection, by separating selected triangles, from unselected triangles in UV space.

- Then selected triangles will become a separate patch.

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.Slice('');

HRESULT IRiUVEditor::WeldSelection | ( | [in] BSTR | senderControl | ) |

Welds all selected vertices in UV space into single vertex.

- Edge and triangle selection is converted to vertex selection.

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.Weld('');

HRESULT IRiUVEditor::SetTool | ( | [in] BSTR | senderControl,
|  | [in] BSTR | tool |
| ) |  |  |

Sets the current UV editor tool. Current tool must be one of these:

- Rectangle - activates rectangle selectio tool
- Lasso - activates lasso selection tool
- Paint - activates paint selection tool
- DynaPick - activates dynapick selection tool (pick and move)
- Move - activates move tool
- Rotate - activates rotate tool
- Scale - activates scale tool
- Brush - activates texture brush painting tool
- Line - activates texture line painting tool
- Freeform - activates free movement tool with widget

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.
  | tool | [in] Tool to activate, one of above values.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.SetTool('Rotate');

HRESULT IRiUVEditor::SetSelectionElement | ( | [in] BSTR | senderControl,
|  | [in] BSTR | element |
| ) |  |  |

Sets the current selection element for editor. One of following values can be set:

- Locked - no selection can be made
- Vertex - only vertices are selected
- Edge - only edges are selected
- Triangle - only triangles are selected
- FaceTriangle - face triangles are selected
- Nearest - nearest element (vertex, edge or triangle is selected)
- Patch - whole patches of triangles/faces are selected

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.
  | element | [in] Tool to activate, one of above values.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.SetSelectionElement('Triangle');

HRESULT IRiUVEditor::ExportTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename,
|  | [in] BOOL | wiring |
| ) |  |  |

Exports diffuse texture of current material into specified file.

- If no file is specified, file dialog is spawned to choose target file.

Note: backslashes must be escaped (use double backslash whenever one occurs).

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank
  | filename | [in] Full filename with extension. Must contain extension in order to determine file type. Specify blank for opening export dialog.
  - | wiring | [in] Specifies whether UV mapping should be painted into exported texture. This can be
         true
    or
         false

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.ExportTexture('', 'C:\\tS7_exports\\exported.bmp');

HRESULT IRiUVEditor::ImportTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename |
| ) |  |  |

Imports diffuse texture into current material from specified file.

Note: backslashes must be escaped (use double backslash whenever one occurs).

[in] Toolbar button control sending this command. Can be blank. [in] Full filename with extension.

- Must not be blank.
- File must exist.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.ImportTexture('', 'C:\\tS7_exports\\exported.bmp');

HRESULT IRiUVEditor::EditTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename |
| ) |  |  |

Opens the diffuse texture of current material in external drawing tool.

- Once file overwritten, it is imported back to UV editor.
- Note that external drawing tool must be set in preferences.

Note: backslashes must be escaped (use double backslash whenever one occurs).

[in] Toolbar button control sending this command. Can be blank. [in] Temporary file to be used as connection between UV editor and external program.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.EditTexture('', 'C:\\tS7_exports\\exported.bmp');

HRESULT IRiUVEditor::ToggleMaterial | ( | [in] BSTR | senderControl,
|  | [in] int | direction |
| ) |  |  |

Toggles currently displayed material with associated UV mapping.

- Can be used to cycle between available materials and their display in UV editor.
- By default, only triangles with currently displayed material are shown.

Note: backslashes must be escaped (use double backslash whenever one occurs).

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.
  | direction | [in] Direction of material toggling. Can be -1 or 1. If -1 specified, previous material in list is displayed. If 1 specified, next material is displayed.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.ToggleMaterial('', 1);

HRESULT IRiUVEditor::Heal | ( | [in] BSTR | senderControl | ) |

Welds together all UV vertices which are close to each other.

- Useful for reducing number of UV vertices.

Note: backslashes must be escaped (use double backslash whenever one occurs).

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.Heal('');

HRESULT IRiUVEditor::SyncUV | ( | [in] BSTR | senderControl,
|  | [in] RtDWORD | source_set,
|  | [in] RtDWORD | dest_set |
| ) |  |  |

Copies source UV set into target UV set (e.g. UV1 to UV2 or vice-versa).

- Original target UV mapping is lost.
- Source set must not be equal to target set.

Parameters:

  | senderControl | [in] Toolbar button control sending this command. Can be blank.
  | source_set | [in] Source UV set. Valid values are 0 and 1.
  | dest_set | [in] Target UV set. Valid values are 0 and 1.

Returns:
  standard HRESULT processing can be applied to returned value.

Example:

        UVEditor.SyncUV('');

HRESULT IRiUVEditor::RelaxUV | ( | [in] BSTR | senderControl,
|  | [in] RtDWORD | iterations |
| ) |  |  |

Code stub, not implemented yet.

Parameters:

  | senderControl | [in] .
  | iterations | [in] .

HRESULT IRiUVEditor::Unwrap | ( | [in] BSTR | senderControl | ) |

Code stub, not implemented yet.

Parameters:

  | senderControl | [in] .

HRESULT IRiUVEditor::ToggleUvProjection | ( | [in] BSTR | bszProjection,
|  | [in] BSTR | bszSelection |
| ) |  |  |

Toggle UV projection tool.

Parameters:

  | bszProjection | [in] Projection algorithm.
  | bszSelection | [in] List of objects or '' for current selection.

HRESULT IRiUVEditor::Flatten | ( | BSTR | bszSenderControl | ) |

Flatten.

Parameters:

  | bszSenderControl | [in] .

HRESULT IRiUVEditor::FlipSelection | ( | BSTR | bszSenderControl,
|  | BSTR | bszMode |
| ) |  |  |

Flips selection according to specified mode.

Parameters:

  | bszSenderControl | [in] Toolbar button sending the command. Can be blank.
  | bszMode | [in] Mode of flip. Can be: "Vertical" "Horizontal" "SelectEdge" (V,H,S abbreviations can be used). SelectEdge activates a dynapick-like tool where after picking edge, the selection will flip around it.

HRESULT IRiUVEditor::ShowPreferencesPanel | ( | BSTR | bszFullName | ) |

Shows specified UV preferences panel

Parameters:

  | bszFullName | - full name of the preferences node to show

HRESULT IRiUVEditor::Test | ( |  | ) |

Internal testing purposes only (does nothing useful in public builds)

HRESULT IRiUVEditor::Open | ( | [in] BSTR | bszSelection | ) |

Opens UV editor window. Only one UV editor window is supported at a time.

Example: `UVEditor.Open('Project/Space 3D/Cube');`

Parameters:

  | bszSelection | - full name of selected object to display in editor. Can be blank, in such case first object of current selection is used

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::ClearBackground | ( | [in] BSTR | bszPreferencesNode | ) |

Clears auxiliary background texture in UV editor, as well as in preferences panel

Example: `UVEditor.ClearBackground('Preferences/UV Editor preferences');`

Parameters:

  | bszPreferencesNode | - full name of preferences node where background texture is set

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::ConvertToEditable | ( | [in] BSTR | bszSelection | ) |

Converts current selection into editable node, by adding an editable mesh modifier. This is necessary for any object, which is displayed or edited in UV editor. Called automatically when the UV editor opens, or new object is selected. You should never need to call this directly.

Example: `UVEditor.ConvertToEditable('');`

Parameters:

  | bszSelection | - selected object to process. Can be blank, in such case first object of current selection is used.

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::SliceSelection | ( | [in] BSTR | senderControl | ) |

Slices the UV selection, by separating selected triangles, from unselected triangles in UV space. Then selected triangles will become a separate patch

Example: `UVEditor.Slice('');`

Parameters:

  | senderControl | - toolbar button control sending this command. Can be blank

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::WeldSelection | ( | [in] BSTR | senderControl | ) |

Welds all selected vertices in UV space into single vertex. Edge and triangle selection is converted to vertex selection.

Example: `UVEditor.Weld('');`

Parameters:

  | senderControl | - toolbar button control sending this command. Can be blank

Returns:
  standard HRESULT processing can be applied to returned value.

HRESULT IRiUVEditor::SetTool | ( | [in] BSTR | senderControl,
|  | [in] BSTR | tool |
| ) |  |  |

Sets the current UV editor tool. Current tool must be one of these:

- Rectangle - activates rectangle selectio tool
- Lasso - activates lasso selection tool
- Paint - activates paint selection tool
- DynaPick - activates dynapick selection tool (pick and move)
- Move - activates move tool
- Rotate - activates rotate tool
- Scale - activates scale tool
- Brush - activates texture brush painting tool
- Line - activates texture line painting tool
- Freeform - activates free movement tool with widget

Example: `UVEditor.SetTool('Rotate');`

Parameters:

  | senderControl | - toolbar button control sending this command. Can be blank
  | tool | - tool to activate, one of above values

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::SetSelectionElement | ( | [in] BSTR | senderControl,
|  | [in] BSTR | element |
| ) |  |  |

Sets the current selection element for editor. One of following values can be set:

- Locked - no selection can be made
- Vertex - only vertices are selected
- Edge - only edges are selected
- Triangle - only triangles are selected
- FaceTriangle - face triangles are selected
- Nearest - nearest element (vertex, edge or triangle is selected)
- Patch - whole patches of triangles/faces are selected

Example: `UVEditor.SetSelectionElement('Triangle');`

Parameters:

  | senderControl | - toolbar button control sending this command. Can be blank
  | element | - tool to activate, one of above values

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::ExportTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename,
|  | [in] BOOL | wiring |
| ) |  |  |

Exports diffuse texture of current material into specified file. If no file is specified, file dialog is spawned to choose target file.

Example: `UVEditor.ExportTexture('', 'C:\tS7_exports\exported.bmp');`

Note: backslashes must be escaped (use double backslash whenever one occurs)

Parameters:

  | senderControl | - toolbar button control sending this command. Can be blank
  | filename | - full filename with extension. Must contain extension in order to determine file type. Specify blank for opening export dialog
  | wiring | - specifies whether UV mapping should be painted into exported texture. This can be `true` or `false`

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::ImportTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename |
| ) |  |  |

Imports diffuse texture into current material from specified file.

Example: `UVEditor.ImportTexture('', 'C:\tS7_exports\exported.bmp');`

Note: backslashes must be escaped (use double backslash whenever one occurs)

- toolbar button control sending this command. Can be blank - full filename with extension. Must not be blank. File must exist

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::EditTexture | ( | [in] BSTR | senderControl,
|  | [in] BSTR | filename |
| ) |  |  |

Opens the diffuse texture of current material in external drawing tool. Once file overwritten, it is imported back to UV editor. Note that external drawing tool must be set in preferences

Example: `UVEditor.EditTexture('', 'C:\tS7_exports\exported.bmp');`

Note: backslashes must be escaped (use double backslash whenever one occurs)

- toolbar button control sending this command. Can be blank - temporary file to be used as connection between UV editor and external program

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::ToggleMaterial | ( | [in] BSTR | senderControl,
|  | [in] int | direction |
| ) |  |  |

Toggles currently displayed material with associated UV mapping. Can be used to cycle between available materials and their display in UV editor. By default, only triangles with currently displayed material are shown

Example: `UVEditor.ToggleMaterial('', 1);`

Note: backslashes must be escaped (use double backslash whenever one occurs)

- toolbar button control sending this command. Can be blank - direction of material toggling. Can be -1 or 1. If -1 specified, previous material in list is displayed. If 1 specified, next material is displayed

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::Heal | ( | [in] BSTR | senderControl | ) |

Welds together all UV vertices which are close to each other. Useful for reducing number of UV vertices.

Example: `UVEditor.Heal('');`

Note: backslashes must be escaped (use double backslash whenever one occurs)

- toolbar button control sending this command. Can be blank

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::SyncUV | ( | [in] BSTR | senderControl,
|  | [in] RtDWORD | source_set,
|  | [in] RtDWORD | dest_set |
| ) |  |  |

Copies source UV set into target UV set (e.g. UV1 to UV2 or vice-versa). Original target UV mapping is lost. Source set must not be equal to target set.

Example: `UVEditor.SyncUV('');`

- toolbar button control sending this command. Can be blank - source UV set. Valid values are 0 and 1 - target UV set. Valid values are 0 and 1

Returns:
  standard HRESULT processing can be applied to returned value

HRESULT IRiUVEditor::RelaxUV | ( | [in] BSTR | senderControl,
|  | [in] RtDWORD | iterations |
| ) |  |  |

Code stub, not implemented yet

HRESULT IRiUVEditor::Unwrap | ( | [in] BSTR | senderControl | ) |

Code stub, not implemented yet

HRESULT IRiUVEditor::Test | ( |  | ) |

Internal testing purposes only (does nothing useful in public builds)