Dynamic Decals Widgets
Editor module providing the unified property widget rendering system for the Dynamic Decals tool. Maps API property types to appropriate ImGui controls (sliders, inputs, combos, color pickers, texture
Editor module providing the unified property widget rendering system for the Dynamic Decals tool. Maps API property types to appropriate ImGui controls (sliders, inputs, combos, color pickers, texture selectors, etc.) with reset-to-default buttons, lock-ratio support, and widget highlighting.
Module Info
| Key | Value |
|---|---|
| File | extensions/editor/dynamicDecals/widgets.lua |
| logTag | editor_dynamicDecals_widgets |
| Dependencies | editor_api_dynamicDecals, editor_dynamicDecals_helper |
Public API
| Function | Signature | Description |
|---|---|---|
M.draw | (value, property, guiId, editEnded?, widgetOptions?) | Main entry point - renders the appropriate widget for a property based on its type and widget type override. Returns true if value changed |
M.highlight | (id, time) | Highlights a widget by ID with a timed border outline |
M.defaultButton | (widgetId, cbFunc, tooltipMsg?) | Renders a reset/refresh icon button that calls cbFunc on click |
M.registerEditorPreferences | (prefsRegistry) | Registers widget preferences |
M.editorPreferenceValueChanged | (path, value) | Stub |
M.setup | (tool_in) | Stores references, registers editModeUpdate for highlight timers |
Preferences
| Path | Type | Default | Description |
|---|---|---|---|
dynamicDecalsTool.widgets.texturePreviewSize | float | 128 | Texture thumbnail max width (32–512) |
dynamicDecalsTool.widgets.multiColorWidgetWidth | float | 128 | Gradient preview width (32–512) |
Supported Property Types & Widget Variants
| Type | Widget Variants | Default |
|---|---|---|
bool | Checkbox | Checkbox |
int | Input, Slider, Drag, Combo | Input |
float | Input, Slider, Drag | Slider |
Point2F | Input, Slider, Drag | Slider |
Point3F | Slider, Color | Slider |
Point4F | Slider, Color | Slider |
string | Input, InputMultiline | Input |
Texture | File, ImageButton | ImageButton |
File | File | File |
ColorI | Color | Color |
MultiColor | ColorGradient | ColorGradient |
Widget Features
- Reset button - Each widget can have a refresh icon that resets to
property.default - Lock ratio - Point2F/Point3F/Point4F widgets support a lock icon to constrain all components
- getMod/setMod - Properties can define transform functions for display vs storage values
- Widget type override -
property.widgetTypeselects among available variants; a diamond icon popup lets users switch - Highlighting -
highlight(id, time)draws a BeamNG-colored border around a widget fortimeseconds - Drag-drop - Texture widgets accept
DynDecalTextureDrapDroppayloads - Image preview - Texture widgets show preview with configurable size and border
Usage Example
local widgets = extensions.editor_dynamicDecals_widgets
local api = extensions.editor_api_dynamicDecals
-- Draw a property widget
if widgets.draw(api.getDecalRotation(), api.propertiesMap["decalRotation"], "myGui") then
api.setDecalRotation(api.propertiesMap["decalRotation"].value)
end
-- Highlight a specific widget for 5 seconds
widgets.highlight("##Decal Properties_section_decalScale", 5)See Also
- Dynamic Decals - Browser - Related reference
- Dynamic Decals - Brushes - Related reference
- Dynamic Decals - Camera - Related reference
- World Editor Guide - Guide
Dynamic Decals Vehicle Color Palette
Editor module providing the Vehicle Color Palette section for the Dynamic Decals tool. Allows editing the three vehicle color slots (color, colorPalette0, colorPalette1) with metallic paint data, rand
Dynamic Decals Inspector Utils
Utility functions for the Dynamic Decals inspector. Provides reusable ImGui widgets for editing decal texture paths and gradient colors within layer inspectors.