material_editor_design - ryzom/ryzomcore GitHub Wiki
title: "NeL Material Editor: Design" description: Design and state of the NeL Material Editor, a Qt tool that opens one scene of a project at a time, a .max file (landscape zones included) or another model, shows its nodes and every material of the file, assigns materials to nodes and edits the NeL materials, in the .max files themselves, in the NeL sidecar beside any other model file, or in the extras of a glTF model, and runs the export tools of the build on the scene published: true date: 2026-12-01T00:00:00.000Z tags: editor: markdown dateCreated: 2026-11-29T00:00:00.000Z
The NeL Material Editor (nl_material_editor, nel/tools/3d/material_editor) is a standalone Qt application. An artist opens a file of a project, a .max file or a model of another format, and sees its whole scene, as the modelling program shows it: every node of the file in the Scene panel, every material of the file in the Materials panel, the scene in a NeL viewport. The artist selects nodes in the tree or in the view, assigns materials to them, edits the NeL materials in panels laid out like the rollouts of the NeL Material script, and saves. It replaces the editing of materials in the modelling program's material editor, and it is the authoring tool for the materials of the NeL sidecar of a model and of the NeL data a glTF model carries in itself (NeL-Specific glTF Extras).
This page records the design and says, for each part, whether it exists. Implemented means the code is there (the test programs are listed under Tests); designed, not implemented yet means the design is settled and the code is not. Where the design leaves a decision to the maintainer, the point is listed under Open points with the default the code uses.
The parameters the editor edits, their defaults, ranges and effect at export are on NeL Material Parameters. How an artist uses the editor is on NeL Material Editor, the user guide. How a tool on the same machine drives the editor (--ctrl-listen, nel_mcp) is on Material Editor Control Endpoint.
| Source file in the graphics folder | What the editor writes | Read by |
|---|---|---|
model.max |
The same file, edited in place: the values and names of its existing materials, and the material of each node (implemented) | The .max exporters |
tree.obj, or any other file assimp reads |
tree.obj.nel.gltf beside it, the NeL sidecar of the model; the model file is not changed (implemented) |
mesh_export, which reads the sidecar of a model by itself |
tree.gltf, tree.glb
|
The extras of the file's own materials, or the sidecar tree.nel.gltf (tree.glb.nel.gltf), as the model's "NeL data" selector says; the material of each primitive, in the file (implemented) |
mesh_export |
- The input is one source file of a project's graphics folder at a time, the scene: a
.maxfile (with landscape zones or without) or a model file that assimp reads, opened with File > Open. The editor reads nothing else of the project but its configuration (graphics/nel.cfg, the folder lists and the panoply settings of the build workspace) and the sources of what the view needs (the tile bank of an ecosystem, the textures): no pipeline export directory and no build output. Models are evaluated and built for NeL in memory when they are opened. - File > Save As glTF and File > Export Scene run the build's own export tools on the scene as child processes; they write only where the user says (see Save As glTF and Export Scene).
- A
.maxfile is edited in place: the materials inside the scene file and the material references of its nodes change (implemented for existing materials and nodes; structural edits are designed, not implemented yet; see Saving). - A model file of another format is not changed: its NeL data is saved in its NeL sidecar,
<model file name>.nel.gltfbeside it (implemented). A glTF model (.gltf,.glb) can hold the same data in the extras of its own materials, and the editor saves it there or in the sidecar (implemented); a glTF written by the.maxconverter keeps it in the file. - It is not a plugin of Ryzom Core Studio and shares nothing with it.
- Out of scope: node properties (the
nodesof the same sidecar and the extras of the nodes of a glTF model; the editor keeps them as they are when it saves, see NeL-Specific glTF Extras), editing landscape (the zones of a scene are shown, lit and exported, and edited in the Zone Painter), particle systems, editing geometry or UVs.
Requirements the design follows:
- Open
.maxfiles directly, edit their NeL materials and save them; open any file assimp reads and save its materials as metadata. - Find the project root of each file opened by the parent folder that holds
.nel, and switch to that project when it is another one; never rely on a drive letter being mapped.R:is the project root at NeL level, and the oldW:/databaseremapping toR:/graphicsis understood. - An interactive NeL viewport with the navigation of the Zone Painter; the old-style material selector (sample slots); a material panel that is laid out like the rollouts of the NeL Material script and matches its exposed properties. No generic property browser: purpose-built editing components that artists who used the old tooling already know.
- Show the whole opened scene, as the modelling program does: the node hierarchy of the file, its nodes selected in a tree and in the view, materials assigned to the selected nodes; a z = 0 grid, as the Zone Painter and the move gizmo sample draw it. Files are opened with an ordinary file dialog, one scene at a time.
- The Materials panel shows every material of the file: the materials of the nodes, each sub-material of a Multi/Sub-Object in a slot of its own (the same object, not a copy), and the materials the file holds without a node.
- Multi/Sub-Object materials, multi bitmap switching and every other special feature that material export supports.
- A task-oriented interface that prefers sidebars and toolbars over pop-up windows for common tasks.
- A fully functional and reliable undo stack.
- The files of a project's graphics folder are the only input. Unit tests and integration tests.
- A stretch goal: full editing of material animation (moving UVs, as used for waterfalls) with a timeline editor.
| Part | State |
|---|---|
| Window, panels, menus, toolbar, status bar, settings; one scene at a time, opened with File > Open, Open Recent, a drop or the command line; the project found from the file | Implemented |
| Scene: the node tree of the file, the Scene panel with its filters and the switches of the view, the selection shared by the tree, the view and the Materials panel, the grid | Implemented |
Assigning materials to nodes: .max nodes and glTF primitives, by Assign to Selection or a drag; refused for the other formats and for a glTF of the .max converter |
Implemented |
| NeL viewport, navigation (with the left button of the navigation sample), picking of nodes, highlight, texture set selector, playback of default animations | Implemented |
| Display options of the view: the selection outline, the Surfaces switch (shaded, shaded with wireframe, wireframe) and the Textures switch (textured, checker, textures off) | Implemented |
| The scene clock: the animations of the nodes on the time of the timeline, the scene moved by the real time with the kinds of animation that play (flares and shadow fades always), View > While Playing | Implemented |
Landscape zones of a .max scene: read with the zone exporter's library, drawn by CLandscape with the tile bank of the ecosystem, picked, outlined, in the display modes, lit by the view, and lit by the zone lighter in a child process with the Lightmaps switch |
Implemented |
| Panoply colors: the character textures in the color variants of the build's panoply | Implemented |
| File > Save As glTF, Save NeL Data in Sidecar / in Model File, Export Scene and Export Scene and Lightmaps, through the export tools of the pipeline run as child processes | Implemented |
| Select Texture: the color and the alpha of each texture side by side | Implemented |
| The tabs Messages (every message of a load, in groups, a click selecting what a message is about) and Log under the view | Implemented |
| Lighting of the view: three sets of lights, each light switched on its own, presets, the lights of the open model, the Lighting panel | Implemented |
Lightmap preview: the lightmaps of a .max scene or of a glTF of the .max converter calculated in the background, its layers switched and tinted |
Implemented |
| Materials panel with every material of the file and its Multi/Sub-Object groups, Multi/Sub-Object panel, Material panel with all rollouts and the name that renames, Select Texture (with the texture folders of the build workspace) and Color Selector dialogs | Implemented |
nel_material library: parameter catalogue, logic, build, JSON codec; the shape exporter builds its materials with it |
Implemented |
Loading .max files and assimp models in memory, with the probe in a child process |
Implemented |
| Document model, undo and redo | Implemented |
Reading and writing the NeL sidecar; reading and writing the NeL data in a glTF model file (.gltf, .glb) |
Implemented |
Saving .max files: the values and names of existing materials, the keys of existing linear placement tracks, the material of each node |
Implemented |
Saving .max files: structural edits, values made animated or constant |
Designed, not implemented yet. The controls are disabled with the reason. |
| Adding, removing and reordering sub-materials, new materials, converting a Standard material | The commands and the panel actions exist and are tested on a test backend; neither file backend enables them yet (the tooltips say so). |
| Animation timeline | Designed, not implemented yet. Play already runs the default animations of the model. |
Shape process: *.nel.gltf files are not models; mesh_export reads the sidecar of a model by itself; a model whose sidecar is newer than its tag is exported again |
Implemented |
Control endpoint for a tool on the same machine (--ctrl-listen, nel_mcp) |
Implemented, see Material Editor Control Endpoint |
One main window that works on one scene at a time: the file opened, its node tree, its materials and the view of it. The left column holds the Scene panel above the Materials panel, the centre the view above the Multi/Sub-Object panel with the tabs Messages and Log at its foot, the right column the Material panel. The left column is a quarter of the width by default and the right column 30 percent; the splitters are resizable and their sizes are remembered.
| Place | Panel | Content |
|---|---|---|
| left, top | Scene | The node hierarchy of the file opened: every node, with the icon of its kind (a red light on it for a node with meshes that gives no shape, the reason in the tooltip), its material (for an imported mesh whose primitives have materials of their own, a row per primitive with its material) and a switch that shows or hides a node that draws in the view (the editor's view of the scene: no edit, never saved). A filter by name keeps the ancestors of a match, greyed; Kinds hides kinds of nodes, their children risen to the nearest node shown; Meshes Only lists the nodes that draw, flat. Bones and helpers with nothing that draws under them start folded. The nodes that use the material selected in the Materials panel are marked. Its context menu has Assign to Selection, Remove Material, Frame Selection, the switches of the view and the folding. |
| left, bottom | Materials | Every material of the file, in two sections: On Nodes, and Not on a Node (in a .max file the materials of the sample slots, of the scene material library or of another holder such as a modifier; in a glTF the materials no primitive uses), which starts folded. Each Multi/Sub-Object is a group of its own: the Multi/Sub-Object, then each sub-material in a slot of its own with the ID of its slot on the sample; a sub-material is the same object wherever it is listed, so an edit of either is an edit of both. A group folds to its title; a large group, and every group of a file with many, starts folded. A sample is dragged onto a node of the Scene panel or a surface of the view to assign it; the toolbar of the panel has Assign to Selection and Remove Material. |
| centre | Viewport | The scene rendered by NeL. Without a scene, the start page: how to open a file, the recent files, and the file being opened or why it did not open. |
| centre, bottom | Multi/Sub-Object | "Number of Materials" and one row per slot, in the exporter's order: a small sample, the stored id, a button with the name and type of the sub-material, and the on/off switch where the slot has one. Shown when the current material is a Multi/Sub-Object or one of its sub-materials. |
| right | Material | The material being edited: its name, which renames it where the document allows it (a material of a .max file takes any name the file can store, the name of another material included; a material of another model is bound by its name and is renamed in the source file); where it is used; the reason it cannot be edited and what is wrong with it; the notes of the last save. For a glTF model, the selector "NeL data: in file / sidecar" with its note (see Saving). The bar of a file changed on disk (Reload, Overwrite) and of a file read-only at its load that can be written now (Reload). Then the rollouts of the NeL Material script, in a scroll area, each collapsible and remembered. The panel has no Revert and Save buttons: edits apply at once and are undone with undo, and saving the file and reverting it to what is on disk are actions on the file, in the File menu and the toolbar. |
| under the viewport | Timeline | The strip of the animation timeline. Designed, not implemented yet; the window has the place for it. |
| centre, at the foot | Messages, Log | Two tabs whose bar stays at the bottom of the column; the panel of a tab opens above the bar, in a splitter of its own under the one of the view, Timeline and Multi/Sub-Object, so that Multi/Sub-Object coming and going moves the view's lower edge alone and the panel keeps its height. Closed by default; a click on a tab opens it (at 28 percent of the column the first time), a click on the open tab or the arrow at the end of the bar closes it; the settings keep whether it is open, the tab and its height. Messages (CMessagesPanel) lists every message of the last load of the scene (IEditorDocument::loadMessages): the errors, the warnings, then the notes, in groups with their counts, those of the model as a whole before those of its materials, each line with what it is about in its own column (Scene, Node '...', Material '...'), wrapped whole, the full detail in its tooltip. A click on a line about a node selects the nodes of that name, one about a material selects it; a load message of the model names its node where it is about one (SProblem::Node). The list is replaced at each load (a revert, a reload and a failed load too) and emptied at a close; the Material panel shows the messages of a material as they are now. Log is the console widget the tools share (NLQT::CCommandLogDisplayer of nel/tools/3d/shared_widgets, the Console of the panoply preview): the log of the editor since the window opened, each line with its time and in the color of its level, derived from the palette of the theme as the console of servdash derives its colors (kept alike by hand: servdash does not use the shared widgets), the last 5000 lines, lines from other threads taken in one edit so that a burst does not hold the window; and a command line of the user, which runs a command of the editor's process through NeL's command registry, with history and completion. The errors, warnings and notes of a load, a material or an export are the editor's own severities, not NeL's log levels (the editor writes its errors and warnings both at NeL's warning level), so they have colors of their own, from one function (NLMTLUI::severityColour): errors red, warnings amber, notes the text color, chosen for a light and a dark palette so that lightness parts the three as well as hue; the marks of the Messages tab and of its tab, the status bar's line after a load and the mark of its error line, the Material panel's warnings and errors, a texture not found, and the lines of the result of an export take them, while the Log tab keeps NeL's colors by level. Every load message also goes into the log at its level. Nothing opens the panel by itself: the Messages tab shows the count with the mark of the most serious level, and a load that left warnings or notes says so in one line of the status bar, a click on which opens the tab. |
Selection. The scene keeps the selected nodes and the current material; the tree, the view and the Materials panel follow it. A press in the view selects the node under the cursor and makes the sub-material of the face current; Ctrl adds or removes the node, Shift adds it, Alt removes it; a press on nothing pans when it moves and clears the selection on its release otherwise; Escape clears it. A selection in the tree flashes its nodes in the view and makes the material of the first selected node current. A material selected in the Materials panel becomes current without changing the selection of nodes, and the tree marks the nodes that use it. Assign to Selection gives the material selected in the Materials panel, else the current one, to the selected nodes. The selection is not an edit: no undo step, never saved.
Opening. File > Open (a file dialog that starts in the folder of the scene, else in the folder last chosen in it, else in the graphics folder of the project in use, else in that of the project of the current folder, else in the current folder; its filters are the .max files and the models assimp reads), File > Open Recent (the most recent first, a file that is gone listed disabled; Clear Recent Files), a file dropped on the window, or the file of the command line. The file replaces the scene after the question about the scene's unsaved edits (Save, Discard, Cancel); the scene asked for again stays as it is. File > Close Scene closes it. A file that is no model, or is in no project, is refused with the reason, and the scene stays. A file opened while another loads replaces that load, which goes on unseen in its thread and is dropped.
The toolbar carries open, undo, redo, save, revert, frame all, frame selection, the grid, a tool button each for the Surfaces and Textures switches (showing the mode chosen), the background color, the Lighting button (it drops the Lighting panel down, see Lighting of the view), play (the menu of its arrow is View > While Playing), the texture set selector (sets 1 to 8, as the IDs of the Multi Bitmap rollout count them; the engine's index is one less) and the Panoply drop-down. The menus: File (Open, Open Recent, Close Scene, Save, Revert to Saved, Save As glTF, Save NeL Data in Sidecar, Save NeL Data in Model File, Export Scene, Export Scene and Lightmaps, Exit), Edit (Undo, Redo, Assign to Selection, Remove Material), View (Frame All, Frame Selection, the view history, Grid, Highlight Selection, Selection Outline, Surfaces, Textures, Play Animation, While Playing, Background Color, Lighting with the switches of every light, the presets, Lightmaps, Reset Lighting and the Lighting panel, Driver, Theme, Reset Layout), Help.
The status bar shows passing hints, the line of a load that left warnings or notes (it opens the Messages tab), the progress of an export or Save As glTF with its Cancel button, and the errors; the summary of a load's errors ends with how many more are in the Messages tab. The window has several sources of errors (the load of a scene, the notes of a save or a Save As, the problems of the view, the export, the lighting of the landscape, the panoply), so one shown over another does not replace it: the errors not dismissed are kept, the newest shown with "+n" beside it, whose tooltip lists the others; Dismiss shows the one before again. The same error again moves to the top, past 32 the oldest go, and the log has them all.
The formats the dialog lists are the extensions max, 3ds, ase, blend, dae, fbx, glb, gltf, lwo, obj, ply, stl and x. The list is provisional (see Open points). A file whose name ends in .nel.gltf (any case) is a sidecar, never a model.
The task-oriented layout avoids pop-ups for common tasks. Two tasks stay dialogs by the maintainer's decision: choosing a texture is not an always-on task, and this is not a painting application, so choosing a colour does not need a docked panel either. Both follow the behaviour of the old tooling.
-
Select Texture is modelled on the texture browser of the earlier material editor. On the left the texture folders, grouped: the projects of the build workspace, each with the texture folders it lists (the projects that list the folder of the model among their
.maxfiles first and marked "exports this scene", each folder with the kinds of its lists as marks, map, uncompressed, panoply, water, and a folder that does not resolve as missing); then the texture search paths ofgraphics/nel.cfgthat no project names; then the folder of the model; and a last entry that opens a folder tree to pick any folder of the graphics folder. A filter of the folders and projects, Refresh, and a note when entries of the workspace were not understood. On the right the thumbnails of the selected folder with a filter field, and the switch Split RGB and Alpha. Select, Enter or a double click takes the texture; Cancel leaves. The size of the dialog, the folder and the group shown last and the switch are remembered. The thumbnails are made on worker threads and kept in a cache (see Settings and storage). With Split RGB and Alpha each cell holds two pictures: the color channels as stored, opaque (the alpha taken away, never multiplied in), and the alpha channel in grey; a texture without an alpha channel shows a hatched box marked "no alpha" in place of the second, and a grey texture of 8 bits, which a NeL Material loads as an alpha texture (black color, the grey as alpha, as the legacy OpenGL and Direct3D drivers draw it), a hatched box marked "no color" in place of the first. Both presentations come from one thumbnail, which resamples the color and the alpha apart, as NeL builds the mipmaps of a texture; the switch reads no file again. - Color Selector is modelled on the colour selector of the modelling program in its older versions: a hue-by-blackness field with a whiteness strip, Red, Green, Blue, Hue, Sat and Value sliders with spinners, a swatch of the new and the original colour, Reset and Close. It is modeless and there is one of them: clicking another swatch moves it. The material and the viewport follow the colour while the dialog is open, and the whole session until it is closed or moved is one undo step. The Lighting panel picks the colours of the lights with the same dialog, and stays open while it does.
The texture folders of the build workspace (doc/workspace.*). Every <root>/leveldesign/workspace/**/directories.py is a project of the workspace, named by its folder (common/construction). No Python runs: a reader follows the assignments of each file in their order, strings made of literals and names assigned above joined with +, lists of such strings assigned or appended, and the one loop form for x in LIST: whose body only appends. The lists read are MapSourceDirectories, MapUncompressedSourceDirectories, MapPanoplySourceDirectories (the folder of textures of each panoply) and WaterMapSourceDirectories, and the lists of .max files exported with their materials (ShapeSourceDirectories, VegetSourceDirectories, IgOtherSourceDirectories, IgLandSourceDirectories, ClodSourceDirectories), which tell the projects that export a model. Anything else is not evaluated: it is left out and listed with its file, line and reason, in the dialog, the endpoint and the log. On the Ryzom workspace every entry is understood. The workspace is read at the first opening of the dialog and again by its Refresh; the resolution of texture names when a model loads keeps the folders of nel.cfg.
The controls of the Material panel are the legacy ones: the spinner (an edit field with arrows, vertical drag, right click to the minimum, Ctrl for fine and Alt for finer steps; a burst of wheel notches or arrow keys on one spinner is one edit, ended by a pause of 600 ms, the focus leaving, another control of the panel or a change from elsewhere), the colour swatch (a click opens the Color Selector, a drag copies or swaps a colour), the map button (shows the texmap and its file; a click opens Select Texture; a dropped file is taken), check boxes, drop-down lists, radio buttons and group boxes.
| Library | Role |
|---|---|
nel_material (static, NeL and nel_gltf, no Qt) |
material_params: every parameter of the script as typed data, per material. material_catalogue: the one table that describes each parameter (name, block, type, default, range, label, rollout, items, script version, export fallback). material_logic: the derived flags, the enable rules, the presets. material_build: parameters to NL3D::CMaterial and the mesh-side information. material_script_json: parameters to and from the sidecar's JSON object. |
nl_material_editor_widgets (Qt) |
The rollout layout engine, the spinner, swatch, map button, group box, the Color Selector, the Select Texture dialog, the thumbnail cache and provider. |
nl_material_editor_doc (Qt Core and Gui, no widgets) |
Sessions and documents (CSession with the project in use, useProject; CDocument), the material node tree, the node tree of the scene (scene_node.*), the selection and the assignments, the undo commands, the two backends, the sidecar reader and writer, the NeL data of a glTF model file, the .max writer (max_writer.*), the water preview (water_preview.*), the texture folders of the build workspace (workspace.*) and its panoply settings and variants (panoply.*), the tile bank of the landscape zones (landscape.*), the export tools run as child processes (export_tools.*: CToolJob), what an export of a file runs (scene_export.*), the files a glTF names besides itself and its copy under another name (gltf_files.*), the probe. |
nl_material_editor_lib (Qt Widgets) |
The window (CMainWindow: the menus, the start page, File > Open and Open Recent, drops) and its panels: the Scene panel (CScenePanel, CSceneTreeView, CSceneTreeModel), the Materials panel (CMaterialsPanel, CSampleGridView, CSampleSlotDelegate, CMaterialListModel), the Material panel (CMaterialPanel, CMaterialRollouts), the Multi/Sub-Object panel (CMultiSubPanel), the samples (CSampleCache); the scene in the window (CSessionController: opening, the selection, the assignments, saving); the project of a file (CProject) and the resolver that switches the session to it (CEditorApp); the viewport (CViewportCore without Qt, the widget, the navigation input, the sample renderer, the scene binding, the lighting in viewport/lighting.*, the lights of a model in viewport/file_lights*, the lightmap preview in viewport/lightmap_*, the Textures switch in viewport/display_modes.*, the landscape zones in viewport/zone_view.* and their lighting in viewport/zone_light_preview.*, the panoply colors in viewport/panoply_view.*), the Lighting panel, the Panoply drop-down (CPanoplySelector), the File commands Save As glTF, Save NeL Data and Export Scene with their progress and result (CSceneFileCommands), the bindings of the panels to documents (document_binding.* over the interfaces of ui/edit_interfaces.h: IMaterialEditTarget, IMaterialList, IEditorScene, IEditorDocument, IDocumentSession). nl_material_editor is its main.cpp. |
nl_material_editor_ctrl (Qt) |
The control endpoint (ctrl/): CEditorCtrl, the method groups, the input for the widgets. The program links it. |
| existing libraries |
pipeline_max and pipeline_max_export_common read the .max files, and pipeline_max writes them (CMaxDocument); pipeline_max_export_shape extracts materials and builds shapes (MAXSHAPE::buildSceneShapes); mesh_utils imports and builds the assimp models and reads the NeL data of a model (nel_sidecar.*, model_extras.*); nel_gltf holds the glTF codec, the name rule of the sidecar (nel_sidecar_name.*) and the in-place edit of the extras of a glTF file (gltf_json_patch.*); nelpipeline holds CProjectConfig and CAssetPaths; pipeline_max_export_zone_lib builds the zones of a .max scene as pipeline_max_export_zone writes them; nel_panoply (C++03) holds the color math of the panoply that panoply_maker runs. |
The build of a NeL material from its script parameters exists once, in nel_material/material_build.cpp. The shape exporter reads the scene objects into a NLMTL::CMaterialParams (extraction, pipeline_max_export_shape/material_build.cpp) and calls the same build; the editor's preview and the sidecar writer call it too. The split was made so that every exporter output stays byte-identical to what it was before: the exporters pass the option CheckValues = false, so their materials reach NL3D as they always did, its asserts included, while the editor refuses values NL3D would stop on and says which and how to correct them.
Undo is not tied to widgets. Every change is a command on a document, and widgets only display the model and send edit requests.
- A document is one open model file. It holds a tree of material nodes and the node tree of its scene, with stable ids that are never reused within the document, the shapes built in memory, and a
QUndoStack. The window shows one document, the scene; its stack is the active stack of the window'sQUndoGroup, so that Edit > Undo and Redo, the toolbar and the shortcuts act on it, and a file opened in place of the scene comes with a stack of its own. - A parameter is addressed by its catalogue key (a script parameter, or a field of the texmap of a
tTexture_Nparameter), a material by its node id. A command holds ids and values, never pointers into the objects of a backend. - The model has no mutators other than the commands.
- Continuous edits (a spinner drag, a hold on its arrows, a burst of wheel notches or arrow keys, a slider, the Color Selector) merge into one command per interaction: commands with the same node and the same non-zero interaction id merge, keeping the first old values and the last new ones, and the merged command disappears when the values are back where they started.
- A preset, a shader type change or a texmap kind change is one command that holds every parameter it sets and never merges. Switching where a glTF model keeps its NeL data is one command too, and so are a rename and an assignment (
CAssignMaterialCommand: the materials of the nodes or primitives before and after, named after the material and the nodes). - The selection of nodes and the current material belong to the document (
CDocument::selectNodes,selectedNodes,currentMaterial) but are not edits: no command, never saved. - The clean state is the stack's clean index. Saving sets it; undoing past a save makes the document dirty again; revert loads the file again and clears the stack.
- Structural commands (a new material, a sub-material inserted, removed or moved, a Standard material converted) keep the objects they remove alive inside the command.
- The sample images and the view see a change through the document's signals:
materialChangedwith the keys that changed and what has to be rebuilt,structureChanged,shapesRebuilt,selectionChanged,currentMaterialChanged,assignmentChanged.
Project root. The project is that of the file opened: its root is the nearest folder above the file that contains a .nel directory, and its models lie in its graphics folder, <root>/graphics (CProject::ofFile). Each time a file is opened, the session takes its project before the file loads, as a whole (CSession::useProject: the path rules, the texture folders of graphics/nel.cfg, the build workspace, the key of the probe's results), and the title, the status line and the thumbnails of Select Texture follow it; nothing of the project before stays. A file in no project is refused with the file, the rule and the remedy; so is a file of a project outside its graphics folder. The window starts without a project when the command line names no file. The editor never creates a .nel. --root <dir> (the nearest folder with .nel from there up) and --graphics <dir> (the graphics folder of a layout without .nel: a bare graphics checkout, a test tree) state one project for the whole run instead (CProject::stated): a file outside its graphics folder is refused with the reason. They are also the bound of a control endpoint with trusted content, which needs one of them, so that the folder it saves into is never chosen by a file to open.
Configuration. graphics/nel.cfg is read through NLPIPELINE::CProjectConfig for DatabaseTextureSearchPaths. CProjectConfig::init takes a .nel directory into account, and the class gained getAssetRoot(), getProjectRoot() and getDatabaseTextureSearchPaths(); its release() removes only the search paths its init added instead of wiping the other CPath state. The editor reads the configuration once per project and releases it at once, so nothing of it stays in the process-wide search paths. RemapExtensions of the same file is not read.
Authored path to file. The rules are NLPIPELINE::CAssetPaths (nel/include/nel/pipeline/asset_paths.h), in the order they apply:
| Rule | Authored form | Result |
|---|---|---|
| 1 | Any | Cleaned: cut at the first NUL, trailing spaces dropped, \ made /, repeated / collapsed (except a leading //), . components dropped. A .. component is refused. |
| 2 | A drive letter (any) or a leading / followed by graphics or database: R:\graphics\stuff\x.tga, W:\database\stuff\x.tga
|
The rest is relative to the graphics folder. The drive is not looked at: R: need not be mapped. |
| 2 | The historical shares //amiga/3d/database/... and //database/...
|
The rest is relative to the graphics folder. |
| 2 | A relative path, with or without a leading graphics or database
|
Relative to the graphics folder. |
| 2 | A drive path into another folder of the project root (leveldesign, sound, code, patchman, pipeline, redist, distribution, pub, build_*) |
Reported as outside the graphics folder; not read. |
| 2 | Any other drive or network path (E:\Work\x.tga) |
Reported as an unknown prefix; not read. |
| 3 | The components | Matched against the real directory listings: the exact name, else the one entry that differs only in ASCII case; several such entries are an ambiguity error. The result carries the case of the file system. |
| 4 | Textures only | When the file is not there: the same directory and stem with the extensions png, tga, dds, jpg in this order; then the bare file name through the texture folders (the DatabaseTextureSearchPaths, and for an assimp model the folder of the model first): the exact name first, then the same stem with the extensions. The same name in several folders as files that differ is an ambiguity error; identical copies are not. |
A miss is an error value, not a substitution: the authored string, its normalised form, the rule that failed and a remedy, shown on the slot. A texture that does not resolve gets an empty file name in the preview, so NeL shows its placeholder, and the node carries a problem naming the string.
File to authored path. What the Select Texture dialog stores in a slot, for both kinds of document, is R:\graphics\<relative path> with backslashes and the case of the file on disk (CAssetPaths::toAuthoredPath). NeL data (CTextureFile, the built nel_tex<i>_file keys of a sidecar) gets the bare file name (CAssetPaths::bareName), as the exporters always wrote it.
.max files. PMAXLOAD::loadMaxFile reads the scene; MAXSHAPE::buildSceneShapes is the per-node flow of the shape exporter extracted into a shared unit, and builds the shapes in memory without writing a file. For each node it returns the shape, the node's world matrix and, for every built material, the scene material object, the sub-material slot and the index of the material in the shape after the exporter's material optimisation. The editor builds with the lightmap shader off, skinned meshes rigid (in the node's local space at the pose they were skinned in, without a skeleton), and with an option to build every geometry node, including the ones the shape process does not export. Water shapes, flares and remanence shapes come from their own builders. Referenced files (XRef sources, interface files) are loaded through the cache of the loading library under the database root, the graphics folder.
The materials of the nodes become material nodes of several kinds. A NeL Material of script version 14 or 15 is read into its parameters and is editable. A Multi/Sub-Object holds its sub-materials as slots in the exporter's order. Anything else is shown read-only with the reason: a NeL Material of an older script version (the exporter builds it as the Standard material it holds), a Standard material (shown as the exporter builds it), a Multi/Sub-Object inside another one, a material the exporter replaces by its default, and a NeL Material whose stored blocks do not match the definition of the NeL Material script the file stores (its values are not read, and the view shows the default material).
The editor builds with the check of the values of the NeL materials on (SSceneBuildOptions::CheckMaterialValues), where the exporters keep NL3D's asserts: a material whose stored values NeL would stop on, such as an item outside its list, is built as the default material and marked with the value and the remedy. A texture slot that holds a texmap the editor does not read (a Reflect/Refract cube map, a Mix map, another class) is marked on its material, as is a Water material whose water switch a controller drives, which the export of the tools builds as an ordinary mesh. What the evaluation of a mesh leaves out (a modifier or a spline class the editor does not evaluate, the targets of a Morpher) is said in the node's export text, so that the shape shown is not taken for the one 3ds Max gives; a shape without a vertex (an open spline converts to one) is said too.
Assimp models. mesh_utils is split into import (the assimp scene stays alive), build (shapes in memory) and export (write); the editor uses the first two. The NeL data of a material is in one of two places, each bound by its own rule:
- the entry of the sidecar, bound by name, exactly as written (glTF names are case-sensitive), as the shape process's loader binds it, never by position;
- for a glTF model (
.gltf,.glb), the extras of the material in the file itself, bound by its place in the file: the import pairs the nodes of the assimp scene with the nodes of the file along the tree, and each scene material with the material of the file through the primitives of the paired nodes, because assimp makes a scene material only of a material that a primitive uses (a scene material index is not a file material index). The pairing checks the names and the counts. When the scene does not pair with a file that holds NeL data, the shape process stops and the editor opens the model without that data, read-only; without NeL data the model opens, and the editor cannot write into the file and says why.
Where a material has data in both places, the sidecar entry wins, as in the shape process (meshUtilsMaterialSource, see NeL-Specific glTF Extras):
| Binding | When | Parameters come from |
|---|---|---|
| script | The NeL data of the material has a nel_material_script object |
the object |
| imported | The NeL data has only the built nel_* keys (a file of the .max converter, or another tool) |
the built material, as far as it determines the parameters (see NeL-Specific glTF Extras); the rest has the values of a new material |
| converted | No NeL data | A new material with the colours, the opacity, the two-sided flag and the diffuse texture of the model's material; saving an edit adds its NeL data |
Two materials whose names differ only by letter case are two materials; a load message says that a sidecar cannot hold the NeL data of both (the loader refuses such entries as ambiguous), and a save of both into the sidecar is refused. A sidecar entry whose name differs from a material's only by letter case binds to nothing: a load warning says so, and a save of that material into the sidecar is refused while both are there. A material without a name, or whose name another material of the model repeats exactly, is listed read-only with the reason: the editor binds a material to its NeL data by its name so that the data can move between the file and the sidecar, and the name has to be fixed in the source file. A sidecar with errors opens the model read-only, because the editor does not write over a file it cannot read; so does NeL data in the model file with errors. A sidecar whose nodes the shape process cannot use is reported, and the view shows the model without the properties of its nodes.
A glTF written by the .max converter (it has asset.extras.nel_source) keeps its NeL data in the file: the shape process builds it through its exact route, which reads the file's own data and no sidecar, so the editor edits its materials in the file, and warns about a sidecar beside it, which nothing reads. The materials of its lightmapped nodes (nel_lightmap) are read-only: the lightmapper builds those shapes from the lightmap scene stored in the file (asset.extras.nel_lmscene), which an edit would not reach; they are edited in the .max file and converted again.
The materials of the built shapes are the ones the parameters build, so that the view shows what the shape process builds from the NeL data once it is saved.
The files a model names (a glTF its buffers, an OBJ its material library, the parts other formats name) are read only from the folder of the model and below it and from the graphics folder of the project (CModelFileAccess, given to the import of assimp in the load and in the probe child through CMeshUtilsSettings::FileAccess, and to the reading of the lights of a model file). The path is taken as the system takes it, and a file that exists is judged by where it really is; a path that ends outside these folders, a network or device path, a device name, a drive-relative path or a stream of a file is not read, and the messages of the load name the reference and the rule: "'tree.gltf' names the file '...', which is not read: ...". The format then goes on without the file or fails. The exporters read what the format names.
The probe. The .max library and assimp can stop the process on input they do not expect, and such a file must not take the session down. A file is first loaded by a child process of the editor itself (nl_material_editor --probe <file>) that loads and builds it as the backends do, without a window or a 3D driver, prints one PROBE line (ok, or failed with the reason) and exits with 0 or 1; a file the libraries stop on ends the child with their exit code. The editor reads the result before it loads the file itself. A failed probe leaves no scene: the start page and the status bar give the reason, and Open Recent still lists the file. The result is cached by path, size and modification time, together with the settings of the probe and the editor's executable. A glTF whose JSON nests deeper than 20 levels (MeshUtilsMaxGltfNesting) is refused before assimp reads it, by the child and by the load alike, with the place: assimp's reader of glTF extras takes a time that doubles with each level.
The document holds the node tree of its file besides its materials (doc/scene_node.h), read by the load in its thread: per node its id, parent and children, name, kind (TSceneNodeKind: mesh, patch, shape, light, camera, helper, bone, particles, target, XRef, NeL object, plain node, other) and the class name the file gives, whether the file hides it, what the NeL export makes of it (TSceneExportFlag and a line of text: shape, LOD of another node, collision or PACS primitive, accelerator, lightmap or realtime light, sun, skeleton, zone, particle system, instance group, not exported), its material (a .max node) or the materials of its primitives (a model read through assimp, with the mesh and primitive of the file each comes from), the shapes the document built from it, whether it takes a material and why not, and for a node with meshes that gives no shape the problem the import gives (CMeshUtilsNodeIssue: a name that cannot name its shape file, a name an earlier node has or one that differs from it only by letter case, meshes a NeL mesh cannot hold), which the Scene panel marks and the export refuses.
| Part | What |
|---|---|
| Ids | A .max node is its place in the node tree as the shape exporter walks it, plus 1; a material its storage index in the file, plus 1. The same file loads with the same ids, and they stay while the model is open: an assignment, a save, a revert of the unchanged file keep them. A model read through assimp numbers its nodes depth first in the order of the import's tree (its root only when the root carries meshes), the same for every load of the same file. |
| Material list |
CDocument::materialList: the materials of the nodes in the order of the tree, each sub-material of a Multi/Sub-Object after it (the same object as its slot), then the materials no node uses. materialUses names every use: on a node or one of its primitives, in a slot of a Multi/Sub-Object (position and stored slot), held by something else (a .max file: the material editor's sample slots, the scene material library, an object of another class such as the Unwrap UVW modifier; a glTF: the file itself, for a material no primitive uses, which the importer leaves out and the list shows read-only). materialUseText says it in a line, which the Material panel shows. |
| Selection |
CDocument::selectNodes (the nodes, and the material that becomes current), selectedNodes, currentMaterial. The current material is the one given (a pick on a face of a Multi/Sub-Object node gives its sub-material), else that of the first selected node that has one. |
| The view |
CSceneBinding: setNodeVisible hides the shapes of a node without building anything again (not drawn, not picked); flashNodes flashes every material of the given nodes, as the flash of a selected material does; pickPlace gives the node, the material index of the face and the document's material under a pixel. The LOD of a node goes with the shape of its parent. |
CDocument::canAssignMaterial (with the reason) and assignMaterial (nodes, a material or none, a primitive): one undo step, named after the material and the nodes; the view's shapes are built again as for a material edit (the face ids of a Multi/Sub-Object wrapping as the exporter wraps them), and the lightmaps are calculated again. The window's actions (Assign to Selection, Ctrl+Shift+A, in the Materials panel, the context menu of the Scene panel and the Edit menu; Remove Material) are enabled as canAssignMaterial says, with the reason as tooltip. A material dropped on a row of the tree, or on a surface of the view, goes to that node or primitive: the node under the cursor is highlighted while the drag is over it, and the status bar says whether it takes the material and why not (one pick frame per drag).
What each kind of file allows:
-
.max. The node's material is the reference of slot 3 of its references chunk (CNodeImpl::material,setMaterialinpipeline_max; every node of the corpus stores the sparse form). The writer refuses with the reason a node without a references chunk, one with a flat array too short for slot 3, a node that shows an XRef object or has an XRef material, a material that is not a material of this scene, and a file whose materials the editor does not edit (a Scene version other than0x200eand0x2012); a save verifies that every node reads back with its material. A node may lose its material: it then exports with the exporter's default material, which the view builds as the exporter does. Nothing is added to or removed from the scene: a material a node no longer uses stays in the scene material library and the sample slots that hold it, and a material of the list that a node takes is not added to the library; the notes of the save say both ("the material is on the node; the scene's material library was not changed (it does not list this material)", "it is on no node now; the scene's material library was not changed and still lists it, so the file keeps it"). The view builds again the shapes the load built: a node that built none (the load messages say why) shows none after an assignment either, until the saved file is opened again. -
glTF and
.glb. The primitive'smaterialindex in the glTF file itself, plain glTF, whether the NeL data is in the file or in the sidecar (NLGLTF::CGltfExtrasPatch::setPrimitiveMaterial: the integer replaced or the member inserted, a.glb's chunk lengths written again), every other byte kept; the save reads the meshes back and compares them. Since the model file is written whatever the place of the NeL data, an assignment is refused at once when the model file is read-only; while the data is in the sidecar, the note of the storage selector, the tooltip of Save and the notes of the save name the model file beside the sidecar, and a save with assignments and no edited material writes the model file alone. Nodes that show the same mesh of the file take the material together, and the undo text names them; the window and its undo texts count the primitives of a node from 1, the control endpoint gives their index in the node from 0 and the indices of the file. A primitive cannot lose its material (the importer would give it a default material of its own), nor take a material the importer left out. The import holds only the materials the primitives use, in the order it meets them: after a save that changed them, the view's rebuilds read the saved file and map its materials to the document's by their place in the file; a material the saved file uses on no primitive is refused. -
Refused: a glTF of the
.maxconverter (its meshes carry what it built from their materials: the vertex coloursCOLOR_0modulated by the diffuse and opacity,nel_uv_routing,nel_uv_stages,nel_vertex_flags, and its lightmap scenenel_lmscene), and the other formats (OBJ, FBX, ...), whose files the editor does not write.
A parameter edit builds the material of that node again (CDocument::buildMaterial, the exporter's build with the preview's texture names) and gives it to every place that uses it: CMeshBaseInstance::Materials[index] of each instance of a shape built from it. Edits that change what the shape itself contains also build those shapes again; that runs from the event loop, or at once on request.
| Edit | What is built again |
|---|---|
| any change of a value of a NeL material | the material |
the kind of a texmap, a map channel, a crop field, a slot's enable flag or texgen flag, bColorVertex, bAlphaVertex, iAlphaVertexChannel, bUnlighted, iLightMapChannel, the shader type with its derived flags; bAlphaBlend or bAlphaTest while bAlphaVertex is or was set |
the material and the shapes that use it (vertex format, UV routing, crop baked into the UVs, vertex colours) |
| a material that is or was a water material, a rename | the material and its shapes |
cDiffuse or pOpacity of a material used by a shape that carries vertex colours (.max documents) |
the shapes: the mesh build bakes them into the vertex colours |
| a texture matrix track | nothing is built yet; the playback runs the default animations as loaded |
An assimp document is more selective: its mesh build reads no UV routing, crop, vertex colour or water parameter, so its shapes are built again only when bUnlighted or the shader type changes.
The shape process builds the water shape of a .max node from the material object in the scene (its parameters by their stored ids), not from the parameters the editor holds. The editor keeps that build as the document's shape and derives the shape the view shows from it (doc/water_preview.*): the outline, the placement and the distance stay as built, and everything the material gives is set again from the current parameters by the rules of the water build, so edits of a water material show in the view. With the unedited parameters the derived shape is the built one byte for byte.
The viewport. A plain widget with a native window; the 3D driver binds its own context to it when the widget is first shown. Mouse, wheel and keys come from Qt and go to NL3D::CNavMouseListener, with the modifier state Qt reports, because the driver's own event forwarding does not carry modifiers and keys reliably inside Qt. The bindings are the Zone Painter's (see Zone painter: artist user stories): middle drag pans, Ctrl+middle pans faster, Shift+middle pans along one axis, Alt+middle orbits, Ctrl+Alt+middle dollies, the wheel zooms toward the view target, Z frames the selected nodes or, when none is selected, the scene, F the selected nodes, G switches the grid, F3 and F4 the Surfaces switch, Shift+Z and Shift+Y step back and forth through the view history. The left button is as the navigation sample (nel/samples/3d/navigation) has it: a press on a node selects it at once and a drag from there does nothing more; a press without modifiers on empty space (a hidden node, the grid and the ground of landscape zones count as empty space; a click on the ground selects its zone on its release) pans once it moves farther than 0.6 % of the view, through the listener's host gesture (one step of the view history), and is otherwise a click that clears the selection on its release; so a laptop touchpad without a middle button pans. Every modified left press is selection, as the navigation listener reserves the modified left button for it: Ctrl adds or removes, Shift adds, Alt removes; on empty space they keep the selection, and none of them pans. Escape clears the selection. The right button is not used. The framing radius and the closest approach follow the size of the model instead of the landscape constants of the Zone Painter. Frames are drawn on a timer while the view is shown and its window is not minimised; losing the focus does not slow it. OpenGL is the default driver; OpenGL 3 and Direct3D are selectable (View, Driver) and the choice applies at the next start. The view needs the native windows of the windows, xcb or cocoa platforms: in a Wayland session with an X display (XWayland), the editor sets QT_QPA_PLATFORM=xcb;wayland before Qt starts, unless the user chose the platform, and the log says so; on the wayland platform the view says that it needs XWayland and how to start the editor with it (QT_QPA_PLATFORM=xcb). Models are drawn at their finest level of detail, multi-LOD shapes in both passes whatever their opacity flags say, and at any distance from the camera: the LOD distance beyond which the game skips a model is not applied, since the framing of a large scene (a zone, a village) places the camera farther than it. The driver gets no native messages of the widget: on Windows it is told the size of the window through a WM_SIZE handed to its window procedure when the view's native window itself changes size (not at the widget's resize event, which Qt sends for a widget resized while hidden before its window takes the size, as when the Multi/Sub-Object panel hides while the start page covers the view), on X11 through setMode. The background colour is in View > Background Color; the lights are under Lighting of the view below.
The grid. View > Grid (G in the view; off by default, kept by the settings as viewport/grid): lines in the plane z = 0, drawn after the opaque part of the scene with the depth test and before its transparent part, so that a surface that blends and writes no depth is drawn over the lines behind it; the step a power of ten giving 10 to 100 cells across the scene, every tenth line and the axes brighter; the lines lighter than a dark background and darker than a light one (gridColours), fading into the background from the radius of the scene to the end of the grid, one and a half radius from the centre (gridFade). The picking pass does not draw it.
The display options (SViewportOptions: Outline, Surface, Textures; kept by the settings as viewport/outline, viewport/surface, viewport/textures) are matters of the view: no edit, nothing in the undo stack, the samples and thumbnails unchanged. The menu entries, the tool buttons, the keys, the endpoint and the settings all go through the checked state of the actions.
The selection outline (View > Selection Outline, on by default) is the last part of a frame (CViewportCore::drawOutline): the scene drawn once more into a render target of the view's size with the other nodes hidden and no colour written, every fragment of the outlined nodes marking the stencil, so that any kind of model counts as it is drawn (multi-LOD shapes at their first level, the rigid build of skinned meshes, water); a material that cuts by its alpha (an alpha test, a blend by the alpha) covers only what it shows, by the alpha of its first texture (placed by that stage's texture matrix, which Play animates) times its opacity for the Normal and LightMap shaders, by its opacity alone for the Specular and UserColor shaders, whose texture alpha is a mask; an additive material covers all its polygons. The stencil becomes a white mask, and the outline, two pixels at a display scale of 100 %, in the colour of the flash of the selection, is where the mask is set at one of 24 offsets around a pixel and not at the pixel itself, drawn over everything, as the Zone Painter draws the outline of a zone. A landscape zone is outlined by the silhouette of the mesh of its patches (the mesh its picking uses), which the view keeps hidden and draws into the coverage alone: seen as a ground is seen, that is the zone's border. The landscape itself never enters the coverage. When the driver cannot draw into a render target of the view's size, the selection is not outlined and the status bar says so once. The legacy OpenGL driver needed a fix for it: the activation of a render target unbound the texture of the active stage behind its texture cache (CDriverGL::activeFrameBufferObject). 1600 outlined nodes take about twice the time of a plain frame.
The Surfaces switch (Shaded, Shaded + Wireframe with F4, Wireframe with F3, the keys of the modelling program) draws the triangles as the shapes draw them: the scene again with the driver's line mode (IDriver::setPolygonMode), every mesh instance with a flat material of the wire colour swapped in for each of its materials (from both sides of every face; the values the instance's animations write stay in its own materials). Over the surfaces the edges are dark and drawn nearer by half a percent of their distance to the eye, through a frustum made larger by that part, which keeps every point on its pixel and gives it the depth of a nearer point: they win over their own triangles face on and at grazing angles, and a surface hides the edges of what is more than that part of the distance behind it, close up as from afar (a constant step of the depth range would grow with the square of the distance). Alone they are lighter than a dark background and darker than a light one, the faces facing away included, and the grid goes with them. The landscape has no line mode of its own: its tessellation as it draws it now (CLandscape::getTessellationLeaves, at the geomorphed positions) is drawn after it as lines of the same colour (CViewportCore::drawLandscapeLines).
The Textures switch (Textured, Checker, Textures Off; viewport/display_modes.*) stands in for every texture a material maps with the mesh's own coordinates (not the cube maps, not the generated coordinates), applied last (CSceneBinding::shownMaterial), after the texture set and the panoply variant, so that the stand-in takes the size and the alpha of the texture actually shown. Checker is a procedural checker at the size of that texture (CCheckerTexture), drawn after the trame pictures of the graphics repository (stuff/lod_actors/texture_lod/trame.png): square cells of 64 texels, light and dark, coloured by a gradient between four corners (orange top left, magenta top right, blue bottom left, green bottom right, darker toward the bottom), every texel in one of two tones of its cell as the trame's noise has them; a denser mapping shows smaller cells, and the colours show where the mapping turns, mirrors or is cut. Textures Off is white (CWhiteTexture). Both keep the alpha of the texture they stand for wherever the material reads it (an alpha test or blend, the masks of the Specular and UserColor shaders, a Normal stage that mixes by an alpha), texel for texel, up to 32 million texels for the scene; a texture whose alpha does not fit gets an opaque stand-in, and the status bar says how many. On the landscape, each tile texture a zone uses becomes the checker at the size of the tile's picture, or white, set up in the driver under the name of the tile's file before the landscape is made again (CTileStandInTexture, CViewportCore::applyLandscapeTextures). Water keeps its textures (a water shape has no material list to change), lightmaps stay, a texture not found keeps its placeholder.
Picking draws its own frame with the faces shaded, without the outline and the edges, so a click picks the faces in every mode.
The animations of the nodes run on the time of the timeline (the play clock, view.animation's time; a shape that plays its animation by itself in the game, such as a waterfall, plays it with its node). The scene itself moves with the real time: every frame calls UScene::animate with the kinds of animation that move (CViewportCore::setAnimateFlags, the filter flags of CScene::animate), at most a quarter of a second a frame, so that nothing leaps after the view did not draw for a while. The flares and the fades of the shadows always move (StillKinds), so a flare fades in in a still view; what moves by itself in the game's scene (water, particle systems, wind, animated lightmaps, remanence trails) moves while the animation plays, each kind the view shows with a check under View > While Playing (CSceneBinding::playedKindTable(): its name, text, tooltip and the shapes it moves; the menu, the settings view/whilePlaying/<name>, the endpoint and the script take it from there). The table has one row, Water (on by default): the scroll of the bump and displace maps at the speeds of the material. Play is enabled whenever something in the view would move while playing. A flare draws a copy of itself with the textures the path rules find, and a texture of a flare that is not found is said at the load. The stereo handling of the flares and shadows in NeL stays as it was: the filter flags only leave kinds out.
Sample slots. Each material is drawn on a sphere into an offscreen target by the viewport's driver from the event loop, about 12 ms per turn so that the window answers: the slots shown first, then every other slot of the Materials panel in its order, kept by material and revision. A slot whose sample waits shows a dashed outline with three dots, never a grey ball that could be taken for a material; a sample that cannot be drawn says why in its tooltip. The Materials panel and the Multi/Sub-Object rows use these images.
Texture sets. The toolbar selector, counted from 1 as the IDs of the Multi Bitmap rollout, calls selectTextureSet with the engine's index (one less) on every instance, which previews multi bitmap textures (the seasons).
The view is lit as a NeL scene lights models in the game (viewport/lighting.*). CViewportCore sets the lighting into the scene before every frame, and a change of a light builds nothing again. The lights come in three sets, and every light is switched on its own:
| Set | Lights | Where they are |
|---|---|---|
| View | Key (directional), Fill (point), Camera (point, off by default) | Attached to the camera: the azimuth from behind the camera toward its left, the elevation above the view direction; the fill at a distance in scene radii from the target the camera orbits; the camera light at the camera itself, with the attenuation radii the user sets (12 to 20 m by default, as the game's player light). |
| Scene | Sun (directional), Fill and Back (point) | Static in the world around the bounding box of the model: the azimuth from +X toward +Y, the elevation above the horizontal plane, the distance in scene radii from the centre of the box. |
| File | The lights stored in the open model | Where the file places them. They are all on when a model opens; a light switched off stays off while the editor runs. |
The lights of a model come from its document (IFileLights, viewport/file_lights*): those of a .max scene through the lightmap light decode of the shape exporter, with the realtime rules of the game applied; those of another model as assimp reads them from the file (the punctual lights of a glTF and the lights of the other formats), their falloff turned into the two attenuation radii of NeL.
What each light becomes in the scene, as the Lighting panel reports it:
| Report | What it means |
|---|---|
| sun | A NeL scene has one directional light, light 0 of every model. The sun is the first directional light switched on: of the Scene set first, then of the File set, then of the View set. Its ambient is the global ambient plus the ambient of every light without attenuation; the ambient of the driver stays black, as in the game. |
| far point | Another directional light switched on: a point light without attenuation, 20 scene radii away along its direction (its rays differ by at most 3 degrees across the model). It counts against the limit per model like any point light. |
| point, spot | A point light model. The lighting manager gives each model at most lights per model of them (the light contribution limit of the scene: 3 in the game, 6 at most), those of the highest influence at the pivot of the model, and merges the light of the others into the ambient of the model. A light reaches a model only when its attenuation end holds the pivot of the model. |
| ambient | A light of ambient only: with attenuation radii an ambient point light model, without them a colour added to the ambient of the sun. |
| merged | A point light model that reached models in the last frame but lit none of them: more lights reach those models than they take. |
| out of reach | A point light model whose reach held the pivot of no model drawn in the last frame. |
| lightmap only | A light of a .max file that is not exported as a realtime light, or a directional one not marked as the sun: it lights nothing dynamically in the game, and nothing here. |
| not read | A light of the file whose parameters could not be read; its row says why. |
With the Lightmaps switch off, LightMap materials are shown with their stand-in Normal material and lit as above. In the game a lightmapped surface takes its lightmaps and at most one dynamic point light flagged to reach lightmaps (the player's light), never the sun: the View camera light is that light, and the Lighting panel marks it LM. The material samples keep their own light.
The Lighting panel drops down from the Lighting button of the toolbar, a frameless window that a press outside it, Escape or the application losing the focus closes, and that stays open while the Color Selector edits one of its colours. It holds the preset (Neutral Studio, the key and fill lights of the View set with a neutral ambient; Day, Dusk and Night, the sun of the Scene set with the balance of the continents of the game; Flat, no light and a white ambient, for unlit and self-illuminated materials), Reset, the global Ambient, the lights per model, and for each set a check box (all, none or some on) with one row per light: its switch, its colour (the Color Selector; the menu of the row has the ambient and the specular colours), its report from the last frame and, for the built-in lights, the azimuth and the elevation (for the camera light the begin and end radii of its attenuation in their place). The line at the bottom names the sun and counts the models whose lights were merged. A preset sets the switches and the colours of the built-in lights and the global ambient; the places of the lights, the camera light (a working light for lightmaps rather than a part of a look) and the lights of the file stay as they are. Reset gives the built-in lights their places with Neutral Studio, the camera light off, and switches the lights of the file on. View > Lighting has the same switches, the presets, Reset Lighting and the panel. The settings keep the built-in lights, the global ambient, the lights per model and the Lightmaps switch, never the lights of a file.
The Lightmaps switch of the Lighting panel (View > Lighting > Lightmaps) shows LightMap materials with their lightmaps instead of their Normal stand-ins (viewport/lightmap_preview.*). The shown model's document gives its lightmap scene: for a .max file what pipeline_max_export_shape --lm-scene writes, with the edited materials and assignments; for a glTF of the .max converter the scene it stores (asset.extras.nel_lmscene). A model read through assimp otherwise carries none, and the switch is disabled for it with the reason. One NL3D::CLightmapContext per model prepares the scene once and calculates the receivers in the background, on the cores of the machine but one, with the options of shape_lightmapper without options, each result taken as soon as it is finished, so the receivers show their lightmaps one by one; nothing is written. The lightmapper makes a layer per light group and animated light, which the view switches and tints through the scene's light group colours without a calculation; a light that shares a layer calculates again the receivers it reaches, the others keeping their lightmaps. The Scene lights enter the lightmaps in layers of their own, in one shared layer, or not at all, as the layers of the file leave room in what a material of the view's driver draws (Direct3D 4, OpenGL and OpenGL 3 256). A calculation starts when the changes settle, one that runs is cancelled, and a result of an older state is never applied; the animations of the view go on playing. A receiver whose calculation fails keeps its stand-in and carries the reason; the others are lit, and the state counts the failed ones. The tooltip of the Lighting panel's lightmap status lists the failed receivers with their reasons, behind a "Show them" / "Hide them" link in the panel; while the preview is on, the Scene panel marks their nodes with the problem mark ("Its lightmaps failed: ..."); the control endpoint gives them in receiver_notes. What an artist sees and does is on NeL Material Editor.
The patch nodes of a .max scene (NeL patch objects) are read in the load by the zone exporter's own code, the library pipeline_max_export_zone_lib (MAXZONE::buildLigoZones, buildDirectZone, buildAuthoredPatches, the code pipeline_max_export_zone writes its files from): the export as its process runs it, the ligo export for a file named after a brick (zonematerial-, zonetransition-, zonespecial-), the zone process for any other. Per patch node the document has a zone (SDocZone): the patches the export builds, byte for byte its .zone, when the export writes the node where it lies; the patches as authored, where the node is, for a frozen neighbour brick, a transition brick, a brick mirrored or rotated by its zone properties and a patch the zone process does not take. What the export makes of the node is its export text in the Scene panel; the messages of the export are load messages, worded for an artist, and zone data NeL's landscape would stop on is refused at the load with the reason. A patch node takes no material: its look is the tiles and colours painted on it, and no zone export reads a material. A scene whose nodes take no material lists none in the Materials panel, which says why and how many materials the file holds elsewhere.
The view adds each zone to an NL3D::CLandscape of its scene (viewport/zone_view.*), drawn as the Zone Painter draws it: every tile near (no far bank is needed), the additive tiles and the tile noise on. The tile bank is made from its source in the graphics folder in the load (doc/landscape.*): landscape/_texture_tiles/<ecosystem>/<ecosystem>.bank for a file of landscape/ligo/<ecosystem>/max, each tile texture the file of the spring season folder that the tiles process converts. The micro-vegetation is not shown (its shapes are an export of other .max files). Without a bank, each zone is a mesh of its patches in the checks of a texture not found, unlit. A zone is a node of the view: picked by the mesh of its patches (two triangles per tile on the Bezier surface), which the pick frames draw in place of the landscape, hidden by taking its zone out of the landscape, framed by that mesh's box. A zone the export does not write as it is shown is drawn at half its painted colours. The flash of a selection does not tint the landscape, which has no material.
Its lighting. A CLandscape takes the point lights of the scene, all of them, through its dynamic lightmaps, but not the scene's sun: its tiles show their lumels through a static light of a diffuse and an ambient colour, and the zones the export writes hold no lighting. The view gives it the sun's colours as that static light and, with Lightmaps off, the direction of the sun that stands in the world as its automatic lighting (the lumels computed from the sun on the ground's normals, without shadows): the scene's sun when it is a light of the Scene or the File set, else the Scene Sun, switched on or not. It is computed again when that direction or the colours change, never for a light that turns with the camera (under the View Key an orbit of the Matis capital lit the whole landscape again every frame).
With the Lightmaps switch on, the zones are lit as the zone_light process lights them, with NL3D::CZoneLighter, in a child process of the editor (nl_material_editor --zone-light <request>), since NeL's landscape keeps process-wide state and a second landscape cannot be lit in a thread beside the view's. The request and the results are in cache/zone_light/ of the per-user folder; each zone is shown as soon as it is written, and the folder is removed at the end (one an editor that stopped left goes at a start once it is older than a day). The landscape is the file's zones with the tile bank made from its source; the shadow casters are the zones themselves and the meshes of the file's instance groups whose node casts shadows and is not flagged to cast none on the exterior, cut by the textures of their alpha-tested materials as the view finds them; the sun is the view's sun when it stands in the world, else the Scene Sun. The status says that it is the file alone: no neighbour zones, no placement on a continent, the view's sun in place of the continent's. The lightmaps of the shapes are calculated without the landscape, as the tools do. The Lightmaps switch drives both calculations, the shapes' lightmaps and the lumels of the zones, and is available when the shown model has something for either: a lightmap receiver, or landscape zones with their tile bank (CLightingController::lightmapsAvailable), so a scene of zones alone is lit too. Disabled, its tooltip says what each of the two misses. The status bar and the line of the Lighting panel show the two together, the shapes' line above the landscape's; a scene whose landscape alone is lit shows the landscape's line alone.
The panoply is the build step that makes the colour variants of the character textures: the map process of a workspace project runs panoply_maker on each entry of MapPanoplySourceDirectories, and the game picks a variant by its file name (the colour slots skin, user colour, hair and eyes). The Panoply drop-down beside the texture set shows the textures of the scene that way (viewport/panoply_view.*); it is a matter of the view.
-
Which panoply takes a texture, as the pipeline decides it (
doc/panoply.*): the workspace reader keeps the four strings of each panoply entry (the two configuration files, the folder of the textures and the folder of the masks). An entry is built only when the workspace'sprojects.pylists its project inProjectsToProcessand the project'sprocess.pyhas"map"inProcessToCompleteand setsMapPanoplyFileList; the projects run in the order ofProjectsToProcess, which decides which panoply of a folder is the last. A texture is taken by an entry when it is in its folder of textures, or in itsd4folder (its variants at half size), with an extension ofbitmap_extensions, and has the mask of each extension ofmask_extensionswhose file is in the folder of the masks. What the reader cannot evaluate makes the panoply of that project not known, and its textures say why. -
The configuration files are NeL configuration files, read by a bounded reader of the editor's own rather than
NLMISC::CConfigFile(which reads a file whole without a bound, followsRootConfigFilenameto any path and writes a debug file into the current folder on a parse error). It takes them as the map process reads them, follows NeL's preprocessor, takes the tokens of CConfigFile's lexer and its values; what it reads of the real configurations equals whatpanoply_makerbuilds from CConfigFile, float for float. -
The variants are calculated by the functions of
nel_panoplythatpanoply_makerruns, then through the file it writes (TGA or PNG at the depth of the source) read back as the map process reads it, so the picture is the game's before its compression. A mask of another size, a compressed mask, a colour the panoply does not define, or a variant written into a file that cannot be read back makes no variant: the view shows the placeholder checks there, with the reason.panoply_makerends at the first texture whose files it cannot make, so the editor reads the textures of each entry in the build's order up to the last texture of the scene and shows those after the first one that stops it as checks. - In the background. The variants are calculated in a thread of their own and kept in memory (256 MiB), keyed by the files as they are on disk and the colours; the view shows each one as it comes. Every load reads the panoply settings again.
-
One place in the view. Every material the view shows passes through
CPanoplyView::applyafter the texture set: a texture the panoply takes with masks gets the variant's texture or the placeholder. The samples and Select Texture show the files as they are.
- Save writes only a dirty document. The document compares the size and the modification time of every file it read (the model file, the sidecar) with the values at load or at its last save, and the backends compare the bytes as well, when the save starts and again just before they replace a file. A file that changed on disk is not overwritten: the Material panel shows the bar with Reload and Overwrite. The window asks about the scene's unsaved edits when it closes and when another file replaces the scene (Save, Discard, Cancel).
- A save writes to a temporary file beside the target (
<file>.savingN; the.maxsave's<file>.tmpN), flushes it to the disk and reads it back before it replaces the target in one step (CFile::replaceFile); then it compares the file in place with what was written. A mismatch is a failed save: the original stays, or is put back, and the temporary file is removed; a save that stops at any step removes it (CTempBeside). One that a save left behind because the editor or the system stopped is said at each load of the model ("'...' is left from a save of '...' that did not end, and the editor does not read it: compare it with the file, then remove it."); the editor never removes it. Revert loads again from disk and clears the undo stack. - A save is refused, and its control disabled with the reason as tooltip, for a read-only document and for a backend that cannot write. A read-only file is never replaced: a read-only
.maxfile opens read-only, and a save into a read-only sidecar or glTF file is refused with the reason. A file opened read-only because it was read-only on disk, for no other reason, shows a bar once it can be written (CDocument::writableAgain; the window looks when it gets the focus back): Reload alone, which opens it for editing.
The NeL sidecar of a model is <model file name>.nel.gltf beside it: tree.obj.nel.gltf for tree.obj, tree.glb.nel.gltf for tree.glb; a model whose name ends in .gltf drops that extension first, tree.nel.gltf for tree.gltf (NLGLTF::nelSidecarPathOf in nel_gltf/nel_sidecar_name.*; the shape process has a copy of the rule). A file whose name ends in .nel.gltf is never a model. The format is under The NeL sidecar of a model.
Where a model keeps its NeL data. A glTF model saves its data where it is: in the extras of its own materials, in the sidecar, or, when both hold data, in the sidecar, which overrides the file (a note in the Material panel says so). A glTF that holds no NeL data yet saves where the last choice was, the sidecar by default (the setting models/nelDataInFile). The selector "NeL data: in file / sidecar" in the header of the Material panel switches it: the switch is one undo step, and the next save writes the data to the new place and takes it out of the old one (a sidecar left with nothing but an empty shell is removed, one with other content keeps it). A model of another format keeps its data in the sidecar, and so does a glTF the editor cannot write into: the selector is disabled with the reason. A glTF of the .max converter keeps its data in the file.
What a save writes. A load and a save never change the meaning of a material that nobody edited:
- an edited material is written with its
nel_material_scriptobject and with builtnel_*keys made again from it, with the exporters' bare texture names; in the sidecar, so is an entry that has anel_material_scriptobject already; a colour that does not fit eight bits per channel refuses the save (the NeL data storesrrggbb); - any other material that nobody edited keeps its NeL data as it was: an entry with built keys only (imported) is written back as it was, and the data of a material in the glTF file stays byte for byte unless it moves to the sidecar;
- a converted material that nobody edited gets no NeL data, so that the shape process converts it as before;
- materials without a name or with a repeated name are not written;
- a material whose parameters do not build is not written: its NeL data stays as it was, and the save says so;
- the entries of a sidecar that match no material of the model are kept as they were, and so is everything of the file the editor does not own: the other top-level members (the
nodeswith the properties of the nodes, the members of other tools), the other members ofasset(itsextrasamong them), and in each entry the members and theextraskeys of other tools.
Into the sidecar. The temporary file is read by the shape process's own loader (loadMaterialSidecars), which must build the same material as the editor for every written entry, with the same stained glass flag, and the same material as before for every entry written back as it was; and by the editor's reader, which must return the same parameters. The sidecar must not have changed on disk while it was being saved. After the replacement the file on disk is compared with what was written, and on a mismatch the file from before is put back. No backup copy of the sidecar is made.
Into the glTF file. The data is written into the bytes of the file as it was loaded, never into another program's version of it. Only the extras of the written materials change (NLGLTF::CGltfExtrasPatch, nel_gltf/gltf_json_patch.*): their nel_* keys are replaced by the new ones, which come after the other keys, and those stay byte for byte; a material without extras gets one. Every other byte stays, the standard members of the materials (their PBR view) and the buffers included, and what is inserted follows the layout of the text (indentation, line ends, separators). A .glb gets its JSON chunk written again, padded with spaces to a multiple of four bytes, with the chunk length and the total length fixed; the binary chunk and every chunk after it are copied as they were. A file that starts with a UTF-8 byte order mark is refused, as the glTF importer of the shape process does not read one. The written bytes are read back by the editor and by the shape process's reader of the NeL data of a model; every material that was not written, every other member of the file and the binary chunk of a .glb must be as before. When the save moves data between the file and the sidecar, the model file is replaced first and then the sidecar; a step that fails puts back what the steps before it changed. For a file of the .max converter the built keys keep the LightMap shader, as the build of its exact route does.
Saving edits the materials inside the scene file, in three stages. A stage that is not implemented is a disabled control with a tooltip, never a silent no-op. What a save can write is known before the edit, per material and per parameter: the document takes no edit that a save would refuse, and the control says why.
-
In place (implemented;
doc/max_writer.*,CMaxMaterialWriter, the inverse of the exporter's extractionMATBUILD::extractNelMaterial):- The parameters of an existing NeL material, as stored: script versions 14 and 15 (see NeL Material Parameters). Each parameter is located by its name through the definition of the NeL Material script that the file stores in its configuration stream (
CNelMaterial::findParam), and a material whose stored definition does not give the blocks and ids the exporter reads for its script version is not edited. - A parameter stored as a constant is written in place. A parameter behind a controller that the extraction evaluates at tick 0 (an On/Off controller on a boolean, a Linear or Bezier Float controller on a number) is written as its value at tick 0: an On/Off controller changes its state at tick 0 and keeps its toggle times, so the states after them invert; a float controller changes the key that gives the value at tick 0 (tick 0 on a key or outside the keys; between two keys the value is refused), and one without keys takes the value. When that changes the animation at other times, the save says so in a note. A controller that another parameter or object also uses is not written.
- The shader type, written together with the derived flags it sets, constants or On/Off controllers alike.
- The names of NeL materials, Multi/Sub-Objects and texmaps.
- The material of each node (see Assigning materials).
- Per texture slot: the enable and texgen flags, and clearing the slot. A texmap is edited in place only when no other slot, material or modifier uses it (the maps of the material's own Standard delegate aside, which show the same material): its name, the bitmap file as chosen (
R:\graphics\...; the older 8-bit file name of the bitmap follows it when it held the same path, and then only takes ASCII), the eight files of a NeL Multi Bitmap (ASCII only), the placement values, the tiling flags, the map channel, the crop and its Apply flag, and the keys of Linear Float controllers on the offset, tiling and W angle. Otherwise the slot is pointed at a texmap that the file already holds with exactly the new values, and the edit is refused when there is none. - The Standard delegate inside each NeL material, which the modelling program displays, is kept in step for the values the script mirrors into it: two-sided, opacity, ambient, diffuse, specular, specular level, glossiness, the self-illumination colour, its amount and "use colour", and the maps, as the script keeps them: the diffuse and ambient maps show texture slot 1 and the specular map slot 2, with their enables. Where a material's Standard maps did not follow its slots before, which older scripts did not keep, one note per material says which maps now show which slot: "... the Standard material under the NeL Material now shows texture slot 1 in its diffuse and ambient maps, as 3ds Max does when the material's rollout is opened; the maps it showed before stay in the file"; the modelling program does the same when the material's rollout is opened. A map the writer cannot set (a delegate shared with another material, or one whose layout lacks what the writer sets) is left as it is; when it followed its slot before and the edit leaves it behind, the other note says so: "... the Standard material under the NeL Material no longer matches texture slot 1 in its diffuse map; 3ds Max brings it in line when the material's rollout is opened". A map that did not follow its slot before gets no note, and an edit that keeps the slot's texmap (a new file of the bitmap) changes nothing in the delegate and gives none. A delegate value that is animated or shared is not written; the save lists it as a note, and the exporter reads the NeL blocks.
- Refused, with the reason: a texmap in an empty slot or of another kind, cube maps, a value made animated or constant, keys added to a controller without keys, Bezier keys, a texmap that something else uses (unless the file holds one with the new values), materials of other script versions or whose stored definition does not match, a bitmap path stored as an asset reference, non-ASCII names of a Multi Bitmap. The node flags that the animation export needs are not written.
- The parameters of an existing NeL material, as stored: script versions 14 and 15 (see NeL Material Parameters). Each parameter is located by its name through the definition of the NeL Material script that the file stores in its configuration stream (
- Structural (designed, not implemented yet). A new bitmap texmap in an empty slot, adding, removing and reordering sub-materials, a new NeL material, converting a Standard material. New objects are imported from a template scene shipped with the tool, saved once from the modelling program per supported file version, which holds a default NeL material with a bitmap in slot 1 and a Multi/Sub-Object parent; the class directory and the storage indices are remapped. This needs library prerequisites that do not exist yet: inserting objects into the scene container, fixing up raw storage indices, a class directory keyed by superclass and class, an orphan insert and remove API, and creating objects from a template.
- Animation. Editing the keys of existing linear float controllers on the placement coordinates is implemented (stage 1). Turning a constant into an animated value and back (new controller objects, the stage 2 machinery) is designed, not implemented yet.
Which files can be saved. A file is writable when the .max library, rebuilding its scene from the parsed objects without a change, gets the stored Scene stream back byte for byte (CMaxDocument::isWritable); a file that does not rebuild exactly opens read-only, and the reason names the first byte that differs. The materials are edited in files of the Scene versions 0x200e and 0x2012; a file of another version opens with its materials read-only. In files of the 0x2012 format a bitmap may store its path as an asset reference, whose asset stream the library does not decode: such a path is neither read nor written, and the control says why. A read-only file opens read-only. The scene is written in the version it was read; there is no conversion.
How a save runs (doc/backend_max.* over CMaxDocument of the .max library):
- The save starts from a fresh parse of the image of the file as it was loaded, not from the objects the view uses, writes every change of the document into it, and checks first that every change can be written: it writes all of them or nothing.
- The library writes every stream it does not touch as it was loaded and the Scene rebuilt, to a temporary file in the folder of the target, flushed to the disk, reads it back and requires every stream to be what was written and the written Scene, parsed again, to rebuild to its own bytes; then it replaces the target in one step and compares the file in place with what was verified.
- Before it replaces the file,
<name>.max.bakgets a copy of the file being replaced, unless a.bakexists already that is a complete file whose streams read: that one is kept. One backup is kept, and it is not overwritten while it is complete. The notes of every save say what the backup holds: the file before this save, the file before an earlier save, or, after an overwrite, an older version, the version another program had written having no copy. - The saved file is read again by the exporter's extraction, and every material is compared with the document; every node must read back with its material. A difference fails the save, and the file is put back as it was, when the file on disk is still the one this save wrote.
- The file on disk must hold the bytes that the document loaded or last wrote, when the save starts and again just before the replace. Otherwise the save is refused, and Overwrite on the bar of the Material panel applies the edits to the file as it was loaded and writes that over the other program's version. The backup rule decides what happens to that version: without a
.bakit is copied there; a.bakthat is not a complete file is replaced by it; a complete.bakis kept, and the version on disk is replaced without a copy.CDocument::overwriteConsequencesays which, in the tooltip of Overwrite, andoverwriteWithoutCopyputs the last case in the text of the bar too, where the user decides. - A texmap of a slot is edited in place when no object outside its material uses what the edit writes (
CMaxMaterialWriter::partsExclusive): a use by another part of the same texmap is the texmap's own, and a copy of it with the same placement that the Standard material under the NeL Material shows in the map that mirrors the slot (older scripts made such copies), held by that Standard material alone, is the material's own and takes the file written into the slot (a save note says so when it showed another file before). The placement is checked apart from the file names and the crop, so a placement that another slot uses refuses the placement alone. A save note says that 3ds Max keeps showing the previous image of ID 1 of a NeL Multi Bitmap until Get or a texture set is used there.
ui/scene_file_commands.* (CSceneFileCommands) holds the File commands that write other files than the scene's own save; their state follows the scene, and a command that cannot run says why in its tooltip and status tip.
Save NeL Data in Sidecar / in Model File is the selector of the Material panel and a save in one command: the selector's undo step (which becomes the default of the next glTF without NeL data), then File > Save. It is enabled where the selector takes that place, or where the data goes there with the next save already and the scene has edits.
Save As glTF writes the scene as a glTF with its NeL data inside and continues on it, with an undo history of its own. A .max file is converted by pipeline_max_export_gltf, run as an export tool (below) with the arguments the export gives the tools for the same file, from the file as saved: a scene with unsaved edits is saved first after a question, as the converter reads only a file. The converter reads a copy of the .max file taken when the command is given, in the per-user cache (cache/save_as/, never beside the glTF in the graphics folder), so File > Save stays usable while it runs; at its end, the editor asks before it opens the glTF when the scene got edits or its file changed meanwhile. The glTF is written at the chosen name with its buffer copied beside it as <name>.bin. A glTF or .glb is copied by the backend's verified save into the model file, written to the target (IBackend::writeGltfCopy): the edited materials with their parameters, the entries of the sidecar, the materials of the primitives as the document assigns them, the external buffers copied beside it and named after it; the model, its sidecar and the backend stay as they are. Another format is refused, as assimp's glTF writer would write the model again from what it imported, not from the file. Refused before anything is written: a scene whose files changed on disk, the open file itself, the name of a sidecar, an existing file unless replacing it was asked, a buffer name that another file beside the target has, a read-only target or buffer, a target the editor would not open, a sidecar beside the target, and the copy of a glTF whose sidecar holds more than the entries of materials or an entry with data of another tool.
Export Scene and Export Scene and Lightmaps write what the build pipeline's export tools make of the scene's file into a folder the user chooses (the settings keep the last one per project), in the background (NLMTLDOC::CToolJob, planSceneExport). The tools run as child processes, found beside the editor's executable only (a missing one is an error that names the expected path, before anything is written), each with the arguments the pipeline gives it (the pipeline runs the modelling program for .max files: the headless tools stand in for its scripts): for a .max file pipeline_max_export_shape --db <graphics> --coarse-out --anim-out (with the lightmaps --lm-scene, then shape_lightmapper on the lightmap scene, with the ShapeExportOpt* options of the process.py of the workspace project whose ShapeSourceDirectories hold the file's folder, else the tool's defaults), pipeline_max_export_skel (a node Bip01 at the top of the scene), _anim, _swt, _clod, _veget, _ig (--ps-path the folders of particle systems below graphics/sfx), _cmb, _pacs_prim and _zone (the ligo export with the tile bank of its ecosystem for a brick, else the zone process), each when the scene has what it exports; for a model read through assimp mesh_export -d as the shape process runs it, for a glTF saved from a .max file with the folders of each kind and its lightmap scene into the lightmapper. The child gets the environment the pipeline gives it. A .max file is read through a copy in the staging folder, so that every tool reads one version; a model is read where it is (mesh_export finds its sidecar and buffers beside it), so saving it waits until its export ends.
Refused before any tool runs: a scene whose files changed on disk since it was opened (the plan follows the scene as loaded, the tools read the disk); a name the tools would name a file after that cannot name a file in its folder (NLMISC::CFile::isUsableFileName: no path separator, no : * ? " < > |, no control character, valid UTF-8, no device name of Windows), for a .max file the objects of its shapes and its instance groups, for a glTF saved from a .max file its objects' shape names and the names of the entries of its NeL data; and a model whose nodes give no shape. The tools take paths in any script whatever the code page of the system: each reads its command line, and its temporary folder, in UTF-8. The tools refuse such names themselves too, as an error of the node, and a refused name or a file they cannot write makes them end with a failure, so a name never makes them write outside their folder.
Each step writes into a folder of its own in a staging folder <folder>/.nl_material_editor_export_<pid>_<n> (also the tools' current and temporary folders: nothing is written outside the chosen folder). At the end, the files of the steps that succeeded are moved into place, each replacing its file in one move; a step that failed keeps none (the lightmapper and mesh_export's exact route, which report per node, keep the others), and the staging folder goes. Cancel stops the tool and removes the staging folder. A read-only file in the folder is not replaced. Once the lightmapped shape of an object is in place, its older lightmaps go, as the lightmapper takes them out of its folder once it replaced the shape. One folder per kind: shape, shape_coarse, shape_anim, lightmap, skel, anim, swt, clod, veget, ig, cmb, pacs_prim, zone, zoneligo, as the pipeline keeps one export folder per kind. The result comes in a window of its own (Show in Folder, Close; the same text in the log and from the endpoint, the commands of the tools in the log only): what was written per step and folder, what wrote nothing and why, what failed with the tool's error lines, what a step left undone, the kinds that do not apply and why, what the tools said (their error and warning lines, those of the NeL log and of mesh_export's error log), what was not moved, the older lightmaps removed, and what is needed to look at the shapes. One export or Save As runs at a time; a window that closes cancels it.
What exists: the model holds the animation of a texmap as five tracks per slot (U and V offset, U and V tiling, W angle); the tracks are read from .max files (linear float controllers as editable keys, Bezier and other controllers as read-only information) and from the sidecar; CDocument::setTrack is a command (the control endpoint reaches it with material.tracks and material.set_track), and a save writes the keys of linear tracks into a .max file and into the NeL data of other models; and Play on the toolbar runs the default animations of the model, the texture matrix tracks among them, through NL3D's channel mixer and the animated materials, as the game does, on the time of the timeline (see The scene clock).
Designed, not implemented yet: a strip under the viewport with a ruler in frames (4800 ticks per second, 30 frames per second), one row per animated coordinate of the selected material, keys as draggable marks, a value field for the selected key, play, stop and loop, and scrubbing that drives the viewport through the same animated-material path as the game. Key edits are commands. The strip is hidden when the selected material has no animation and animation editing is off. The runtime defects found while reading the code are fixed in NeL as part of this stage: the default tracks of UScale and VScale, and the WRot default that the stream leaves out (see NeL Material Parameters).
| What | Where |
|---|---|
Window geometry, splitter sizes, the recent files (files/recent), the folder of File > Open (files/openFolder), the open sections of the Materials panel (materials/...), the kinds and Meshes Only of the Scene panel (scene/kinds, scene/meshesOnly), the driver, the viewport options (the grid viewport/grid, the selection outline viewport/outline, the Surfaces and Textures switches viewport/surface, viewport/textures), what moves while the animation plays (view/whilePlaying/<name>), the panoply colors (view/panoply, view/panoplyColors: on or off and the color of each mask, the same for every project), the folder of the last export per project (export/folders, the last 32 projects), the theme, the Select Texture dialog's size, folder and group and its Split RGB and Alpha (textureDialog/splitChannels), the open state of the rollouts, highlight selection, the built-in lights with the global ambient, the lights per model and the Lightmaps switch (lighting/...), where a glTF without NeL data saves it (models/nelDataInFile). The keys of the window before this layout (the folders of each project, the recent project roots, the left column of three panes) are dropped when the settings are read (CEditorSettings::dropObsolete) |
QSettings("Ryzom Core", "nl_material_editor"); --settings <ini> keeps them in an ini file instead, which the tests use |
| Log |
nl_material_editor.log in the local per-user NeL application directory (doc/user_folders.h: CPath::getApplicationDirectory("NeL", true), on Windows the local application data, which does not roam with the profile); appended to, moved to nl_material_editor000.log (001, ...) past 5 MB, and those removed at the next start |
| Thumbnails |
cache/thumbnails/ in the same directory: a PNG named by the SHA-1 of the file's path, whose text chunks carry the source's size and modification time, the thumbnail size and the format version; a thumbnail that does not match is made again |
| Probe results |
cache/probe/ in the same directory |
| The current folder of the probe children |
nl_material_editor_probe/ in the same directory |
The staging folders of Save As glTF of a .max file |
cache/save_as/ in the same directory: the copy of the scene the converter reads and its glTF, each removed when its Save As ends (written, failed, cancelled, or with the window closed) |
| The folders of the lighting of landscape zones |
cache/zone_light/<pid>-<n> in the same directory: the request of a calculation and the zones it lit, removed when it ends or is cancelled |
The record of the control endpoint, with --ctrl-listen only |
The per-user registry of NeL control endpoints, as for the client, which NEL_CTRL_REGISTRY moves (see Material Editor Control Endpoint) |
NL_MTLED_USER_DIR names one absolute folder for the log, the caches, the folder of the probe children, the work folders and the settings (nl_material_editor.ini, unless --settings names a file); a value that is not an absolute folder stops the start with the reason. A --script run needs it, and the tests set it and NEL_CTRL_REGISTRY to folders of the build tree. At each start the caches keep their bounds: their files older than 90 days go, then the oldest until the probe cache is at most 64 MiB and the thumbnails 512 MiB, and a work folder of the landscape lighting or of Save As glTF that an editor that stopped left goes once it is older than a day; only the editor's own files are touched, and the log says what went.
A cache folder that cannot be created or written is an error in the status bar with the path, what failed and the remedy; thumbnails are then made in memory only, and no other location is tried. Nothing is written under the graphics folder except the files the user saves (the sidecar, a glTF model file, a .max file and its .bak, a glTF of Save As glTF with its buffers) and the temporary files of a save, which a save removes; an export writes only into the folder the user chooses.
The editor needs no file beside its executable: the icons, the fonts and the placeholder textures are compiled in or come from the system, the settings are per user, the log and the caches are in the per-user NeL folders, and the texture folders come from graphics/nel.cfg and the build workspace of the project.
Qt 6 is the reference. The code is written to compile with Qt 5.15 as well; the quick start builds it with Qt 6 when the 3rd party libraries have it, else with Qt 5 (the tools of the quick start use one Qt, see Quick Start for Windows), C++17 like the other Qt tools, hand-built layouts and no .ui files. The style is Fusion with light, dark and system palettes, and the icons are painted from code.
| Test program | What it proves |
|---|---|
nel_material_test |
The catalogue against the text of nel_material.ms and its version 14 backup (every parameter once, with its block, type, declared default and position); the derived flags, the enable rules and every preset against tables; parameters to CMaterial against fixtures for each shader; the JSON round trip on random parameter sets, the layout of a new material, missing and unknown keys, malformed values, the reverse mapping from a built material; the glTF material codec. |
nel_material_extract_test |
Parameter ids at versions 14 and 15 and the exporter's fallbacks, on the .max reader. |
nl_material_editor_widgets_test |
The layout engine's metrics against the script's rules, the spinner, the colour maths, the rollouts, the map button, the Color Selector, the thumbnail cache and the texture browser (the color and the alpha apart, Split RGB and Alpha, grey textures as alpha textures); on the offscreen Qt platform. |
nl_material_editor_doc_test |
Sessions, documents and commands (merging, macros, refusals, the clean state); the .max backend on the in-repository sample and on representative files of a graphics checkout (static, Multi/Sub-Object, skinned, multi-LOD, water, waterfall, XRef); the scene (the tree, the material list and its uses, the selection, assignments with undo, on .max files of a graphics checkout saved, reloaded and exported against the exporter, nested and shared sub-materials, glTF and .glb saves, the refusals); the assimp backend (no sidecar, edit and save and load again, unnamed and duplicate names, a sidecar with built keys only, damaged sidecars, files changed on disk, a converter glTF); the sidecar writer; the NeL data kept in a glTF model file (open, edit, save into the file and open again, .gltf and .glb, every byte outside the written extras kept, mesh_export on the saved file, moving the data between the file and the sidecar both ways, both places present, null saves, damaged data, the files of the .max converter from NEL_GLTF_SAMPLE_DIR); saving .max files (below); the probe, its cache and a file the libraries stop on; the export (which exports apply to which content, the shape options of the workspace, a missing tool, a read-only file in the folder, a cancel while the lightmapper runs, and on files of a graphics checkout every output of both commands against the tools run directly with the same arguments, byte for byte); the panoply (the reader of the configuration files against CConfigFile on the real files and hostile ones, the textures each panoply takes, and the variants against the files panoply_maker writes); the audit of the .max files of a graphics folder, disabled by default (every file opened by the editor's load in a child process of its own, bounded in time and memory, with what the file holds, the load messages, what the writer says of each NeL material, and edits saved and read back on copies); and the undo property: seeded random sequences of edits with merged gestures and undos in between, after which undoing everything gives the loaded model field by field, redoing everything gives the edited one, and a save after undoing everything writes the bytes of a save without edits. The property runs 400 sequences of 40 steps on a test backend and 40 sequences of 30 steps on an assimp model with its sidecar. |
nl_material_editor_shell_test |
The window, opening every kind of model in place of the scene (the question about unsaved edits, a file replaced while it loads, a file that fails), the project of the file (two projects with a texture of the same name), the Scene panel (the tree, the filters, the folding, the switches of the view, the selection shared with the scene and the Materials panel, Assign to Selection, drops on rows), the nodes in the view with each driver (picking a node, hiding, the flash of nodes, the grid), the lightmap preview, the settings, the navigation, the viewport with each driver that the build configures (a window that is never shown), the scene binding, opening every kind of model, editing every kind of control, undo, saving, the animation, water, the Multi/Sub-Object panel, robustness, the lighting (the model and its presets, each light on the test sphere with the three drivers, the limits of the engine, the lights of a file, the panel, the menu and the settings), the --script mode, the time of the view (a flare fading in in a still view with the three drivers, the Water check of While Playing), the display options with the three drivers (the checker and the textures it replaces, the outline around selected, hidden, blended and cut-out nodes, the wireframe, picking and the samples in every mode, 1600 nodes outlined), the input of the view (the bindings against the navigation listener's, the left press on empty space, Ctrl, Shift, Alt, Z, F and Escape with a real driver), the landscape zones (drawn, picked, hidden, lit and lightmapped; the display modes on the landscape, the outline of a zone, its tessellation in the wireframe), the panoply colors (a character and a head with their masks, the drop-down, the settings), the File commands (their reasons, the question about unsaved edits, the folder remembered per project, the progress and the result window, a missing tool, Save As glTF of a .max file and of a glTF with the editor continuing on the new file), the view in native windows (the driver's size against its window after each way the view changes size), and the review pictures. |
nl_material_editor_ctrl_test |
The control endpoint: every method group against the editor in the test process, reached through the pipe only, on generated models, the repository's street.max and files of a graphics checkout; Save As glTF, the NeL data with a save and the export with its events and result; the trust gate, the lease, the argument checks, a call during a load, the project that follows the file opened; and the editor as a program driven through nel_mcp (launch, calls, pictures, save, quit), two editors at once, a caller that goes away during a call, malformed and oversized requests, and what the command line refuses. Its endpoints are recorded in a registry folder of the test's build tree, never in the user's. |
Tests that need a graphics checkout take its path from NEL_GRAPHICS_DIR and report themselves skipped without it. The Qt tests run on the offscreen platform and need the externals on the path. ctest -R nl_material_editor runs the four nl_material_editor_* programs.
Saving .max files (doc/tests/ut_mtled_doc_max_save.test.cpp, in nl_material_editor_doc_test): null saves are byte-identical; an edit of every parameter of the catalogue, shader types and presets, texture paths, the names of a NeL Multi Bitmap and the ASCII rule, renames and the names of the animation tracks, keys of animated placements, derived flags and the texture matrix export flag driven by On/Off controllers, water parameters, two saves in one session, a file changed on disk, a file written by another program during the save, a read-only file, a save that waits for a load in another thread, and the capability queries against what a save does. Every save is on a copy in a scratch folder. After a save the test loads the file again in a session of its own and compares the document with the edited one, runs the shape exporter on the saved file and compares its materials with those the document builds, compares every stream but Scene byte for byte and the Scene object by object (only objects reachable from the edited materials may change), then undoes everything and saves again to get the original bytes back. Two tests over a sample of the files of a graphics checkout are disabled by default: a property test of random edits and saves (it runs for an hour), and a table of what the writer can write there, per parameter, with the reasons where it cannot.
Exporter differential (designed; run by hand, outside the repository's test programs). Moving the build of the materials into nel_material, and the shape exporter's per-node flow into a shared unit, must leave every exporter output byte-identical. The gate is two builds of pipeline_max_export_shape and pipeline_max_export_gltf, one from before the change and one after, run over every .max file of a graphics checkout: all outputs must be identical. The repository's own corpus gates (shape_corpus.py, gltf_corpus.py and the others in pipeline_max_corpus_test) compare the exporters with reference data and stay in place.
The defaults below are what the code does today, so that work can proceed.
| # | Point | Default in use |
|---|---|---|
| 1 | Where the script-level parameters go | In the NeL data of the material (its sidecar entry, or its own extras in a glTF model) under nel_material_script, which is the authoring truth; the built nel_* keys are derived on save |
| 2 | The form of a texture string written into a .max file |
R:\graphics\<relative path> |
| 3 | The location of the thumbnail cache | The local per-user NeL application directory, cache/thumbnails/, or NL_MTLED_USER_DIR
|
| 4 | The Qt version | Qt 6 as the reference, Qt 5.15 kept compiling |
| 5 | The values of a new material | The initial values of the script's controls: ambient 63, diffuse 127, specular 255, glossiness 10 %, opacity 100 % |
| 6 | The script version of a saved material | A file keeps its material's script version; the version 15 parameters are editable only in version 15 materials; a new material is version 15 |
| 7 | The order of a Multi/Sub-Object's slots | The exporter's (slot order), with the stored ids shown |
| 8 | The differences between the script and the editor (the Arg2 controls of NeL Slot 4, the blend factor labels, the Mix preset, per pixel lighting without specular, bCalcWaterLightmap, the Not Implemented shader) |
As listed on NeL Material Parameters |
| 9 | Structural .max edits |
They need one template scene per supported file version, saved once from the modelling program, and a check in the modelling program that files with added objects load; neither can be produced without it |
| 10 | The list of model formats | The provisional list above; the editor does not yet take it from the importer. The shape process exports .blend, .obj, .dae, .gltf and .glb through mesh_export
|
| 11 | Whether choosing the water shader writes the Unlighted, stained glass, Alpha Test and Force ZWrite parameters, as the script's user interface unchecks those controls | Not established; the editor leaves the parameters alone and disables their controls |
| 12 | Assigning materials in models of the other formats (OBJ, FBX, ...), whose primitives' materials are part of the model file | Refused for now, with the reason: the material is assigned in the modelling tool and the model exported again |
| 13 | A material of the list that a .max node takes but that only the sample slots or another holder kept |
Not added to the scene material library |
| 14 | The materials the panel lists of a large file | Every Multi/Sub-Object group of a file whose groups hold more than 400 slots starts folded, and a group of more than 40 slots |
Gaps of the existing exporters, recorded here because they decide what an edit in the editor can reach:
- The headless water builder reads the bump and displace parameters, the height factor and the pool id, and none of the splash, scene environment map, realtime reflection or fresnel parameters (see NeL Material Parameters).
- The mesh build of the headless shape exporter does not apply the placement matrix of a texmap to the UVs; only the texture matrix export (
bExportTextureMatrix) carries a placement to a shape. - The headless mesh build does not make the per-pixel-lighting vertex program that the shaders 7 and 8 ask for; it leaves the mesh's vertex program empty.
- NeL Material Editor, the artists' user guide
- NeL Material Parameters, the parameter reference
-
NeL-Specific glTF Extras, the
nel_*keys, the NeL sidecar of a model and the NeL data in a glTF model -
Material Editor Control Endpoint, driving the editor from
nel_mcpor a test -
The
.maxto glTF converter and the assimp route: plan, the converter and the assimp route this tool serves -
The
.maxlibrary: design and coherency contract, the library and its write rules - Zone painter: artist user stories, the viewport navigation and the save flow this tool follows
- Legacy patch-edit plugin: rollout inventory and UI spec, the way the Zone Painter reproduces legacy rollouts
- Creating Water Surfaces