diff options
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/animation_editor.cpp | 2 | ||||
-rw-r--r-- | tools/editor/editor_help.cpp | 26 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 20 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 1 | ||||
-rw-r--r-- | tools/editor/editor_plugin.cpp | 1 | ||||
-rw-r--r-- | tools/editor/editor_settings.cpp | 1 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_sample_import_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/canvas_item_editor_plugin.cpp | 5 | ||||
-rw-r--r-- | tools/editor/plugins/editor_preview_plugins.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/shader_graph_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/plugins/shader_graph_editor_plugin.h | 2 | ||||
-rw-r--r-- | tools/editor/plugins/spatial_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | tools/editor/project_manager.cpp | 7 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 52 | ||||
-rw-r--r-- | tools/editor/scene_tree_dock.cpp | 2 | ||||
-rw-r--r-- | tools/editor/scene_tree_editor.cpp | 2 |
16 files changed, 107 insertions, 23 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 96bd1ed27d..5df49bd327 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -2369,7 +2369,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { te->update(); track_editor->set_tooltip(""); - if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->cast_to<LineEdit>())) + if (!track_editor->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) track_editor->call_deferred("grab_focus"); diff --git a/tools/editor/editor_help.cpp b/tools/editor/editor_help.cpp index 213c18e1b0..46ed2194a8 100644 --- a/tools/editor/editor_help.cpp +++ b/tools/editor/editor_help.cpp @@ -547,6 +547,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -563,6 +564,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v _add_text(cd.brief_description); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } bool method_descr=false; @@ -637,7 +639,6 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v if (cd.properties.size()) { - class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Members:"); @@ -715,9 +716,10 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->add_newline(); } - class_desc->add_newline(); class_desc->pop(); + class_desc->add_newline(); + class_desc->add_newline(); } if (cd.signals.size()) { @@ -779,6 +781,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -823,6 +826,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); + class_desc->add_newline(); } @@ -830,6 +834,7 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v if (cd.description!="") { description_line=class_desc->get_line_count()-2; + class_desc->push_color(EditorSettings::get_singleton()->get("text_editor/keyword_color")); class_desc->push_font(doc_title_font); class_desc->add_text("Description:"); @@ -837,10 +842,10 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); class_desc->add_newline(); - class_desc->add_newline(); _add_text(cd.description); class_desc->add_newline(); class_desc->add_newline(); + class_desc->add_newline(); } if (method_descr) { @@ -853,12 +858,16 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->add_newline(); class_desc->add_newline(); + class_desc->push_indent(1); for(int i=0;i<cd.methods.size();i++) { method_line[cd.methods[i].name]=class_desc->get_line_count()-2; + if( cd.methods[i].description != "") { + class_desc->add_newline(); + } class_desc->push_font(doc_code_font); _add_type(cd.methods[i].return_type); @@ -899,9 +908,12 @@ Error EditorHelp::_goto_desc(const String& p_class,bool p_update_history,int p_v class_desc->pop(); - class_desc->add_newline(); - class_desc->add_newline(); - _add_text(cd.methods[i].description); + if( cd.methods[i].description != "") { + class_desc->add_text(" "); + _add_text(cd.methods[i].description); + class_desc->add_newline(); + class_desc->add_newline(); + } class_desc->add_newline(); class_desc->add_newline(); @@ -1392,6 +1404,8 @@ EditorHelp::EditorHelp(EditorNode *p_editor) { PanelContainer *pc = memnew( PanelContainer ); Ref<StyleBoxFlat> style( memnew( StyleBoxFlat ) ); style->set_bg_color( EditorSettings::get_singleton()->get("text_editor/background_color") ); + style->set_default_margin(MARGIN_LEFT,20); + style->set_default_margin(MARGIN_TOP,20); pc->add_style_override("panel", style); //get_stylebox("normal","TextEdit")); h_split->add_child(pc); class_desc = memnew( RichTextLabel ); diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 9137503e1b..34e2510791 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -976,6 +976,7 @@ void EditorNode::_save_scene(String p_file) { //EditorFileSystem::get_singleton()->update_file(p_file,sdata->get_type()); set_current_version(editor_data.get_undo_redo().get_version()); _update_title(); + _update_scene_tabs(); } else { _dialog_display_file_error(p_file,err); @@ -1399,7 +1400,6 @@ void EditorNode::_dialog_action(String p_file) { } break; default: { //save scene? - if (file->get_mode()==FileDialog::MODE_SAVE_FILE) { //_save_scene(p_file); @@ -3452,6 +3452,9 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo Ref<SceneState> state = sdata->get_state(); state->set_path(lpath); new_scene->set_scene_inherited_state(state); + new_scene->set_filename(String()); + if (new_scene->get_scene_instance_state().is_valid()) + new_scene->get_scene_instance_state()->set_path(String()); } @@ -3931,6 +3934,7 @@ void EditorNode::_bind_methods() { ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene); ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version); ObjectTypeDB::bind_method("_scene_tab_changed",&EditorNode::_scene_tab_changed); + ObjectTypeDB::bind_method("_scene_tab_closed",&EditorNode::_scene_tab_closed); ObjectTypeDB::bind_method("_scene_tab_script_edited",&EditorNode::_scene_tab_script_edited); ObjectTypeDB::bind_method("_set_main_scene_state",&EditorNode::_set_main_scene_state); ObjectTypeDB::bind_method("_update_scene_tabs",&EditorNode::_update_scene_tabs); @@ -4385,6 +4389,17 @@ void EditorNode::_scene_tab_script_edited(int p_tab) { edit_resource(script); } +void EditorNode::_scene_tab_closed(int p_tab) { + set_current_scene(p_tab); + bool p_confirmed = true; + if (unsaved_cache) + p_confirmed = false; + + _menu_option_confirm(FILE_CLOSE, p_confirmed); + _update_scene_tabs(); +} + + void EditorNode::_scene_tab_changed(int p_tab) { @@ -4552,8 +4567,10 @@ EditorNode::EditorNode() { scene_tabs=memnew( Tabs ); scene_tabs->add_tab("unsaved"); scene_tabs->set_tab_align(Tabs::ALIGN_CENTER); + scene_tabs->set_tab_close_display_policy(Tabs::SHOW_HOVER); scene_tabs->connect("tab_changed",this,"_scene_tab_changed"); scene_tabs->connect("right_button_pressed",this,"_scene_tab_script_edited"); + scene_tabs->connect("tab_close", this, "_scene_tab_closed"); top_dark_vb->add_child(scene_tabs); //left left_l_hsplit = memnew( HSplitContainer ); @@ -4690,6 +4707,7 @@ EditorNode::EditorNode() { main_editor_tabs = memnew( Tabs ); main_editor_tabs->connect("tab_changed",this,"_editor_select"); + main_editor_tabs->set_tab_close_display_policy(Tabs::SHOW_NEVER); HBoxContainer *srth = memnew( HBoxContainer ); srt->add_child( srth ); Control *tec = memnew( Control ); diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index d52e08191d..978e8390dc 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -501,6 +501,7 @@ class EditorNode : public Node { void _dock_split_dragged(int ofs); void _dock_popup_exit(); void _scene_tab_changed(int p_tab); + void _scene_tab_closed(int p_tab); void _scene_tab_script_edited(int p_tab); Dictionary _get_main_scene_state(); diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp index 04c34d9a88..7417d707bb 100644 --- a/tools/editor/editor_plugin.cpp +++ b/tools/editor/editor_plugin.cpp @@ -74,6 +74,7 @@ void EditorPlugin::add_custom_control(CustomControlContainer p_location,Control case CONTAINER_CANVAS_EDITOR_SIDE: { CanvasItemEditor::get_singleton()->get_palette_split()->add_child(p_control); + CanvasItemEditor::get_singleton()->get_palette_split()->move_child(p_control,0); } break; case CONTAINER_CANVAS_EDITOR_BOTTOM: { diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index a771893bdd..651b30c724 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -474,6 +474,7 @@ void EditorSettings::_load_defaults() { set("scenetree_editor/duplicate_node_name_num_separator",0); hints["scenetree_editor/duplicate_node_name_num_separator"]=PropertyInfo(Variant::INT,"scenetree_editor/duplicate_node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"); + set("gridmap_editor/pick_distance", 5000.0); set("3d_editor/default_fov",45.0); set("3d_editor/default_z_near",0.1); diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp index 9491f957c3..9298b35b3b 100644 --- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp @@ -710,7 +710,7 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,D *(out++) =0; for (i=0;i<datalen;i++) { - int step,diff,vpdiff,signed_nibble,p,mask; + int step,diff,vpdiff,mask; uint8_t nibble; int16_t xm_sample; diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index 8fc2945450..d318f6f6fa 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -144,6 +144,9 @@ void CanvasItemEditor::_unhandled_key_input(const InputEvent& p_ev) { if (!is_visible()) return; + if (p_ev.key.mod.control) + // prevent to change tool mode when control key is pressed + return; if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_Q) _tool_select(TOOL_SELECT); if (p_ev.key.pressed && !p_ev.key.echo && p_ev.key.scancode==KEY_W) @@ -1281,7 +1284,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) { if (p_event.type==InputEvent::MOUSE_MOTION) { - if (!viewport->has_focus()) + if (!viewport->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) viewport->call_deferred("grab_focus"); const InputEventMouseMotion &m=p_event.mouse_motion; diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index a77ba9a605..c2b3ecfcda 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -25,7 +25,7 @@ Ref<Texture> EditorTexturePreviewPlugin::generate(const RES& p_from) { if (img.is_compressed()) { if (img.decompress()!=OK) return Ref<Texture>(); - } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGB) { + } else if (img.get_format()!=Image::FORMAT_RGB && img.get_format()!=Image::FORMAT_RGBA) { img.convert(Image::FORMAT_RGBA); } diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp index 1997b268a7..684e7e32ef 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.cpp +++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp @@ -1246,7 +1246,7 @@ void ShaderGraphView::_duplicate_nodes_request() } -void ShaderGraphView::_duplicate_nodes(Array &p_nodes) +void ShaderGraphView::_duplicate_nodes(const Array &p_nodes) { List<int> n = List<int>(); for (int i=0; i<p_nodes.size();i++) diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h index 800fdf1fea..39e9b29d45 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -149,7 +149,7 @@ class ShaderGraphView : public Node { void _end_node_move(); void _move_node(int p_id,const Vector2& p_to); void _duplicate_nodes_request(); - void _duplicate_nodes(Array &p_nodes); + void _duplicate_nodes(const Array &p_nodes); void _delete_nodes_request(); diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index 8fc6a6931e..3ab9339265 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -677,7 +677,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili void SpatialEditorViewport::_smouseenter() { - surface->grab_focus(); + if (!surface->has_focus() && (!get_focus_owner() || !get_focus_owner()->is_text_field())) + surface->grab_focus(); } void SpatialEditorViewport::_sinput(const InputEvent &p_event) { diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index f1eecd53b0..9f47291433 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -245,7 +245,8 @@ public: project_name->clear(); if (import_mode) { - set_title("Import Existing Project:"); + set_title("Import Existing Project"); + get_ok()->set_text("Import"); pp->set_text("Project Path: (Must exist)"); pn->set_text("Project Name:"); pn->hide(); @@ -254,7 +255,8 @@ public: popup_centered(Size2(500,125)); } else { - set_title("Create New Project:"); + set_title("Create New Project"); + get_ok()->set_text("Create"); pp->set_text("Project Path:"); pn->set_text("Project Name:"); pn->show(); @@ -313,7 +315,6 @@ public: l->add_color_override("font_color",Color(1,0.4,0.3,0.8)); l->set_align(Label::ALIGN_CENTER); - get_ok()->set_text("Create"); DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); project_path->set_text(d->get_current_dir()); memdelete(d); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 5599305945..549a3f7ffb 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -1746,7 +1746,7 @@ bool PropertyEditor::_might_be_in_instance() { } -bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_prop,Variant& value) { +bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_prop, Variant& value) { Node *node = obj->cast_to<Node>(); @@ -1761,29 +1761,33 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p // print_line("for prop - "+String(p_prop)); + while(node) { Ref<SceneState> ss; if (node==edited_scene) { ss=node->get_scene_inherited_state(); + } else { ss=node->get_scene_instance_state(); } -// print_line("at - "+String(edited_scene->get_path_to(node))); + // print_line("at - "+String(edited_scene->get_path_to(node))); if (ss.is_valid()) { + NodePath np = node->get_path_to(orig); int node_idx = ss->find_node_by_path(np); -// print_line("\t valid, nodeidx "+itos(node_idx)); + // print_line("\t valid, nodeidx "+itos(node_idx)); if (node_idx>=0) { bool lfound=false; Variant lvar; lvar=ss->get_property_value(node_idx,p_prop,lfound); if (lfound) { + found=true; value=lvar; -// print_line("\t found value "+String(value)); + // print_line("\t found value "+String(value)); } } } @@ -1800,7 +1804,47 @@ bool PropertyEditor::_get_instanced_node_original_property(const StringName& p_p bool PropertyEditor::_is_property_different(const Variant& p_current, const Variant& p_orig,int p_usage) { + + { + Node *node = obj->cast_to<Node>(); + if (!node) + return false; + + Node* edited_scene =EditorNode::get_singleton()->get_edited_scene(); + bool found_state=false; + + // print_line("for prop - "+String(p_prop)); + + + while(node) { + + Ref<SceneState> ss; + + if (node==edited_scene) { + ss=node->get_scene_inherited_state(); + + } else { + ss=node->get_scene_instance_state(); + } + + if (ss.is_valid()) { + found_state=true; + } + if (node==edited_scene) { + //just in case + break; + } + node=node->get_owner(); + } + + if (!found_state) + return false; //pointless to check if we are not comparing against anything. + } + if (p_orig.get_type()==Variant::NIL) { + + + //special cases if (p_current.is_zero() && p_usage&PROPERTY_USAGE_STORE_IF_NONZERO) return false; diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 920ab599e9..510517de6f 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -875,7 +875,7 @@ bool SceneTreeDock::_validate_no_foreign() { } - if (edited_scene->get_scene_instance_state().is_valid() && edited_scene->get_scene_instance_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) { + if (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(E->get()))>=0) { accept->get_ok()->set_text("Makes Sense!"); accept->set_text("Can't operate on nodes the current scene inherits from!"); diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index b746af7f0e..60395d5ff5 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -239,7 +239,7 @@ void SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) { TreeItem *item = tree->create_item(p_parent); item->set_text(0, p_node->get_name() ); - if (can_rename && (p_node->get_owner() == get_scene_node() || p_node==get_scene_node())) + if (can_rename && !part_of_subscene /*(p_node->get_owner() == get_scene_node() || p_node==get_scene_node())*/) item->set_editable(0, true); item->set_selectable(0,true); |