QodotPlugin / qodot-plugin

(LEGACY) Quake .map support for Godot 3.x
MIT License
960 stars 70 forks source link

Suggestion about project settings #94

Open sunkper opened 4 years ago

sunkper commented 4 years ago

I think it would be good to have project settings for Qodot, so users can set default settings per project. For example:

Shfty commented 4 years ago

Adding project settings entries for these should be fairly easy, but I'll have to think on actually making QodotMap respect them - default values in the inspector are driven by class-scope values that get baked into the definition at compile-time, so getting it to work in an elegant fashion will require some setter-driven trickery.

Ideally I'd want to be able to offer overridable defaults for every property in QodotMap, so a more generalized solution is probably in order.

On the PBR properties, that extends beyond the scope of default values and into the realm of the texture loader, so I've opened a separate issue for the functionality itself: #101

Any further thoughts you may have on either issue would be most welcome @sunkper

kryptot7 commented 3 years ago

I actually think default directories could be better implemented using EditorSettings. Currently, all paths are absolute, and they match your (@Shfty 's) hard drive, but not mine. For example: P:/Personal/Godot/Qodot/qodot-example/addons/qodot/example_scenes/1-interactivity/4-advanced-signal-wiring/4-advanced-signal-wiring.map So to re-build any example maps, I have to use Godot's file picker to choose the same file but with an absolute path that fits my hard drive.

If file path settings are saved with the Editor and NOT with the project, users on multiple computers can download the files and edit them wherever they want on their hard drive, without having to manually change every file path (which is, AFAIK, what you have to do now; not workable for teams). I also think you can skirt past the class-scope values issue by making all paths RELATIVE to the editor setting. That way, it's okay if the "path" string variable in, say, a QodotMap object is set in stone. The full file path will be added together like this...

# inside a QodotMap
path = "maps/bobomb_battlefield/luigi_land.map"
actual_path_to_load = str(EditorSettings.get_setting("Qodot_asset_directory"), /, path)
# example result: C:/Users/foofoocuddlyfoops/my_supercalifragilisticexpialidocious_godot_thing/maps/bobomb_battlefield/luigi_land.map

To accommodate multiple projects on one computer, perhaps EditorSettings could contain a dictionary that matches each a project directory with an "assets" directory (where Qodot looks for assets). By default, the assets directory and the project directory could be one and the same, encouraging users to store their maps and textures in res://.

Alternatively, just make all of this super simple and make all asset paths relative to res://.

If this is change implemented in an update, it could cause some issues upgrading a Qodot project (like if someone has their files scattered across their hard drive). However, these can be solved by finding all the used .maps and textures and automatically copying them all into organized locations within the res:// folder during the upgrade process.

One final note, I think Trenchbroom's location should also be stored as a separate Editor Setting (rather than baked into the definition of an FGD asset) for similar usability reasons.