Repository navigation
fix(SerializedFile): load dependencies as dependencies - #392
Open
nichinichisou0609 wants to merge 1 commit into
Open
nichinichisou0609 wants to merge 1 commit into
nichinichisou0609 wants to merge 1 commit into
Conversation
load_dependencies called environment.load_file(path, True), which passes True as the parent argument, so is_dependency stayed False. The externals of a file, also the ones loaded while get_resource_data looks for a resource file, were therefore treated as files the user loaded: their objects showed up in Environment.objects next to the objects of the loaded file. is_dependency=True is now passed by keyword, so dependencies resolve references and resources but are no longer listed as objects. tests/test_dependencies.py writes two copies of a sample serialized file to a temporary directory, the first listing the second as an external, and checks that loading the dependency leaves Environment.objects as it was.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SerializedFile.load_dependenciescallsenvironment.load_file(path, True), which passesTrueas theparentargument ofload_file, sois_dependencystaysFalse.get_resource_datacallsload_dependencieswhen the resource file of a texture, mesh or audio clip is not loaded yet, which then loads every external of the file as if the user had loaded it: their objects show up inEnvironment.objectsnext to the objects of the loaded file, and a loop overenv.objectsthat runs again after reading such data also goes through the objects of the externals.is_dependency=Trueis now passed by keyword, so the externals still resolve references and resources but are no longer listed as objects.tests/test_dependencies.py(new) writes two copies of a sample serialized file to a temporary directory, the first listing the second as an external, loads the first and checks thatload_dependencies()leavesEnvironment.objectsas it was and marks the loaded external as a dependency.Validation on Windows x86_64, CPython 3.11.13, pytest 9.1.1. The compiled path uses the
UnityPyBoostextension of the 1.25.4 wheel;UnityPyBoost/has no changes between 1.25.4 and417d595. This branch and #383 merge without conflicts.417d595ruff checkandruff format --check