Bablo ResourcesDocs

Import, Export & Publish

The Publish tab of the Map Workshop takes maps in and out of the editor. It has three parts:

PartWhat it does
ExportTake this map out as a file that anything else can read. The map is turned into text that you copy.
ImportPaste a bundle and it becomes a new draft map.
Map as its own resourceBuilds a resource that loads the map by itself, so the editor doesn’t have to be running.

At the top of the tab:

  • Map: the map to export or publish. It starts on your working map.
  • Only category: All categories, or one category. Export and publish then take only the props of that category and its subcategories.
  • The size of the chosen map, for example 240 object(s) · 3 hide(s).

Exporting a map

  1. Choose the map under Map, and a category under Only category if you want part of it.
  2. Click a format in Export.
  3. Press Export. The text appears in a box under the button, with its format and size.
  4. Press Copy (it turns into Copied) and paste the text into a file of your own.

When you click another format after an export, the new export is made right away. Every export is written to the History.

Formats

FormatFileWhat it is for
JSON.jsonThe one format that keeps hides, lights and categories. Use it for backups and to move a map to another server with the editor. It can be imported again.
YMAP.ymap.xmlStreams without the editor once converted in CodeWalker. A ymap in XML form. Convert it to a .ymap file in CodeWalker and stream it in a resource of your own.
MENYOO.xmlLoads into Menyoo’s object spooner. A placements file (SpoonerPlacements).
LUA.luaFor pasting into another script. A Lua table with one entry per prop.
CSV.csvOpens in any spreadsheet app. One line per prop.

What each format holds

FormatPropsProp settingsErased GTA propsLightsCategories
JSONYesAllYesYesYes, with their nesting and capacity
YMAPYesRender distanceNoNoNo
MENYOOYesFrozen, collision, visible, opacity and gravityNoNoNo
LUAYesRender distance, opacity, frozen, collision, visible and gravityNoNoBy name, per prop
CSVYesNoneNoNoBy name, per prop
  • Every format holds the model, position and rotation of each prop.
  • Labels are not part of any export.
  • Only category limits the props. A JSON export still holds every erased GTA prop and every light of the map.

The formats that leave things out show these notes under the text:

NoteShown for
Only objects — hidden props and lights aren’t included.YMAP, MENYOO, LUA and CSV
Lights are not part of this format and will be droppedYMAP, MENYOO, LUA and CSV
When adding ymaps to your server, mind their load order.YMAP

Lua and CSV

A Lua export returns a table. Each prop is one line with its model, coords and rotation as vector3, its category name when it has one, its render distance as lodDist, and only the settings that differ from a normal prop: alpha when it is not 255, frozen = false, collision = false, visible = false and gravity = true.

LUA
return {
    { model = 'prop_bench_01a', coords = vector3(215.123456, -810.654321, 30.727000), rotation = vector3(0.000000, 0.000000, 45.000000), category = 'Seating', lodDist = 400 },
}

A CSV export starts with a header line. The category column holds the category name, or nothing.

PLAINTEXT
model,x,y,z,rx,ry,rz,category
prop_bench_01a,215.123456,-810.654321,30.727000,0.000000,0.000000,45.000000,Seating

YMAP

The ymap is named after the map, in lower case with _ between the words, for example docks_map for Docks Map. Each prop is an entity with its render distance as lodDist. Props that have no render distance of their own get Config.ObjectDefaults.lod (400, see Object defaults).

The extents of the ymap are padded with Config.Formats.ymapEntityMargin around the props, and with each prop’s render distance plus Config.Formats.ymapStreamMargin for streaming. See Settings.

Exporting a category from every map

With a category chosen under Only category, a second button appears: Export “Seating” from every map. One JSON bundle with the category and its subcategories, gathered across all maps.

It makes a JSON export of every prop in that category and its subcategories, on all maps, enabled or disabled. It holds no erased GTA props and no lights. When the category has no props: That category has no props on any map.


Importing a map

The Import part reads a pasted map and saves it as a new, disabled map. Three formats can be imported:

FormatRecognised byWhat is imported
JSONText that starts with { or [A JSON export from this tab: props with all their settings and categories, erased GTA props and lights. A plain JSON list of props works as well.
MENYOOA SpoonerPlacements or Placement elementEvery object placement, with its position, rotation, frozen, collision, visible, opacity and gravity. Peds and vehicles are left out.
YMAPA CMapData element or a CEntityDef itemA ymap saved as XML from CodeWalker: every entity with its position, rotation and render distance.

Lua and CSV exports can’t be imported.

  1. Type a name for the new map in Name the imported map…, up to 64 characters.
  2. Paste the text into Text to import. The badge above the box shows the format it recognises, or Unknown.
  3. Press Preview.
  4. Check the preview and press Import.

Import is greyed out until the preview of the text in the box worked and the map has a name.

Preview

The preview shows Format, Objects, Categories, Hides and Lights: what the server found in the text.

Props whose model is not in the catalogue of the editor are listed under Not in the catalogue, will be skipped. The catalogue is the prop list of the editor plus Config.CustomProps. The list shows up to Config.Formats.previewUnknownMax (20) model names. To import custom props, add them to Config.CustomProps first. See Custom Props & Thumbnails.

When the preview fails:

MessageWhy
That doesn’t read as a map bundle.The text is not one of the three formats, is larger than Config.Formats.importMaxBytes, or holds nothing that can be imported.
Unsupported bundle version — expected 1.A JSON export without "version": 1.
Couldn’t check the text right now. Try again.The server gave no answer, for example because you previewed too often in a short time.

The imported map

After Import: Created Docks as a disabled map — 236 object(s) in, 4 skipped. Under it are the Skipped models, when there are any, and Show in Maps, which opens the Maps tab with the new map highlighted.

  • The new map is disabled and uses the default load distance. Enable it on the Maps tab when it is ready.
  • Skipped are props with an unknown model or without a position and rotation, props outside the world (X or Y beyond 10,000 either way, or Z below -100 or above 2,000), and erased GTA props and lights that can’t be read.
  • Up to Config.Lights.maxPerMap (320) lights are imported. See Lights.
  • Each category in a JSON export is added as a new category, also when a category with that name exists. Names, nesting and capacities are kept. Categories deeper than Config.Studio.maxCategoryDepth are left out, and their props are imported without a category.

An import with more props or more erased GTA props than Config.MaxObjectsPerMap, or more props than fit under Config.MaxObjectsTotal, is refused as a whole: Too many objects for the server limits. See Maps and limits.


Publishing a map as its own resource

Map as its own resource builds a resource that loads one map by itself. The players then get the map from that resource, and the editor doesn’t have to run.

  1. Choose the map under Map, and a category under Only category if you want part of it.
  2. Type a folder name under New resource folder, for example docks_map. Use lowercase letters, digits, dashes or underscores.
  3. Check Preflight: the target folder, for example exports/docks_map/, and Map, Category, Objects and Hides.
  4. Press Publish.

The resource name

Characters other than letters, digits, - and _ are dropped, and letters are turned into lower case. Preflight shows the folder name that will be used. The name is 1 to 32 characters and can’t be the name of the editor itself (bablo-mapeditor). Otherwise: That resource name doesn’t work — 1 to 32 characters, not the editor’s own name.

Overwriting

When exports/docks_map/ already holds a published resource, you are asked first: Overwrite Resource, docks_map already exists in exports/. Publishing again replaces its files. and Overwrite. Only the files in the list below are replaced. Files you added yourself, for example in stream/, stay.

The files

The resource is written into the exports folder inside the editor, for example resources/bablo-mapeditor/exports/docks_map/. The editor creates the folder and the stream folder in it by itself. It holds these files:

FileWhat it holds
fxmanifest.luaThe manifest of the new resource.
client.luaThe script that spawns the props, hides the erased GTA props and draws the lights.
map.jsonThe map data client.lua reads.
docks_map.jsonA JSON export of the same map. You can paste it into Import later.
docks_map.csvA CSV export of the same props.
stream/.keepKeeps the stream folder in place. The file says to drop your own .ytyp, .ydr, .ytd and .ymap files in this folder.

The manifest:

LUA
fx_version 'cerulean'
game 'gta5'
name 'docks_map'
author 'bablo-mapeditor publish'
version '1.0.0'
client_script 'client.lua'
files {
    'map.json'
}

Starting the published resource

When it worked, the tab shows Published with the size, the folder and the Files, and: The folder was created inside the editor, where it can’t run. Move it to your server’s resources folder and start it with the line below.

  1. Move the folder from bablo-mapeditor/exports/ into your resources folder.

  2. Add the line from the tab to server.cfg:

    PLAINTEXT
    ensure docks_map
  3. Restart the server, or run refresh and ensure docks_map in the console.

The tab also says: Drop your own props into the stream/ folder, FiveM streams it without a manifest entry.

The published resource needs nothing else: no database, no framework, no ox_lib and no map editor.

Disable or delete the map in the editor once the published resource runs. While both load the same map, every player gets each prop twice.

What the published resource does

  • It loads the props in squares of 150 metres. A square loads when its centre is within 300 metres of the player’s character and unloads when it is more than 350 metres away. The load distance of the map in the editor is not used.
  • It applies the frozen, collision, gravity, opacity and visibility settings of each prop, and the render distance of props whose render distance was changed.
  • It gives each model up to Config.ModelLoadTimeoutMs (3000 ms, taken at the time you publish, see Models) to load. A model that fails is tried again after 30 seconds.
  • It hides every GTA prop erased on the map, also when Only category is set.
  • It draws every light of the map that is switched on, also when Only category is set. The light settings of Config.Lights are copied in when you publish.
  • When the resource stops, it removes its props and the erased GTA props come back.

When publishing fails

MessageWhat to do
The server couldn’t create the export folder. Make sure bablo-mapeditor can write to its exports folder, then publish again.The server can’t write into the editor’s exports folder. Give it write access and publish again.
The server couldn’t create /home/fivem/server/resources/bablo-mapeditor/exports/docks_map. Create that folder with an empty stream folder inside it, then publish again.Create that folder and a stream folder inside it by hand, then publish again.
Publish failed.Anything else. A notification shows the reason, for example You’re doing that too fast.

With the folder messages, the notification The exports folder is missing — create it inside bablo-mapeditor and retry. shows as well, and the server console prints which folder could not be created. The exports folder ships with the resource.


Messages

MessageWhen
Export failed.An export could not be made. The notification Couldn’t create the export. may show with it.
That category has no props on any map.Export “Seating” from every map found no props.
That doesn’t read as a map bundle.See Preview. On import, the notification Couldn’t read that import. Check that the whole text was pasted. or Nothing importable in that bundle. may show with it.
Unsupported bundle version — expected 1.See Preview.
Couldn’t check the text right now. Try again.See Preview.
Too many objects for the server limits.The import does not fit the object limits. The notification The import exceeds the object limits. shows with it.
Import failed.Anything else during the import, for example a map name the server refuses (That name doesn’t work — 1 to 64 characters.).
That resource name doesn’t work — 1 to 32 characters, not the editor’s own name.See The resource name. The notification Resource name must be 1-32 characters: a-z, 0-9, - or _. shows with it.
Publish failed. and the two folder messagesSee When publishing fails.

Settings

LUA
Config.Formats = {
    importMaxBytes = 33554432, -- largest paste import and preview accept (bytes; 32 MiB)
    previewCost = 5.0, -- rate-limit tokens one import preview costs ...
    previewCostPerMiB = 0.7, -- ... plus this many per MiB of pasted text; keep the total below Config.RateLimit.tokens
    previewUnknownMax = 20, -- most unknown model names a preview lists
    ymapEntityMargin = 5.0, -- YMAP export: padding around the props' positions (m)
    ymapStreamMargin = 5.0, -- YMAP export: padding added to each prop's LOD distance for streaming (m)
    detectScanBytes = 262144, -- how much of a paste is scanned to recognise its format (bytes)
}
SettingWhat it does
importMaxBytesThe largest text that Preview and Import accept, in bytes.
previewCost / previewCostPerMiBHow much of the rate limit in Config.RateLimit one preview uses: previewCost, plus previewCostPerMiB for every MiB of pasted text. The total is capped just below Config.RateLimit.tokens.
previewUnknownMaxThe most unknown model names a preview lists.
ymapEntityMarginYMAP export: padding in metres around the props for the entity extents.
ymapStreamMarginYMAP export: padding in metres added to each prop’s render distance for the streaming extents.
detectScanBytesHow much of the start of a paste the server reads to recognise an XML format, in bytes. Values below 8192 count as 8192.

See Import and export.