BuiltInGraphicsModule class

The editor's 3-D graphics: models, lights and the environment.

It adds:

  • models (.glb, .gltf) to the Assets dock, pictured by a render of each (ModelThumbnails), and dropped on the viewport of a 3-D scene as an entity with a ModelComponent where the pointer meets the ground;
  • picking by triangles once a model has loaded (ModelRayTest);
  • viewport aids in 3-D scenes: a marker on every light, a selected light's reach (LightReachOverlay) and a selected camera's frustum (CameraFrustumOverlay);
  • inspector sections for Model, Light and Environment (GraphicsInspectors);
  • importing: a model opens in a workspace of its settings and materials with a live preview (ModelWorkspace); saved, it is cooked (ModelCooking) and the game loads the cooked copy. Models with settings are cooked again when their file changes. The Assets dock offers to cook, to stop using the cooked copy, and to place a model with its lights and sockets as entities of their own (ModelExpansion).

While the editor runs, the game reads models from the project's files rather than the app's bundle, so a model added or cooked since the app was built loads.

One of the editor's own modules, for a game with 3-D graphics only (isFor): a 2-D game can't draw a model, so it is not offered one.

Inheritance

Constructors

BuiltInGraphicsModule({String? root, ModelThumbnails? thumbnails})
The module for the project at root (the working directory when null).

Properties

assetActions → List<AssetAction>
What this module can do with a file in the Assets dock.
no setteroverride
assetKinds → List<AssetKind>
Kinds of file it knows: how the asset browser shows them and what dropping one on the viewport makes (see AssetKind).
no setteroverride
commands → List<DesignerCommand>
Commands this module adds, or replaces by reusing a built-in's id.
no setterinherited
componentExtras → List<ComponentEditorExtras>
Editor-only additions to how components are inspected: header actions, a custom section, a replacement editor for one field.
no setterinherited
componentGroups → List<String>
Add-Component picker groups this module's definitions use, in the order they should appear after the built-in groups.
no setterinherited
cooking → ModelCooking
Import settings and cooking for the project's models.
latefinal
dataFileSuffixes → List<String>
Endings of the JSON files this module owns (.ui.json), so the editor never takes one for a sprite atlas — which is what it assumes of any .json it does not recognise.
no setterinherited
designerModes → Set<SceneMode>
The scene modes this module is a level designer for: the switch lists it only while a scene of one of them is open, as the platformer kit is listed for 2-D levels and a 3-D kit for 3-D ones.
no setterinherited
designerPanels → List<SidePanelSection>
Sections added to the designer's side panel.
no setterinherited
docks → List<DockDefinition>
Bottom docks beside the built-in ones.
no setterinherited
entityIcons → List<EntityIcon>
Icons for the kinds of entity this module's game is made of — a coin, a hazard, a checkpoint. Asked in EntityIcon.order, and the first non-null answer is the one drawn.
no setterinherited
fieldAccessories → List<FieldAccessory>
What the inspector puts beside component fields, and tells of the edits made through them (see FieldAccessory).
no setterinherited
fieldEditors → Map<String, FieldEditorBuilder>
Inspector editors for this module's own field types, by jge.FieldType.id. Registered over the built-ins, so a module can also replace one of those.
no setterinherited
gettingStartedTips → List<GettingStartedTip>
What the start card — shown over the viewport while no scene is open — says about this module: where the player starts, the key that draws a path.
no setterinherited
gridTopology → GridTopology?
The shape of the designer's cells, when this module changes it. The last module to answer wins; null keeps the square grid.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
icon → IconData?
Optional icon for that listing.
no setteroverride
id → String
Stable identifier. Registering twice with the same id replaces the first.
no setteroverride
inheritedColors → List<InheritedColor>
What an unset colour field falls back to, for the components this module knows — so the inspector can show it rather than a blank.
no setterinherited
inspectorSections → List<InspectorSection>
Inspector sections after the component sections.
no setteroverride
keyBindings → List<KeyBinding>
Key chords for commands, this module's or anyone's. A chord bound here takes precedence over a built-in binding of the same chord.
no setterinherited
layers → List<LayerPreset>
Named draw-order layers this genre expects.
no setterinherited
levelAids → LevelAids?
What this game kit knows about how its levels are played — its player's jump and slopes, its kill height, starting play from a point — for the Level Designer's aids. Asked of every module.
no setterinherited
markers → List<EditorMarker>
Icons the viewport draws at every entity of a kind, so things with nothing to draw can be found (see EditorMarker).
no setteroverride
modelKind → AssetKind
The model kind: .glb and .gltf, with a picture, and a drop in a 3-D scene (modelScenes).
latefinal
name → String
Display name, shown wherever modules are listed.
no setteroverride
overlays → List<DesignerOverlay>
Things drawn over the level, each with its own visibility toggle.
no setterinherited
pickTests → List<EntityRayTest>
What knows the real shape of some entities, so a 3-D pick lands on what is drawn rather than its box (a model's triangles).
no setteroverride
prefabCategories → List<PrefabCategory>
Palette groups this module's prefabs use, with their order.
no setterinherited
prefabPictures → List<PrefabPicture>
Pictures for prefabs in the palette (see PrefabPicture): asked in turn, the first that draws one wins; a prefab without one shows its icon.
no setterinherited
prefabs → List<PrefabDefinition>
Palette entries the draw and paint tools can place — while this module is the Level Designer (see providesLevelDesigner).
no setterinherited
prefabVariants → List<PrefabVariant>
Other ways to offer the prefabs any module offers in space: a physics module's Solid and Trigger of every shape (see PrefabVariant).
no setterinherited
protectionRule → EntityProtectionRule?
Which entities this module says must not be deleted; see EditorScope.isProtected.
no setterinherited
providesLevelDesigner → bool
Whether this module is a level designer of its own: an entry in the designer's switch beside the built-in one, whose designer contributions are live only while it is chosen.
no setterinherited
root → String?
The project folder.
final
rowDecorations → List<SceneTreeRowDecoration>
Things drawn at the end of scene-tree rows.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sceneTreeActions → List<SceneTreeAction>
Entries in an entity's scene-tree context menu.
no setterinherited
settingsSections → List<SettingsSection>
Sections on the settings dialog's Modules tab.
no setterinherited
sharedPrefabs → List<PrefabDefinition>
Palette entries every Level Designer offers, whichever module is designing: beside the editor's own shapes, as the Interface module's Text is. Offering them does not make this module a designer.
no setterinherited
statusControls → List<StatusBarControl>
Controls added to the designer's status bar.
no setterinherited
tags → List<TagDefinition>
Tags this module's game code looks for by name — enemy, say. The project's tag list shows them as built in: they cannot be renamed or deleted there, since code would go on looking for the old name.
no setterinherited
themePresets → List<ThemePreset>
Palettes offered in the settings dialog beside the built-in accents.
no setterinherited
thumbnails → ModelThumbnails
The pictures of models the Assets dock shows.
no setter
tiledObjectMappers → List<TiledObjectMapper>
What objects of an imported Tiled map become: a spawn point, a coin.
no setterinherited
toolbarButtons → List<ToolbarButton>
Buttons after the built-in play controls.
no setterinherited
toolGroups → List<ToolGroup>
Groups of the tool strip this module's tools go under, beside the editor's own (ToolGroups.builtIn).
no setterinherited
validators → List<SceneValidator>
Checks this module makes of the open scene, listed in the Problems dock beside the editor's own: a level with no spawn point, say.
no setterinherited
viewFactories → Map<SceneMode, EditorView Function(EditorScope scope)>
The views this module offers, by scene mode: what the viewport looks through while a scene of that mode is edited. A later module's wins; with none, the editor's own (GameCameraEditorView in 2-D, OrbitFlyEditorView in 3-D).
no setterinherited
viewportHandles → List<ViewportHandles>
Points it lets the author drag to edit the selected entity: a polygon's corners (see ViewportHandles).
no setterinherited
viewportOverlays → List<ViewportOverlay>
What it draws over the viewport while authoring, with the Level Designer open or not (see ViewportOverlay).
no setteroverride
workspaceContributions → List<WorkspaceContribution>
What it adds to windows — its own or others' (the editor's material windows: WorkspaceIds): tools on their toolbars, sections in their panels, overlays over their views. Each window builds them from the WorkspaceView it hands them.
no setterinherited
workspaces → List<WorkspaceDefinition>
Full-screen tools that take the viewport: a sprite editor, a dialogue graph. Opened with EditorScope.openWorkspace.
no setteroverride

Methods

createSessionState(DesignerToolContext context) → Object?
State this module keeps per designer session — a route being edited, say. Tools reach it with context.stateOf<T>(); it survives a reload. Released through disposeSessionState.
inherited
createSnapProviders(DesignerToolContext context) → List<SnapProvider>
Ways of snapping, built fresh per session. Priority decides where they sit relative to the built-ins (entities 100, grid 0).
inherited
createTools(DesignerToolContext context) → List<LevelToolHandler>
Viewport tools, built fresh for each designer session. Ids should be prefixed to avoid colliding with built-ins; reusing a built-in's id replaces it.
inherited
dispose() → void
Called when the owning editor is disposed.
inherited
disposeSessionState(Object state) → void
Releases state, which createSessionState made: its session has closed, or this module has left it (another designer chosen). For state that holds signals, listeners or timers. Nothing by default.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onAssetChanged(String path) → void
A file changed: a picture a shape is drawn with is read again by the game's renderer. (The editor has materials read again itself.)
override
onPlayStateChanged(bool playing) → void
A play-test started (true) or stopped (false).
inherited
onReassemble(EditorModuleContext context) → void
Called after each hot reload, before the editor reads this module's contributions again. For anything onRegister set up from code that may have changed — a loader it handed out, say — and must be done again. Must not undo what a play-test in progress relies on.
inherited
onRegister(EditorModuleContext context) → void
Called once, when this module joins an editor, after the built-ins are in place. One-time setup belongs here: loading files, installing into the engine, recovering from a crash. A hot reload does not call it again — see onReassemble.
override
onSceneOpened(String sceneName) → void
Called when a scene finishes loading.
inherited
onSceneSaving(String sceneName) → Future<void>
Called as scene sceneName is saved, before its file is written: for files of this module's own that the scene refers to — a terrain's heights — to be written with it. A throw is reported, and the scene is saved all the same.
inherited
onUpdate(double dt) → void
Called every editor tick.
override
readProjectFile(String path) → Future<Uint8List?>
The bytes of the project's file at path, or null when it isn't there (a package's asset: the bundle has it).
restoreEditorData(DesignerSession session, Map<String, Object?> data) → void
Restores what saveEditorData wrote for this scene.
inherited
saveEditorData(DesignerSession session) → Map<String, Object?>?
What this module saves in the scene file's editor section, under its own id. Null saves nothing.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

dropModel(AssetDrop drop) → Entity?
Makes an entity showing the model drop carries, where it landed.
isFor(Engine engine) → bool
Whether the editor has this module for engine's game: when it has 3-D graphics (EngineConfig(graphics3D: Graphics3D())).
loadedModel(EditorScope? scope, String path) → ModelData?
The parsed model at path if scope's engine has loaded it.
make(EditorScope scope) → EditorModule
The module for scope: how the editor makes its built-ins.

Constants

cookedKind → const AssetKind
Cooked copies (.jmodel): listed, not dropped — drop the model.
modelScenes → const Dimensions
The scenes models go in: 3-D ones. What the viewport takes a model dropped into, and where the Assets dock offers to place one.
moduleId → const String
Its id.
placeId → const String
The Place with its lights and sockets action's id.
workspaceId → const String
The model workspace's id.