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

Warn if nodes added by user are inside the QodotMap when pressing Build #88

Open
cybernaut4 opened this issue Sep 27, 2023 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@cybernaut4
Copy link

Situation

I'm using TrenchBroom and the plugin to build the base gameplay geometry, then add models on top.

Problem

When not paying attention where you're adding said models, if any node within QodotMap is selected, everything you drag and drop goes in there. When pressing the build button, everything inside is deleted or queued free. CTRL+Z is not effective, making it a certain waste of time because of not paying attention to the hierarchy.

Solution

All nodes generated by QodotMap are named with prefix "entity_"
A checking operation can be made upon pressing a Build button, before it actually starts building the map, to check if any children not named with said prefix exists. If there is any, then pop a window to warn the user "The nodes inserted by you inside QodotMap will be deleted before building the map. Are you sure?" and the buttons "No, I'm not." "Yes, continue."

If it's possible, also a checkbox that says "Don't ask me again" which could be disabled in Project Settings -> Qodot.

@RhapsodyInGeek
Copy link
Collaborator

RhapsodyInGeek commented Sep 28, 2023

Unfortunately it cannot be guaranteed that all nodes will be named with the prefix "entity_", since users can customize their entities to autogenerate others or change their own names in order to link them to other entities via their code.

If you run into an issue where you accidentally place nodes as children of the QodotMap node and rebuild the map, your best option is to close the scene without saving to restore the erased nodes, provided you saved prior to building.

I personally recommend creating an entity definition that will allow you to place those models from within TrenchBroom. It's a bit of extra work, but it's safer and allows you a bit more flexibility in my opinion.

@DeerTears
Copy link
Member

Could you also import the QodotMap as its own .tscn rather than making it the scene root? That's my only understanding of how dragging and dropping nodes into the SceneTree would parent it to the QodotMap.

I feel like it'd be more reliable to throw a warning when a QodotMap is an empty scene root (so it doesn't get in the way all the time) with this kind of information, ensuring the user knows they're risking losing edits after build.

@DeerTears DeerTears added the documentation Improvements or additions to documentation label Oct 18, 2023
@RhapsodyInGeek
Copy link
Collaborator

Funny enough, despite my tutorial, in my actual projects I never have the QodotMap node be the root node in my scenes. Maybe it'd be useful to put as a best practices, update my guide's FAQ for that.

I feel like it'd be more reliable to throw a warning when a QodotMap is an empty scene root
I was initially agreeing with this idea until I thought to myself: "what about when the user adds nodes to the QodotMap node when it's not a scene root?" Becomes sort of a "When do we stop warning them?"

I think a warning with an editor setting to disable the warning could be helpful.

#95 adds Editor Settings in a way that I think would work well that doesn't break projects. I would've preferred it as a separate PR but it's also needed for her Model Point Class to work. Still need to review it though since the fork it was being added with was a fair bit behind the main branch and would've undone a lot of recent changes, but I think Gwen fixed that.

If it checks out and we merge it, then it shouldn't be too much trouble to add it to the Qodot Editor Settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

No branches or pull requests

3 participants