API ReferenceGE ExtensionsuiliveryEditortools
Livery Editor – Tools / Group
Layer ordering and grouping/ungrouping operations for the livery editor.
Layer ordering and grouping/ungrouping operations for the livery editor.
Overview
ui_liveryEditor_tools_group manages layer stack ordering (move up/down/top/bottom) and group creation/dissolution. It operates on the currently selected layer(s) via the selection API.
Extension path: lua/ge/extensions/ui/liveryEditor/tools/group.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
moveOrderUp | () → newOrder | Moves the selected layer one position up in the stack. |
moveOrderDown | () → newOrder | Moves the selected layer one position down. |
changeOrderToTop | () → newOrder | Moves the selected layer to the top of its siblings. |
changeOrderToBottom | () → newOrder | Moves the selected layer to position 2 (above the fill base). |
setOrder | (order) → result | Sets the selected layer to an explicit order position. |
moveOrderUpById | (layerUid) → newOrder | Moves a specific layer up by UID. |
moveOrderDownById | (layerUid) → newOrder | Moves a specific layer down by UID. |
changeOrder | (oldOrder, oldParentUid, newOrder, newParentUid) | Low-level order change with parent support. |
groupLayers | () | Groups all selected layers into a new linked set. |
ungroupLayer | () | Dissolves a group, moving children to the group's parent. |
Internals
Order Bounds
- Top =
siblingCount(highest order) - Bottom =
2(position 1 is typically the fill base layer) - Moving up increments order; moving down decrements
Group Creation
M.groupLayers = function()
-- Find shallowest selected layer to determine parent
local shallowestLevel, parentUid = ...
local newGroup = api.addLinkedSet({parentUid})
-- Move each selected layer into the new group
for k, layerUid in ipairs(selectedLayerUids) do
api.moveLayer(uiLayer.order, uiLayer.parentUid, newOrder, newGroup.uid)
end
uiSelectionApi.select(newGroup.uid)
endUngroup Flow
- Stores child UIDs (to avoid stale references during moves)
- Moves each child from the group to the group's parent at sequential positions
- Removes the now-empty group layer
How It Works
- Order operations use
api.moveLayer(from, fromParent, to, toParent)to reposition - Group creation uses
api.addLinkedSet()then moves selected layers into it - Ungrouping iterates children, moves them out, then deletes the group shell
- The selection automatically updates to the newly created group
Example Usage
local groupTool = extensions.ui_liveryEditor_tools_group
-- Move selected layer up
groupTool.moveOrderUp()
-- Group multiple selected layers
extensions.ui_liveryEditor_selection.select({uid1, uid2})
groupTool.groupLayers()
-- Ungroup
groupTool.ungroupLayer()Additional Exports
The following exports are available but not yet documented in detail:
M.changeOrderM.changeOrderToBottomM.changeOrderToTopM.moveOrderDownM.moveOrderDownByIdM.moveOrderUpM.moveOrderUpByIdM.setOrderM.ungroupLayer