PrefabRenderer:Using the 3D View

From MutigerAffe Wiki
Jump to navigation Jump to search

The 3D view is an extra editor for *.prefab.json files called Hytale Prefab 3D View. It is registered with the priority "option", so prefab files keep opening as normal JSON text. You open the 3D view on demand.

The 3D view with the sidebar
The 3D view with the sidebar

Opening the view

There are four ways to open it:

  • Editor title bar: while a *.prefab.json file is open, click the Open Prefab Preview button (preview icon) at the top right of the editor.
  • Explorer: right-click a *.prefab.json file and choose Open Prefab Preview.
  • Command Palette: run Hytale: Open Prefab Preview. The command is only listed while the active file is a *.prefab.json file.
  • Reopen Editor With: in the open JSON tab, use Reopen Editor With... → Hytale Prefab 3D View. This replaces the text editor in the same tab.

The command opens the 3D view to the side of the current editor, so you can see the JSON and the 3D view at the same time. If the file is not a *.prefab.json file, a warning asks you to open one first.

You can open several 3D views of the same file. A view that is moved to the background keeps its state, so switching tabs does not rebuild the scene.

The view is read only. To change the prefab, edit the JSON.

Live update

The view follows the JSON document:

  • Edits in the text editor show up about 300 ms after you stop typing, also before you save.
  • When the file changes on disk and VS Code reloads it, the view updates as well.
  • The camera, the Y slice and the selected block stay where they are. The selection is kept as long as there is still a block at the same position.
  • If the JSON is invalid or has no blocks array, the view shows the error message. It goes away as soon as the JSON can be read again.
  • A prefab without any blocks or fluids shows the sign ∅.

Camera controls

Input Action
Left drag Rotate around the target
Right drag Pan
Mouse wheel Zoom
Click Select the block under the cursor
Double-click Move the camera target to the block under the cursor

A short help line with these controls is shown at the bottom left of the view.

Reset camera in the sidebar frames the whole prefab again. The camera is also reset when the view loads a different file.

Hover and selection

  • Hovering over a block shows its name next to the cursor and draws a white frame around its cell.
  • Clicking a block selects it and draws a yellow frame. Clicking empty space clears the selection.
  • Picking works on whole cells. Hovering over the empty part of a cell that holds a small model still picks that block.
  • Blocks above the Y slice cannot be picked.

Sidebar

The sidebar on the right shows, from top to bottom:

File info

Row Content
File name The name of the prefab file
Size Width × height × depth in blocks, measured over all blocks and fluids
Blocks Number of drawn blocks. Air and filler cells are not counted.
Block types Number of different block names in the prefab
Fluids Number of fluid cells. Only shown if the prefab has fluids.
Anchor anchorX, anchorY, anchorZ of the prefab. Only shown if one of them is not 0.

Y slice

The slider hides all layers above the chosen Y value. The label shows the current limit, for example ≤ 9. Faces that become visible when a layer is hidden are drawn, so you can look inside buildings. When you edit the prefab, the slider stays at its value. If it was at the top, it stays at the top.

Buttons

  • Reset camera: frames the whole prefab.
  • Reload assets: drops all cached block definitions, models and textures, opens Assets.zip again and redraws every open 3D view. Use it after you changed textures or block definitions in a mod folder. See Asset Sources.

Selection

Details of the selected block:

Row Content
Name The block name as written in the prefab
Position X, Y, Z of the cell
Rotation Yaw, pitch and roll in degrees. Only shown if the block is rotated.
Item The item ID, if it differs from the block name (for example for states or names with a * or |Yaw= part)
State The state name, if the block uses a state
Draw type The DrawType of the block, or how it was drawn (cube, model, cubeModel, unknown)
Problem Why the block could not be resolved or what was missing
Droplist, Capacity For chests: the droplist (or (no droplist)) and the capacity, if set

Chests

All blocks that have an ItemContainerBlock component in the prefab, with their droplist, block name and position. Click an entry to select the chest and move the camera to it.

Unknown blocks

All block names that could not be resolved, with the number of blocks and the reason. They are drawn as magenta cubes. Click an entry to jump to the first block of that name. If everything was found, the list says All blocks resolved. See FAQ and Troubleshooting for the reasons.

Block types

A collapsible list of all block names, sorted by how often they occur. Hovering an entry shows its draw type.

Warnings

Only shown if there are warnings, for example a missing texture, an unknown state or an asset folder that does not exist.

Asset sources

A collapsible list of the asset folders and the Assets.zip used for this view, in the order they are searched.

Language

The view and the command follow the VS Code display language. English and German are included.

Prefab Renderer
Start Installation · Using the 3D View
Features Rendering · Asset Sources
Reference Commands and Settings · FAQ and Troubleshooting · Version History
Links Project page on mutigeraffe.com · Download on the VS Code Marketplace