You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 8, 2021. It is now read-only.
When spawning a custom Deck or Card using spawnObjectJSON, when the callback_function is executed, the object should be in a valid state. However, loading_custom is incorrectly false despite the fact the card/deck is still not in its final state, as custom resources are still being loaded at this point.
To Reproduce
Create a new Single Player game, dismiss the Load prompt to use the default empty scene.
Open the Scripting editor and paste the Lua attached below into Global.
Hit "Save & Play".
Expected behavior
Should see in Game chat tab:
Spawning: false
Loading custom: true
Alternatively, if the resource really did load in one frame, the card object should be in its final ready to use state. Presently, that's not the case, it's still grey and the card's aspect ratio still reflects the default custom card aspect ratio.
Tabletop Simulator Info (please complete the following information):
OS: macOS
Version: v12.2.1-12.2.3
Known workarounds
None. We have no way of knowing when the resource loading has actually finished.
In practice, if the load came from the cache, waiting not one, but two frames, after the callback_function has fired, seems to be enough time for the resources to loaded and applied. Although, that could easily be platform specific, in general this approach is far from reliable.
Nonetheless, the above only "works" for cached resources. When loading from the network, despite the fact loading_custom will be true in the callback_function, it's set to false too early. Even if we do something like:
Wait.condition(function()
Wait.frames(function()
-- Code you want to execute with a fully loaded card/deckend, 2)
end, function()
returnnotobject.spawningandnotobject.loading_customend, 10)
waiting 2, or even 3 frames isn't enough. At this point it's far too much of guessing game, and it's not likely to be consistent.
Describe the bug
When spawning a custom Deck or Card using
spawnObjectJSON
, when thecallback_function
is executed, the object should be in a valid state. However,loading_custom
is incorrectlyfalse
despite the fact the card/deck is still not in its final state, as custom resources are still being loaded at this point.To Reproduce
Expected behavior
Should see in Game chat tab:
Alternatively, if the resource really did load in one frame, the card object should be in its final ready to use state. Presently, that's not the case, it's still grey and the card's aspect ratio still reflects the default custom card aspect ratio.
Actual behavior
Instead seeing:
Lua Scripts:
Global:
Tabletop Simulator Info (please complete the following information):
Known workarounds
None. We have no way of knowing when the resource loading has actually finished.
In practice, if the load came from the cache, waiting not one, but two frames, after the
callback_function
has fired, seems to be enough time for the resources to loaded and applied. Although, that could easily be platform specific, in general this approach is far from reliable.Nonetheless, the above only "works" for cached resources. When loading from the network, despite the fact
loading_custom
will betrue
in thecallback_function
, it's set tofalse
too early. Even if we do something like:waiting 2, or even 3 frames isn't enough. At this point it's far too much of guessing game, and it's not likely to be consistent.
Additional context
Stack traces and screenshots:
https://gist.github.com/Benjamin-Dobell/f4808ab5b3bee7068779a288f1268576
The text was updated successfully, but these errors were encountered: