mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 12:12:28 +00:00
Merge pull request #10771 from neikeq/pr-improve-build-callbacks
Improve build callbacks
This commit is contained in:
commit
6d41ceea99
@ -1036,7 +1036,6 @@ void EditorNode::_dialog_action(String p_file) {
|
||||
|
||||
_save_default_environment();
|
||||
_save_scene_with_preview(p_file);
|
||||
_call_build();
|
||||
_run(true);
|
||||
}
|
||||
} break;
|
||||
@ -1586,6 +1585,9 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
|
||||
editor_data.save_editor_external_data();
|
||||
}
|
||||
|
||||
if (!_call_build())
|
||||
return;
|
||||
|
||||
if (bool(EDITOR_DEF("run/output/always_clear_output_on_play", true))) {
|
||||
log->clear();
|
||||
}
|
||||
@ -2045,7 +2047,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
} break;
|
||||
case RUN_PLAY: {
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_call_build();
|
||||
_run(false);
|
||||
|
||||
} break;
|
||||
@ -2090,7 +2091,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
|
||||
_save_default_environment();
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_call_build();
|
||||
_run(true);
|
||||
|
||||
} break;
|
||||
@ -2102,7 +2102,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
}
|
||||
if (run_native->is_deploy_debug_remote_enabled()) {
|
||||
_menu_option_confirm(RUN_STOP, true);
|
||||
_call_build();
|
||||
|
||||
if (!_call_build())
|
||||
break; // build failed
|
||||
|
||||
emit_signal("play_pressed");
|
||||
editor_run.run_native_notify();
|
||||
}
|
||||
@ -3056,7 +3059,6 @@ void EditorNode::_quick_opened() {
|
||||
|
||||
void EditorNode::_quick_run() {
|
||||
|
||||
_call_build();
|
||||
_run(false, quick_run->get_selected());
|
||||
}
|
||||
|
||||
@ -4232,13 +4234,16 @@ void EditorNode::add_build_callback(EditorBuildCallback p_callback) {
|
||||
build_callbacks[build_callback_count++] = p_callback;
|
||||
}
|
||||
|
||||
EditorPluginInitializeCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS];
|
||||
EditorBuildCallback EditorNode::build_callbacks[EditorNode::MAX_BUILD_CALLBACKS];
|
||||
|
||||
void EditorNode::_call_build() {
|
||||
bool EditorNode::_call_build() {
|
||||
|
||||
for (int i = 0; i < build_callback_count; i++) {
|
||||
build_callbacks[i]();
|
||||
if (!build_callbacks[i]())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void EditorNode::_inherit_imported(const String &p_action) {
|
||||
|
@ -85,7 +85,7 @@
|
||||
|
||||
typedef void (*EditorNodeInitCallback)();
|
||||
typedef void (*EditorPluginInitializeCallback)();
|
||||
typedef void (*EditorBuildCallback)();
|
||||
typedef bool (*EditorBuildCallback)();
|
||||
|
||||
class EditorPluginList;
|
||||
|
||||
@ -575,7 +575,7 @@ private:
|
||||
static EditorPluginInitializeCallback plugin_init_callbacks[MAX_INIT_CALLBACKS];
|
||||
void _save_default_environment();
|
||||
|
||||
void _call_build();
|
||||
bool _call_build();
|
||||
static int build_callback_count;
|
||||
static EditorBuildCallback build_callbacks[MAX_BUILD_CALLBACKS];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user