Replace atlast with liveupdate version

I am trying to use liveupdate to load atlas with icons.
But i get this erorr.

It is because i already use this atlas in game?


go.property("atlas_empty", resource.atlas("/assets/images/icons/skins/skins_empty.atlas"))
go.property("atlas", resource.atlas("/assets/images/icons/skins/skins.atlas"))

function init(self)
	print(self.atlas_empty)
	print(self.atlas)
	pprint(resource.get_atlas(self.atlas_empty).animations)
	pprint(resource.get_atlas(self.atlas).animations)
	print("replace skins atlas")
	resource.set_atlas(self.atlas_empty, resource.get_atlas(self.atlas))
	pprint(resource.get_atlas(self.atlas_empty).animations)
end

Logs

DEBUG:SCRIPT: [INFO 16:58:16] none: liveupdate_atlases.script:5: hash: [/assets/images/icons/skins/skins_empty.a.texturesetc]
DEBUG:SCRIPT: [INFO 16:58:16] none: liveupdate_atlases.script:6: hash: [/assets/images/icons/skins/skins.a.texturesetc]
DEBUG:SCRIPT: 
{ --[[000002B877B72140]]
  1 = { --[[000002B877B72190]]
    flip_vertical = false,
    width = 64,
    id = "unknown",
    height = 84,
    fps = 30,
    playback = 0,
    frame_start = 1,
    frame_end = 2,
    flip_horizontal = false
  }
}
DEBUG:SCRIPT: 
{ --[[000002B877B72850]]
  1 = { --[[000002B877B728A0]]
    flip_vertical = false,
    width = 61,
    id = "char_beard_man",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 1,
    frame_end = 2,
    flip_horizontal = false
  },
  2 = { --[[000002B877B72920]]
    flip_vertical = false,
    width = 61,
    id = "char_boxer",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 2,
    frame_end = 3,
    flip_horizontal = false
  },
  3 = { --[[000002B877B729A0]]
    flip_vertical = false,
    width = 61,
    id = "char_boxer_girl",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 3,
    frame_end = 4,
    flip_horizontal = false
  },
  4 = { --[[000002B877B72C60]]
    flip_vertical = false,
    width = 61,
    id = "char_cookie",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 4,
    frame_end = 5,
    flip_horizontal = false
  },
  5 = { --[[000002B877B72E90]]
    flip_vertical = false,
    width = 61,
    id = "char_cool_guy",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 5,
    frame_end = 6,
    flip_horizontal = false
  },
  6 = { --[[000002B877B72A20]]
    flip_vertical = false,
    width = 61,
    id = "char_cyborg",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 6,
    frame_end = 7,
    flip_horizontal = false
  },
  7 = { --[[000002B877B730F0]]
    flip_vertical = false,
    width = 61,
    id = "char_dark_soldier",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 7,
    frame_end = 8,
    flip_horizontal = false
  },
  8 = { --[[000002B877B734E0]]
    flip_vertical = false,
    width = 61,
    id = "char_eagle",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 8,
    frame_end = 9,
    flip_horizontal = false
  },
  9 = { --[[000002B877B73530]]
    flip_vertical = false,
    width = 61,
    id = "char_executener",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 9,
    frame_end = 10,
    flip_horizontal = false
  },
  10 = { --[[000002B877B72F10]]
    flip_vertical = false,
    width = 61,
    id = "char_general",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 10,
    frame_end = 11,
    flip_horizontal = false
  },
  11 = { --[[000002B877B73B30]]
    flip_vertical = false,
    width = 61,
    id = "char_human_1",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 11,
    frame_end = 12,
    flip_horizontal = false
  },
  12 = { --[[000002B877B73BB0]]
    flip_vertical = false,
    width = 61,
    id = "char_kori",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 12,
    frame_end = 13,
    flip_horizontal = false
  },
  13 = { --[[000002B877B73DC0]]
    flip_vertical = false,
    width = 61,
    id = "char_layer",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 13,
    frame_end = 14,
    flip_horizontal = false
  },
  14 = { --[[000002B877B73FF0]]
    flip_vertical = false,
    width = 61,
    id = "char_mecha",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 14,
    frame_end = 15,
    flip_horizontal = false
  },
  15 = { --[[000002B877B74070]]
    flip_vertical = false,
    width = 61,
    id = "char_metalmecha",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 15,
    frame_end = 16,
    flip_horizontal = false
  },
  16 = { --[[000002B877B74410]]
    flip_vertical = false,
    width = 61,
    id = "char_ninja",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 16,
    frame_end = 17,
    flip_horizontal = false
  },
  17 = { --[[000002B877B74640]]
    flip_vertical = false,
    width = 61,
    id = "char_policeman",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 17,
    frame_end = 18,
    flip_horizontal = false
  },
  18 = { --[[000002B877B746C0]]
    flip_vertical = false,
    width = 61,
    id = "...
[Output truncated]
DEBUG:SCRIPT: [INFO 16:58:16] none: liveupdate_atlases.script:9: replace skins atlas
DEBUG:SCRIPT: 
{ --[[000002B8780A9210]]
  1 = { --[[000002B8780A9260]]
    flip_vertical = false,
    width = 61,
    id = "char_beard_man",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 1,
    frame_end = 2,
    flip_horizontal = false
  },
  2 = { --[[000002B8780A92B0]]
    flip_vertical = false,
    width = 61,
    id = "char_boxer",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 2,
    frame_end = 3,
    flip_horizontal = false
  },
  3 = { --[[000002B8780A9300]]
    flip_vertical = false,
    width = 61,
    id = "char_boxer_girl",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 3,
    frame_end = 4,
    flip_horizontal = false
  },
  4 = { --[[000002B8780A9350]]
    flip_vertical = false,
    width = 61,
    id = "char_cookie",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 4,
    frame_end = 5,
    flip_horizontal = false
  },
  5 = { --[[000002B8780A93A0]]
    flip_vertical = false,
    width = 61,
    id = "char_cool_guy",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 5,
    frame_end = 6,
    flip_horizontal = false
  },
  6 = { --[[000002B8780A95D0]]
    flip_vertical = false,
    width = 61,
    id = "char_cyborg",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 6,
    frame_end = 7,
    flip_horizontal = false
  },
  7 = { --[[000002B8780A9970]]
    flip_vertical = false,
    width = 61,
    id = "char_dark_soldier",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 7,
    frame_end = 8,
    flip_horizontal = false
  },
  8 = { --[[000002B8780A99C0]]
    flip_vertical = false,
    width = 61,
    id = "char_eagle",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 8,
    frame_end = 9,
    flip_horizontal = false
  },
  9 = { --[[000002B8780A9D60]]
    flip_vertical = false,
    width = 61,
    id = "char_executener",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 9,
    frame_end = 10,
    flip_horizontal = false
  },
  10 = { --[[000002B8780A9580]]
    flip_vertical = false,
    width = 61,
    id = "char_general",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 10,
    frame_end = 11,
    flip_horizontal = false
  },
  11 = { --[[000002B8780A9DB0]]
    flip_vertical = false,
    width = 61,
    id = "char_human_1",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 11,
    frame_end = 12,
    flip_horizontal = false
  },
  12 = { --[[000002B8780AA540]]
    flip_vertical = false,
    width = 61,
    id = "char_kori",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 12,
    frame_end = 13,
    flip_horizontal = false
  },
  13 = { --[[000002B8780AA590]]
    flip_vertical = false,
    width = 61,
    id = "char_layer",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 13,
    frame_end = 14,
    flip_horizontal = false
  },
  14 = { --[[000002B8780AA7A0]]
    flip_vertical = false,
    width = 61,
    id = "char_mecha",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 14,
    frame_end = 15,
    flip_horizontal = false
  },
  15 = { --[[000002B8780AA7F0]]
    flip_vertical = false,
    width = 61,
    id = "char_metalmecha",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 15,
    frame_end = 16,
    flip_horizontal = false
  },
  16 = { --[[000002B8780AAB90]]
    flip_vertical = false,
    width = 61,
    id = "char_ninja",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 16,
    frame_end = 17,
    flip_horizontal = false
  },
  17 = { --[[000002B8780AABE0]]
    flip_vertical = false,
    width = 61,
    id = "char_policeman",
    height = 120,
    fps = 30,
    playback = 0,
    frame_start = 17,
    frame_end = 18,
    flip_horizontal = false
  },
  18 = { --[[000002B8780AAF80]]
    flip_vertical = false,
    width = 61,
    id = "...
[Output truncated]

ERROR

Assertion failed: i < m_Capacity, file D:\a\defold\defold\tmp\dynamo_home\include\dlib/opaque_handle_container.h, line 244
INFO:CRASH: Successfully wrote Crashdump to file: C:\Users\user\AppData\Roaming\Defold/_crash
ERROR:CRASH: CALL STACK:

ERROR:CRASH:  0 0x7FF77C494660 dmCrash::GenerateCallstack D:\a\defold\defold\engine\crash\src\backtrace_win32.cpp:144
ERROR:CRASH:  1 0x7FF77C7CD810 raise /tmp/job2786423018271048004/minkernel/crts/ucrt/src/appcrt/misc/signal.cpp:547
ERROR:CRASH:  2 0x7FF77C7BDB68 abort /tmp/job2786423018271048004/minkernel/crts/ucrt/src/appcrt/startup/abort.cpp:71
ERROR:CRASH:  3 0x7FF77C7BCE4C common_assert_to_stderr<wchar_t> /tmp/job2786423018271048004/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:186
ERROR:CRASH:  4 0x7FF77C7BC964 _wassert /tmp/job2786423018271048004/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:443
ERROR:CRASH:  5 0x7FF77C44FAA0 dmOpaqueHandleContainer<unsigned __int64>::Get D:\a\defold\defold\tmp\dynamo_home\include\dlib\opaque_handle_container.h:231
ERROR:CRASH:  6 0x7FF77C45C140 dmGraphics::OpenGLGetOriginalTextureHeight D:\a\defold\defold\engine\graphics\src\opengl\graphics_opengl.cpp:3447
ERROR:CRASH:  7 0x7FF77C46F950 dmGameSystem::SetupGuiScene D:\a\defold\defold\engine\gamesys\src\gamesys\components\comp_gui.cpp:606
ERROR:CRASH:  8 0x7FF77C4702D0 dmGameSystem::CompGuiCreate D:\a\defold\defold\engine\gamesys\src\gamesys\components\comp_gui.cpp:781
ERROR:CRASH:  9 0x7FF77C4ED260 dmGameObject::CreateComponents D:\a\defold\defold\engine\gameobject\src\gameobject\gameobject.cpp:829
ERROR:CRASH: 10 0x7FF77C460E70 dmGameObject::AcquireResources D:\a\defold\defold\engine\gameobject\src\gameobject\res_collection.cpp:143
ERROR:CRASH: 11 0x7FF77C4617C0 dmGameObject::ResCollectionCreate D:\a\defold\defold\engine\gameobject\src\gameobject\res_collection.cpp:261
ERROR:CRASH: 12 0x7FF77C4E3780 dmResource::CreateResource D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:546
ERROR:CRASH: 13 0x7FF77C4E3C10 dmResource::PreloaderTryPruneParent D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:684
ERROR:CRASH: 14 0x7FF77C4E3C10 dmResource::PreloaderTryPruneParent D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:686
ERROR:CRASH: 15 0x7FF77C4E3C10 dmResource::PreloaderTryPruneParent D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:686
ERROR:CRASH: 16 0x7FF77C4E3C10 dmResource::PreloaderTryPruneParent D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:686
ERROR:CRASH: 17 0x7FF77C4E3DA0 dmResource::DoPreloaderUpdateOneReq D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:812
ERROR:CRASH: 18 0x7FF77C4E40B0 dmResource::PreloaderUpdateOneItem D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:760
ERROR:CRASH: 19 0x7FF77C4E3DA0 dmResource::DoPreloaderUpdateOneReq D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:823
ERROR:CRASH: 20 0x7FF77C4E40B0 dmResource::PreloaderUpdateOneItem D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:760
ERROR:CRASH: 21 0x7FF77C4E3DA0 dmResource::DoPreloaderUpdateOneReq D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:823
ERROR:CRASH: 22 0x7FF77C4E40B0 dmResource::PreloaderUpdateOneItem D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:760
ERROR:CRASH: 23 0x7FF77C4E3DA0 dmResource::DoPreloaderUpdateOneReq D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:823
ERROR:CRASH: 24 0x7FF77C4E40B0 dmResource::PreloaderUpdateOneItem D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:760
ERROR:CRASH: 25 0x7FF77C4E3DA0 dmResource::DoPreloaderUpdateOneReq D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:823
ERROR:CRASH: 26 0x7FF77C4E40B0 dmResource::PreloaderUpdateOneItem D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:760
ERROR:CRASH: 27 0x7FF77C4E1430 dmResource::UpdatePreloader D:\a\defold\defold\engine\resource\src\resource_preloader.cpp:951
ERROR:CRASH: 28 0x7FF77C5F75F0 dmGameSystem::CompCollectionProxyUpdate D:\a\defold\defold\engine\gamesys\src\gamesys\components\comp_collection_proxy.cpp:250
ERROR:CRASH: 29 0x7FF77C4F4540 dmGameObject::Update D:\a\defold\defold\engine\gameobject\src\gameobject\gameobject.cpp:2555
ERROR:CRASH: 30 0x7FF77C5792E0 dmEngine::StepFrame D:\a\defold\defold\engine\engine\src\engine.cpp:1642
ERROR:CRASH: 31 0x7FF77C574200 dmEngineUpdate D:\a\defold\defold\engine\engine\src\engine.cpp:2177
ERROR:CRASH: 32 0x7FF77C579D90 dmEngine::RunLoop D:\a\defold\defold\engine\engine\src\engine_loop.cpp:83
ERROR:CRASH: 33 0x7FF77C482250 engine_main D:\a\defold\defold\engine\engine\src\engine_main.cpp:148
ERROR:CRASH: 34 0x7FF77C776714 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
ERROR:CRASH: 35 0x7FFE1DAF7330 BaseThreadInitThunk <unknown>:0
ERROR:CRASH: 36 0x7FFE1E442690 RtlUserThreadStart <unknown>:0
ERROR:CRASH: 

1 Like

Ok if i add timer.delay it worked)

Now i have second problem.
For some images i get strange size.

It looks like if image is rotated in atlas i get bad size(

if LIVEUPDATE.is_ready() then
	gui.set_texture(self.vh_skin.icon, HASH_SKINS)
	gui.play_flipbook(self.vh_skin.icon, self.def.icon)
	gui.set_size_mode(self.vh_skin.icon, gui.SIZE_MODE_AUTO)
else
	gui.set_texture(self.vh_skin.icon, HASH_GUI)
	gui.play_flipbook(self.vh_skin.icon, "unknown")
	gui.set_size_mode(self.vh_skin.icon, gui.SIZE_MODE_AUTO)
end


In gui you add check that image is rotated.

I think in resource.get_atlas, you also need to add check for rotation?

I try to fix geomtry and now i get this)
Any ideas how to fix rotation?

local atlas = resource.get_atlas(self.atlas)
		for idx,geometry in ipairs(atlas.geometries) do
			if geometry.uvs[1]	~= geometry.uvs[3] then
				local tc = geometry.vertices
				--add rotation to geometry
				local new_vertices = {
					tc[3], tc[4],
					tc[5], tc[6],
					tc[7], tc[8],   -- top-right (corresponds to UV top-right)
					tc[1], tc[2],  -- bottom-right (corresponds to UV bottom-right)
				}

				geometry.vertices = new_vertices
			end
		end

Add rotation in gui)

I have no idea how to return this rotation in atlas)

if COMMON.skins_atlas.animations[self.def.icon].need_rotate then
	gui.set_rotation(self.vh_skin.icon, vmath.vector3(0,0,90))
else
	gui.set_rotation(self.vh_skin.icon, vmath.vector3(0,0,0))
end

Did you try gui.set_texture() with the atlas texture and then using gui.play_flipbook() as usual?

Yes I change texture and then play_flipbook.
And if texture region in atlas is rotated, image in node have wrong width and height

So you used the texture entry returned from resource.get_atlas()? If yes it should be a bug :roll_eyes:

Try to make repro cases.
I can’t reproduce this error in small repro case. But mb other errors that i can reproduce give you some ideas

ERROR:CRASH:  6 0x7FF77C45C140 dmGraphics::OpenGLGetOriginalTextureHeight D:\a\defold\defold\engine\graphics\src\opengl\graphics_opengl.cpp:3447
ERROR:CRASH:  7 0x7FF77C46F950 dmGameSystem::SetupGuiScene D:\a\defold\defold\engine\gamesys\src\gamesys\components\comp_gui.cpp:606
ERROR:CRASH:  8 0x7FF77C4702D0 dmGameSystem::CompGuiCreate D:\a\defold\defold\engine\gamesys\src\gamesys\components\comp_gui.cpp:781
ERROR:CRASH:  9 0x7FF77C4ED260 dmGameObject::CreateComponents D:\a\defold\defold\engine\gameobject\src\gameobject\gameobject.cpp:829

So which of the issues reported are still happening now? We merged a fix for gui to make sure the resource pointers are used instead of raw atlas pointers, which fixed one or two of these.

1 Like

Thanks for fixes👍

This issue is still existed.The only one issue where I can’t create small repro case:(

3 Likes

How do I repro it in your project? You can write dm if it’s sensitive info

1 Like

Add info in issue

Excellent, thank you!

1 Like

Found the issue and a fix is on the way :+1:

4 Likes