-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement unload of PCK files #61286
base: master
Are you sure you want to change the base?
Conversation
I think the testing project would be worth adding to the demo projects repository 🙂 |
Will do! I'll clean up the code for it then 😉 |
Finally got a chance to work at this again 😌. I've added a demo at godotengine/godot-demo-projects#751 |
045b159
to
c0c4957
Compare
c0c4957
to
a51032d
Compare
Hi! What is the status on this pr? Curious when would it be merged because It's necessary for my project |
4.0 is in feature freeze, so this can only be merged for 4.1 at the earliest. In the meantime, you can pull the pull request's code into the |
Now that 4.0 is released, can we get this reviewed? There seems to people requesting this feature and there was effort to make a demo too. |
This will need an update due to the new UID system (#50786). While it still works, since the UIDs among different sources for the same resource don't match (or replaced resources likely will get different UIDs), it generates a lot of warnings, and uses the file path as fallback. I'm gonna need some time to find a solution to get these UIDs and account for them when loading PCK files. For now, I'll mark this as a draft since it's not ready to be merged. |
a51032d
to
13769ca
Compare
|
13769ca
to
ddfcb91
Compare
After more investigation, it looks like the godot/editor/export/editor_export_platform.cpp Lines 842 to 845 in 4642448
However, this issue occurs when loading PCK files, and doesn't concern anything from this PR, so I'll separate this to another issue/PR. The unloading functionality is working as intended, so this PR is ready to merge. |
This has a bug where if scripts from different packs share the same filename, their contents are still re-used even when packs are unloaded (likely EDIT: Fixed |
ddfcb91
to
87a38bd
Compare
87a38bd
to
4e1be1c
Compare
4e1be1c
to
66e5cfc
Compare
66e5cfc
to
41d2f26
Compare
Is it realistic that this will be released with godot 4.3? |
Looking forward of it being merged too |
We can't promise this will be merged for a specific release, as this still needs review from contributors knowledgeable with core parts of the engine. This is the area of engine which is critical to keep in a clean state since everything else relies on it, so there's naturally more resistance to change in that area too. |
any update on this? I would love to see this merged one day 😊 |
41d2f26
to
8ac6823
Compare
Implements some ideas from godotengine/godot-proposals#2689.
This adds the functionality to unload any manually loaded pack from
load_resource_pack
, as well as querying if a specific pack is currently loaded.The tricky part here is handling packs that replace files. The way I implemented some scenarios may not be what's intended, so I'll describe scenarios I found to ensure the behavior is intended. I also created a small project to help me test this, so if you want to play around and test these for yourself, here are the project files:
PCKTestingTool.zip
Peek.2023-07-01.12-13.mp4
On all these scenarios, there are 3 PCK files, all with different content on each scene, but with some duplicated names:
Unloading pack which replaced some files from another one
2.pck
:3.pck
with replacing files enabled:3.pck
, the files from2.pck
that were replaced are fetched and loaded again, essentially restoring the previous state:Unloading pack which replaced files from an unloaded package
1.pck
:2.pck
with replacing files enabled:1.pck
(nothing happens because all its files were replaced by2.pck
):2.pck
, the files from1.pck
could have been replaced; however, because1.pck
has been unloaded in the meantime, none of it's files are reloaded:Unloading pack which didn't replace any existing files
1.pck
2.pck
without replacing files:1.pck
, the only files remaining are the ones2.pck
was able to load, leaving it in a partial state:2.pck
loads the missing files: