diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 126 | ||||
-rw-r--r-- | tools/editor/property_editor.h | 8 | ||||
-rw-r--r-- | tools/html_fs/godot.html | 24 |
5 files changed, 38 insertions, 124 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 3888ed23a6..eae2d69dd9 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -164,7 +164,7 @@ void EditorNode::_update_title() { void EditorNode::_unhandled_input(const InputEvent& p_event) { - if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo) { + if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) { switch(p_event.key.scancode) { diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 1e16f32e6e..76e4af5f16 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -2329,7 +2329,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { script_list = memnew( ItemList ); script_split->add_child(script_list); script_list->set_custom_minimum_size(Size2(0,0)); - script_split->set_split_offset(70); + script_split->set_split_offset(140); tab_container = memnew( TabContainer ); tab_container->set_tabs_visible(false); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 286a8f25b1..16e4d4ec6c 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -27,7 +27,6 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "property_editor.h" -#include "scene/gui/label.h" #include "io/resource_loader.h" #include "io/image_loader.h" #include "object_type_db.h" @@ -35,7 +34,6 @@ #include "globals.h" #include "scene/resources/font.h" #include "pair.h" -#include "scene/scene_string_names.h" #include "editor_settings.h" #include "editor_import_export.h" #include "editor_node.h" @@ -43,6 +41,8 @@ #include "array_property_edit.h" #include "editor_help.h" #include "scene/resources/packed_scene.h" +#include "os/input.h" +#include "os/keyboard.h" void CustomPropertyEditor::_notification(int p_what) { @@ -52,11 +52,16 @@ void CustomPropertyEditor::_notification(int p_what) { RID ci = get_canvas_item(); get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size())); - /* - if (v.get_type()==Variant::COLOR) { - VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v ); - }*/ + } else if (p_what==NOTIFICATION_POPUP_HIDE) { + + if (!text_changed) + return; + + if (Input::get_singleton()->is_key_pressed(KEY_ESCAPE)) + return; + + _modified(String()); } } @@ -235,6 +240,8 @@ String CustomPropertyEditor::get_name() const { bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Type p_type, const Variant& p_variant,int p_hint,String p_hint_text) { + text_changed=false; + owner=p_owner; updating=true; name=p_name; @@ -254,8 +261,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty value_editor[i]->hide(); value_label[i]->hide(); - if (i<4) - scroll[i]->hide(); } for (int i=0;i<MAX_ACTION_BUTTONS;i++) { @@ -591,44 +596,10 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty } break; case Variant::COLOR: { - color_picker->show(); color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA); color_picker->set_color(v); set_size( Size2(300, color_picker->get_combined_minimum_size().height+10)); - /* - int ofs=80; - int m=10; - int h=20; - Color c=v; - float values[4]={c.r,c.g,c.b,c.a}; - for (int i=0;i<4;i++) { - int y=m+i*h; - - value_editor[i]->show(); - value_label[i]->show(); - value_label[i]->set_pos(Point2(ofs,y)); - scroll[i]->set_min(0); - scroll[i]->set_max(1.0); - scroll[i]->set_page(0); - scroll[i]->set_pos(Point2(ofs+15,y+Math::floor((h-scroll[i]->get_minimum_size().height)/2.0))); - scroll[i]->set_val(values[i]); - scroll[i]->set_size(Size2(120,1)); - scroll[i]->show(); - value_editor[i]->set_pos(Point2(ofs+140,y)); - value_editor[i]->set_size(Size2(40,h)); - value_editor[i]->set_text( String::num(values[i],2 )); - - } - - value_label[0]->set_text("R"); - value_label[1]->set_text("G"); - value_label[2]->set_text("B"); - value_label[3]->set_text("A"); - - Size2 new_size = value_editor[3]->get_pos() + value_editor[3]->get_size() + Point2(10,10); - set_size( new_size ); - */ } break; case Variant::IMAGE: { @@ -1184,37 +1155,8 @@ void CustomPropertyEditor::_action_pressed(int p_which) { } break; default: {}; } - -} - -void CustomPropertyEditor::_scroll_modified(double p_value) { - - if (updating) - return; - /* - switch(type) { - - case Variant::COLOR: { - - for (int i=0;i<4;i++) { - - value_editor[i]->set_text( String::num(scroll[i]->get_val(),2) ); - } - Color c; - c.r=scroll[0]->get_val(); - c.g=scroll[1]->get_val(); - c.b=scroll[2]->get_val(); - c.a=scroll[3]->get_val(); - v=c; - update(); - emit_signal("variant_changed"); - } break; - default: {} - } - */ } - void CustomPropertyEditor::_drag_easing(const InputEvent& p_ev) { @@ -1309,6 +1251,7 @@ void CustomPropertyEditor::_modified(String p_string) { if (updating) return; updating=true; + text_changed=false; switch(type) { case Variant::REAL: { @@ -1435,20 +1378,8 @@ void CustomPropertyEditor::_modified(String p_string) { } break; case Variant::COLOR: { - /* - for (int i=0;i<4;i++) { - scroll[i]->set_val( value_editor[i]->get_text().to_double() ); - } - Color c; - c.r=value_editor[0]->get_text().to_double(); - c.g=value_editor[1]->get_text().to_double(); - c.b=value_editor[2]->get_text().to_double(); - c.a=value_editor[3]->get_text().to_double(); - v=c; - update(); - emit_signal("variant_changed"); - */ + } break; case Variant::IMAGE: { @@ -1601,9 +1532,11 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int value_label[i]->hide(); } } +} +void CustomPropertyEditor::_text_editor_changed(String p_text) { - + text_changed=true; } void CustomPropertyEditor::_bind_methods() { @@ -1612,7 +1545,6 @@ void CustomPropertyEditor::_bind_methods() { ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit); ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified); ObjectTypeDB::bind_method("_range_modified", &CustomPropertyEditor::_range_modified); - ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified); ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed); ObjectTypeDB::bind_method("_file_selected",&CustomPropertyEditor::_file_selected); ObjectTypeDB::bind_method("_type_create_selected",&CustomPropertyEditor::_type_create_selected); @@ -1620,9 +1552,9 @@ void CustomPropertyEditor::_bind_methods() { ObjectTypeDB::bind_method("_color_changed",&CustomPropertyEditor::_color_changed); ObjectTypeDB::bind_method("_draw_easing",&CustomPropertyEditor::_draw_easing); ObjectTypeDB::bind_method("_drag_easing",&CustomPropertyEditor::_drag_easing); - ObjectTypeDB::bind_method( "_text_edit_changed",&CustomPropertyEditor::_text_edit_changed); - ObjectTypeDB::bind_method( "_menu_option",&CustomPropertyEditor::_menu_option); - + ObjectTypeDB::bind_method("_text_edit_changed",&CustomPropertyEditor::_text_edit_changed); + ObjectTypeDB::bind_method("_menu_option",&CustomPropertyEditor::_menu_option); + ObjectTypeDB::bind_method("_text_editor_changed",&CustomPropertyEditor::_text_editor_changed); ADD_SIGNAL( MethodInfo("variant_changed") ); ADD_SIGNAL( MethodInfo("resource_edit_request") ); @@ -1633,6 +1565,8 @@ CustomPropertyEditor::CustomPropertyEditor() { read_only=false; updating=false; + text_changed=false; + for (int i=0;i<MAX_VALUE_EDITORS;i++) { value_editor[i]=memnew( LineEdit ); @@ -1642,22 +1576,11 @@ CustomPropertyEditor::CustomPropertyEditor() { value_editor[i]->hide(); value_label[i]->hide(); value_editor[i]->connect("text_entered", this,"_modified"); + value_editor[i]->connect("text_changed", this, "_text_editor_changed"); value_editor[i]->connect("focus_enter", this, "_focus_enter"); value_editor[i]->connect("focus_exit", this, "_focus_exit"); } - for(int i=0;i<4;i++) { - - scroll[i] = memnew( HScrollBar ); - scroll[i]->hide(); - scroll[i]->set_min(0); - scroll[i]->set_max(1.0); - scroll[i]->set_step(0.01); - add_child(scroll[i]); - scroll[i]->connect("value_changed", this,"_scroll_modified"); - - } - for(int i=0;i<20;i++) { checks20[i]=memnew( Button ); checks20[i]->set_toggle_mode(true); @@ -1729,7 +1652,6 @@ CustomPropertyEditor::CustomPropertyEditor() { easing_draw->hide(); easing_draw->connect("draw",this,"_draw_easing"); easing_draw->connect("input_event",this,"_drag_easing"); - //easing_draw->emit_signal(SceneStringNames::get_singleton()->input_event,InputEvent()); easing_draw->set_default_cursor_shape(Control::CURSOR_MOVE); menu = memnew(PopupMenu); diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h index 5dc2f6d154..2e533a0c64 100644 --- a/tools/editor/property_editor.h +++ b/tools/editor/property_editor.h @@ -38,8 +38,6 @@ #include "scene/gui/menu_button.h" #include "scene/gui/texture_frame.h" #include "scene/gui/text_edit.h" -#include "scene/gui/check_button.h" -#include "scene/gui/split_container.h" #include "scene_tree_editor.h" /** @@ -85,7 +83,6 @@ class CustomPropertyEditor : public Popup { String hint_text; LineEdit *value_editor[MAX_VALUE_EDITORS]; Label *value_label[MAX_VALUE_EDITORS]; - HScrollBar *scroll[4]; Button *action_buttons[MAX_ACTION_BUTTONS]; MenuButton *type_button; Vector<String> inheritors_array; @@ -106,7 +103,6 @@ class CustomPropertyEditor : public Popup { void _text_edit_changed(); void _file_selected(String p_file); - void _scroll_modified(double p_value); void _modified(String p_string); void _range_modified(double p_value); void _focus_enter(); @@ -126,6 +122,10 @@ class CustomPropertyEditor : public Popup { void config_value_editors(int p_amount, int p_columns,int p_label_w,const List<String>& p_strings); void config_action_buttons(const List<String>& p_strings); + bool text_changed; + + void _text_editor_changed(String p_text); + protected: void _notification(int p_what); diff --git a/tools/html_fs/godot.html b/tools/html_fs/godot.html index 6176fe7afa..c354826e1f 100644 --- a/tools/html_fs/godot.html +++ b/tools/html_fs/godot.html @@ -93,23 +93,15 @@ top: 0; right: 0; bottom: 0; - } - - #status-table { - /* vertical centering per table... */ - display: table; - width: 100%; - height: 100%; - } - - #status-table-cell { - display: table-cell; - vertical-align: middle; + display: flex; + justify-content: center; + align-items: center; + /* don't consume click events - make children visible explicitly */ + visibility: hidden; } #status { - /* hidden until explicitly shown in debug mode */ - visibility: hidden; + visibility: visible; padding: 4px 6px; } @@ -184,9 +176,9 @@ <canvas id="canvas" width="$GODOT_CANVAS_WIDTH" height="$GODOT_CANVAS_HEIGHT" onclick="canvas.ownerDocument.defaultView.focus();" oncontextmenu="event.preventDefault();"> HTML5 canvas appears to be unsupported in the current browser.<br />Please try updating or use a different browser. </canvas> - <div id="status-container"><div id="status-table"><div id="status-table-cell"> + <div id="status-container"> <span id="status" class="godot" onclick="this.style.visibility='hidden';">Loading page...</span> - </div></div></div> + </div> <div id="controls" class="godot"> <label id="display-output"><input id="output-toggle" type="checkbox" autocomplete="off" onchange="Presentation.setOutputVisible(this.checked);" />display output</label> <!-- hidden until implemented |