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

TileSetDefinition PreProcessor & added missing PreProcess invocations #55

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

leohilbert
Copy link

Hi!
Based on our conversation in discord, I spent some time adding a TilesetDefinition PreProcessor and integrating it into my project, to finally replace my custom PreProcessor that I needed to patch in after every update.

While integrating I noticed that the PreProcessors for Level & Project were not always invoked after reading the JSON. This resulted in my adjustments not being executed everywhere (e.g. in the JsonEditorCache). I think the easiest and safest bet is to just always execute it directly after a Level-, Project- or TilesetDefinition-Json is parsed.
I also needed to add the AssetPath of the parsed Json, because I need it :|

Let me know what you think :)

@Cammin
Copy link
Owner

Cammin commented May 23, 2024

always execute it directly after a Level-, Project- or TilesetDefinition-Json is parsed

I haven't looked into the commit yet, but reading this, I'm concerned that this might create some additional performance overhead 😬
Though it's probably quite fine compared to other stuff

I also needed to add the AssetPath of the parsed Json, because I need it :|

I might look into making a new field to LDtkPreprocessor so it has an asset import context just like the postprocessor; that way we can avoid an additional parameter

@Cammin
Copy link
Owner

Cammin commented May 25, 2024

I have a question: Could we have this merge request target a brand-new branch in your fork so I can test it out (and potentially make some minor tweaks) before merging?

I'm new to pull requests, I'm not 100% sure how to test something that is targeting the master branch without actually merging it in.
Maybe there is an easier way for me to approach this, let me know 😅

@leohilbert
Copy link
Author

Hi, thanks so much for looking into this! I don't know how often the Project/Tileset Def Jsons are parsed, but I don't think this one reflection call will take a lot of time. Doesn't hurt to check though of course!

I also never worked with pullrequests from an external fork into the main repository.
Normally its always just a branch within the same repo 😅 I think the easiest approach would be to add my repo as an additional origin in your (local) git project.
Via cli that would be git remote add leo https://github.com/leohilbert/LDtkToUnity.git i think. In a Git GUI you can also just click "add remote" somewhere. If you are using the Github CLI there is also this command to "Checkout with GitHub CLI", but I don't know what it does haha gh pr checkout 55
Now you have your own origin and my origin (called leo) and can just checkout my master branch without switching the git project. Alternatively you can just clone my repo separately, but then everything is duplicated and you need to set up and additional Unity project etc etc.
I have Allow edits by maintainers enabled, so I think you are allowed to commit and push on my branch as you please :)

@Cammin
Copy link
Owner

Cammin commented May 27, 2024

Cool, I'll give these a try when I get around to it, thanks for helping 👍

@Cammin
Copy link
Owner

Cammin commented Dec 11, 2024

Reviewing this again, it seems good. But I still need to get around to cloning your branch and playing with it. I ought to make it my mission soon

@leohilbert
Copy link
Author

all good, the workflow of just merging your latest release into this fork and then merging it into my project works fine for me as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants