1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Ability to set script debugger reason text context.

This commit is contained in:
Daniel J. Ramirez
2017-08-22 14:16:08 -05:00
parent 00a26f512c
commit 92c63dc9a7
2 changed files with 24 additions and 4 deletions

View File

@@ -306,8 +306,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
String error = p_data[1]; String error = p_data[1];
step->set_disabled(!can_continue); step->set_disabled(!can_continue);
next->set_disabled(!can_continue); next->set_disabled(!can_continue);
reason->set_text(error); _set_reason_text(error, MESSAGE_ERROR);
reason->set_tooltip(error);
breaked = true; breaked = true;
dobreak->set_disabled(true); dobreak->set_disabled(true);
docontinue->set_disabled(false); docontinue->set_disabled(false);
@@ -761,6 +760,21 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
} }
} }
void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType p_type) {
switch (p_type) {
case MESSAGE_ERROR:
reason->add_color_override("font_color", get_color("error_color", "Editor"));
break;
case MESSAGE_WARNING:
reason->add_color_override("font_color", get_color("warning_color", "Editor"));
break;
default:
reason->add_color_override("font_color", get_color("success_color", "Editor"));
}
reason->set_text(p_reason);
reason->set_tooltip(p_reason);
}
void ScriptEditorDebugger::_performance_select(Object *, int, bool) { void ScriptEditorDebugger::_performance_select(Object *, int, bool) {
perf_draw->update(); perf_draw->update();
@@ -921,8 +935,7 @@ void ScriptEditorDebugger::_notification(int p_what) {
dobreak->set_disabled(false); dobreak->set_disabled(false);
tabs->set_current_tab(0); tabs->set_current_tab(0);
reason->set_text(TTR("Child Process Connected")); _set_reason_text(TTR("Child Process Connected"), MESSAGE_SUCCESS);
reason->set_tooltip(TTR("Child Process Connected"));
profiler->clear(); profiler->clear();
inspect_scene_tree->clear(); inspect_scene_tree->clear();

View File

@@ -56,6 +56,12 @@ class ScriptEditorDebugger : public Control {
GDCLASS(ScriptEditorDebugger, Control); GDCLASS(ScriptEditorDebugger, Control);
enum MessageType {
MESSAGE_ERROR,
MESSAGE_WARNING,
MESSAGE_SUCCESS,
};
AcceptDialog *msgdialog; AcceptDialog *msgdialog;
Button *debugger_button; Button *debugger_button;
@@ -144,6 +150,7 @@ class ScriptEditorDebugger : public Control {
void _scene_tree_selected(); void _scene_tree_selected();
void _scene_tree_request(); void _scene_tree_request();
void _parse_message(const String &p_msg, const Array &p_data); void _parse_message(const String &p_msg, const Array &p_data);
void _set_reason_text(const String &p_msg, MessageType p_type);
void _scene_tree_property_select_object(ObjectID p_object); void _scene_tree_property_select_object(ObjectID p_object);
void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value); void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value);