gui.set()
(by AGulev)hash
management when creating objects using collectionfactory (by AGulev)camera.set_orthographic_zoom
to accept numeric zoom value (by aglitchman)NEW: (#10547) ‘Added support of runtime creating and updating of textures array’ by ekharkunov Texture arrays can be created and updated in the runtime. Example how it can be done:
--- create new texture array
local new_tex = resource.create_texture("/runtime/example_array.texturec", {
type = graphics.TEXTURE_TYPE_2D_ARRAY,
width = 512,
height = 512,
page_count = 5,
format = graphics.TEXTURE_FORMAT_RGB,
})
--- update texture array slice
local tex_path = "/bundle_resources/slice_02.png"
local data = sys.load_resource(tex_path)
local buf = image.load_buffer(data)
resource.set_texture(new_tex, {
type = graphics.TEXTURE_TYPE_2D_ARRAY,
width = buf.width,
height = buf.height,
page = 1,
format = graphics.TEXTURE_FORMAT_RGB
}, buf.buffer)
go.set("#mesh", "texture0", new_tex)
Also resource.get_texture_info()
returns additional field page_count
with actual slice count. For regular 2D texture value is 1, for cube map is 6.
NEW: (#10619) ‘Make it possible to set GUI resources using gui.set()
‘ by AGulev
It is now possible to set Font or Texture resources for a GUI using the gui.set()
function from the GUI component itself, provided that msg.url()
is used as the first argument instead of a node.
function on_message(self, message_id, message, sender)
if message_id == hash("set_font") then
gui.set(msg.url(), "fonts", message.font, {key = "my_font_name"})
gui.set_font(gui.get_node("text"), "my_font_name")
elseif message_id == hash("set_texture") then
gui.set(msg.url(), "textures", message.texture, {key = "my_texture"})
gui.set_texture(gui.get_node("box"), "my_texture")
gui.play_flipbook(gui.get_node("box"), "logo_256")
end
end
NEW: (#10539) ‘Wrong include reference for dmMemory’ by selimanac
Include reference should be <dmsdk/dlib/memory.h>
not <dmsdk/dlib/dalloca.h>
Doc: https://defold.com/ref/stable/dmMemory/
NEW: (#10715) ‘Added support for hash userdata type keys in lua table (de)serialization.’ by Gert-Jan
It is now possible to use sys.save()
and sys.load()
to save and load tables with hashes as keys. This allows for example to (de)serialize tables that are produced and used by collectionfactory. This change also means that sys.serialize()
and sys.deserialize()
can serialize and deserialize tables with hashes as keys.
:warning: Using a hash as a key in a serialized table makes the binary format incompatible with older versions of the engine.
FIX: (#10592) ‘Default to no wasm simd on HTML5’ by JCash This fixes a regression from 1.10.0
FIX: (#10589) ‘Copy resources from pods’ by ekharkunov Now all resources from Pods correctly packed into .ipa.
FIX: (#10529) ‘Updating volume and panning handling for sound system’ by thengel01
Sound panning now configured to correctly pan stereo sound instances (basically treats them as 2 mono sources for panning).
sound.gain
(default 1.0) in the game.project
settings.Added logic that can support exponential gain (as in: 0.5 perceptually is “half volume”). This is useful for a nicer fade ins/outs.
sound.use_linear_gain = 0
in game.project
FIX: (#10626) ‘Faster atlas creation’ by AGulev
Atlas creation is now twice as fast in bob.jar
and about three times faster in the editor.
FIX: (#10631) ‘Make sure that GUI components are sorted per world’ by AGulev
Make sure that GUI components spawned in different worlds (in different collection proxies) are sorted separately, and that the later-spawned world is always rendered on top unless another behavior is specified using gui.set_render_order()
.
FIX: (#10653) ‘go.exist() will now throw a Lua error if referencing another collection’ by britzl
Like all other functions in the go.* namespace the go.exists(url)
function will now throw a Lua error if specifying a url referencing a game object from a different collection than the one from which go.exists()
was called.
FIX: (#10656) ‘Fixes memory leak in profiler on web platforms’ by AGulev
FIX: (#10661) ‘Make sure that changes in shaders are always taken into account during rebuild’ by AGulev
FIX: (#10663) ‘Added function dmGameSys::ResFontSetLineHeight() to set font line height for dynamic fonts’ by JCash
There is also the corresponding dmGameSys::ResFontGetLineHeight()
FIX: (#10678) ‘Added mutex to font.cpp to protect when adding and removing glyphs dynamically’ by JCash
FIX: (#10695) ‘Updated to lipo 0.10 (4c7c275) to fix a Windows renaming issue’ by JCash https://github.com/konoui/lipo/releases/tag/v0.10.0
FIX: (#10713) ‘Fixed issue where build to remote target can’t load a file more than once’ by AGulev
Fixed issue where cached resources loaded remotely from the editor return the wrong file size, resulting in a string length overflow
error
FIX: (#10654) ‘Make sure hashes are comparable even after the game object is removed’ by AGulev Fixes an issue where, after removing a game object, its ID isn’t equal to a hash with the same value.
FIX: (#10686) ‘Fixed data size when uploads compressed paged texture’ by ekharkunov Fixed wrong data size used when updating a compressed paged texture in OpenGL.
FIX: (#10712) ‘Fixing EOS behavior of tremolo decoder when skipping data’ by thengel01 This fixes a recently introduced issue with sound instances “hanging around” forever if they are played back with group volume down to zero.
FIX: (#10705) ‘Adding check to avoid zero delta values in sound mixer’ by thengel01 This change fixes a recently introduced issue where the engine would crash if a sound was played with a very low speed.
FIX: (#10727) ‘Fix for getting win32 user directories containing unicode characters’ by JCash This fixes an issue where the engine wouldn’t start for some users, when their app directory contained unicode characters.
FIX: (#10730) ‘Improve hash
management when creating objects using collectionfactory’ by AGulev
Fix issue where hash
can be removed while it’s in use
FIX: (#10734) ‘Remove all dynamically created hashes (from factories) when they aren’t used anymore’ by AGulev
FIX: (#10624) ‘Update camera.set_orthographic_zoom
to accept numeric zoom value’ by aglitchman
The function camera.set_orthographic_zoom()
now accepts the value as number (before it was boolean) and works the same as setting this value via go.set.
FIX: (#10575) ‘Added thread support to HTML5’ by JCash
This introduces a new web target platform wasm_pthread-web
When bundling, you can select to include supoprt for this platform.
Note that distribution sites using ADS don’t generally support threads, as it requires CORS setup.
We’ve also updated to Emscripten 4.0.6. This also updates our minimum supported browser versions:
No Threads:
With pthreads:
FIX: (#10789) ‘Fixed issue with font cache invalidation’ by AGulev
Fixed issue where the cache stayed invalidated after updating to a newer version of Defold where the font or glyph bank output format was changed.
Usually, it appeared as a Unable to create resource: /_generated_font_f8188ecab1e82fcc.glyph_bankc: FORMAT_ERROR
and could only be fixed by removing the build
folder, which is no longer necessary.
FIX: (#10769) ‘Fixed crash on Android when rebooting the engine’ by AGulev
Fixed issue where sys.reboot()
of the engine on Android may crash the game.
NEW: (#10587) ‘Allow getting/setting more properties using editor scripts’ by vlaaad Previously, some properties couldn’t be get/set by editor scripts. Now, it’s possible to do so! We added support for getting and setting:
Remaining unsettable properties are curve and curve spread (in particle fx).
NEW: (#10635) ‘Improve Scene View error experience’ by matgis
NEW: (#10651) ‘Directories are now treated as resources in editor scripts’ by vlaaad Now, directories may be accessed as resources in editor scripts. The directories have 2 properties:
path
- the path to the directory, same as with file resourceschildren
- list of children resourcesFor example, here is how you can ensure that an atlas has all images from a directory:
local images = editor.get("/assets/images", "children")
local atlas = "/assets/main.atlas"
local txs = {editor.tx.clear(atlas, "images")}
for i = 1, #images do
local resource_path = editor.get(images[i], "path")
if resource_path:match(".png$") ~= nil then
txs[#txs + 1] = editor.tx.add(atlas, "images", {image = resource_path})
end
end
editor.transact(txs)
NEW: (#10644) ‘Allow editing atlas images and animations from scripts’ by vlaaad Now, it’s possible to edit (add/remove) atlas images and animations using editor scripts. This is achieved using the following additions to the editor script API:
images
and animations
properties, which are lists of image and animation nodes, respectivelyimages
property, which is a list of image nodeseditor.get
can be used to get the list of images and animations in an atlas, and then to look up the properties of the returned nodeseditor.tx.add
, editor.tx.remove
, and editor.tx.clear
can be used to edit these node listseditor.can_add
can be used to check if a node property is a list of nodesSome examples:
editor.transact({
editor.tx.add("/main.atlas", "images", {image="/assets/hero.png"})
})
local all_images = {} ---@type table<string, true>
-- first, collect all "bare" images
local image_nodes = editor.get("/main.atlas", "images")
for i = 1, #image_nodes do
all_images[editor.get(image_nodes[i], "image")] = true
end
-- second, collect all images used in animations
local animation_nodes = editor.get("/main.atlas", "animations")
for i = 1, #animation_nodes do
local animation_image_nodes = editor.get(animation_nodes[i], "images")
for j = 1, #animation_image_nodes do
all_images[editor.get(animation_image_nodes[j], "image")] = true
end
end
pprint(all_images)
-- {
-- ["/assets/hero.png"] = true,
-- ["/assets/enemy.png"] = true,
-- }}
editor.transact({
editor.tx.clear("/main.atlas", "animations"),
editor.tx.add("/main.atlas", "animations", {
id = "hero_run",
images = {
{image = "/assets/hero_run_1.png"},
{image = "/assets/hero_run_2.png"},
{image = "/assets/hero_run_3.png"},
{image = "/assets/hero_run_4.png"}
}
})
})
Related to https://github.com/defold/defold/issues/8504
NEW: (#10701) ‘Introduce property drag handle’ by sprocketc
Draggable properties now display a dedicated drag controller on mouse over input, instead of using the label as a handle.
NEW: (#10662) ‘Expose tilesource animations and collision groups to editor scripts’ by vlaaad Now editor scripts can access and edit animations and collision groups of tilesources using these 3 new tilesource properties:
animations
- a list of animation nodes of the tilesourcecollision_groups
- a list of collision group nodes of the tilesourcetile_collision_groups
- a table of collision group assignments for tiles in the tilesourceFor example, here is how you can setup a tilesource:
local tilesource = "/game/world.tilesource"
editor.transact({
editor.tx.add(tilesource, "animations", {id = "idle", start_tile = 1, end_tile = 1}),
editor.tx.add(tilesource, "animations", {id = "walk", start_tile = 2, end_tile = 6, fps = 10}),
editor.tx.add(tilesource, "collision_groups", {id = "player"}),
editor.tx.add(tilesource, "collision_groups", {id = "obstacle"}),
editor.tx.set(tilesource, "tile_collision_groups", {
[1] = "player",
[7] = "obstacle",
[8] = "obstacle"
})
})
NEW: (#10714) ‘Edit tilemaps using editor scripts’ by vlaaad Now you can edit tilemaps using editor scripts! To support this feature, we introduce the following additions to the editor script API:
editor.get(tilemap_layer, "tiles")
to get tiles from a tilemap layereditor.tx.set(tilemap_layer, "tiles", tiles)
to create a transaction step that sets tiles in a tilemap layertilemap.tiles.new()
to create a fresh data structure that holds an unbounded 2d tile grid (in the editor, contrary to the engine, the tilemap is unbounded, and coordinates may be negative)tilemap.tiles.get_tile(tiles, x, y)
to get a tile index at a specific coordinatetilemap.tiles.get_info(tiles, x, y)
to get full tile information at a specific coordinate (the data shape is the same as in the engine’s tilemap.get_tile_info
function)tilemap.tiles.iterator(tiles)
to create an iterator over all tiles in the tilemaptilemap.tiles.clear(tiles)
to remove all tiles from the tilemaptilemap.tiles.set(tiles, x, y, tile_or_info)
to set a tile at a specific coordinatetilemap.tiles.remove(tiles, x, y)
to remove a tile at a specific coordinateFor example, here is how you can print the contents of the whole tilemap:
local layers = editor.get("/level.tilemap", "layers")
for i = 1, #layers do
local layer = layers[i]
local id = editor.get(layer, "id")
local tiles = editor.get(layer, "tiles")
print("layer " .. id .. ": {")
for x, y, tile in tilemap.tiles.iterator(tiles) do
print(" [" .. x .. ", " .. y .. "] = " .. tile)
end
print("}")
end
Here is how you can add a layer with tiles to a tilemap:
local tiles = tilemap.tiles.new()
tilemap.tiles.set(tiles, 1, 1, 2)
editor.transact({
editor.tx.add("/level.tilemap", "layers", {
id = "new_layer",
tiles = tiles
})
})
NEW: (#10723) ‘Edit particlefx emitters and modifiers using editor scripts’ by vlaaad With this change, it’s now possible to edit particlefx emitters and modifiers using editor scripts. We added:
"emitters"
and "modifiers"
properties on particlefx component"modifiers"
property on particlefx emitter componentNew emitters
and modifiers
properties are node lists, where each node may be accessed using editor.get()
and modified using editor.tx.set()
. For example, adding a new circle emitter works like this:
editor.transact({
editor.tx.add("/fire.particlefx", "emitters", {
type = "emitter-type-circle"
})
})
Curves are represented as a table with a non-empty list of points
, where each point is a table with the following properties:
x
- the x coordinate of the point, should start at 0 and end at 1y
- the value of the pointtx
(0 to 1) and ty
(-1 to 1) - tangents of the point. E.g., for an 80-degree angle, tx
should be math.cos(math.rad(80))
and ty
should be math.sin(math.rad(80))
.
Curve spreads additionally have a spread
number property.For example, setting a particle lifetime alpha curve might look like this:
editor.transact({
editor.tx.set(emitter, "particle_key_alpha", { points = {
{x = 0, y = 0, tx = 0.1, ty = 1}, -- start at 0, go up quickly
{x = 0.2, y = 1, tx = 1, ty = 0}, -- reach 1 at 20% of a lifetime
{x = 1, y = 0, tx = 1, ty = 0} -- slowly go down to 0
}})
})
FIX: (#10611) ‘Add game objects, collections and components on drop’ by sprocketc
Add game objects, collections and components on drop to scenes.
FIX: (#10612) ‘Fix minimum scrollbar thumb size’ by sprocketc Increased minimum scrollbar thumb size.
Before (600 nodes) -> After (600 nodes)
FIX: (#10522) ‘Render convex hull collision shape’ by sprocketc
Renders the collision polygon of .convexshape
files.
FIX: (#10610) ‘Don’t apply Model material assignments unless fully-formed’ by matgis
The editor will no longer try to apply Model material assignments that do not refer to a .material
resource when rendering Models in the Scene View. This fixes an issue where manually deleting the path from the material resource field of a previously assigned material, that is no longer defined in the referenced Mesh, would cause an exception that locked up the editor.
FIX: (#10696) ‘Take page offset into account when calculating the absolute position of the pivot handle’ by sprocketc Fixed pivot point handle position on paged atlases.
FIX: (#10697) ‘Improve performance when editing a large tilesource’ by sprocketc Editing collision groups or other properties of a tilesource which do not affect the tilesource layout will no longer regenerate the texture.
FIX: (#10685) ‘Fixed an issue with editor logs’ by AGulev Fixes the issue where logs in the Editor’s console don’t work when Simulated Resolution is used (Windows only).