Material Editor
Full-featured material editor for inspecting and modifying Torque3D `Material` objects. Supports PBR workflows, texture issue scanning, cubemap editing, material preview, layer management, copy/paste,
Full-featured material editor for inspecting and modifying Torque3D Material objects. Supports PBR workflows, texture issue scanning, cubemap editing, material preview, layer management, copy/paste, and per-object material picking.
Public API (Extension Hooks)
| Function | Signature | Description |
|---|---|---|
M.onEditorGui | () | Main editor GUI callback (tool windows) |
M.onEditorInitialized | () | Registers edit mode, windows, preferences |
M.onEditorActivated | () | Called when editor is activated |
M.onEditorDeactivated | () | Called when editor is deactivated |
M.onEditorObjectSelectionChanged | () | Updates material list on selection change |
M.onEditorRegisterPreferences | (prefsRegistry) | Registers material editor preferences |
M.onEditorPreferenceValueChanged | (path, value) | Handles preference changes |
M.onEditorDeleteSelection | () | Handles delete selection |
M.onFilesChanged | (files) | Reloads on file changes |
M.onVehicleSwitched | (oid, nid, player) | Updates on vehicle switch |
M.selectMaterialByName | (name) | Selects a material by name in the editor |
M.showMaterialEditor | () | Shows the material editor window |
M.setMaterialDirty | (materialObj) | Marks a material as dirty |
M.setProperty | (matObj, prop, layer, value) | Sets a material field and marks dirty |
M.deleteMapButton | (label, property, layer) | UI helper for texture map delete button |
M.imageButton | (label, property, layer, additionalGuiFn) | UI helper for texture image button |
M.inputFloat | (label, property, float_step, float_step_fast, string_format, layer, tooltip) | UI helper for float input |
M.colorEdit4 | (label, property, id, layer, labelSameLine) | UI helper for color edit |
M.dbg | - | Debug flag (variable) |
M.v | - | Shared state table (picking, materials, serialization) |
M.o | - | Options table |
M.customMaterialsArray | - | Custom materials array (variable) |
M.customMaterialsArrayPtr | - | Custom materials array pointer (variable) |
Key Internal Functions
| Function | Description |
|---|---|
getMaterials(optionalList?) | Builds sorted material name list, filters by selection or text |
selectMaterialByName(name, clearFilter?) | Selects a material in the editor by name |
updateMaterialProperties() | Updates preview renders and reflection mode for current material |
setProperty(matObj, prop, layer, value) | Sets a material field and marks dirty |
setPropertyWithUndo(prop, layer, value) | Sets property with undo history |
saveCurrentMaterial() | Saves the current material via PersistenceManager |
saveAllDirtyMaterials() | Saves all modified materials |
swapLayersWithUndo(layer1, layer2) | Swaps two material layers with undo support |
scanTextureIssues(mat) | Scans textures for format, path, resolution, and cooker issues |
computeTotalTextureSize(mat) | Estimates total GPU memory for all textures |
computeMaterialUsageForMatName(name) | Finds all TSStatic and ForestItemData using a material |
Texture Issue Scanner
Checks per-texture-field:
- Missing files, non-power-of-2 sizes, sizes < 16px
- Legacy DXT formats vs optimal BC7/BC4/BC5
- PNG without texture cooker suffix
- Vehicle material using non-vehicle textures
- Incorrect format for PBR channels (diffuse=BC7 sRGB, normal=BC5, etc.)
Material Preview
ShapePreviewinstances for inline and extended previews- Configurable preview mesh (sphere, cube, etc.)
- Rotation and sun control
Usage Example
-- Activate via editor menu: Window > Material Editor
-- Pick materials from scene objects or browse the full list
-- Edit PBR properties, textures, animation flags per layer
-- Save individual or all dirty materialsDependencies
ui_imguifor all UIscenetreefor Material object lookupPersistenceManagerfor savingcore_environment.groundModelsfor ground model tags
Module Variables
dbg(any) - Module variable.customMaterialsArray(any) - Module variable.customMaterialsArrayPtr(any) - Module variable.
Functions
deleteMapButton(label, property, layer)
Deletes map button.
label(string)property(any)layer(object)
imageButton(label, property, layer, additionalGuiFn)
Handles image button.
label(string)property(any)layer(object)additionalGuiFn(any)
inputFloat(label, property, float_step, float_step_fast, string_format, layer, tooltip)
Handles input float.
label(string)property(any)float_step(any)float_step_fast(any)string_format(any)layer(object)tooltip(any)
colorEdit4(label, property, id, layer, labelSameLine)
Handles color edit4.
label(string)property(any)id(number)layer(object)labelSameLine(any)
onFilesChanged(files)
Callback for files changed event.
files(any)
onVehicleSwitched(oid, nid, player)
Callback for vehicle switched event.
oid(any)nid(any)player(any)
onEditorActivated()
Callback for editor activated event.
onEditorDeactivated()
Callback for editor deactivated event.
showMaterialEditor()
Handles show material editor.
setMaterialDirty(materialObj)
Sets the material dirty.
materialObj(any)
onEditorObjectSelectionChanged()
Callback for editor object selection changed event.
onEditorRegisterPreferences(prefsRegistry)
Callback for editor register preferences event.
prefsRegistry(any)
onEditorPreferenceValueChanged(path, value)
Callback for editor preference value changed event.
path(string)value(any)
onEditorDeleteSelection()
Callback for editor delete selection event.
Returns: self
See Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide
Master Spline Editor
Main editor tool for the Master Spline system - a parametric road/spline editor with multi-layer linking (mesh, assembly, decal, road splines), auto banking, terrain conforming, road design homologati
Measures Inspector Header
Lightweight editor extension that displays the bounding box size of the current selection in the inspector header. Shows width × depth × height for single or multi-object selections.