summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-29 20:12:04 -0300
committerGitHub <noreply@github.com>2017-08-29 20:12:04 -0300
commit6d41ceea992e7f6589ea83e4db80fe4fe342fbdb (patch)
tree172bf81863ab40fb8d71ad36a22b0e4869f72e44 /editor
parent9c3bddfac2d80b0e52b94eeace58dbfd249459e7 (diff)
parentc18b7046c6e6834c22b64f714d6bd46b4330a543 (diff)
Merge pull request #10771 from neikeq/pr-improve-build-callbacks
Improve build callbacks
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp21
-rw-r--r--editor/editor_node.h4
2 files changed, 15 insertions, 10 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 112d94dc3b..cee65387f5 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -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) {
diff --git a/editor/editor_node.h b/editor/editor_node.h
index 60c0609e33..445ef4922e 100644
--- a/editor/editor_node.h
+++ b/editor/editor_node.h
@@ -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];