Skip to content
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

Fix LDtk tile map resources export with the fast loading #5951

Merged
merged 6 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/GDCore/IDE/Project/ArbitraryResourceWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,12 @@ bool ResourceWorkerInEventsWorker::DoVisitInstruction(gd::Instruction& instructi
} else if (parameterMetadata.GetType() == "jsonResource") {
gd::String updatedParameterValue = parameterValue;
worker.ExposeJson(updatedParameterValue);
worker.ExposeEmbeddeds(updatedParameterValue);
instruction.SetParameter(parameterIndex, updatedParameterValue);
} else if (parameterMetadata.GetType() == "tilemapResource") {
gd::String updatedParameterValue = parameterValue;
worker.ExposeTilemap(updatedParameterValue);
worker.ExposeEmbeddeds(updatedParameterValue);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only those 2 types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only these kind of resources are depending on external files.

instruction.SetParameter(parameterIndex, updatedParameterValue);
} else if (parameterMetadata.GetType() == "tilesetResource") {
gd::String updatedParameterValue = parameterValue;
Expand Down
10 changes: 10 additions & 0 deletions Core/GDCore/IDE/Project/SceneResourcesFinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@ namespace gd {

std::set<gd::String> SceneResourcesFinder::FindProjectResources(gd::Project &project) {
gd::SceneResourcesFinder resourceWorker;

// TODO Refactor this to avoid to list all project resources as files.
gd::ResourcesManager* resourcesManager = &(project.GetResourcesManager());
resourceWorker.ExposeResources(resourcesManager);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth adding and doing a

Suggested change
// TODO Refactor this to avoid to list all project resources as files.
gd::ResourcesManager* resourcesManager = &(project.GetResourcesManager());
resourceWorker.ExposeResources(resourcesManager);
// TODO Refactor this to avoid to list all project resources as files.
gd::ResourcesManager* resourcesManager = &(project.GetResourcesManager());
resourceWorker.SetResourcesManager(resourcesManager);

To avoid all the calls to ExposeResource that will uselessly list all project resources as files?


gd::ResourceExposer::ExposeProjectResources(project, resourceWorker);
return resourceWorker.resourceNames;
}

std::set<gd::String> SceneResourcesFinder::FindSceneResources(gd::Project &project,
gd::Layout &layout) {
gd::SceneResourcesFinder resourceWorker;

// TODO Refactor this to avoid to list all project resources as files.
gd::ResourcesManager* resourcesManager = &(project.GetResourcesManager());
resourceWorker.ExposeResources(resourcesManager);

gd::ResourceExposer::ExposeLayoutResources(project, layout, resourceWorker);
return resourceWorker.resourceNames;
}
Expand Down