-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Editor: Allow to override CLI args on a per-instance basis #57975
Conversation
When running the Project from the Editor, this allows the user to override the CLI arguments each instance is started with per instance using the new project settings editor/run/instance_1_run_args through editor/run/instance_4_run_args (overriding editor/run/main_run_args for each instance if set). This is useful for multiplayer testing or when testing with different settings/profiles to reduce manual configuration on each test/run.
Some thoughts on the current implementation:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments, I think these options should be project metadata in EditorSettings, and not stored in project settings.
Maybe it's time we add some form of "run configuration" page like many IDEs do? I'm not great at UX so I'm a bit unsure what a good simple design would be here.
|
||
const String raw_custom_args = ProjectSettings::get_singleton()->get("editor/run/main_run_args"); | ||
void EditorRun::parse_run_args(String *exec_path, List<String> *args, const String raw_custom_args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fits more the godot codebase:
void EditorRun::parse_run_args(String *exec_path, List<String> *args, const String raw_custom_args) { | |
void EditorRun::parse_run_args(String &r_exec_path, List<String> &r_args, const String p_raw_custom_args) { |
String instance_arg_setting = "editor/run/instance_" + itos(instance_num) + "_run_args"; | ||
String raw_custom_args = ProjectSettings::get_singleton()->get(instance_arg_setting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like these should be in editor settings meta too (i.e. EditorSettings::get_singleton()->get_project_metadata("debug_options", instance_arg_setting)
).
We don't really want to export them, they are debug/editor configurations, not something to store in the project settings.
I guess that raises the question of where to show those info, and maybe an hint to proceed towards an initial implementation of godotengine/godot-proposals#522 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to limit it to the 4 instances?
Note: I have not tested suggested changes, but PackedStringArray
project setting should work fine.
*Edit: * Ah, I see, it's already limited to 4 instances (took me a few minutes to find it).
But it's probably better to add instances_to_run
as another project setting (or just use size of the argument list as an instance number), the current UI is not intuitive.
GLOBAL_DEF("editor/run/instance_1_run_args", ""); | ||
GLOBAL_DEF("editor/run/instance_2_run_args", ""); | ||
GLOBAL_DEF("editor/run/instance_3_run_args", ""); | ||
GLOBAL_DEF("editor/run/instance_4_run_args", ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GLOBAL_DEF("editor/run/instance_1_run_args", ""); | |
GLOBAL_DEF("editor/run/instance_2_run_args", ""); | |
GLOBAL_DEF("editor/run/instance_3_run_args", ""); | |
GLOBAL_DEF("editor/run/instance_4_run_args", ""); | |
GLOBAL_DEF("editor/run/instance_run_args", PackedStringArray()); |
@@ -184,9 +184,44 @@ Error EditorRun::run(const String &p_scene) { | |||
args.push_back(p_scene); | |||
} | |||
|
|||
String exec = OS::get_singleton()->get_executable_path(); | |||
int instances = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_instances", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int instances = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_instances", 1); | |
int instances = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_instances", 1); | |
PackedStringArray instance_arg_setting = ProjectSettings::get_singleton()->get("editor/run/instance_run_args"); |
String instance_arg_setting = "editor/run/instance_" + itos(instance_num) + "_run_args"; | ||
String raw_custom_args = ProjectSettings::get_singleton()->get(instance_arg_setting); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String instance_arg_setting = "editor/run/instance_" + itos(instance_num) + "_run_args"; | |
String raw_custom_args = ProjectSettings::get_singleton()->get(instance_arg_setting); | |
String raw_custom_args; | |
if (instance_num >= instance_arg_setting.size()) { | |
raw_custom_args = instance_arg_setting[instance_num - 1]; | |
} |
@bruvzg as mentioned above, I don't think these should be project settings at all. godot/editor/plugins/debugger_editor_plugin.cpp Lines 101 to 110 in 33c7f52
godot/editor/plugins/debugger_editor_plugin.cpp Lines 119 to 125 in 33c7f52
|
We discussed this on As @groud pointed it out this could use a Tree like e.g. the AutoLoad settings dialog. This was just to illustrate the feature set, UX should still be worked on. I'll comment further in the proposal, it's probably best to keep things there. |
This comment was marked as off-topic.
This comment was marked as off-topic.
EditorSettings project metadata are per project, so no, it doesn't have to be project settings. |
Closing, as I currently lack the bandwidth for this one. Still should be done however IMO :) |
When running the Project from the Editor, this allows the user to override the CLI arguments each instance is started with per instance using the new advanced project settings
editor/run/instance_1_run_args
througheditor/run/instance_4_run_args
(overridingeditor/run/main_run_args
for each instance if set).This is useful for multiplayer testing or when testing with different settings/profiles to reduce manual configuration on each test/run.
These new advanced settings, like the main run args one, are hidden by default.
Supersedes #57910. May also be a first step towards this proposal: godotengine/godot-proposals#522