Titania X3D Editor

Bring Colours to Your Life.

Titania v4.1.1

Bring Colours to Your Life.

X3D Reference

How to Create External Tools

How to Create External Tools

External tools are an convenient way to create custom applications to add new features like file converters, code generators, node editors, Git support, and other useful features to Titania.

Find it: Click on the External Tools > Manage External Tools menu item in the menu bar.


External Tools Editor

Manage External Tools Dialog

The name of the current tool can be edited directly using the list on the left side of the dialog. The list item can be rearranged using drag & drop to create a custom menu layout including submenus.

Here is a short description of the editable properties for a given tool:

  • Edit: the actual commands to be ran
  • Save: saving or not (current document or all documents) before running the tool.
  • Input: what content to give to the commands (as stdin).
    • Encoding: what type of encoding (XML, VRML, or JSON) should have the input.
  • Output: what to do with the commands output (from stdout).
  • Applicability: what documents can be affected by that tool? Criteria are: saved or not, local or remote.

If a script is run TITANIA_* environment variables are available.

D-Bus Interface

Titania can be controlled using it's D-Bus interface. Useful methods and signals are available. The D-Bus Interface can be inspected using D-Feet.

Methods

void GetCurrentScene (encoding : String)

Returns the current scene as X3D file in the desired format specified by encoding. Encoding can be of type 'XML', 'VRML', or 'JSON'.

String GetSelection (encoding : String)

Returns the current selection as X3D file in the desired format specified by encoding. Encoding can be of type 'XML', 'VRML', or 'JSON'.

void ReplaceSelection (pluginName : String, x3dSyntax : String, assign : Boolean)

Replaces or assigns the current selection by the first node found in x3dSyntax. To create a useful undo description, the pluginName must be provided and shall reflect the use of the plug-in. x3dSyntax must be a valid X3D scene string in XML, Classic VRML. or JSOM encoding. If assign is false  the current selection is replaced by the first node found in x3dSyntax. If assign is true  and this will be in most cases the desired option, it will be tried to assign the output to the selection, if this is not possible the selection will be replaces.

Signals

CurrentSceneChanged : void on_current_scene_changed ()

The signal is send when the current scene changes.

SelectionChanged : void on_selection_changed ()

The signal is send when the current selection changes.

Python D-Bus Example

The script below shows a minimal Python D-Bus example that can be run as