TerraBrush Documentation

repository·main·Indexed 21 days ago

https://github.com/spimort/terrabrush

Technical documentation for TerraBrush, featuring guides on the BrushDecal node for sculpting feedback, the ImportDialog for terrain data configuration, KeybindSettings for editor hotkeys, and TerrainPositionInformation resources for managing texture, water, and snow properties.

Tokens
986
Snippets
3
Records
9
Agent score
79%

What's inside terrabrush

  1. Initialize the ImportDialog with an acceptance callback

    main
    The ImportDialog is a Godot Window used to configure the import of terrain data (heightmaps, color maps, splatmaps, etc.). To use it, you must call init() and provide a callback function that accepts an ImporterSettings object. This callback is triggered when the user clicks the 'OK' button in the dialog, providing the configuration chosen by the user.
  2. Configure editor hotkeys with KeybindSettings

    main

    The KeybindSettings class is a dialog (inheriting from AcceptDialog) used to manage and configure editor hotkeys. It interacts with a KeybindManager to handle the underlying keybinding logic.

    Within the dialog, shortcuts are categorized by ShortcutType:

    • SHORTCUTTYPE_ADD: Used for adding new shortcuts.
    • SHORTCUTTYPE_ERASE: Used for erasing/removing existing shortcuts.

    As a UI component, it provides a list of keybindings that can be modified via button clicks (handled by keybindListOnButtonClicked) and finalized when the user confirms the changes (via onConfirm).

  3. ShortcutType enumeration for keybinding operations

    main

    The ShortcutType enum defines the mode of operation for shortcut modifications within the KeybindSettings dialog:

    ValueDescription
    SHORTCUTTYPE_ADDMode for adding a new shortcut.
    SHORTCUTTYPE_ERASEMode for removing an existing shortcut.
    enum ShortcutType {
        SHORTCUTTYPE_ADD = 1,
        SHORTCUTTYPE_ERASE  = 2
    };
  4. Configure terrain texture information with TerrainPositionTextureInformation

    main

    The TerrainPositionTextureInformation class is a RefCounted resource used to define specific texture properties for terrain positions. It stores an index, a name, and a scaling factor.

    Use the following methods to configure a texture entry:

    • set_index(int value): Sets the texture index.
    • set_name(String value): Sets the name of the texture.
    • set_factor(float value): Sets the scaling factor for the texture.
  5. Use setBrushImage() to change the brush texture

    main

    The setBrushImage(const Ref<Image> image) method allows you to pass a Ref<Image> to define the texture of the brush decal. This is used to change the visual pattern or shape projected onto the terrain during sculpting.

    void setBrushImage(const Ref<Image> image);
  6. Manage terrain position data with TerrainPositionInformation

    main

    The TerrainPositionInformation class is a RefCounted resource that aggregates texture data and environmental factors (water and snow) for terrain positioning.

    Properties

    Textures

    • get_textures() / set_textures(TypedArray<Ref<TerrainPositionTextureInformation>> value): Returns or sets a TypedArray of TerrainPositionTextureInformation resources.

    Water Settings

    • get_waterFactor() / set_waterFactor(float value): Gets or sets the water factor.
    • get_waterDeepness() / set_waterDeepness(float value): Gets or sets the water deepness.

    Snow Settings

    • get_snowFactor() / set_snowFactor(float value): Gets or sets the snow factor.
    • get_snowHeight() / set_snowHeight(float value): Gets or sets the snow height.

    Metadata

    • get_metaInfoIndex() / set_metaInfoIndex(int value): Gets or sets the metadata information index.
    • get_metaInfoName() / set_metaInfoName(String value): Gets or sets the metadata information name.