diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/SCsub | 1 | ||||
-rw-r--r-- | tools/editor/animation_editor.cpp | 12 | ||||
-rw-r--r-- | tools/editor/editor_log.cpp | 12 | ||||
-rw-r--r-- | tools/editor/editor_log.h | 2 | ||||
-rw-r--r-- | tools/editor/editor_node.cpp | 2 | ||||
-rw-r--r-- | tools/editor/editor_node.h | 1 | ||||
-rw-r--r-- | tools/editor/editor_run.cpp | 4 | ||||
-rw-r--r-- | tools/editor/editor_run.h | 2 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_texture_import_plugin.cpp | 53 | ||||
-rw-r--r-- | tools/editor/io_plugins/editor_texture_import_plugin.h | 2 | ||||
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 21 | ||||
-rw-r--r-- | tools/editor/plugins/script_text_editor.cpp | 114 | ||||
-rw-r--r-- | tools/editor/plugins/script_text_editor.h | 11 | ||||
-rw-r--r-- | tools/editor/plugins/theme_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | tools/editor/project_manager.cpp | 14 | ||||
-rw-r--r-- | tools/editor/property_editor.cpp | 6 | ||||
-rw-r--r-- | tools/editor/scene_tree_editor.cpp | 2 | ||||
-rw-r--r-- | tools/editor/script_editor_debugger.cpp | 2 | ||||
-rw-r--r-- | tools/pck/SCsub | 4 | ||||
-rw-r--r-- | tools/pck/pck_packer.cpp | 191 | ||||
-rw-r--r-- | tools/pck/pck_packer.h | 59 |
21 files changed, 202 insertions, 315 deletions
diff --git a/tools/SCsub b/tools/SCsub index aaebab724a..67b1f20e72 100644 --- a/tools/SCsub +++ b/tools/SCsub @@ -117,7 +117,6 @@ if (env["tools"]!="no"): SConscript('editor/SCsub'); SConscript('collada/SCsub'); SConscript('doc/SCsub') - SConscript('pck/SCsub') lib = env.Library("tool",env.tool_sources) 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/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 60642999f2..2935ea8fe2 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -38,6 +38,7 @@ #include "scene/gui/check_button.h" #include "scene/gui/button_group.h" #include "scene/gui/margin_container.h" +#include "scene/io/resource_format_image.h" static const char *flag_names[]={ ("Streaming Format"), @@ -1589,16 +1590,9 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c } break; //use default } + String validated_path=EditorImportPlugin::validate_source_path(p_path); - int flags=0; - - if (Globals::get_singleton()->get("image_loader/filter")) - flags|=IMAGE_FLAG_FILTER; - if (!Globals::get_singleton()->get("image_loader/gen_mipmaps")) - flags|=IMAGE_FLAG_NO_MIPMAPS; - if (!Globals::get_singleton()->get("image_loader/repeat")) - flags|=IMAGE_FLAG_REPEAT; - + int flags=texture_flags_to_export_flags(ResourceFormatLoaderImage::load_image_flags(validated_path)); flags|=IMAGE_FLAG_FIX_BORDER_ALPHA; print_line("group format"+itos(group_format)); @@ -1607,7 +1601,7 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c rimd->set_option("quality",group_lossy_quality); rimd->set_option("atlas",false); rimd->set_option("shrink",group_shrink); - rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path)); + rimd->add_source(validated_path,FileAccess::get_md5(p_path)); } else if (EditorImportExport::get_singleton()->get_image_formats().has(p_path.extension().to_lower()) && EditorImportExport::get_singleton()->get_export_image_action()!=EditorImportExport::IMAGE_ACTION_NONE) { //handled by general image export settings @@ -1619,22 +1613,16 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c case EditorImportExport::IMAGE_ACTION_COMPRESS_RAM: rimd->set_option("format",IMAGE_FORMAT_COMPRESS_RAM); break; } - int flags=0; - - if (Globals::get_singleton()->get("image_loader/filter")) - flags|=IMAGE_FLAG_FILTER; - if (!Globals::get_singleton()->get("image_loader/gen_mipmaps")) - flags|=IMAGE_FLAG_NO_MIPMAPS; - if (!Globals::get_singleton()->get("image_loader/repeat")) - flags|=IMAGE_FLAG_REPEAT; + String validated_path=EditorImportPlugin::validate_source_path(p_path); + int flags=texture_flags_to_export_flags(ResourceFormatLoaderImage::load_image_flags(validated_path)); flags|=IMAGE_FLAG_FIX_BORDER_ALPHA; rimd->set_option("shrink",EditorImportExport::get_singleton()->get_export_image_shrink()); rimd->set_option("flags",flags); rimd->set_option("quality",EditorImportExport::get_singleton()->get_export_image_quality()); rimd->set_option("atlas",false); - rimd->add_source(EditorImportPlugin::validate_source_path(p_path),FileAccess::get_md5(p_path)); + rimd->add_source(validated_path,FileAccess::get_md5(p_path)); } else { return Vector<uint8_t>(); @@ -1726,6 +1714,33 @@ Vector<uint8_t> EditorTextureImportPlugin::custom_export(const String& p_path, c return ret; } +uint32_t EditorTextureImportPlugin::texture_flags_to_export_flags(uint32_t p_tex_flags) const { + + uint32_t flags=0; + + if (!(p_tex_flags&Texture::FLAG_MIPMAPS)) { + flags|=IMAGE_FLAG_NO_MIPMAPS; + } + if (p_tex_flags&Texture::FLAG_REPEAT) { + flags|=IMAGE_FLAG_REPEAT; + } + if (p_tex_flags&Texture::FLAG_FILTER) { + flags|=IMAGE_FLAG_FILTER; + } + if (p_tex_flags&Texture::FLAG_ANISOTROPIC_FILTER) { + flags|=IMAGE_FLAG_USE_ANISOTROPY; + } + if (p_tex_flags&Texture::FLAG_CONVERT_TO_LINEAR) { + flags|=IMAGE_FLAG_CONVERT_TO_LINEAR; + } + /* // no correspondence yet + if (p_tex_flags&Texture::TEXTURE_FLAG_MIRRORED_REPEAT) { + flags|=; + }*/ + + return flags; +} + void EditorTextureImportPlugin::import_from_drop(const Vector<String>& p_drop,const String& p_dest_path) { Vector<String> valid; diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h index 5c8abd10a4..22c10a1a3a 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.h +++ b/tools/editor/io_plugins/editor_texture_import_plugin.h @@ -72,6 +72,8 @@ private: Error _process_texture_data(Ref<ImageTexture> &texture, int format, float quality, int flags,EditorExportPlatform::ImageCompression p_compr,int tex_flags,float shrink); void compress_image(EditorExportPlatform::ImageCompression p_mode,Image& image,bool p_smaller); + + uint32_t texture_flags_to_export_flags(uint32_t p_tex_flags) const; public: diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index fd25843de9..3cd6d8336a 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -755,29 +755,10 @@ void ScriptEditor::_menu_option(int p_option) { } break; case FILE_SAVE_ALL: { - if (!_test_script_times_on_disk()) + if (_test_script_times_on_disk()) return; save_all_scripts(); - -#if 0 - for(int i=0;i<tab_container->get_child_count();i++) { - - ScriptTextEditor *se = tab_container->get_child(i)->cast_to<ScriptTextEditor>(); - if (!se) - continue; - - - Ref<Script> script = se->get_edited_script(); - - if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) - continue; //internal script, who cares - - - editor->save_resource( script ); - } - -#endif } break; case FILE_IMPORT_THEME: { file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); 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); diff --git a/tools/pck/SCsub b/tools/pck/SCsub deleted file mode 100644 index cf98ae145d..0000000000 --- a/tools/pck/SCsub +++ /dev/null @@ -1,4 +0,0 @@ -Import('env') - -if env["tools"] == "yes": - env.add_source_files(env.tool_sources, "*.cpp") diff --git a/tools/pck/pck_packer.cpp b/tools/pck/pck_packer.cpp deleted file mode 100644 index 04b88ea028..0000000000 --- a/tools/pck/pck_packer.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/*************************************************************************/ -/* pkc_packer.cpp */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "pck_packer.h" - -#include "core/os/file_access.h" - -static uint64_t _align(uint64_t p_n, int p_alignment) { - - if (p_alignment == 0) - return p_n; - - uint64_t rest = p_n % p_alignment; - if (rest == 0) - return p_n; - else - return p_n + (p_alignment - rest); -}; - -static void _pad(FileAccess* p_file, int p_bytes) { - - for (int i=0; i<p_bytes; i++) { - - p_file->store_8(0); - }; -}; - -void PCKPacker::_bind_methods() { - - ObjectTypeDB::bind_method(_MD("pck_start","pck_name","alignment"),&PCKPacker::pck_start); - ObjectTypeDB::bind_method(_MD("add_file","pck_path","source_path"),&PCKPacker::add_file); - ObjectTypeDB::bind_method(_MD("flush","verbose"),&PCKPacker::flush); -}; - - -Error PCKPacker::pck_start(const String& p_file, int p_alignment) { - - file = FileAccess::open(p_file, FileAccess::WRITE); - if (file == NULL) { - - return ERR_CANT_CREATE; - }; - - alignment = p_alignment; - - file->store_32(0x43504447); // MAGIC - file->store_32(0); // # version - file->store_32(0); // # major - file->store_32(0); // # minor - file->store_32(0); // # revision - - for (int i=0; i<16; i++) { - - file->store_32(0); // reserved - }; - - files.clear(); - - return OK; -}; - -Error PCKPacker::add_file(const String& p_file, const String& p_src) { - - FileAccess* f = FileAccess::open(p_src, FileAccess::READ); - if (!f) { - return ERR_FILE_CANT_OPEN; - }; - - File pf; - pf.path = p_file; - pf.src_path = p_src; - pf.size = f->get_len(); - pf.offset_offset = 0; - - files.push_back(pf); - - f->close(); - memdelete(f); - - return OK; -}; - -Error PCKPacker::flush(bool p_verbose) { - - if (!file) { - ERR_FAIL_COND_V(!file, ERR_INVALID_PARAMETER); - return ERR_INVALID_PARAMETER; - }; - - // write the index - - file->store_32(files.size()); - - for (int i=0; i<files.size(); i++) { - - file->store_pascal_string(files[i].path); - files[i].offset_offset = file->get_pos(); - file->store_64(0); // offset - file->store_64(files[i].size); // size - - // # empty md5 - file->store_32(0); - file->store_32(0); - file->store_32(0); - file->store_32(0); - }; - - - uint64_t ofs = file->get_pos(); - ofs = _align(ofs, alignment); - - _pad(file, ofs - file->get_pos()); - - const uint32_t buf_max = 65536; - uint8_t *buf = memnew_arr(uint8_t, buf_max); - - int count = 0; - for (int i=0; i<files.size(); i++) { - - FileAccess* src = FileAccess::open(files[i].src_path, FileAccess::READ); - uint64_t to_write = files[i].size; - while (to_write > 0) { - - int read = src->get_buffer(buf, MIN(to_write, buf_max)); - file->store_buffer(buf, read); - to_write -= read; - }; - - uint64_t pos = file->get_pos(); - file->seek(files[i].offset_offset); // go back to store the file's offset - file->store_64(ofs); - file->seek(pos); - - ofs = _align(ofs + files[i].size, alignment); - _pad(file, ofs - pos); - - src->close(); - memdelete(src); - count += 1; - if (p_verbose) { - if (count % 100 == 0) { - printf("%i/%i (%.2f)\r", count, files.size(), float(count) / files.size() * 100); - fflush(stdout); - }; - }; - }; - - if (p_verbose) - printf("\n"); - - file->close(); - - return OK; -}; - -PCKPacker::PCKPacker() { - - file = NULL; -}; - -PCKPacker::~PCKPacker() { - if (file != NULL) { - memdelete(file); - }; - file = NULL; -}; diff --git a/tools/pck/pck_packer.h b/tools/pck/pck_packer.h deleted file mode 100644 index b1182335e2..0000000000 --- a/tools/pck/pck_packer.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************/ -/* pck_packer.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#include "core/reference.h" - -class FileAccess; - -class PCKPacker : public Reference { - - OBJ_TYPE(PCKPacker, Reference); - - FileAccess* file; - int alignment; - - static void _bind_methods(); - - struct File { - - String path; - String src_path; - int size; - uint64_t offset_offset; - }; - Vector<File> files; - -public: - Error pck_start(const String& p_file, int p_alignment); - Error add_file(const String& p_file, const String& p_src); - Error flush(bool p_verbose = false); - - - PCKPacker(); - ~PCKPacker(); -}; |