aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp22
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp92
2 files changed, 82 insertions, 32 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 4772583c5..1b059f3d2 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -294,6 +294,7 @@ void ScriptTextEditor::_load_theme_settings() {
get_text_edit()->add_color_override("current_line_color",EDITOR_DEF("text_editor/current_line_color",Color(0.3,0.5,0.8,0.15)));
get_text_edit()->add_color_override("word_highlighted_color",EDITOR_DEF("text_editor/word_highlighted_color",Color(0.8,0.9,0.9,0.15)));
get_text_edit()->add_color_override("number_color",EDITOR_DEF("text_editor/number_color",Color(0.9,0.6,0.0,2)));
+ get_text_edit()->add_color_override("function_color",EDITOR_DEF("text_editor/function_color",Color(0.4,0.6,0.8)));
Color keyword_color= EDITOR_DEF("text_editor/keyword_color",Color(0.5,0.0,0.2));
@@ -1070,6 +1071,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
+ tx->begin_complex_operation();
if (tx->is_selection_active())
{
int from_line = tx->get_selection_from_line();
@@ -1101,6 +1103,7 @@ void ScriptEditor::_menu_option(int p_option) {
swap_lines(tx, line_id, next_id);
}
+ tx->end_complex_operation();
tx->update();
} break;
@@ -1111,6 +1114,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
+ tx->begin_complex_operation();
if (tx->is_selection_active())
{
int from_line = tx->get_selection_from_line();
@@ -1142,6 +1146,7 @@ void ScriptEditor::_menu_option(int p_option) {
swap_lines(tx, line_id, next_id);
}
+ tx->end_complex_operation();
tx->update();
} break;
@@ -1152,7 +1157,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
-
+ tx->begin_complex_operation();
if (tx->is_selection_active())
{
int begin = tx->get_selection_from_line();
@@ -1191,6 +1196,7 @@ void ScriptEditor::_menu_option(int p_option) {
tx->set_line(begin, line_text);
}
}
+ tx->end_complex_operation();
tx->update();
//tx->deselect();
@@ -1202,6 +1208,7 @@ void ScriptEditor::_menu_option(int p_option) {
if (scr.is_null())
return;
+ tx->begin_complex_operation();
if (tx->is_selection_active())
{
int begin = tx->get_selection_from_line();
@@ -1220,6 +1227,7 @@ void ScriptEditor::_menu_option(int p_option) {
line_text = '\t' + line_text;
tx->set_line(begin, line_text);
}
+ tx->end_complex_operation();
tx->update();
//tx->deselect();
@@ -1251,11 +1259,16 @@ void ScriptEditor::_menu_option(int p_option) {
return;
-
+ tx->begin_complex_operation();
if (tx->is_selection_active())
{
int begin = tx->get_selection_from_line();
int end = tx->get_selection_to_line();
+
+ // End of selection ends on the first column of the last line, ignore it.
+ if(tx->get_selection_to_column() == 0)
+ end -= 1;
+
for (int i = begin; i <= end; i++)
{
String line_text = tx->get_line(i);
@@ -1278,6 +1291,7 @@ void ScriptEditor::_menu_option(int p_option) {
line_text = "#" + line_text;
tx->set_line(begin, line_text);
}
+ tx->end_complex_operation();
tx->update();
//tx->deselect();
@@ -1933,6 +1947,7 @@ void ScriptEditor::edit(const Ref<Script>& p_script) {
ste->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete"));
ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
ste->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
+ ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences"));
ste->get_text_edit()->set_callhint_settings(
EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"),
@@ -2073,6 +2088,7 @@ void ScriptEditor::_editor_settings_changed() {
ste->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file"));
ste->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size"));
ste->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs"));
+ ste->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers"));
ste->get_text_edit()->set_highlight_all_occurrences(EditorSettings::get_singleton()->get("text_editor/highlight_all_occurrences"));
}
@@ -2702,7 +2718,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("text_editor/script_temperature_history_size",15);
EDITOR_DEF("text_editor/script_temperature_hot_color",Color(1,0,0,0.3));
EDITOR_DEF("text_editor/script_temperature_cold_color",Color(0,0,1,0.3));
- EDITOR_DEF("text_editor/group_help_pages",false);
+ EDITOR_DEF("text_editor/group_help_pages",true);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE));
EDITOR_DEF("external_editor/exec_flags","");
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 79ff78ca0..c78b3086e 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -51,7 +51,31 @@
#define GIZMO_SCALE_DEFAULT 0.15
-//void SpatialEditorViewport::_update_camera();
+void SpatialEditorViewport::_update_camera() {
+ if (orthogonal) {
+ Size2 size = get_size();
+ Size2 vpsize = Point2(cursor.distance*size.get_aspect(), cursor.distance / size.get_aspect());
+ //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
+ camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
+ }
+ else
+ camera->set_perspective(get_fov(), get_znear(), get_zfar());
+
+ Transform camera_transform;
+ camera_transform.translate(cursor.pos);
+ camera_transform.basis.rotate(Vector3(0, 1, 0), cursor.y_rot);
+ camera_transform.basis.rotate(Vector3(1, 0, 0), cursor.x_rot);
+
+ if (orthogonal)
+ camera_transform.translate(0, 0, 4096);
+ else
+ camera_transform.translate(0, 0, cursor.distance);
+
+ if (camera->get_global_transform() != camera_transform) {
+ camera->set_global_transform(camera_transform);
+ update_transform_gizmo_view();
+ }
+}
String SpatialEditorGizmo::get_handle_name(int p_idx) const {
@@ -819,7 +843,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
}
}
-
switch(p_event.type) {
case InputEvent::MOUSE_BUTTON: {
@@ -1204,11 +1227,9 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
}
} break;
case InputEvent::MOUSE_MOTION: {
-
const InputEventMouseMotion &m=p_event.mouse_motion;
_edit.mouse_pos=Point2(p_event.mouse_motion.x,p_event.mouse_motion.y);
-
-
+
if (spatial_editor->get_selected()) {
@@ -1244,7 +1265,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
NavigationScheme nav_scheme = _get_navigation_schema("3d_editor/navigation_scheme");
NavigationMode nav_mode = NAVIGATION_NONE;
-
+
if (_edit.gizmo.is_valid()) {
Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal());
@@ -1558,6 +1579,26 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (m.mod.alt)
nav_mode = NAVIGATION_PAN;
}
+ }else{
+ // Handle trackpad (no external mouse) use case
+ int mod = 0;
+ if (m.mod.shift)
+ mod=KEY_SHIFT;
+ if (m.mod.alt)
+ mod=KEY_ALT;
+ if (m.mod.control)
+ mod=KEY_CONTROL;
+ if (m.mod.meta)
+ mod=KEY_META;
+
+ if(mod){
+ if (mod == _get_key_modifier("3d_editor/pan_modifier"))
+ nav_mode = NAVIGATION_PAN;
+ else if (mod == _get_key_modifier("3d_editor/zoom_modifier"))
+ nav_mode = NAVIGATION_ZOOM;
+ else if (mod == _get_key_modifier("3d_editor/orbit_modifier"))
+ nav_mode = NAVIGATION_ORBIT;
+ }
}
switch(nav_mode) {
@@ -1770,6 +1811,10 @@ void SpatialEditorViewport::_notification(int p_what) {
bool visible=is_visible();
set_process(visible);
+
+ if (visible)
+ _update_camera();
+
call_deferred("update_transform_gizmo_view");
}
@@ -1791,28 +1836,7 @@ void SpatialEditorViewport::_notification(int p_what) {
}
*/
- if (orthogonal) {
- Size2 size=get_size();
- Size2 vpsize = Point2(cursor.distance*size.get_aspect(),cursor.distance/size.get_aspect());
- //camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
- camera->set_orthogonal(2*cursor.distance,0.1,8192);
- } else
- camera->set_perspective(get_fov(),get_znear(),get_zfar());
-
- Transform camera_transform;
- camera_transform.translate( cursor.pos );
- camera_transform.basis.rotate(Vector3(0,1,0),cursor.y_rot);
- camera_transform.basis.rotate(Vector3(1,0,0),cursor.x_rot);
-
- if (orthogonal)
- camera_transform.translate(0,0,4096);
- else
- camera_transform.translate(0,0,cursor.distance);
-
- if (camera->get_global_transform()!=camera_transform) {
- camera->set_global_transform( camera_transform );
- update_transform_gizmo_view();
- }
+ _update_camera();
Map<Node*,Object*> &selection = editor_selection->get_selection();
@@ -1915,7 +1939,6 @@ void SpatialEditorViewport::_notification(int p_what) {
surface->connect("mouse_enter",this,"_smouseenter");
preview_camera->set_icon(get_icon("Camera","EditorIcons"));
_init_gizmo_instance(index);
-
}
if (p_what==NOTIFICATION_EXIT_TREE) {
@@ -3579,6 +3602,17 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
case KEY_E: _menu_item_pressed(MENU_TOOL_ROTATE); break;
case KEY_R: _menu_item_pressed(MENU_TOOL_SCALE); break;
+ case KEY_Z: {
+ if (k.mod.shift || k.mod.control || k.mod.command)
+ break;
+
+ if (view_menu->get_popup()->is_item_checked( view_menu->get_popup()->get_item_index(MENU_VIEW_DISPLAY_WIREFRAME))) {
+ _menu_item_pressed(MENU_VIEW_DISPLAY_NORMAL);
+ } else {
+ _menu_item_pressed(MENU_VIEW_DISPLAY_WIREFRAME);
+ }
+ } break;
+
#if 0
#endif
}