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

Allow quick creation of scripts. #1827

Merged
merged 1 commit into from Feb 19, 2024

Conversation

MineBill
Copy link
Contributor

@MineBill MineBill commented Oct 28, 2023

Implements #1820

2023-10-28.20-39-21.mp4

This allows for quick creation and attachment of scripts when clicking the "Add script" button in the properties window for an Actor. I am not at all happy with this implementation for a couple of reasons:

  • The Editor has no knowledge about which modules exist and are active. As such, we have to resort to hacky solutions by manually scanning the target files and search for strings, which might indicate what modules are available. This PR reads all *.Build.cs files in the source directory and scans for the "Modules.Add" string to see if the Game module exists. But what happens if a user modifies their build script as such:
var mods = Modules;
mods.Add(
"Game");

Ideally, the editor would have a list of active modules, their names, their paths, if they are editor modules or not etc.

  • There is no "main" game module. All modules are treated equally and maybe that's a good thing. But this makes it harder to make certain assumptions. In this case, we could assume that newly created scripts, not including ones created from the Content Window, would be put inside the "main" module. Right now, because all the project templates create a "Game" module, i treat it as the "main" module and if it is not available i ask the user to pick a module folder.
  • The ScriptsEditor is destroyed after scripts compilation, because the editor "reloads", and it becomes impossible to keep some data around, like the script name. I decided to make a static variable but i don't like it.

I'm not sure if this should be merged but i decided to open this PR to highlight some of these problems.

@mafiesto4 mafiesto4 added enhancement New feature or request editor labels Oct 28, 2023
@mafiesto4 mafiesto4 added this to the 1.8 milestone Oct 28, 2023
flaxtechnology pushed a commit that referenced this pull request Feb 19, 2024
@flaxtechnology flaxtechnology merged commit 71627f1 into FlaxEngine:master Feb 19, 2024
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants