summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/animation_editor.cpp12
-rw-r--r--tools/editor/editor_log.cpp12
-rw-r--r--tools/editor/editor_log.h2
-rw-r--r--tools/editor/editor_node.cpp2
-rw-r--r--tools/editor/editor_node.h1
-rw-r--r--tools/editor/editor_run.cpp4
-rw-r--r--tools/editor/editor_run.h2
-rw-r--r--tools/editor/plugins/script_text_editor.cpp114
-rw-r--r--tools/editor/plugins/script_text_editor.h11
-rw-r--r--tools/editor/plugins/theme_editor_plugin.cpp2
-rw-r--r--tools/editor/project_manager.cpp14
-rw-r--r--tools/editor/property_editor.cpp6
-rw-r--r--tools/editor/scene_tree_editor.cpp2
-rw-r--r--tools/editor/script_editor_debugger.cpp2
14 files changed, 165 insertions, 21 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 2f67df1fc3..a556031e5e 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -1933,12 +1933,20 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
if (mb.button_index==BUTTON_WHEEL_UP && mb.pressed) {
- v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 );
+ if (mb.mod.command) {
+ zoom->set_val(zoom->get_val() + zoom->get_step());
+ } else {
+ v_scroll->set_val( v_scroll->get_val() - v_scroll->get_page() / 8 );
+ }
}
if (mb.button_index==BUTTON_WHEEL_DOWN && mb.pressed) {
- v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 );
+ if (mb.mod.command) {
+ zoom->set_val(zoom->get_val() - zoom->get_step());
+ } else {
+ v_scroll->set_val( v_scroll->get_val() + v_scroll->get_page() / 8 );
+ }
}
if (mb.button_index==BUTTON_RIGHT && mb.pressed) {
diff --git a/tools/editor/editor_log.cpp b/tools/editor/editor_log.cpp
index 20613467d3..02af9712a8 100644
--- a/tools/editor/editor_log.cpp
+++ b/tools/editor/editor_log.cpp
@@ -161,7 +161,7 @@ void EditorLog::_undo_redo_cbk(void *p_self,const String& p_name) {
void EditorLog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_clear_request"),&EditorLog::_clear_request );
-
+ ObjectTypeDB::bind_method("_override_logger_styles",&EditorLog::_override_logger_styles );
//ObjectTypeDB::bind_method(_MD("_dragged"),&EditorLog::_dragged );
ADD_SIGNAL( MethodInfo("clear_request"));
}
@@ -193,11 +193,10 @@ EditorLog::EditorLog() {
ec->set_custom_minimum_size(Size2(0,180));
ec->set_v_size_flags(SIZE_EXPAND_FILL);
-
- PanelContainer *pc = memnew( PanelContainer );
- pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+ pc = memnew( PanelContainer );
ec->add_child(pc);
pc->set_area_as_parent_rect();
+ pc->connect("enter_tree", this, "_override_logger_styles");
log = memnew( RichTextLabel );
log->set_scroll_follow(true);
@@ -224,6 +223,11 @@ void EditorLog::deinit() {
}
+void EditorLog::_override_logger_styles() {
+
+ pc->add_style_override("panel",get_stylebox("normal","TextEdit"));
+
+}
EditorLog::~EditorLog() {
diff --git a/tools/editor/editor_log.h b/tools/editor/editor_log.h
index 699be710d8..bbf35b63cb 100644
--- a/tools/editor/editor_log.h
+++ b/tools/editor/editor_log.h
@@ -50,6 +50,7 @@ class EditorLog : public VBoxContainer {
HBoxContainer *title_hb;
// PaneDrag *pd;
Control *ec;
+ PanelContainer *pc;
static void _error_handler(void *p_self, const char*p_func, const char*p_file,int p_line, const char*p_error,const char*p_errorexp,ErrorHandlerType p_type);
@@ -64,6 +65,7 @@ protected:
static void _bind_methods();
void _notification(int p_what);
+ void _override_logger_styles();
public:
void add_message(const String& p_msg, bool p_error=false);
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index fe97fe2881..8274272a7e 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2678,7 +2678,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case RUN_PLAY_NATIVE: {
-
+
bool autosave = EDITOR_DEF("run/auto_save_before_running",true);
if (autosave) {
_menu_option_confirm(FILE_SAVE_ALL_SCENES, false);
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 2fae5daced..0393cd19a9 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -700,6 +700,7 @@ public:
void notify_child_process_exited();
+ OS::ProcessID get_child_process_id() const { return editor_run.get_pid(); }
void stop_child_process();
Ref<Theme> get_editor_theme() const { return theme; }
diff --git a/tools/editor/editor_run.cpp b/tools/editor/editor_run.cpp
index fb0f24c084..5fbb4ae2a0 100644
--- a/tools/editor/editor_run.cpp
+++ b/tools/editor/editor_run.cpp
@@ -52,6 +52,9 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List
args.push_back("localhost:"+String::num(GLOBAL_DEF("debug/debug_port", 6007)));
}
+ args.push_back("-epid");
+ args.push_back(String::num(OS::get_singleton()->get_process_ID()));
+
if (p_custom_args!="") {
Vector<String> cargs=p_custom_args.split(" ",false);
@@ -132,6 +135,7 @@ Error EditorRun::run(const String& p_scene,const String p_custom_args,const List
}
+
if (p_breakpoints.size()) {
args.push_back("-bp");
diff --git a/tools/editor/editor_run.h b/tools/editor/editor_run.h
index 0b96a2c91c..5aa2adf801 100644
--- a/tools/editor/editor_run.h
+++ b/tools/editor/editor_run.h
@@ -53,6 +53,8 @@ public:
void run_native_notify() { status=STATUS_PLAY; }
void stop();
+ OS::ProcessID get_pid() const { return pid; }
+
void set_debug_collisions(bool p_debug);
bool get_debug_collisions() const;
diff --git a/tools/editor/plugins/script_text_editor.cpp b/tools/editor/plugins/script_text_editor.cpp
index ca0398f069..2f807eaa19 100644
--- a/tools/editor/plugins/script_text_editor.cpp
+++ b/tools/editor/plugins/script_text_editor.cpp
@@ -498,6 +498,7 @@ void ScriptTextEditor::_code_complete_scripts(void* p_ud,const String& p_code, L
void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>* r_options) {
+ if (color_panel->is_visible()) return;
Node *base = get_tree()->get_edited_scene_root();
if (base) {
base = _find_node_for_script(base,base,script);
@@ -882,6 +883,9 @@ void ScriptTextEditor::_edit_option(int p_op) {
case EDIT_TRIM_TRAILING_WHITESAPCE: {
trim_trailing_whitespace();
} break;
+ case EDIT_PICK_COLOR: {
+ color_panel->popup();
+ } break;
case SEARCH_FIND: {
@@ -989,7 +993,8 @@ void ScriptTextEditor::_bind_methods() {
ObjectTypeDB::bind_method("_edit_option",&ScriptTextEditor::_edit_option);
ObjectTypeDB::bind_method("_goto_line",&ScriptTextEditor::_goto_line);
ObjectTypeDB::bind_method("_lookup_symbol",&ScriptTextEditor::_lookup_symbol);
-
+ ObjectTypeDB::bind_method("_text_edit_input_event", &ScriptTextEditor::_text_edit_input_event);
+ ObjectTypeDB::bind_method("_color_changed", &ScriptTextEditor::_color_changed);
ObjectTypeDB::bind_method("get_drag_data_fw",&ScriptTextEditor::get_drag_data_fw);
@@ -1168,6 +1173,96 @@ void ScriptTextEditor::drop_data_fw(const Point2& p_point,const Variant& p_data,
}
+void ScriptTextEditor::_text_edit_input_event(const InputEvent& ev) {
+ if (ev.type == InputEvent::MOUSE_BUTTON) {
+ InputEventMouseButton mb = ev.mouse_button;
+ if (mb.button_index == BUTTON_RIGHT && !mb.pressed) {
+
+ int col, row;
+ TextEdit* tx = code_editor->get_text_edit();
+ tx->_get_mouse_pos(Point2i(mb.global_x, mb.global_y)-tx->get_global_pos(), row, col);
+ Vector2 mpos = Vector2(mb.global_x, mb.global_y)-tx->get_global_pos();
+ bool have_selection = (tx->get_selection_text().length() > 0);
+ bool have_color = (tx->get_word_at_pos(mpos) == "Color");
+ if (have_color) {
+
+ String line = tx->get_line(row);
+ color_line = row;
+ int begin = 0;
+ int end = 0;
+ bool valid = false;
+ for (int i = col; i < line.length(); i++) {
+ if (line[i] == '(') {
+ begin = i;
+ continue;
+ }
+ else if (line[i] == ')') {
+ end = i+1;
+ valid = true;
+ break;
+ }
+ }
+ if (valid) {
+ color_args = line.substr(begin, end-begin);
+ String stripped = color_args.replace(" ", "").replace("(", "").replace(")", "");
+ Vector<float> color = stripped.split_floats(",");
+ if (color.size() > 2) {
+ float alpha = color.size() > 3 ? color[3] : 1.0f;
+ color_picker->set_color(Color(color[0], color[1], color[2], alpha));
+ }
+ color_panel->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ Size2 ms = Size2(300, color_picker->get_combined_minimum_size().height+10);
+ color_panel->set_size(ms);
+ } else {
+ have_color = false;
+ }
+ }
+ _make_context_menu(have_selection, have_color);
+ }
+ }
+}
+
+void ScriptTextEditor::_color_changed(const Color& p_color) {
+ String new_args;
+ if (p_color.a == 1.0f) {
+ new_args = String("("+rtos(p_color.r)+", "+rtos(p_color.g)+", "+rtos(p_color.b)+")");
+ } else {
+ new_args = String("("+rtos(p_color.r)+", "+rtos(p_color.g)+", "+rtos(p_color.b)+", "+rtos(p_color.a)+")");
+ }
+
+ String line = code_editor->get_text_edit()->get_line(color_line);
+ String new_line = line.replace(color_args, new_args);
+ color_args = new_args;
+ code_editor->get_text_edit()->set_line(color_line, new_line);
+}
+
+void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) {
+
+ context_menu->clear();
+ if (p_selection) {
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/cut"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/copy"));
+ }
+
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/paste"));
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/select_all"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/undo"));
+
+ if (p_selection) {
+ context_menu->add_separator();
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_left"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/indent_right"));
+ context_menu->add_shortcut(ED_GET_SHORTCUT("script_text_editor/toggle_comment"));
+ }
+ if (p_color) {
+ context_menu->add_separator();
+ context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR);
+ }
+ context_menu->set_pos(get_global_transform().xform(get_local_mouse_pos()));
+ context_menu->set_size(Vector2(1, 1));
+ context_menu->popup();
+}
ScriptTextEditor::ScriptTextEditor() {
@@ -1197,6 +1292,19 @@ ScriptTextEditor::ScriptTextEditor() {
EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset"));
code_editor->get_text_edit()->set_select_identifiers_on_hover(true);
+ code_editor->get_text_edit()->set_context_menu_enabled(false);
+ code_editor->get_text_edit()->connect("input_event", this, "_text_edit_input_event");
+
+ context_menu = memnew(PopupMenu);
+ add_child(context_menu);
+ context_menu->connect("item_pressed", this, "_edit_option");
+
+ color_panel = memnew(PopupPanel);
+ add_child(color_panel);
+ color_picker = memnew(ColorPicker);
+ color_panel->add_child(color_picker);
+ color_panel->set_child_rect(color_picker);
+ color_picker->connect("color_changed", this, "_color_changed");
edit_hb = memnew (HBoxContainer);
@@ -1279,8 +1387,8 @@ void ScriptTextEditor::register_editor() {
ED_SHORTCUT("script_text_editor/select_all", TTR("Select All"), KEY_MASK_CMD|KEY_A);
ED_SHORTCUT("script_text_editor/move_up", TTR("Move Up"), KEY_MASK_ALT|KEY_UP);
ED_SHORTCUT("script_text_editor/move_down", TTR("Move Down"), KEY_MASK_ALT|KEY_DOWN);
- ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), 0);
- ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), 0);
+ ED_SHORTCUT("script_text_editor/indent_left", TTR("Indent Left"), KEY_MASK_ALT|KEY_LEFT);
+ ED_SHORTCUT("script_text_editor/indent_right", TTR("Indent Right"), KEY_MASK_ALT|KEY_RIGHT);
ED_SHORTCUT("script_text_editor/toggle_comment", TTR("Toggle Comment"), KEY_MASK_CMD|KEY_K);
ED_SHORTCUT("script_text_editor/clone_down", TTR("Clone Down"), KEY_MASK_CMD|KEY_B);
#ifdef OSX_ENABLED
diff --git a/tools/editor/plugins/script_text_editor.h b/tools/editor/plugins/script_text_editor.h
index 2c7eac6095..ceef50f0bc 100644
--- a/tools/editor/plugins/script_text_editor.h
+++ b/tools/editor/plugins/script_text_editor.h
@@ -30,6 +30,7 @@
#define SCRIPT_TEXT_EDITOR_H
#include "script_editor_plugin.h"
+#include "scene/gui/color_picker.h"
class ScriptTextEditor : public ScriptEditorBase {
@@ -47,10 +48,16 @@ class ScriptTextEditor : public ScriptEditorBase {
MenuButton *edit_menu;
MenuButton *search_menu;
+ PopupMenu *context_menu;
GotoLineDialog *goto_line_dialog;
ScriptEditorQuickOpen *quick_open;
+ PopupPanel *color_panel;
+ ColorPicker *color_picker;
+ int color_line;
+ String color_args;
+
enum {
EDIT_UNDO,
EDIT_REDO,
@@ -67,6 +74,7 @@ class ScriptTextEditor : public ScriptEditorBase {
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
EDIT_CLONE_DOWN,
+ EDIT_PICK_COLOR,
SEARCH_FIND,
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,
@@ -96,6 +104,9 @@ protected:
static void _bind_methods();
void _edit_option(int p_op);
+ void _make_context_menu(bool p_selection, bool p_color);
+ void _text_edit_input_event(const InputEvent& ev);
+ void _color_changed(const Color& p_color);
void _goto_line(int p_line) { goto_line(p_line); }
void _lookup_symbol(const String& p_symbol,int p_row, int p_column);
diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp
index 5db331ba45..84568aa8c0 100644
--- a/tools/editor/plugins/theme_editor_plugin.cpp
+++ b/tools/editor/plugins/theme_editor_plugin.cpp
@@ -668,7 +668,7 @@ ThemeEditor::ThemeEditor() {
theme_menu = memnew( MenuButton );
- theme_menu->set_text("Theme");
+ theme_menu->set_text(TTR("Theme"));
theme_menu->get_popup()->add_item(TTR("Add Item"),POPUP_ADD);
theme_menu->get_popup()->add_item(TTR("Add Class Items"),POPUP_CLASS_ADD);
theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index b2eae2f6d1..18a4e845a0 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -506,7 +506,7 @@ void ProjectManager::_panel_draw(Node *p_hb) {
hb->draw_line(Point2(0,hb->get_size().y+1),Point2(hb->get_size().x-10,hb->get_size().y+1),get_color("guide_color","Tree"));
if (selected_list.has(hb->get_meta("name"))) {
- hb->draw_style_box(get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
+ hb->draw_style_box( gui_base->get_stylebox("selected","Tree"),Rect2(Point2(),hb->get_size()-Size2(10,0)));
}
}
@@ -753,7 +753,7 @@ void ProjectManager::_load_recent_projects() {
List<PropertyInfo> properties;
EditorSettings::get_singleton()->get_property_list(&properties);
- Color font_color = get_color("font_color","Tree");
+ Color font_color = gui_base->get_color("font_color","Tree");
List<ProjectItem> projects;
List<ProjectItem> favorite_projects;
@@ -864,6 +864,7 @@ void ProjectManager::_load_recent_projects() {
hb->set_meta("favorite",is_favorite);
hb->connect("draw",this,"_panel_draw",varray(hb));
hb->connect("input_event",this,"_panel_input",varray(hb));
+ hb->add_constant_override("separation",10*EDSCALE);
VBoxContainer *favorite_box = memnew( VBoxContainer );
TextureButton *favorite = memnew( TextureButton );
@@ -885,7 +886,7 @@ void ProjectManager::_load_recent_projects() {
ec->set_custom_minimum_size(Size2(0,1));
vb->add_child(ec);
Label *title = memnew( Label(project_name) );
- title->add_font_override("font",get_font("large","Fonts"));
+ title->add_font_override("font", gui_base->get_font("large","Fonts"));
title->add_color_override("font_color",font_color);
vb->add_child(title);
Label *fpath = memnew( Label(path) );
@@ -1205,6 +1206,7 @@ ProjectManager::ProjectManager() {
gui_base = memnew( Control );
add_child(gui_base);
gui_base->set_area_as_parent_rect();
+ gui_base->set_theme(create_custom_theme());
Panel *panel = memnew( Panel );
gui_base->add_child(panel);
@@ -1227,7 +1229,7 @@ ProjectManager::ProjectManager() {
CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
- l->add_font_override("font",get_font("doc","EditorFonts"));
+ l->add_font_override("font", gui_base->get_font("doc","EditorFonts"));
ccl->add_child(l);
top_hb->add_child(ccl);
top_hb->add_spacer();
@@ -1263,7 +1265,7 @@ ProjectManager::ProjectManager() {
search_tree_vb->add_child(search_box);
PanelContainer *pc = memnew( PanelContainer);
- pc->add_style_override("panel",get_stylebox("bg","Tree"));
+ pc->add_style_override("panel", gui_base->get_stylebox("bg","Tree"));
search_tree_vb->add_child(pc);
pc->set_v_size_flags(SIZE_EXPAND_FILL);
@@ -1392,8 +1394,6 @@ ProjectManager::ProjectManager() {
last_clicked = "";
SceneTree::get_singleton()->connect("files_dropped", this, "_files_dropped");
-
- gui_base->set_theme(create_custom_theme());
}
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 1a8d373f7f..7163836f73 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -3049,7 +3049,7 @@ void PropertyEditor::update_tree() {
if (E) {
descr=E->get().brief_description;
}
- class_descr_cache[type]=descr.world_wrap(80);
+ class_descr_cache[type]=descr.word_wrap(80);
}
@@ -3142,7 +3142,7 @@ void PropertyEditor::update_tree() {
if (E) {
for(int i=0;i<E->get().methods.size();i++) {
if (E->get().methods[i].name==setter.operator String()) {
- descr=E->get().methods[i].description.strip_edges().world_wrap(80);
+ descr=E->get().methods[i].description.strip_edges().word_wrap(80);
}
}
}
@@ -3182,6 +3182,7 @@ void PropertyEditor::update_tree() {
item->set_cell_mode( 1, TreeItem::CELL_MODE_CHECK );
item->set_text(1,TTR("On"));
+ item->set_tooltip(1, obj->get(p.name) ? "True" : "False");
item->set_checked( 1, obj->get( p.name ) );
if (show_type_icons)
item->set_icon( 0, get_icon("Bool","EditorIcons") );
@@ -3828,6 +3829,7 @@ void PropertyEditor::_item_edited() {
case Variant::BOOL: {
_edit_set(name,item->is_checked(1));
+ item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
} break;
case Variant::INT:
case Variant::REAL: {
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index e5a97fa26e..53bfe8cc57 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -254,7 +254,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id)
String config_err = n->get_configuration_warning();
if (config_err==String())
return;
- config_err=config_err.world_wrap(80);
+ config_err=config_err.word_wrap(80);
warning->set_text(config_err);
warning->popup_centered_minsize();
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index 7fba73ca08..c8170ca9a3 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -216,6 +216,8 @@ void ScriptEditorDebugger::debug_continue() {
ERR_FAIL_COND(connection.is_null());
ERR_FAIL_COND(!connection->is_connected());
+ OS::get_singleton()->enable_for_stealing_focus(EditorNode::get_singleton()->get_child_process_id());
+
Array msg;
msg.push_back("continue");
ppeer->put_var(msg);