diff options
Diffstat (limited to 'tools/editor')
22 files changed, 216 insertions, 7 deletions
diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 34651b36f2..f6cb16dc24 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index ffcb344497..626f86d33d 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -1112,6 +1112,7 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/tab_size")); text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/draw_tabs")); text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/show_line_numbers")); + text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers_zero_padded")); text_editor->set_show_line_length_guideline(EditorSettings::get_singleton()->get("text_editor/show_line_length_guideline")); text_editor->set_line_length_guideline_column(EditorSettings::get_singleton()->get("text_editor/line_length_guideline_column")); text_editor->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/syntax_highlighting")); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 0ab42c5adb..f5741c4a9e 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -546,6 +546,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { hints["text_editor/tab_size"]=PropertyInfo(Variant::INT,"text_editor/tab_size",PROPERTY_HINT_RANGE,"1, 64, 1"); // size of 0 crashes. set("text_editor/draw_tabs", true); + set("text_editor/line_numbers_zero_padded", false); + set("text_editor/show_line_numbers", true); set("text_editor/show_breakpoint_gutter", true); @@ -1024,6 +1026,34 @@ void EditorSettings::set_optimize_save(bool p_optimize) { optimize_save=p_optimize; } +String EditorSettings::get_last_selected_language() +{ + Ref<ConfigFile> cf = memnew( ConfigFile ); + String path = get_project_settings_path().plus_file("project_metadata.cfg"); + Error err = cf->load(path); + if (err != OK) { + WARN_PRINTS("Can't load config file: " + path); + return ""; + } + Variant last_selected_language = cf->get_value("script_setup", "last_selected_language"); + if (last_selected_language.get_type() != Variant::STRING) + return ""; + return static_cast<String>(last_selected_language); +} + +void EditorSettings::set_last_selected_language(String p_language) +{ + Ref<ConfigFile> cf = memnew( ConfigFile ); + String path = get_project_settings_path().plus_file("project_metadata.cfg"); + Error err = cf->load(path); + if (err != OK) { + WARN_PRINTS("Can't load config file: " + path); + return; + } + cf->set_value("script_setup", "last_selected_language", p_language); + cf->save(path); +} + void EditorSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("erase","property"),&EditorSettings::erase); diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 2a7d3bb4f0..a976602304 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -160,6 +160,9 @@ public: void set_optimize_save(bool p_optimize); + String get_last_selected_language(); + void set_last_selected_language(String p_language); + EditorSettings(); ~EditorSettings(); diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/fileserver/SCsub +++ b/tools/editor/fileserver/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/icons/2x/icon_load.png b/tools/editor/icons/2x/icon_load.png Binary files differindex 2e797c448b..729eedd2dd 100644 --- a/tools/editor/icons/2x/icon_load.png +++ b/tools/editor/icons/2x/icon_load.png diff --git a/tools/editor/icons/2x/icon_open.png b/tools/editor/icons/2x/icon_open.png Binary files differdeleted file mode 100644 index 2e797c448b..0000000000 --- a/tools/editor/icons/2x/icon_open.png +++ /dev/null diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 44e28f49e6..9e05d8f391 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') def make_editor_icons_action(target, source, env): diff --git a/tools/editor/icons/icon_load.png b/tools/editor/icons/icon_load.png Binary files differindex cc05e98ebb..98da8135f2 100644 --- a/tools/editor/icons/icon_load.png +++ b/tools/editor/icons/icon_load.png diff --git a/tools/editor/icons/icon_open.png b/tools/editor/icons/icon_open.png Binary files differdeleted file mode 100644 index cc05e98ebb..0000000000 --- a/tools/editor/icons/icon_open.png +++ /dev/null diff --git a/tools/editor/icons/source/icon_load.svg b/tools/editor/icons/source/icon_load.svg new file mode 100644 index 0000000000..f8e78fb4ea --- /dev/null +++ b/tools/editor/icons/source/icon_load.svg @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="16" + height="16" + viewBox="0 0 16 16" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/godotengine/godot/tools/editor/icons/2x/icon_load.png" + inkscape:export-xdpi="180" + inkscape:export-ydpi="180" + sodipodi:docname="icon_load.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="22.627417" + inkscape:cx="12.685427" + inkscape:cy="1.6294402" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="false" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="false" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1119" + inkscape:window-x="0" + inkscape:window-y="26" + inkscape:window-maximized="1" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true" + showguides="false"> + <inkscape:grid + type="xygrid" + id="grid3336" + spacingx="0.5" + spacingy="0.5" + empspacing="2" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" + d="M 1.5000703,2 C 1.0834036,2 0.7251221,2.1928844 0.4590547,2.4589844 0.1929873,2.7250844 7.03e-5,3.0834 7.03e-5,3.5 l 0.5,8.5 c 0.041565,0.581917 0.1536332,1.110716 0.5214844,1.478516 C 1.3894058,13.846416 1.916737,14 2.5000703,14 l 0.5,0 0.5,0 9.9997657,0 c 0.231666,-10e-5 0.432919,-0.159266 0.486328,-0.384766 l 2,-7.4999996 C 16.060474,5.8013344 15.822456,5.5002 15.499836,5.5 L 4.7559297,5.5 C 4.5236856,5.5003 4.3126587,5.6584963 4.2696015,5.8867188 L 3.0383769,12.412759 C 2.9838992,12.701515 2.7130529,12.963778 2.2988984,12.972656 1.7175274,12.985119 1.5058274,12.46121 1.5000703,12 l -0.5,-8.5 c 0,-0.083 0.057083,-0.2249844 0.1660156,-0.3339844 C 1.2750185,3.0571156 1.416737,3 1.5000703,3 L 12.499836,3 c 0.08333,0 0.225052,0.057016 0.333984,0.1660156 0.108933,0.109 0.224913,0.2750776 0.166016,0.3339844 l 0,1 1,0 0,-1 c 0,-0.4166 -0.192917,-0.7749156 -0.458984,-1.0410156 C 13.274784,2.1928844 12.916503,2 12.499836,2 Z" + transform="translate(0,1036.3622)" + id="path8167" + inkscape:connector-curvature="0" + sodipodi:nodetypes="sscccscccccccssscccssssccssss" /> + </g> +</svg> diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/io_plugins/SCsub +++ b/tools/editor/io_plugins/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 190b56faba..56af35c6db 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -175,6 +175,7 @@ class EditorSceneImportDialog : public ConfirmationDialog { EditorDirDialog *save_select; OptionButton *texture_action; CreateDialog *root_type_choose; + LineEdit *root_node_name; ConfirmationDialog *confirm_open; @@ -639,6 +640,7 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { } else { #endif save_path->set_text(""); + root_node_name->set_text(""); //save_path->set_text(p_path.get_file().basename()+".scn"); #if 0 } @@ -656,6 +658,9 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { import_path->set_text(p_path); + if (root_node_name->get_text().size()==0){ + root_node_name->set_text(import_path->get_text().get_file().basename()); + } } void EditorSceneImportDialog::_choose_save_file(const String& p_path) { @@ -788,6 +793,10 @@ void EditorSceneImportDialog::_import(bool p_and_open) { if (!root_default->is_pressed()) { rim->set_option("root_type",root_type->get_text()); } + if (root_node_name->get_text().size()==0) { + root_node_name->set_text(import_path->get_text().get_file().basename()); + } + rim->set_option("root_name",root_node_name->get_text()); List<String> missing; Error err = plugin->import1(rim,&scene,&missing); @@ -946,7 +955,11 @@ void EditorSceneImportDialog::popup_import(const String &p_from) { root_default->set_pressed(true); root_type->set_disabled(true); } - + if (rimd->has_option("root_name")) { + root_node_name->set_text(rimd->get_option("root_name")); + } else { + root_node_name->set_text(root_type->get_text()); // backward compatibility for 2.1 or before + } script_path->set_text(rimd->get_option("post_import_script")); save_path->set_text(p_from.get_base_dir()); @@ -1241,7 +1254,9 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce root_default->connect("pressed",this,"_root_default_pressed"); custom_root_hb->add_child(root_default); - + root_node_name = memnew( LineEdit ); + root_node_name->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->add_margin_child(TTR("Root Node Name:"),root_node_name); /* this_import = memnew( OptionButton ); this_import->add_item("Overwrite Existing Scene"); @@ -2185,6 +2200,7 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from } } + scene->set_name(from->get_option("root_name")); _tag_import_paths(scene,scene); *r_node=scene; diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/plugins/SCsub +++ b/tools/editor/plugins/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index b4d54c6b1e..d6d452dd72 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -666,7 +666,7 @@ void AnimationPlayerEditor::set_state(const Dictionary& p_state) { return; Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]); - if (n && n->cast_to<AnimationPlayer>()) { + if (n && n->cast_to<AnimationPlayer>() && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) { player=n->cast_to<AnimationPlayer>(); _update_player(); show(); diff --git a/tools/editor/plugins/texture_region_editor_plugin.cpp b/tools/editor/plugins/texture_region_editor_plugin.cpp index 43086fb208..6b918e6e8f 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.cpp +++ b/tools/editor/plugins/texture_region_editor_plugin.cpp @@ -653,6 +653,7 @@ void TextureRegionEditor::edit(Object *p_obj) } else { p_obj->connect("texture_changed",this,"_edit_region"); } + p_obj->add_change_receptor(this); p_obj->connect("exit_tree",this,"_node_removed",varray(p_obj),CONNECT_ONESHOT); _edit_region(); } else { @@ -673,6 +674,12 @@ void TextureRegionEditor::edit(Object *p_obj) edit_draw->update(); } +void TextureRegionEditor::_changed_callback(Object *p_changed, const char *p_prop) { + if ((String)p_prop == "region_rect") { + _edit_region(); + } +} + void TextureRegionEditor::_edit_region() { Ref<Texture> texture = NULL; diff --git a/tools/editor/plugins/texture_region_editor_plugin.h b/tools/editor/plugins/texture_region_editor_plugin.h index 3658a38f11..f0bb7c9bc2 100644 --- a/tools/editor/plugins/texture_region_editor_plugin.h +++ b/tools/editor/plugins/texture_region_editor_plugin.h @@ -116,6 +116,8 @@ protected: Vector2 snap_point(Vector2 p_target) const; + virtual void _changed_callback(Object *p_changed, const char *p_prop); + public: void _edit_region(); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index f18d5c928a..ef6b1aa47c 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -3613,9 +3613,10 @@ void PropertyEditor::update_tree() { } break; case Variant::NODE_PATH: { - item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); + item->set_cell_mode(1, TreeItem::CELL_MODE_STRING); item->set_editable( 1, !read_only ); item->set_text(1,obj->get(p.name)); + item->add_button(1, get_icon("Collapse", "EditorIcons")); } break; case Variant::OBJECT: { @@ -3892,6 +3893,7 @@ void PropertyEditor::_item_edited() { } break; case Variant::NODE_PATH: { + _edit_set(name, NodePath(item->get_text(1))); } break; @@ -4067,7 +4069,17 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { String n = d["name"]; String ht = d["hint_text"]; - if (t==Variant::STRING) { + if(t == Variant::NODE_PATH) { + + Variant v = obj->get(n); + custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht); + Rect2 where = tree->get_item_rect(ti, 1); + where.pos -= tree->get_scroll(); + where.pos += tree->get_global_pos(); + custom_editor->set_pos(where.pos); + custom_editor->popup(); + + } else if (t==Variant::STRING) { Variant v = obj->get(n); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 342e6b98c8..56f10ff7f8 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -238,6 +238,34 @@ void SceneTreeDock::_perform_instance_scenes(const Vector<String>& p_files,Node* } +void SceneTreeDock::_replace_with_branch_scene(const String& p_file,Node* base) { + Ref<PackedScene> sdata = ResourceLoader::load(p_file); + if (!sdata.is_valid()) { + accept->get_ok()->set_text(TTR("Ugh")); + accept->set_text(vformat(TTR("Error loading scene from %s"),p_file)); + accept->popup_centered_minsize(); + return; + } + + Node *instanced_scene=sdata->instance(true); + if (!instanced_scene) { + accept->get_ok()->set_text(TTR("Ugh")); + accept->set_text(vformat(TTR("Error instancing scene from %s"),p_file)); + accept->popup_centered_minsize(); + return; + } + + Node *parent = base->get_parent(); + int pos = base->get_index(); + memdelete(base); + parent->add_child(instanced_scene); + parent->move_child(instanced_scene, pos); + instanced_scene->set_owner(edited_scene); + editor_selection->clear(); + editor_selection->add_node(instanced_scene); + scene_tree->set_selected(instanced_scene); +} + bool SceneTreeDock::_cyclical_dependency_exists(const String& p_target_scene_path, Node* p_desired_node) { int childCount = p_desired_node->get_child_count(); @@ -1513,7 +1541,7 @@ void SceneTreeDock::_new_scene_from(String p_file) { accept->popup_centered_minsize(); return; } - + _replace_with_branch_scene(p_file, base); } else { accept->get_ok()->set_text(TTR("I see..")); accept->set_text(TTR("Error duplicating scene to save it.")); diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h index 971013a568..8933a03883 100644 --- a/tools/editor/scene_tree_dock.h +++ b/tools/editor/scene_tree_dock.h @@ -153,6 +153,7 @@ class SceneTreeDock : public VBoxContainer { void _filter_changed(const String& p_filter); void _perform_instance_scenes(const Vector<String>& p_files,Node* parent,int p_pos); + void _replace_with_branch_scene(const String& p_file,Node* base); protected: diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index 749198314a..62d5c7cd84 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -121,6 +121,8 @@ void ScriptCreateDialog::ok_pressed() { Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text()); //scr->set_source_code(text); + String selected_language = language_menu->get_item_text(language_menu->get_selected()); + editor_settings->set_last_selected_language(selected_language); if (cname!="") scr->set_name(cname); @@ -330,7 +332,17 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu->add_item(ScriptServer::get_language(i)->get_name()); } - language_menu->select(0); + editor_settings = EditorSettings::get_singleton(); + String last_selected_language = editor_settings->get_last_selected_language(); + if (last_selected_language != "") + for (int i = 0; i < language_menu->get_item_count(); i++) + if (language_menu->get_item_text(i) == last_selected_language) + { + language_menu->select(i); + break; + } + else language_menu->select(0); + language_menu->connect("item_selected",this,"_lang_changed"); //parent_name->set_text(); diff --git a/tools/editor/script_create_dialog.h b/tools/editor/script_create_dialog.h index 181989402e..c71ea16d39 100644 --- a/tools/editor/script_create_dialog.h +++ b/tools/editor/script_create_dialog.h @@ -33,6 +33,7 @@ #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" #include "tools/editor/editor_file_dialog.h" +#include "tools/editor/editor_settings.h" #include "scene/gui/check_button.h" class ScriptCreateDialog : public ConfirmationDialog { @@ -50,6 +51,7 @@ class ScriptCreateDialog : public ConfirmationDialog { AcceptDialog *alert; bool path_valid; String initial_bp; + EditorSettings *editor_settings; void _path_changed(const String& p_path=String()); |