diff options
Diffstat (limited to 'tools/editor')
126 files changed, 3159 insertions, 1721 deletions
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp index 08b90b5408..dd3c3fee32 100644 --- a/tools/editor/animation_editor.cpp +++ b/tools/editor/animation_editor.cpp @@ -754,7 +754,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { undo_redo->add_undo_method(animation.ptr(),"track_set_interpolation_type",idx,animation->track_get_interpolation_type(idx)); if (animation->track_get_type(idx)==Animation::TYPE_VALUE) { - undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",idx,animation->value_track_is_continuous(idx)); + undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",idx,animation->value_track_get_update_mode(idx)); } @@ -918,7 +918,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { pos=animation->get_length(); timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } break; case TRACK_MENU_PREV_STEP: { @@ -934,7 +934,7 @@ void AnimationKeyEditor::_menu_track(int p_type) { pos=0; timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } break; @@ -1169,8 +1169,9 @@ void AnimationKeyEditor::_track_editor_draw() { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; Ref<Texture> type_icon[3]={ get_icon("KeyValue","EditorIcons"), @@ -1442,15 +1443,15 @@ void AnimationKeyEditor::_track_editor_draw() { if (animation->track_get_type(idx)==Animation::TYPE_VALUE) { - int continuous = animation->value_track_is_continuous(idx)?1:0; + int umode = animation->value_track_get_update_mode(idx); icon_ofs.x-=hsep; icon_ofs.x-=down_icon->get_width(); te->draw_texture(down_icon,icon_ofs); icon_ofs.x-=hsep; - icon_ofs.x-=cont_icon[continuous]->get_width(); - te->draw_texture(cont_icon[continuous],icon_ofs); + icon_ofs.x-=cont_icon[umode]->get_width(); + te->draw_texture(cont_icon[umode],icon_ofs); } else { icon_ofs.x -= hsep*2 + cont_icon[0]->get_width() + down_icon->get_width(); @@ -1626,8 +1627,8 @@ void AnimationKeyEditor::_track_menu_selected(int p_idx) { ERR_FAIL_INDEX(cont_editing,animation->get_track_count()); undo_redo->create_action(TTR("Anim Track Change Value Mode")); - undo_redo->add_do_method(animation.ptr(),"value_track_set_continuous",cont_editing,p_idx); - undo_redo->add_undo_method(animation.ptr(),"value_track_set_continuous",cont_editing,animation->value_track_is_continuous(cont_editing)); + undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",cont_editing,p_idx); + undo_redo->add_undo_method(animation.ptr(),"value_track_set_update_mode",cont_editing,animation->value_track_get_update_mode(cont_editing)); undo_redo->commit_action(); } @@ -1820,8 +1821,9 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; Ref<Texture> type_icon[3]={ get_icon("KeyValue","EditorIcons"), @@ -1972,7 +1974,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { click.click=ClickOver::CLICK_DRAG_TIMELINE; click.at=Point2(mb.x,mb.y); click.to=click.at; - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,false); } @@ -2184,8 +2186,8 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { track_menu->clear(); track_menu->set_size(Point2(1,1)); - static const char *cont_name[3]={"Discrete","Continuous"}; - for(int i=0;i<2;i++) { + String cont_name[3]={TTR("Continuous"),TTR("Discrete"),TTR("Trigger")}; + for(int i=0;i<3;i++) { track_menu->add_icon_item(cont_icon[i],cont_name[i]); } @@ -2594,7 +2596,7 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) { } timeline_pos=pos; - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); @@ -2920,6 +2922,7 @@ void AnimationKeyEditor::_notification(int p_what) { edit_button->connect("pressed",this,"_toggle_edit_curves"); loop->set_icon(get_icon("Loop","EditorIcons")); + loop_interpolation->set_icon(get_icon("LoopInterpolation","EditorIcons")); curve_edit->connect("transition_changed",this,"_curve_transition_changed"); //edit_button->add_color_override("font_color",get_color("font_color","Tree")); @@ -2940,8 +2943,9 @@ void AnimationKeyEditor::_notification(int p_what) { get_icon("InterpCubic","EditorIcons") }; Ref<Texture> cont_icon[3]={ + get_icon("TrackContinuous","EditorIcons"), get_icon("TrackDiscrete","EditorIcons"), - get_icon("TrackContinuous","EditorIcons") + get_icon("TrackTrigger","EditorIcons") }; //right_data_size_cache = remove_icon->get_width() + move_up_icon->get_width() + move_down_icon->get_width() + down_icon->get_width() *2 + interp_icon[0]->get_width() + cont_icon[0]->get_width() + add_key_icon->get_width() + hsep*11; @@ -3009,6 +3013,7 @@ void AnimationKeyEditor::_update_menu() { length->set_val(animation->get_length()); loop->set_pressed(animation->has_loop()); + loop_interpolation->set_pressed(animation->has_loop_interpolation()); step->set_val(animation->get_step()); } @@ -3311,7 +3316,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { created=true; undo_redo->create_action(TTR("Anim Insert Track & Key")); - bool continuous=false; + Animation::UpdateMode update_mode=Animation::UPDATE_DISCRETE; if (p_id.type==Animation::TYPE_VALUE) { //wants a new tack @@ -3324,16 +3329,21 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { PropertyInfo h = _find_hint_for_track(animation->get_track_count()-1,np); animation->remove_track(animation->get_track_count()-1); //hack - - continuous = - h.type==Variant::REAL || + if ( h.type==Variant::REAL || h.type==Variant::VECTOR2 || h.type==Variant::RECT2 || h.type==Variant::VECTOR3 || h.type==Variant::_AABB || h.type==Variant::QUAT || h.type==Variant::COLOR || - h.type==Variant::TRANSFORM ; + h.type==Variant::TRANSFORM ) { + + update_mode=Animation::UPDATE_CONTINUOUS; + } + + if (h.usage&PROPERTY_USAGE_ANIMATE_AS_TRIGGER) { + update_mode=Animation::UPDATE_TRIGGER; + } } } @@ -3342,7 +3352,7 @@ int AnimationKeyEditor::_confirm_insert(InsertData p_id,int p_last_track) { undo_redo->add_do_method(animation.ptr(),"add_track",p_id.type); undo_redo->add_do_method(animation.ptr(),"track_set_path",p_id.track_idx,p_id.path); if (p_id.type==Animation::TYPE_VALUE) - undo_redo->add_do_method(animation.ptr(),"value_track_set_continuous",p_id.track_idx,continuous); + undo_redo->add_do_method(animation.ptr(),"value_track_set_update_mode",p_id.track_idx,update_mode); } else { undo_redo->create_action(TTR("Anim Insert Key")); @@ -3459,6 +3469,21 @@ void AnimationKeyEditor::_animation_loop_changed() { } +void AnimationKeyEditor::_animation_loop_interpolation_changed() { + + if (updating) + return; + + if (!animation.is_null()) { + + undo_redo->create_action(TTR("Change Anim Loop Interpolation")); + undo_redo->add_do_method(animation.ptr(),"set_loop_interpolation",loop_interpolation->is_pressed()); + undo_redo->add_undo_method(animation.ptr(),"set_loop_interpolation",!loop_interpolation->is_pressed()); + undo_redo->commit_action(); + } + +} + void AnimationKeyEditor::_create_value_item(int p_type) { @@ -3536,7 +3561,7 @@ void AnimationKeyEditor::_insert_delay() { pos=animation->get_length(); timeline_pos=pos; track_pos->update(); - emit_signal("timeline_changed",pos); + emit_signal("timeline_changed",pos,true); } insert_queue=false; } @@ -3744,6 +3769,7 @@ void AnimationKeyEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_loop_changed"),&AnimationKeyEditor::_animation_loop_changed); + ObjectTypeDB::bind_method(_MD("_animation_loop_interpolation_changed"),&AnimationKeyEditor::_animation_loop_interpolation_changed); ObjectTypeDB::bind_method(_MD("_animation_len_changed"),&AnimationKeyEditor::_animation_len_changed); ObjectTypeDB::bind_method(_MD("_create_value_item"),&AnimationKeyEditor::_create_value_item); ObjectTypeDB::bind_method(_MD("_pane_drag"),&AnimationKeyEditor::_pane_drag); @@ -3759,7 +3785,7 @@ void AnimationKeyEditor::_bind_methods() { ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) ); ADD_SIGNAL( MethodInfo("keying_changed" ) ); - ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos") ) ); + ADD_SIGNAL( MethodInfo("timeline_changed", PropertyInfo(Variant::REAL,"pos"), PropertyInfo(Variant::BOOL,"drag") ) ); ADD_SIGNAL( MethodInfo("animation_len_changed", PropertyInfo(Variant::REAL,"len") ) ); ADD_SIGNAL( MethodInfo("animation_step_changed", PropertyInfo(Variant::REAL,"step") ) ); ADD_SIGNAL( MethodInfo("key_edited", PropertyInfo(Variant::INT,"track"), PropertyInfo(Variant::INT,"key") ) ); @@ -3854,6 +3880,12 @@ AnimationKeyEditor::AnimationKeyEditor() { hb->add_child(loop); loop->set_tooltip(TTR("Enable/Disable looping in animation.")); + loop_interpolation = memnew( ToolButton ); + loop_interpolation->set_toggle_mode(true); + loop_interpolation->connect("pressed",this,"_animation_loop_interpolation_changed"); + hb->add_child(loop_interpolation); + loop_interpolation->set_tooltip(TTR("Enable/Disable interpolation when looping animation.")); + hb->add_child( memnew( VSeparator ) ); menu_add_track = memnew( MenuButton ); diff --git a/tools/editor/animation_editor.h b/tools/editor/animation_editor.h index 413c73b4b9..c8de1d87c1 100644 --- a/tools/editor/animation_editor.h +++ b/tools/editor/animation_editor.h @@ -173,6 +173,7 @@ class AnimationKeyEditor : public VBoxContainer { //MenuButton *menu; SpinBox *length; Button *loop; + Button *loop_interpolation; bool keying; ToolButton *edit_button; ToolButton *move_up_button; @@ -238,6 +239,7 @@ class AnimationKeyEditor : public VBoxContainer { void _animation_len_changed(float p_len); void _animation_loop_changed(); + void _animation_loop_interpolation_changed(); void _step_changed(float p_len); struct InsertData { diff --git a/tools/editor/array_property_edit.cpp b/tools/editor/array_property_edit.cpp index 1ff6e644d7..b6219ce67b 100644 --- a/tools/editor/array_property_edit.cpp +++ b/tools/editor/array_property_edit.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* array_property_edit.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 "array_property_edit.h" #include "editor_node.h" diff --git a/tools/editor/array_property_edit.h b/tools/editor/array_property_edit.h index 948b2a71a3..a2aa24c8ed 100644 --- a/tools/editor/array_property_edit.h +++ b/tools/editor/array_property_edit.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* array_property_edit.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. */ +/*************************************************************************/ #ifndef ARRAY_PROPERTY_EDIT_H #define ARRAY_PROPERTY_EDIT_H diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp index be5d9c47ff..644478923c 100644 --- a/tools/editor/code_editor.cpp +++ b/tools/editor/code_editor.cpp @@ -30,6 +30,7 @@ #include "editor_settings.h" #include "scene/gui/margin_container.h" #include "scene/gui/separator.h" +#include "scene/resources/dynamic_font.h" #include "os/keyboard.h" void GotoLineDialog::popup_find_line(TextEdit *p_edit) { @@ -974,6 +975,48 @@ FindReplaceDialog::FindReplaceDialog() { /*** CODE EDITOR ****/ +void CodeTextEditor::_text_editor_input_event(const InputEvent& p_event) { + + if (p_event.type==InputEvent::MOUSE_BUTTON) { + + const InputEventMouseButton& mb=p_event.mouse_button; + + if (mb.pressed && mb.mod.command) { + + if (mb.button_index==BUTTON_WHEEL_UP) { + + font_resize_val+=1; + + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); + + } else if (mb.button_index==BUTTON_WHEEL_DOWN) { + + font_resize_val-=1; + + if (font_resize_timer->get_time_left()==0) + font_resize_timer->start(); + } + } + } else if (p_event.type==InputEvent::KEY) { + + const InputEventKey& k=p_event.key; + + if (k.pressed && k.mod.command) { + + if (k.scancode==KEY_0) { // reset source font size to default + + Ref<DynamicFont> font = text_editor->get_font("font"); + + if (font.is_valid()) { + EditorSettings::get_singleton()->set("global/source_font_size",14); + font->set_size(14); + } + } + } + } +} + void CodeTextEditor::_line_col_changed() { String text = String()+TTR("Line:")+" "+itos(text_editor->cursor_get_line()+1)+", "+TTR("Col:")+" "+itos(text_editor->cursor_get_column()); @@ -1011,6 +1054,22 @@ void CodeTextEditor::_complete_request() { text_editor->code_complete(strs); } +void CodeTextEditor::_font_resize_timeout() { + + Ref<DynamicFont> font = text_editor->get_font("font"); + + if (font.is_valid()) { + int size=font->get_size()+font_resize_val; + + if (size>=8 && size<=96) { + EditorSettings::get_singleton()->set("global/source_font_size",size); + font->set_size(size); + } + + font_resize_val=0; + } +} + void CodeTextEditor::set_error(const String& p_error) { if (p_error!="") { @@ -1026,15 +1085,15 @@ void CodeTextEditor::_update_font() { // FONTS String editor_font = EDITOR_DEF("text_editor/font", ""); - bool font_overrode = false; + bool font_overridden = false; if (editor_font!="") { Ref<Font> fnt = ResourceLoader::load(editor_font); if (fnt.is_valid()) { text_editor->add_font_override("font",fnt); - font_overrode = true; + font_overridden = true; } } - if(!font_overrode) + if(!font_overridden) text_editor->add_font_override("font",get_font("source","EditorFonts")); } @@ -1078,12 +1137,14 @@ void CodeTextEditor::_notification(int p_what) { void CodeTextEditor::_bind_methods() { + ObjectTypeDB::bind_method("_text_editor_input_event",&CodeTextEditor::_text_editor_input_event); ObjectTypeDB::bind_method("_line_col_changed",&CodeTextEditor::_line_col_changed); ObjectTypeDB::bind_method("_text_changed",&CodeTextEditor::_text_changed); ObjectTypeDB::bind_method("_on_settings_change",&CodeTextEditor::_on_settings_change); ObjectTypeDB::bind_method("_text_changed_idle_timeout",&CodeTextEditor::_text_changed_idle_timeout); ObjectTypeDB::bind_method("_code_complete_timer_timeout",&CodeTextEditor::_code_complete_timer_timeout); ObjectTypeDB::bind_method("_complete_request",&CodeTextEditor::_complete_request); + ObjectTypeDB::bind_method("_font_resize_timeout",&CodeTextEditor::_font_resize_timeout); } CodeTextEditor::CodeTextEditor() { @@ -1139,6 +1200,7 @@ CodeTextEditor::CodeTextEditor() { line_col->set_valign(Label::VALIGN_CENTER); + text_editor->connect("input_event", this,"_text_editor_input_event"); text_editor->connect("cursor_changed", this,"_line_col_changed"); text_editor->connect("text_changed", this,"_text_changed"); text_editor->connect("request_completion", this,"_complete_request"); @@ -1151,5 +1213,12 @@ CodeTextEditor::CodeTextEditor() { code_complete_timer->connect("timeout", this,"_code_complete_timer_timeout"); + font_resize_val=0; + font_resize_timer = memnew(Timer); + add_child(font_resize_timer); + font_resize_timer->set_one_shot(true); + font_resize_timer->set_wait_time(0.07); + font_resize_timer->connect("timeout", this, "_font_resize_timeout"); + EditorSettings::get_singleton()->connect("settings_changed",this,"_on_settings_change"); } diff --git a/tools/editor/code_editor.h b/tools/editor/code_editor.h index 2e1bf46c02..bdfd295ded 100644 --- a/tools/editor/code_editor.h +++ b/tools/editor/code_editor.h @@ -202,22 +202,27 @@ class CodeTextEditor : public VBoxContainer { Timer *code_complete_timer; bool enable_complete_timer; + Timer *font_resize_timer; + int font_resize_val; + Label *error; void _on_settings_change(); void _update_font(); void _complete_request(); + void _font_resize_timeout(); + + void _text_editor_input_event(const InputEvent& p_event); + protected: void set_error(const String& p_error); - virtual void _load_theme_settings() {} virtual void _validate_script()=0; virtual void _code_complete_script(const String& p_code, List<String>* r_options) {}; - void _text_changed_idle_timeout(); void _code_complete_timer_timeout(); void _text_changed(); @@ -225,7 +230,6 @@ protected: void _notification(int); static void _bind_methods(); - public: TextEdit *get_text_edit() { return text_editor; } diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp index 8847654ad7..faaae4360b 100644 --- a/tools/editor/connections_dialog.cpp +++ b/tools/editor/connections_dialog.cpp @@ -309,7 +309,7 @@ ConnectDialog::ConnectDialog() { tree = memnew(SceneTreeEditor(false)); - vbc_left->add_margin_child(TTR("Conect To Node:"),tree,true); + vbc_left->add_margin_child(TTR("Connect To Node:"),tree,true); diff --git a/tools/editor/default_saver.cpp b/tools/editor/default_saver.cpp deleted file mode 100644 index 611232e04b..0000000000 --- a/tools/editor/default_saver.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************/ -/* default_saver.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. */ -/*************************************************************************/ diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp index 6ad7704815..ad2eb57f00 100644 --- a/tools/editor/dependency_editor.cpp +++ b/tools/editor/dependency_editor.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* dependency_editor.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 "dependency_editor.h" #include "os/file_access.h" #include "scene/gui/margin_container.h" diff --git a/tools/editor/dependency_editor.h b/tools/editor/dependency_editor.h index c372025ca0..60758f8f4e 100644 --- a/tools/editor/dependency_editor.h +++ b/tools/editor/dependency_editor.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* dependency_editor.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. */ +/*************************************************************************/ #ifndef DEPENDENCY_EDITOR_H #define DEPENDENCY_EDITOR_H diff --git a/tools/editor/editor_asset_installer.cpp b/tools/editor/editor_asset_installer.cpp index 2967abbc0a..ec36773d8d 100644 --- a/tools/editor/editor_asset_installer.cpp +++ b/tools/editor/editor_asset_installer.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_asset_installer.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 "editor_asset_installer.h" #include "io/zip_io.h" #include "os/dir_access.h" diff --git a/tools/editor/editor_asset_installer.h b/tools/editor/editor_asset_installer.h index 713c5f14f1..d6e71dbb3c 100644 --- a/tools/editor/editor_asset_installer.h +++ b/tools/editor/editor_asset_installer.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_asset_installer.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. */ +/*************************************************************************/ #ifndef EDITORASSETINSTALLER_H #define EDITORASSETINSTALLER_H diff --git a/tools/editor/editor_data.h b/tools/editor/editor_data.h index 79843c4df5..319155655d 100644 --- a/tools/editor/editor_data.h +++ b/tools/editor/editor_data.h @@ -34,7 +34,6 @@ #include "list.h" #include "undo_redo.h" #include "pair.h" -#include "default_saver.h" class EditorHistory { diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp index 395c4ba680..a6e231cf18 100644 --- a/tools/editor/editor_dir_dialog.cpp +++ b/tools/editor/editor_dir_dialog.cpp @@ -30,6 +30,7 @@ #include "os/os.h" #include "os/keyboard.h" #include "tools/editor/editor_settings.h" +#include "tools/editor/editor_file_system.h" void EditorDirDialog::_update_dir(TreeItem* p_item) { @@ -77,6 +78,11 @@ void EditorDirDialog::_update_dir(TreeItem* p_item) { void EditorDirDialog::reload() { + if (!is_visible()) { + must_reload=true; + return; + } + tree->clear(); TreeItem *root = tree->create_item(); root->set_metadata(0,"res://"); @@ -84,13 +90,24 @@ void EditorDirDialog::reload() { root->set_text(0,"/"); _update_dir(root); _item_collapsed(root); + must_reload=false; + } + void EditorDirDialog::_notification(int p_what) { if (p_what==NOTIFICATION_ENTER_TREE) { reload(); tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED); + EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload"); + + } + + if (p_what==NOTIFICATION_VISIBILITY_CHANGED) { + if (must_reload && is_visible()) { + reload(); + } } } @@ -198,6 +215,7 @@ void EditorDirDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_item_collapsed"),&EditorDirDialog::_item_collapsed); ObjectTypeDB::bind_method(_MD("_make_dir"),&EditorDirDialog::_make_dir); ObjectTypeDB::bind_method(_MD("_make_dir_confirm"),&EditorDirDialog::_make_dir_confirm); + ObjectTypeDB::bind_method(_MD("reload"),&EditorDirDialog::reload); ADD_SIGNAL(MethodInfo("dir_selected",PropertyInfo(Variant::STRING,"dir"))); } @@ -238,4 +256,8 @@ EditorDirDialog::EditorDirDialog() { get_ok()->set_text(TTR("Choose")); + must_reload=false; + + + } diff --git a/tools/editor/editor_dir_dialog.h b/tools/editor/editor_dir_dialog.h index 1c2593219c..69f9850c30 100644 --- a/tools/editor/editor_dir_dialog.h +++ b/tools/editor/editor_dir_dialog.h @@ -53,6 +53,10 @@ class EditorDirDialog : public ConfirmationDialog { void _make_dir_confirm(); void ok_pressed(); + + bool must_reload; + + protected: void _notification(int p_what); diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index e631aad7f6..97feaa80a5 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_file_dialog.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 "editor_file_dialog.h" #include "scene/gui/label.h" #include "scene/gui/center_container.h" @@ -352,7 +380,7 @@ void EditorFileDialog::_action_pressed() { } - if (dir_access->file_exists(f)) { + if (dir_access->file_exists(f) && !disable_overwrite_warning) { confirm_save->set_text(TTR("File Exists, Overwrite?")); confirm_save->popup_centered(Size2(200,80)); } else { @@ -508,6 +536,11 @@ void EditorFileDialog::update_file_list() { } } + if (dirs.find("..")==NULL) { + //may happen if lacking permissions + dirs.push_back(".."); + } + dirs.sort_custom<NoCaseComparator>(); files.sort_custom<NoCaseComparator>(); @@ -1129,6 +1162,8 @@ void EditorFileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_display_mode","mode"),&EditorFileDialog::set_display_mode); ObjectTypeDB::bind_method(_MD("get_display_mode"),&EditorFileDialog::get_display_mode); ObjectTypeDB::bind_method(_MD("_thumbnail_result"),&EditorFileDialog::_thumbnail_result); + ObjectTypeDB::bind_method(_MD("set_disable_overwrite_warning","disable"),&EditorFileDialog::set_disable_overwrite_warning); + ObjectTypeDB::bind_method(_MD("is_overwrite_warning_disabled"),&EditorFileDialog::is_overwrite_warning_disabled); ObjectTypeDB::bind_method(_MD("_recent_selected"),&EditorFileDialog::_recent_selected); ObjectTypeDB::bind_method(_MD("_go_back"),&EditorFileDialog::_go_back); @@ -1202,12 +1237,23 @@ void EditorFileDialog::_save_to_recent() { } +void EditorFileDialog::set_disable_overwrite_warning(bool p_disable) { + + disable_overwrite_warning=p_disable; +} + +bool EditorFileDialog::is_overwrite_warning_disabled() const{ + + return disable_overwrite_warning; +} + + EditorFileDialog::EditorFileDialog() { show_hidden_files=default_show_hidden_files; display_mode=default_display_mode; local_history_pos=0; - + disable_overwrite_warning=false; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); @@ -1433,4 +1479,5 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() { dialog->connect("dir_selected",this,"_chosen"); dialog->connect("files_selected",this,"_chosen"); + } diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index a8f62a5226..14683856c0 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* file_dialog.h */ +/* editor_file_dialog.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,8 +26,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ - - #ifndef EDITORFILEDIALOG_H #define EDITORFILEDIALOG_H @@ -132,6 +130,7 @@ private: bool show_hidden_files; DisplayMode display_mode; + bool disable_overwrite_warning; bool invalidated; void update_dir(); @@ -218,6 +217,9 @@ public: void invalidate(); + void set_disable_overwrite_warning(bool p_disable); + bool is_overwrite_warning_disabled() const; + EditorFileDialog(); ~EditorFileDialog(); diff --git a/tools/editor/editor_fonts.cpp b/tools/editor/editor_fonts.cpp index 7ec22a4068..47891eef6c 100644 --- a/tools/editor/editor_fonts.cpp +++ b/tools/editor/editor_fonts.cpp @@ -157,12 +157,18 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("doc_source","EditorFonts",df_doc_code); + if (editor_is_hidpi()) { //replace default theme Ref<Texture> di; Ref<StyleBox> ds; fill_default_theme(p_theme,df,df_doc,di,ds,true); + } else { + Ref<Texture> di; + Ref<StyleBox> ds; + fill_default_theme(p_theme,df,df_doc,di,ds,false); + } } diff --git a/tools/editor/editor_initialize_ssl.cpp b/tools/editor/editor_initialize_ssl.cpp index e0602a88c7..c0b55b302f 100644 --- a/tools/editor/editor_initialize_ssl.cpp +++ b/tools/editor/editor_initialize_ssl.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_initialize_ssl.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 "editor_initialize_ssl.h" #include "certs_compressed.h" #include "io/stream_peer_ssl.h" diff --git a/tools/editor/editor_initialize_ssl.h b/tools/editor/editor_initialize_ssl.h index 4eaf387a0a..082d546832 100644 --- a/tools/editor/editor_initialize_ssl.h +++ b/tools/editor/editor_initialize_ssl.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_initialize_ssl.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. */ +/*************************************************************************/ #ifndef EDITOR_INITIALIZE_SSL_H #define EDITOR_INITIALIZE_SSL_H diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 1132db5991..5a3e3069e4 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -29,8 +29,7 @@ #include "version.h" #include "editor_node.h" #include "print_string.h" -#include "editor_icons.h" -#include "editor_fonts.h" +#include "editor_themes.h" #include "editor_help.h" #include "core/io/resource_saver.h" @@ -206,6 +205,18 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { case KEY_F6: _menu_option_confirm(RUN_PLAY_SCENE,true); break; //case KEY_F7: _menu_option_confirm(RUN_PAUSE,true); break; case KEY_F8: _menu_option_confirm(RUN_STOP,true); break;*/ + case KEY_TAB: + if (p_event.key.mod.command) { + int current_tab = editor_data.get_edited_scene(); + int tab_offset = 1; + if (p_event.key.mod.shift) + tab_offset = -1; + int next_tab = current_tab + tab_offset; + next_tab = next_tab >= 0 ? next_tab : editor_data.get_edited_scene_count() - 1; + next_tab %= editor_data.get_edited_scene_count(); + _scene_tab_changed(next_tab); + } + break; } } @@ -743,100 +754,6 @@ void EditorNode::_set_scene_metadata(const String& p_file) { } -static Error _fix_object_paths(Object* obj, Node* root, String save_path) { - - Globals* g = Globals::get_singleton(); - - String import_dir = root->get_meta("__editor_import_file__"); - import_dir = import_dir.get_base_dir(); - import_dir = DirAccess::normalize_path(import_dir); - if (import_dir[import_dir.length()-1] != '/') { - import_dir = import_dir + "/"; - }; - - String resource_dir = DirAccess::normalize_path(g->get_resource_path()); - if (resource_dir[resource_dir.length()-1] != '/') { - resource_dir = resource_dir + "/"; - }; - - - List<PropertyInfo> list; - obj->get_property_list(&list, false); - - List<PropertyInfo>::Element *E = list.front(); - - while (E) { - - Variant v = obj->get(E->get().name); - if (v.get_type() == Variant::OBJECT) { - - Ref<Resource> res = (RefPtr)v; - if (res.is_null()) { - E = E->next(); - continue; - } - - if (res->get_path() != "") { - - String res_path = res->get_path(); - res_path = Globals::get_singleton()->globalize_path(res_path); - res_path = DirAccess::normalize_path(res_path); - - if (res_path.find(resource_dir) != 0) { - - // path of resource is not inside engine's resource path - - String new_path; - - if (res_path.find(import_dir) == 0) { - - // path of resource is relative to path of import file - new_path = save_path + "/" + res_path.substr(import_dir.length(), res_path.length() - import_dir.length()); - - } else { - - // path of resource is not relative to import file - new_path = save_path + "/" + res_path.get_file(); - }; - - res->set_path(g->localize_path(new_path)); - DirAccess* d = DirAccess::create(DirAccess::ACCESS_RESOURCES); - d->make_dir_recursive(new_path.get_base_dir()); - printf("copying from %ls to %ls\n", res_path.c_str(), new_path.c_str()); - Error err = d->copy(res_path, new_path); - memdelete(d); - ERR_FAIL_COND_V(err != OK, err); - } - - } else { - - _fix_object_paths(res.operator->(), root, save_path); - }; - }; - - - E = E->next(); - }; - - return OK; -}; - -static Error _fix_imported_scene_paths(Node* node, Node* root, String save_path) { - - if (node == root || node->get_owner() == root) { - Error e = _fix_object_paths(node, root, save_path); - ERR_FAIL_COND_V(e != OK, e); - }; - - for (int i=0; i<node->get_child_count(); i++) { - - Error e = _fix_imported_scene_paths(node->get_child(i), root, save_path); - ERR_FAIL_COND_V(e != OK, e); - }; - - return OK; -}; - bool EditorNode::_find_and_save_resource(RES res,Map<RES,bool>& processed,int32_t flags) { @@ -1253,7 +1170,6 @@ void EditorNode::_dialog_action(String p_file) { } break; case FILE_RUN_SCRIPT: { - print_line("RUN: "+p_file); Ref<Script> scr = ResourceLoader::load(p_file,"Script",true); if (scr.is_null()) { add_io_error("Script Failed to Load:\n"+p_file); @@ -1397,7 +1313,6 @@ void EditorNode::_dialog_action(String p_file) { ret = unzGoToFirstFile(pkg); EditorProgress p("ltask",TTR("Loading Export Templates"),fc); - print_line("BEGIN IMPORT"); fc=0; @@ -1427,7 +1342,6 @@ void EditorNode::_dialog_action(String p_file) { file=file.get_file(); p.step(TTR("Importing:")+" "+file,fc); - print_line("IMPORT "+file); FileAccess *f = FileAccess::open(EditorSettings::get_singleton()->get_settings_path()+"/templates/"+file,FileAccess::WRITE); @@ -2215,7 +2129,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { String existing; if (extensions.size()) { String root_name(get_edited_scene()->get_name()); - existing=root_name+"."+extensions.front()->get().to_lower(); + existing=root_name+".tscn";//+extensions.front()->get().to_lower(); } file->set_current_path(existing); @@ -3646,7 +3560,6 @@ Error EditorNode::load_scene(const String& p_scene, bool p_ignore_broken_deps,bo load_errors->clear(); String lpath = Globals::get_singleton()->localize_path(p_scene); - print_line("LOCAL PATH: "+lpath+" from "+p_scene); if (!lpath.begins_with("res://")) { current_option=-1; @@ -4293,7 +4206,6 @@ void EditorNode::_dock_select_input(const InputEvent& p_input) { dock_slot[dock_popup_selected]->set_current_tab(0); } - print_line("performing reparent"); dock_slot[nrect]->add_child(dock); dock_popup_selected=nrect; dock_slot[nrect]->set_current_tab(dock_slot[nrect]->get_tab_count()-1); @@ -4706,9 +4618,9 @@ void EditorNode::_update_layouts_menu() { editor_layouts->set_size(Vector2()); editor_layouts->add_shortcut(ED_SHORTCUT("layout/save",TTR("Save Layout")), SETTINGS_LAYOUT_SAVE); - editor_layouts->add_shortcut(ED_SHORTCUT("layout/load",TTR("Load Layout")), SETTINGS_LAYOUT_DELETE); + editor_layouts->add_shortcut(ED_SHORTCUT("layout/delete",TTR("Delete Layout")), SETTINGS_LAYOUT_DELETE); editor_layouts->add_separator(); - editor_layouts->add_shortcut(ED_SHORTCUT("property_editor/reset",TTR("Default")), SETTINGS_LAYOUT_DEFAULT); + editor_layouts->add_shortcut(ED_SHORTCUT("layout/default",TTR("Default")), SETTINGS_LAYOUT_DEFAULT); Ref<ConfigFile> config; config.instance(); @@ -5267,7 +5179,6 @@ EditorNode::EditorNode() { EditorSettings::create(); { int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode"); - print_line("DPI MODE: "+itos(dpi_mode)); if (dpi_mode==0) { editor_set_hidpi( OS::get_singleton()->get_screen_dpi(0) > 150 ); } else if (dpi_mode==2) { @@ -5318,38 +5229,18 @@ EditorNode::EditorNode() { ObjectTypeDB::set_type_enabled("CollisionShape",true); ObjectTypeDB::set_type_enabled("CollisionShape2D",true); ObjectTypeDB::set_type_enabled("CollisionPolygon2D",true); - //ObjectTypeDB::set_type_enabled("BodyVolumeConvexPolygon",true); + + Control *theme_base = memnew( Control ); + add_child(theme_base); + theme_base->set_area_as_parent_rect(); gui_base = memnew( Panel ); - add_child(gui_base); + theme_base->add_child(gui_base); gui_base->set_area_as_parent_rect(); - - theme = Ref<Theme>( memnew( Theme ) ); - gui_base->set_theme( theme ); - editor_register_icons(theme); - editor_register_fonts(theme); - - //theme->set_icon("folder","EditorFileDialog",Theme::get_default()->get_icon("folder","EditorFileDialog")); - //theme->set_color("files_disabled","EditorFileDialog",Color(0,0,0,0.7)); - - String global_font = EditorSettings::get_singleton()->get("global/custom_font"); - if (global_font!="") { - Ref<Font> fnt = ResourceLoader::load(global_font); - if (fnt.is_valid()) { - theme->set_default_theme_font(fnt); - } - } - - Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); - focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); - for(int i=0;i<4;i++) { - focus_sbt->set_margin_size(Margin(i),16); - focus_sbt->set_default_margin(Margin(i),16); - } - focus_sbt->set_draw_center(false); - theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); - + theme_base->set_theme( create_default_theme() ); + theme = create_editor_theme(); + gui_base->set_theme(theme); resource_preview = memnew( EditorResourcePreview ); add_child(resource_preview); @@ -5635,8 +5526,8 @@ EditorNode::EditorNode() { p->add_submenu_item(TTR("Convert To.."),"Export"); pm_export->add_item(TTR("Translatable Strings.."),FILE_DUMP_STRINGS); pm_export->add_separator(); - pm_export->add_item(TTR("MeshLibrary.."),FILE_EXPORT_MESH_LIBRARY); - pm_export->add_item(TTR("TileSet.."),FILE_EXPORT_TILESET); + pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_MeshLibrary", TTR("MeshLibrary..")), FILE_EXPORT_MESH_LIBRARY); + pm_export->add_shortcut(ED_SHORTCUT("editor/convert_to_TileSet", TTR("TileSet..")), FILE_EXPORT_TILESET); pm_export->connect("item_pressed",this,"_menu_option"); p->add_separator(); @@ -6540,12 +6431,12 @@ EditorNode::EditorNode() { { List<StringName> tl; StringName ei = "EditorIcons"; - gui_base->get_theme()->get_icon_list(ei,&tl); + theme_base->get_theme()->get_icon_list(ei,&tl); for(List<StringName>::Element *E=tl.front();E;E=E->next()) { if (!ObjectTypeDB::type_exists(E->get())) continue; - icon_type_cache[E->get()]=gui_base->get_theme()->get_icon(E->get(),ei); + icon_type_cache[E->get()]=theme_base->get_theme()->get_icon(E->get(),ei); } } diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h index 7023c6c174..bea973a357 100644 --- a/tools/editor/editor_node.h +++ b/tools/editor/editor_node.h @@ -65,7 +65,6 @@ #include "tools/editor/editor_log.h" #include "tools/editor/scene_tree_dock.h" #include "tools/editor/resources_dock.h" -#include "tools/editor/optimized_save_dialog.h" #include "tools/editor/editor_run_script.h" #include "tools/editor/editor_run_native.h" @@ -693,6 +692,7 @@ public: static void unregister_editor_types(); Control *get_gui_base() { return gui_base; } + Control *get_theme_base() { return gui_base->get_parent_control(); } static void add_io_error(const String& p_error); diff --git a/tools/editor/editor_plugin_settings.cpp b/tools/editor/editor_plugin_settings.cpp index 1a6be05af3..5342007e6d 100644 --- a/tools/editor/editor_plugin_settings.cpp +++ b/tools/editor/editor_plugin_settings.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_plugin_settings.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 "editor_plugin_settings.h" #include "scene/gui/margin_container.h" #include "io/config_file.h" diff --git a/tools/editor/editor_plugin_settings.h b/tools/editor/editor_plugin_settings.h index 4f3c5b8268..4a982e40e2 100644 --- a/tools/editor/editor_plugin_settings.h +++ b/tools/editor/editor_plugin_settings.h @@ -1,10 +1,37 @@ +/*************************************************************************/ +/* editor_plugin_settings.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. */ +/*************************************************************************/ #ifndef EDITORPLUGINSETTINGS_H #define EDITORPLUGINSETTINGS_H #include "scene/gui/dialogs.h" #include "property_editor.h" -#include "optimized_save_dialog.h" #include "undo_redo.h" #include "editor_data.h" diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp index 05b935f26c..8975c0ec35 100644 --- a/tools/editor/editor_resource_preview.cpp +++ b/tools/editor/editor_resource_preview.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_resource_preview.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 "editor_resource_preview.h" #include "editor_settings.h" #include "os/file_access.h" diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h index 13c3d51313..63dc5c3dd3 100644 --- a/tools/editor/editor_resource_preview.h +++ b/tools/editor/editor_resource_preview.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_resource_preview.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. */ +/*************************************************************************/ #ifndef EDITORRESOURCEPREVIEW_H #define EDITORRESOURCEPREVIEW_H diff --git a/tools/editor/editor_run_script.cpp b/tools/editor/editor_run_script.cpp index d34cac1530..765f36d3bc 100644 --- a/tools/editor/editor_run_script.cpp +++ b/tools/editor/editor_run_script.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_run_script.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 "editor_run_script.h" #include "editor_node.h" diff --git a/tools/editor/editor_run_script.h b/tools/editor/editor_run_script.h index 8dbefced7f..144fad5ab1 100644 --- a/tools/editor/editor_run_script.h +++ b/tools/editor/editor_run_script.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_run_script.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. */ +/*************************************************************************/ #ifndef EDITOR_RUN_SCRIPT_H #define EDITOR_RUN_SCRIPT_H diff --git a/tools/editor/editor_selection.cpp b/tools/editor/editor_selection.cpp deleted file mode 100644 index f3fbdba907..0000000000 --- a/tools/editor/editor_selection.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************/ -/* editor_selection.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 "editor_selection.h" - diff --git a/tools/editor/editor_selection.h b/tools/editor/editor_selection.h deleted file mode 100644 index d238d86567..0000000000 --- a/tools/editor/editor_selection.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************/ -/* editor_selection.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. */ -/*************************************************************************/ -#ifndef EDITOR_SELECTION_H -#define EDITOR_SELECTION_H - -#endif // EDITOR_SELECTION_H diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 0d0008fcb8..49a1158ec6 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -63,7 +63,6 @@ bool EditorSettings::_set(const StringName& p_name, const Variant& p_value) { Array arr=p_value; ERR_FAIL_COND_V(arr.size() && arr.size()&1,true); - print_line("shortcuts: "+Variant(arr).get_construct_string()); for(int i=0;i<arr.size();i+=2) { String name = arr[i]; @@ -381,7 +380,7 @@ void EditorSettings::create() { singleton->save_changed_setting=true; singleton->config_file_path=config_file_path; singleton->settings_path=config_path+"/"+config_dir; - singleton->_load_defaults(extra_config); + singleton->_load_defaults(extra_config); singleton->setup_language(); singleton->setup_network(); singleton->list_text_editor_themes(); @@ -399,14 +398,11 @@ String EditorSettings::get_settings_path() const { void EditorSettings::setup_language() { String lang = get("global/editor_language"); - print_line("LANG IS "+lang); if (lang=="en") return; //none to do for(int i=0;i<translations.size();i++) { - print_line("TESTING "+translations[i]->get_locale()); if (translations[i]->get_locale()==lang) { - print_line("ok translation"); TranslationServer::get_singleton()->set_tool_translation(translations[i]); break; } @@ -515,9 +511,13 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("global/font_size",14); hints["global/font_size"]=PropertyInfo(Variant::INT,"global/font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/source_font_size",14); - hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"10,40,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["global/source_font_size"]=PropertyInfo(Variant::INT,"global/source_font_size",PROPERTY_HINT_RANGE,"8,96,1",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); set("global/custom_font",""); hints["global/custom_font"]=PropertyInfo(Variant::STRING,"global/custom_font",PROPERTY_HINT_GLOBAL_FILE,"*.fnt",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + set("global/custom_theme",""); + hints["global/custom_theme"]=PropertyInfo(Variant::STRING,"global/custom_theme",PROPERTY_HINT_GLOBAL_FILE,"*.res,*.tres,*.theme",PROPERTY_USAGE_DEFAULT|PROPERTY_USAGE_RESTART_IF_CHANGED); + + set("global/autoscan_project_path",""); hints["global/autoscan_project_path"]=PropertyInfo(Variant::STRING,"global/autoscan_project_path",PROPERTY_HINT_GLOBAL_DIR); set("global/default_project_path",""); @@ -563,6 +563,8 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { 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("scenetree_editor/display_old_action_buttons",false); set("scenetree_editor/start_create_dialog_fully_expanded",false); + set("scenetree_editor/draw_relationship_lines",false); + set("scenetree_editor/relationship_line_color",Color::html("464646")); set("gridmap_editor/pick_distance", 5000.0); @@ -581,7 +583,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("3d_editor/zoom_modifier",4); hints["3d_editor/zoom_modifier"]=PropertyInfo(Variant::INT,"3d_editor/zoom_modifier",PROPERTY_HINT_ENUM,"None,Shift,Alt,Meta,Ctrl"); set("3d_editor/emulate_numpad",false); - set("3d_editor/trackpad_hint", false); + set("3d_editor/emulate_3_button_mouse", false); set("2d_editor/bone_width",5); set("2d_editor/bone_color1",Color(1.0,1.0,1.0,0.9)); @@ -705,7 +707,6 @@ void EditorSettings::notify_changes() { sml = OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); if (!sml) { - print_line("not SML"); return; } diff --git a/tools/editor/scenes.cpp b/tools/editor/editor_themes.cpp index e6569c98a9..44e21aee85 100644 --- a/tools/editor/scenes.cpp +++ b/tools/editor/editor_themes.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* scenes.cpp */ +/* editor_themes.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,8 +26,52 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "scenes.h" -Scenes::Scenes() +#include "editor_themes.h" +#include "editor_icons.h" +#include "editor_fonts.h" +#include "editor_settings.h" +#include "core/io/resource_loader.h" + +Ref<Theme> create_default_theme() { + Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); + + editor_register_fonts(theme); + editor_register_icons(theme); + + Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); + focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); + for(int i=0;i<4;i++) { + focus_sbt->set_margin_size(Margin(i),16); + focus_sbt->set_default_margin(Margin(i),16); + } + focus_sbt->set_draw_center(false); + theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); + + return theme; +} + +Ref<Theme> create_editor_theme() +{ + Ref<Theme> theme = NULL; + + String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); + if (custom_theme!="") { + theme = ResourceLoader::load(custom_theme); + } + + if (theme.is_null() || !theme.is_valid()) { + theme = create_default_theme(); + } + + String global_font = EditorSettings::get_singleton()->get("global/custom_font"); + if (global_font!="") { + Ref<Font> fnt = ResourceLoader::load(global_font); + if (fnt.is_valid()) { + theme->set_default_theme_font(fnt); + } + } + + return theme; } diff --git a/tools/editor/default_saver.h b/tools/editor/editor_themes.h index 2b1a1edb23..dbff8b3079 100644 --- a/tools/editor/default_saver.h +++ b/tools/editor/editor_themes.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* default_saver.h */ +/* editor_themes.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,10 +26,13 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef DEFAULT_SAVER_H -#define DEFAULT_SAVER_H +#ifndef EDITOR_THEMES_H +#define EDITOR_THEMES_H +#include "scene/resources/theme.h" +Ref<Theme> create_default_theme(); +Ref<Theme> create_editor_theme(); -#endif // DEFAULT_SAVER_H +#endif diff --git a/tools/editor/editor_vu.cpp b/tools/editor/editor_vu.cpp deleted file mode 100644 index 7a133c9736..0000000000 --- a/tools/editor/editor_vu.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/*************************************************************************/ -/* editor_vu.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 "editor_vu.h" - diff --git a/tools/editor/editor_vu.h b/tools/editor/editor_vu.h deleted file mode 100644 index 78fe3eda86..0000000000 --- a/tools/editor/editor_vu.h +++ /dev/null @@ -1,32 +0,0 @@ -/*************************************************************************/ -/* editor_vu.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. */ -/*************************************************************************/ -#ifndef EDITOR_VU_H -#define EDITOR_VU_H - -#endif // EDITOR_VU_H diff --git a/tools/editor/fileserver/editor_file_server.cpp b/tools/editor/fileserver/editor_file_server.cpp index ea95e4da1c..c464e10fc2 100644 --- a/tools/editor/fileserver/editor_file_server.cpp +++ b/tools/editor/fileserver/editor_file_server.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_file_server.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 "editor_file_server.h" #include "io/marshalls.h" #include "io/marshalls.h" diff --git a/tools/editor/fileserver/editor_file_server.h b/tools/editor/fileserver/editor_file_server.h index 587b2c4fdb..fcb3d8546c 100644 --- a/tools/editor/fileserver/editor_file_server.h +++ b/tools/editor/fileserver/editor_file_server.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_file_server.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. */ +/*************************************************************************/ #ifndef EDITOR_FILE_SERVER_H #define EDITOR_FILE_SERVER_H diff --git a/tools/editor/icons/2x/icon_cone_twist_joint.png b/tools/editor/icons/2x/icon_cone_twist_joint.png Binary files differnew file mode 100644 index 0000000000..3aeba5855d --- /dev/null +++ b/tools/editor/icons/2x/icon_cone_twist_joint.png diff --git a/tools/editor/icons/2x/icon_generic_6_d_o_f_joint.png b/tools/editor/icons/2x/icon_generic_6_d_o_f_joint.png Binary files differnew file mode 100644 index 0000000000..506c873376 --- /dev/null +++ b/tools/editor/icons/2x/icon_generic_6_d_o_f_joint.png diff --git a/tools/editor/icons/2x/icon_hinge_joint.png b/tools/editor/icons/2x/icon_hinge_joint.png Binary files differnew file mode 100644 index 0000000000..b888102573 --- /dev/null +++ b/tools/editor/icons/2x/icon_hinge_joint.png diff --git a/tools/editor/icons/2x/icon_interpolated_camera.png b/tools/editor/icons/2x/icon_interpolated_camera.png Binary files differnew file mode 100644 index 0000000000..e4551a84ce --- /dev/null +++ b/tools/editor/icons/2x/icon_interpolated_camera.png diff --git a/tools/editor/icons/2x/icon_loop_interpolation.png b/tools/editor/icons/2x/icon_loop_interpolation.png Binary files differnew file mode 100644 index 0000000000..6009b50300 --- /dev/null +++ b/tools/editor/icons/2x/icon_loop_interpolation.png diff --git a/tools/editor/icons/2x/icon_rating_no_star.png b/tools/editor/icons/2x/icon_rating_no_star.png Binary files differindex 0d0c893938..f855fd8b56 100644 --- a/tools/editor/icons/2x/icon_rating_no_star.png +++ b/tools/editor/icons/2x/icon_rating_no_star.png diff --git a/tools/editor/icons/2x/icon_tool_button.png b/tools/editor/icons/2x/icon_tool_button.png Binary files differnew file mode 100644 index 0000000000..091fa8334f --- /dev/null +++ b/tools/editor/icons/2x/icon_tool_button.png diff --git a/tools/editor/icons/2x/icon_track_trigger.png b/tools/editor/icons/2x/icon_track_trigger.png Binary files differnew file mode 100644 index 0000000000..c04d47f9a4 --- /dev/null +++ b/tools/editor/icons/2x/icon_track_trigger.png diff --git a/tools/editor/icons/icon_cone_twist_joint.png b/tools/editor/icons/icon_cone_twist_joint.png Binary files differnew file mode 100644 index 0000000000..bbf93f2f71 --- /dev/null +++ b/tools/editor/icons/icon_cone_twist_joint.png diff --git a/tools/editor/icons/icon_generic_6_d_o_f_joint.png b/tools/editor/icons/icon_generic_6_d_o_f_joint.png Binary files differnew file mode 100644 index 0000000000..00ba76c098 --- /dev/null +++ b/tools/editor/icons/icon_generic_6_d_o_f_joint.png diff --git a/tools/editor/icons/icon_hinge_joint.png b/tools/editor/icons/icon_hinge_joint.png Binary files differnew file mode 100644 index 0000000000..246ca1ba42 --- /dev/null +++ b/tools/editor/icons/icon_hinge_joint.png diff --git a/tools/editor/icons/icon_interpolated_camera.png b/tools/editor/icons/icon_interpolated_camera.png Binary files differnew file mode 100644 index 0000000000..c66724f513 --- /dev/null +++ b/tools/editor/icons/icon_interpolated_camera.png diff --git a/tools/editor/icons/icon_loop_interpolation.png b/tools/editor/icons/icon_loop_interpolation.png Binary files differnew file mode 100644 index 0000000000..488b33316e --- /dev/null +++ b/tools/editor/icons/icon_loop_interpolation.png diff --git a/tools/editor/icons/icon_rating_no_star.png b/tools/editor/icons/icon_rating_no_star.png Binary files differindex d4085330ce..e7421bdb13 100644 --- a/tools/editor/icons/icon_rating_no_star.png +++ b/tools/editor/icons/icon_rating_no_star.png diff --git a/tools/editor/icons/icon_tool_button.png b/tools/editor/icons/icon_tool_button.png Binary files differnew file mode 100644 index 0000000000..b2f3f6103f --- /dev/null +++ b/tools/editor/icons/icon_tool_button.png diff --git a/tools/editor/icons/icon_track_trigger.png b/tools/editor/icons/icon_track_trigger.png Binary files differnew file mode 100644 index 0000000000..e89f95561a --- /dev/null +++ b/tools/editor/icons/icon_track_trigger.png diff --git a/tools/editor/icons/source/icon_cone_twist_joint.svg b/tools/editor/icons/source/icon_cone_twist_joint.svg new file mode 100644 index 0000000000..4799deb1d5 --- /dev/null +++ b/tools/editor/icons/source/icon_cone_twist_joint.svg @@ -0,0 +1,93 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_area.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_cone_twist_joint.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="8.6908051" + inkscape:cy="11.390572" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </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="opacity:1;fill:none;fill-opacity:0.99607843;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="M 8 2 L 2 11 A 6 3 0 0 0 5 13.597656 A 6 3 0 0 0 11 13.597656 A 6 3 0 0 0 14 11 L 8 2 z " + transform="translate(0,1036.3622)" + id="path4172" /> + <ellipse + style="opacity:1;fill:none;fill-opacity:0.99607843;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4177" + cx="8" + cy="1047.3622" + rx="6" + ry="3" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 8,1039.3622 0,8" + id="path4179" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_generic_6_d_o_f_joint.svg b/tools/editor/icons/source/icon_generic_6_d_o_f_joint.svg new file mode 100644 index 0000000000..485040c6dc --- /dev/null +++ b/tools/editor/icons/source/icon_generic_6_d_o_f_joint.svg @@ -0,0 +1,92 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_area.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_generic_6_dof_joint.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="8.4723042" + inkscape:cy="10.441783" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </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="fill:none;fill-rule:evenodd;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" + d="m 3,1042.3622 10,5" + id="path4241" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="fill:#fc9c9c;fill-rule:evenodd;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:0.99607843;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:0.99607843" + d="m 8,1050.3622 0,-12" + id="path4243" + inkscape:connector-curvature="0" /> + <path + inkscape:connector-curvature="0" + id="path4245" + d="m 3,1047.3622 10,-5" + style="fill:none;fill-rule:evenodd;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" + sodipodi:nodetypes="cc" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_hinge_joint.svg b/tools/editor/icons/source/icon_hinge_joint.svg new file mode 100644 index 0000000000..767feac9d5 --- /dev/null +++ b/tools/editor/icons/source/icon_hinge_joint.svg @@ -0,0 +1,91 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_area.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_hinge_joint.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="8.5772937" + inkscape:cy="8.9985765" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 4,1045.3622 a 3,2.9999826 0 0 0 -3,3 3,2.9999826 0 0 0 3,3 3,2.9999826 0 0 0 3,-3 3,2.9999826 0 0 0 -3,-3 z m 0,2 a 1.0000231,1.0000174 0 0 1 1,1 1.0000231,1.0000174 0 0 1 -1,1 1.0000231,1.0000174 0 0 1 -1,-1 1.0000231,1.0000174 0 0 1 1,-1 z" + id="path4145" + inkscape:connector-curvature="0" /> + <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:#fc9c9c;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;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 7.2832031 1.328125 A 1.0001 1.0001 0 0 0 6.4023438 1.8398438 L 2.7128906 8.2304688 C 3.1188799 8.0916963 3.5469997 8 4 8 C 4.3704308 8 4.722062 8.0678727 5.0625 8.1621094 L 8.1347656 2.8398438 A 1.0001 1.0001 0 0 0 7.2832031 1.328125 z " + transform="translate(0,1036.3622)" + id="path4147" /> + <path + style="fill:none;fill-rule:evenodd;stroke:#fc9c9c;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 4,1050.3622 10,0" + id="path4149" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_interpolated_camera.svg b/tools/editor/icons/source/icon_interpolated_camera.svg new file mode 100644 index 0000000000..16fc731c12 --- /dev/null +++ b/tools/editor/icons/source/icon_interpolated_camera.svg @@ -0,0 +1,259 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_camera.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_interpolated_camera.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="8.5491949" + inkscape:cy="8.618964" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + showguides="true"> + <inkscape:grid + type="xygrid" + id="grid3336" + empspacing="4" /> + </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)"> + <rect + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4144" + width="10" + height="5.0000172" + x="1" + y="1039.3622" /> + <rect + y="1037.3622" + x="3" + height="9.0000172" + width="6" + id="rect4146" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <circle + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4148" + cx="3" + cy="1039.3622" + r="2" /> + <circle + r="2" + cy="1044.3622" + cx="3" + id="circle4150" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <circle + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="circle4152" + cx="9" + cy="1039.3622" + r="2" /> + <circle + r="2" + cy="1044.3622" + cx="9" + id="circle4154" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="m 12,1040.3622 0,3 3,1 0,-5 z" + id="rect4156" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <rect + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4141" + width="1" + height="4" + x="6" + y="1047.3622" + ry="0" /> + <rect + ry="0" + y="1047.3622" + x="7" + height="1.0000174" + width="1" + id="rect4143" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4145" + width="1" + height="1.0000174" + x="7" + y="1049.3622" + ry="0" /> + <rect + ry="0" + y="1048.3622" + x="8" + height="1.0000174" + width="1" + id="rect4147" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + ry="0" + y="1047.3622" + x="3" + height="4" + width="1" + id="rect4149" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + ry="0" + y="1048.3622" + x="10" + height="2.0000174" + width="1" + id="rect4157" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4159" + width="1" + height="1.0000174" + x="11" + y="1047.3622" + ry="0" /> + <rect + ry="0" + y="1050.3622" + x="11" + height="1.0000174" + width="1" + id="rect4161" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <rect + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4163" + width="1" + height="2.0000174" + x="12" + y="1048.3622" + ry="0" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4165" + sodipodi:type="arc" + sodipodi:cx="8" + sodipodi:cy="1048.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="3.1415927" + sodipodi:end="0" + d="m 7,1048.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" /> + <path + d="m 7,-1049.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" + sodipodi:end="0" + sodipodi:start="3.1415927" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="-1049.3622" + sodipodi:cx="8" + sodipodi:type="arc" + id="path4167" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(1,-1)" /> + <path + transform="scale(1,-1)" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4169" + sodipodi:type="arc" + sodipodi:cx="11" + sodipodi:cy="-1050.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="3.1415927" + sodipodi:end="0" + d="m 10,-1050.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" /> + <path + d="m 11,-1050.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" + sodipodi:end="0" + sodipodi:start="3.1415927" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="-1050.3622" + sodipodi:cx="12" + sodipodi:type="arc" + id="path4171" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(1,-1)" /> + <path + d="m 10,1048.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" + sodipodi:end="0" + sodipodi:start="3.1415927" + sodipodi:ry="1" + sodipodi:rx="1" + sodipodi:cy="1048.3622" + sodipodi:cx="11" + sodipodi:type="arc" + id="path4173" + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <path + style="opacity:1;fill:#fc9c9c;fill-opacity:1;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4175" + sodipodi:type="arc" + sodipodi:cx="12" + sodipodi:cy="1048.3622" + sodipodi:rx="1" + sodipodi:ry="1" + sodipodi:start="3.1415927" + sodipodi:end="0" + d="m 11,1048.3622 a 1,1 0 0 1 1,-1 1,1 0 0 1 1,1 l -1,0 z" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_loop_interpolation.svg b/tools/editor/icons/source/icon_loop_interpolation.svg new file mode 100644 index 0000000000..3733acb253 --- /dev/null +++ b/tools/editor/icons/source/icon_loop_interpolation.svg @@ -0,0 +1,111 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_loop_interpolation.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_loop_interpolation.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="3.8522581" + inkscape:cy="6.9411054" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + 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="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + inkscape:snap-midpoints="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </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 /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(0,-1036.3622)"> + <g + id="layer1-8" + inkscape:label="Layer 1" + transform="matrix(0,-1,1,0,-1021.3622,1033.3622)" /> + <circle + style="opacity:1;fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="path4155" + cx="3" + cy="1048.3622" + r="2" /> + <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:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:2;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 4 3 A 2 2 0 0 0 2.2675781 4 A 2 2 0 0 0 2.0019531 5 L 2 5 L 2 5.046875 L 2 12 L 4 12 L 4 7 L 4 5 L 6 5 L 6 3 L 4 3 z " + transform="translate(0,1036.3622)" + id="path4157" /> + <path + style="fill:#e0e0e0;fill-opacity:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 6,1037.3622 0,6 4,-3 z" + id="path4159" + inkscape:connector-curvature="0" /> + <circle + r="2" + cy="1040.3622" + cx="13" + id="circle4161" + style="opacity:1;fill:#e0e0e0;fill-opacity:0.99607843;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <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:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:2;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 12 4 L 12 9 L 12 11 L 10 11 L 10 13 L 12 13 A 2 2 0 0 0 13.732422 12 A 2 2 0 0 0 13.998047 11 L 14 11 L 14 4 L 12 4 z " + transform="translate(0,1036.3622)" + id="path4163" /> + <path + inkscape:connector-curvature="0" + id="path4165" + d="m 10,1045.3622 0,6 -4,-3 z" + style="fill:#e0e0e0;fill-opacity:0.99607843;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_rating_no_star.svg b/tools/editor/icons/source/icon_rating_no_star.svg index 123f524ed3..09a9efa112 100644 --- a/tools/editor/icons/source/icon_rating_no_star.svg +++ b/tools/editor/icons/source/icon_rating_no_star.svg @@ -29,8 +29,8 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="32" - inkscape:cx="6.994096" - inkscape:cy="8.2713563" + inkscape:cx="6.5847936" + inkscape:cy="10.189102" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="true" @@ -47,10 +47,10 @@ inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" - inkscape:object-paths="true" - inkscape:snap-intersection-paths="true" - inkscape:object-nodes="true" - inkscape:snap-smooth-nodes="true"> + inkscape:object-paths="false" + inkscape:snap-intersection-paths="false" + inkscape:object-nodes="false" + inkscape:snap-smooth-nodes="false"> <inkscape:grid type="xygrid" id="grid3336" @@ -64,7 +64,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -73,15 +73,16 @@ inkscape:groupmode="layer" id="layer1" transform="translate(0,-1036.3622)"> - <path - style="opacity:1;fill:#ffe484;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - d="M 8.0000004,1038.0862 5.62591,1042.1835 1,1043.2813 l 3.2360991,3.4074 -0.3586608,4.6735 4.1388649,-1.9766 4.1572048,1.9421 -0.395342,-4.6532 3.221834,-3.3932 -4.625909,-1.0978 -2.3740906,-4.0973 z" - id="path4254" - inkscape:connector-curvature="0" /> - <path - inkscape:connector-curvature="0" - id="path4182" - d="M 8.0000004,1038.0862 5.62591,1042.1835 1,1043.2813 l 3.2360991,3.4074 -0.3586608,4.6735 4.1388649,-1.9766 4.1572048,1.9421 -0.395342,-4.6532 3.221834,-3.3932 -4.625909,-1.0978 -2.3740906,-4.0973 z" - style="opacity:1;fill:#000000;fill-opacity:0.23529412;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <g + id="layer1-7" + inkscape:label="Layer 1" + style="fill:#c3ae65;fill-opacity:1"> + <path + id="path4254-1" + transform="translate(0,1036.3622)" + d="M 8,1.7246094 5.625,5.8222656 1,6.9199219 4.2363281,10.326172 3.8769531,15 8.015625,13.023438 12.173828,14.964844 11.777344,10.3125 15,6.9199219 10.375,5.8222656 8,1.7246094 Z M 8,4 l 1.6582031,2.7773438 3.2324219,0.7441406 -2.25,2.3007812 0.275391,3.1542964 L 8.0117188,11.660156 5.1191406,13 5.3710938,9.8320312 3.109375,7.5214844 6.3417969,6.7773438 8,4 Z" + style="opacity:1;fill:#c3ae65;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + inkscape:connector-curvature="0" /> + </g> </g> </svg> diff --git a/tools/editor/icons/source/icon_tool_button.svg b/tools/editor/icons/source/icon_tool_button.svg new file mode 100644 index 0000000000..1c5176c8c9 --- /dev/null +++ b/tools/editor/icons/source/icon_tool_button.svg @@ -0,0 +1,94 @@ +<?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/djrm/Projects/godot/tools/editor/icons/icon_button.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_tool_button.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="8.173168" + inkscape:cy="9.7479984" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1"> + <inkscape:grid + type="xygrid" + id="grid3336" + empspacing="4" /> + </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="opacity:1;fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + d="M 1 3 L 1 11 L 15 11 L 15 3 L 1 3 z M 11 4 A 3 3 0 0 1 13.826172 6 L 11 6 A 1 1 0 0 0 10 7 A 1 1 0 0 0 11 8 L 13.824219 8 A 3 3 0 0 1 11 10 A 3 3 0 0 1 8.1757812 8 L 3 8 A 1 1 0 0 1 2 7 A 1 1 0 0 1 3 6 L 8.1738281 6 A 3 3 0 0 1 11 4 z " + transform="translate(0,1036.3622)" + id="rect4139" /> + <rect + transform="scale(1,-1)" + style="opacity:1;fill:#a5efac;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4160" + width="14" + height="2.0000522" + x="1" + y="-1049.3622" /> + <rect + y="-1049.3622" + x="1" + height="2.0000522" + width="14" + id="rect4142" + style="opacity:1;fill:#000000;fill-opacity:0.07843138;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + transform="scale(1,-1)" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_track_trigger.svg b/tools/editor/icons/source/icon_track_trigger.svg new file mode 100644 index 0000000000..9c13791f70 --- /dev/null +++ b/tools/editor/icons/source/icon_track_trigger.svg @@ -0,0 +1,109 @@ +<?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="8" + viewBox="0 0 16 8" + id="svg2" + version="1.1" + inkscape:version="0.91 r13725" + inkscape:export-filename="/home/djrm/Projects/godot/tools/editor/icons/icon_track_trigger.png" + inkscape:export-xdpi="90" + inkscape:export-ydpi="90" + sodipodi:docname="icon_track_trigger.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="32" + inkscape:cx="0.93634514" + inkscape:cy="3.5256605" + inkscape:document-units="px" + inkscape:current-layer="layer1" + showgrid="true" + units="px" + inkscape:snap-bbox="true" + inkscape:bbox-paths="true" + inkscape:bbox-nodes="true" + inkscape:snap-bbox-edge-midpoints="true" + inkscape:snap-bbox-midpoints="true" + inkscape:snap-object-midpoints="true" + inkscape:snap-center="true" + inkscape:window-width="1920" + inkscape:window-height="1016" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + showguides="true" + inkscape:snap-smooth-nodes="true" + inkscape:object-nodes="true" + inkscape:object-paths="true" + inkscape:snap-intersection-paths="true"> + <inkscape:grid + type="xygrid" + id="grid3336" /> + </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,-1044.3622)"> + <circle + r="1" + cy="1048.3622" + cx="11" + id="circle4232" + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> + <circle + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="circle4234" + cx="14" + cy="1046.3622" + r="1" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4169" + width="6" + height="2" + x="1" + y="1045.3622" /> + <rect + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="rect4171" + width="2" + height="3.9999826" + x="3" + y="1047.3622" /> + <circle + style="opacity:1;fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + id="circle4173" + cx="8" + cy="1050.3622" + r="1" /> + </g> +</svg> diff --git a/tools/editor/inspector_dock.cpp b/tools/editor/inspector_dock.cpp index 57d19c3ec8..7b06761e53 100644 --- a/tools/editor/inspector_dock.cpp +++ b/tools/editor/inspector_dock.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* inspector_dock.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 "inspector_dock.h" #if 0 diff --git a/tools/editor/inspector_dock.h b/tools/editor/inspector_dock.h index 90f043aba8..40c153e2d4 100644 --- a/tools/editor/inspector_dock.h +++ b/tools/editor/inspector_dock.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* inspector_dock.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. */ +/*************************************************************************/ #ifndef INSPECTOR_DOCK_H #define INSPECTOR_DOCK_H diff --git a/tools/editor/io_plugins/editor_export_scene.cpp b/tools/editor/io_plugins/editor_export_scene.cpp index dff41a59ed..acbbf8c737 100644 --- a/tools/editor/io_plugins/editor_export_scene.cpp +++ b/tools/editor/io_plugins/editor_export_scene.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_export_scene.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 "editor_export_scene.h" #include "io/resource_loader.h" #include "io/resource_saver.h" diff --git a/tools/editor/io_plugins/editor_export_scene.h b/tools/editor/io_plugins/editor_export_scene.h index 134da6c234..2c7fe9a1ab 100644 --- a/tools/editor/io_plugins/editor_export_scene.h +++ b/tools/editor/io_plugins/editor_export_scene.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_export_scene.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. */ +/*************************************************************************/ #ifndef EDITOR_EXPORT_SCENE_H #define EDITOR_EXPORT_SCENE_H diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp index d5e6e3077e..70bc44ba7d 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -102,6 +102,7 @@ public: bool disable_filter; bool round_advance; + bool premultiply_alpha; @@ -167,6 +168,8 @@ public: round_advance=p_value; else if (n=="advanced/disable_filter") disable_filter=p_value; + else if (n=="advanced/premultiply_alpha") + premultiply_alpha=p_value; else return false; @@ -235,6 +238,8 @@ public: r_ret=round_advance; else if (n=="advanced/disable_filter") r_ret=disable_filter; + else if (n=="advanced/premultiply_alpha") + r_ret=premultiply_alpha; else return false; @@ -297,6 +302,7 @@ public: p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/round_advance")); p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/disable_filter")); + p_list->push_back(PropertyInfo(Variant::BOOL,"advanced/premultiply_alpha")); } @@ -336,6 +342,7 @@ public: font_mode=FONT_BITMAP; round_advance=true; disable_filter=false; + premultiply_alpha=false; } @@ -368,6 +375,7 @@ public: round_advance=true; disable_filter=false; + premultiply_alpha=false; } @@ -489,18 +497,22 @@ class EditorFontImportDialog : public ConfirmationDialog { Image img = tex->get_data(); f->store_line("static const int _builtin_font_img_width="+itos(img.get_width())+";"); - f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - f->store_line("static const unsigned char _builtin_font_img_data["+itos(img.get_width()*img.get_height()*2)+"]={"); - for(int i=0;i<img.get_height();i++) { + f->store_line("static const int _builtin_font_img_height="+itos(img.get_height())+";"); - for(int j=0;j<img.get_width();j++) { + String fname = p_font.basename()+".sv.png"; + ResourceSaver::save(fname,tex); + Vector<uint8_t> data=FileAccess::get_file_as_array(fname); - Color c = img.get_pixel(j,i); - int v = CLAMP(((c.r+c.g+c.b)/3.0)*255,0,255); - int a = CLAMP(c.a*255,0,255); - f->store_line(itos(v)+","+itos(a)+","); - } + f->store_line("static const int _builtin_font_img_data_size="+itos(data.size())+";"); + f->store_line("static const unsigned char _builtin_font_img_data["+itos(data.size())+"]={"); + + + + for(int i=0;i<data.size();i++) { + + f->store_line(itos(data[i])+","); + } f->store_line("};"); @@ -524,6 +536,16 @@ class EditorFontImportDialog : public ConfirmationDialog { dest->get_line_edit()->set_text(dest->get_line_edit()->get_text().get_base_dir() + "/" + source->get_line_edit()->get_text().get_file().basename() + ".fnt" ); } + if (dest->get_line_edit()->get_text().extension() == dest->get_line_edit()->get_text()) { + dest->get_line_edit()->set_text(dest->get_line_edit()->get_text() + ".fnt"); + } + + if (dest->get_line_edit()->get_text().extension().to_lower() != "fnt") { + error_dialog->set_text(TTR("Invalid file extension.\nPlease use .fnt.")); + error_dialog->popup_centered(Size2(200,100)); + return; + } + Ref<ResourceImportMetadata> rimd = get_rimd(); if (rimd.is_null()) { @@ -1528,12 +1550,30 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe } + if (from->has_option("advanced/premultiply_alpha") && bool(from->get_option("advanced/premultiply_alpha"))) { + + DVector<uint8_t> data = atlas.get_data(); + int dl = data.size(); + { + DVector<uint8_t>::Write w = data.write(); + + for(int i=0;i<dl;i+=4) { + + w[i+0]= uint8_t(int(w[i+0])*int(w[i+3])/255); + w[i+1]= uint8_t(int(w[i+1])*int(w[i+3])/255); + w[i+2]= uint8_t(int(w[i+2])*int(w[i+3])/255); + } + } + + atlas=Image(res_size.x,res_size.y,0,Image::FORMAT_RGBA,data); + } if (from->has_option("color/monochrome") && bool(from->get_option("color/monochrome"))) { atlas.convert(Image::FORMAT_GRAYSCALE_ALPHA); } + if (0) { //debug the texture Ref<ImageTexture> atlast = memnew( ImageTexture ); diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp index 80cd54756e..363cba3678 100644 --- a/tools/editor/io_plugins/editor_import_collada.cpp +++ b/tools/editor/io_plugins/editor_import_collada.cpp @@ -2077,6 +2077,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones animation->add_track(Animation::TYPE_TRANSFORM); int track = animation->get_track_count() -1; animation->track_set_path( track , path ); + animation->track_set_imported( track , true ); //helps merging later Vector<float> snapshots = base_snapshots; @@ -2229,6 +2230,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones animation->add_track(Animation::TYPE_TRANSFORM); int track = animation->get_track_count() -1; animation->track_set_path( track , path ); + animation->track_set_imported( track , true ); //helps merging later Transform xform = cn->compute_transform(collada); @@ -2284,8 +2286,11 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones animation->add_track(Animation::TYPE_VALUE); int track = animation->get_track_count() -1; + path = path +":"+at.param; animation->track_set_path( track , path ); + animation->track_set_imported( track , true ); //helps merging later + for(int i=0;i<at.keys.size();i++) { @@ -2376,6 +2381,7 @@ Node* EditorSceneImporterCollada::import_scene(const String& p_path, uint32_t p_ state.create_animations(p_flags&IMPORT_ANIMATION_FORCE_ALL_TRACKS_IN_ALL_CLIPS); AnimationPlayer *ap = memnew( AnimationPlayer ); + ap->set_name("animations"); for(int i=0;i<state.animations.size();i++) { String name; if (state.animations[i]->get_name()=="") diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp index c20515f0f3..095c56a373 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_mesh_import_plugin.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 "editor_mesh_import_plugin.h" #include "tools/editor/editor_file_dialog.h" diff --git a/tools/editor/io_plugins/editor_mesh_import_plugin.h b/tools/editor/io_plugins/editor_mesh_import_plugin.h index ed30d69e18..d200603e6a 100644 --- a/tools/editor/io_plugins/editor_mesh_import_plugin.h +++ b/tools/editor/io_plugins/editor_mesh_import_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_mesh_import_plugin.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. */ +/*************************************************************************/ #ifndef EDITOR_MESH_IMPORT_PLUGIN_H #define EDITOR_MESH_IMPORT_PLUGIN_H diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index f346306f61..c7d92a9658 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -30,6 +30,7 @@ #include "globals.h" #include "tools/editor/editor_node.h" #include "scene/resources/packed_scene.h" +#include "scene/resources/box_shape.h" #include "os/file_access.h" #include "scene/3d/path.h" #include "scene/animation/animation_player.h" @@ -1068,12 +1069,14 @@ const EditorSceneImportDialog::FlagInfo EditorSceneImportDialog::scene_flag_name {EditorSceneImportPlugin::SCENE_FLAG_IMPORT_ANIMATIONS,("Actions"),"Import Animations",true}, {EditorSceneImportPlugin::SCENE_FLAG_COMPRESS_GEOMETRY,("Actions"),"Compress Geometry",false}, {EditorSceneImportPlugin::SCENE_FLAG_GENERATE_TANGENT_ARRAYS,("Actions"),"Force Generation of Tangent Arrays",false}, - {EditorSceneImportPlugin::SCENE_FLAG_DETECT_ALPHA,("Materials"),"Set Alpha in Materials (-alpha)",true}, - {EditorSceneImportPlugin::SCENE_FLAG_DETECT_VCOLOR,("Materials"),"Set Vert. Color in Materials (-vcol)",true}, {EditorSceneImportPlugin::SCENE_FLAG_LINEARIZE_DIFFUSE_TEXTURES,("Actions"),"SRGB->Linear Of Diffuse Textures",false}, {EditorSceneImportPlugin::SCENE_FLAG_CONVERT_NORMALMAPS_TO_XY,("Actions"),"Convert Normal Maps to XY",true}, {EditorSceneImportPlugin::SCENE_FLAG_SET_LIGHTMAP_TO_UV2_IF_EXISTS,("Actions"),"Set Material Lightmap to UV2 if Tex2Array Exists",true}, - {EditorSceneImportPlugin::SCENE_FLAG_CREATE_COLLISIONS,("Create"),"Create Collisions (-col},-colonly)",true}, + {EditorSceneImportPlugin::SCENE_FLAG_MERGE_KEEP_MATERIALS,("Merge"),"Keep Materials after first import (delete them for re-import).",true}, + {EditorSceneImportPlugin::SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,("Merge"),"Keep user-added Animation tracks.",true}, + {EditorSceneImportPlugin::SCENE_FLAG_DETECT_ALPHA,("Materials"),"Set Alpha in Materials (-alpha)",true}, + {EditorSceneImportPlugin::SCENE_FLAG_DETECT_VCOLOR,("Materials"),"Set Vert. Color in Materials (-vcol)",true}, + {EditorSceneImportPlugin::SCENE_FLAG_CREATE_COLLISIONS,("Create"),"Create Collisions and/or Rigid Bodies (-col,-colonly,-rigid)",true}, {EditorSceneImportPlugin::SCENE_FLAG_CREATE_PORTALS,("Create"),"Create Portals (-portal)",true}, {EditorSceneImportPlugin::SCENE_FLAG_CREATE_ROOMS,("Create"),"Create Rooms (-room)",true}, {EditorSceneImportPlugin::SCENE_FLAG_SIMPLIFY_ROOMS,("Create"),"Simplify Rooms",false}, @@ -1745,6 +1748,49 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh> colshape->set_owner(sb->get_owner()); } + } else if (p_flags&SCENE_FLAG_CREATE_COLLISIONS && _teststr(name,"rigid") && p_node->cast_to<MeshInstance>()) { + + if (isroot) + return p_node; + + // get mesh instance and bounding box + MeshInstance *mi = p_node->cast_to<MeshInstance>(); + AABB aabb = mi->get_aabb(); + + // create a new rigid body collision node + RigidBody * rigid_body = memnew( RigidBody ); + Node * col = rigid_body; + ERR_FAIL_COND_V(!col,NULL); + + // remove node name postfix + col->set_name(_fixstr(name,"rigid")); + // get mesh instance xform matrix to the rigid body collision node + col->cast_to<Spatial>()->set_transform(mi->get_transform()); + // save original node by duplicating it into a new instance and correcting the name + Node * mesh = p_node->duplicate(); + mesh->set_name(_fixstr(name,"rigid")); + // reset the xform matrix of the duplicated node so it can inherit parent node xform + mesh->cast_to<Spatial>()->set_transform(Transform(Matrix3())); + // reparent the new mesh node to the rigid body collision node + p_node->add_child(mesh); + mesh->set_owner(p_node->get_owner()); + // replace the original node with the rigid body collision node + p_node->replace_by(col); + memdelete(p_node); + p_node=col; + + // create an alias for the rigid body collision node + RigidBody *rb = col->cast_to<RigidBody>(); + // create a new Box collision shape and set the right extents + Ref<BoxShape> shape = memnew( BoxShape ); + shape->set_extents(aabb.get_size() * 0.5); + CollisionShape *colshape = memnew( CollisionShape); + colshape->set_name("shape"); + colshape->set_shape(shape); + // reparent the new collision shape to the rigid body collision node + rb->add_child(colshape); + colshape->set_owner(p_node->get_owner()); + } else if (p_flags&SCENE_FLAG_CREATE_COLLISIONS &&_teststr(name,"col") && p_node->cast_to<MeshInstance>()) { @@ -2411,6 +2457,138 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_ } +void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, bool p_merge_material, Map<String, Ref<Material> > &materials, bool p_merge_anims, Map<String,Ref<Animation> >& merged_anims,Set<Ref<Mesh> > &tested_meshes) { + + if (node->get_owner()!=scene) + return; + + String path = scene->get_path_to(node); + + if (p_merge_anims && node->cast_to<AnimationPlayer>()) { + + AnimationPlayer *ap = node->cast_to<AnimationPlayer>(); + List<StringName> anims; + ap->get_animation_list(&anims); + for (List<StringName>::Element *E=anims.front();E;E=E->next()) { + Ref<Animation> anim = ap->get_animation(E->get()); + Ref<Animation> clone; + + bool has_user_tracks=false; + + for(int i=0;i<anim->get_track_count();i++) { + + if (!anim->track_is_imported(i)) { + has_user_tracks=true; + break; + } + } + + if (has_user_tracks) { + + clone = anim->duplicate(); + for(int i=0;i<clone->get_track_count();i++) { + if (clone->track_is_imported(i)) { + clone->remove_track(i); + i--; + } + } + + merged_anims[path+"::"+String(E->get())]=clone; + } + } + } + + + + if (p_merge_material && node->cast_to<MeshInstance>()) { + MeshInstance *mi=node->cast_to<MeshInstance>(); + Ref<Mesh> mesh = mi->get_mesh(); + if (mesh.is_valid() && mesh->get_name()!=String() && !tested_meshes.has(mesh)) { + + for(int i=0;i<mesh->get_surface_count();i++) { + Ref<Material> material = mesh->surface_get_material(i); + materials[mesh->get_name()+":surf:"+mesh->surface_get_name(i)]=material; + } + + tested_meshes.insert(mesh); + } + } + + + + for(int i=0;i<node->get_child_count();i++) { + _find_resources_to_merge(scene,node->get_child(i),p_merge_material,materials,p_merge_anims,merged_anims,tested_meshes); + } + +} + + +void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bool p_merge_material, const Map<String, Ref<Material> > &materials, bool p_merge_anims, const Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes) { + + if (node->get_owner()!=scene) + return; + + String path = scene->get_path_to(node); + + if (node->cast_to<AnimationPlayer>()) { + + AnimationPlayer *ap = node->cast_to<AnimationPlayer>(); + List<StringName> anims; + ap->get_animation_list(&anims); + for (List<StringName>::Element *E=anims.front();E;E=E->next()) { + Ref<Animation> anim = ap->get_animation(E->get()); + + String anim_path = path+"::"+String(E->get()); + + if (merged_anims.has(anim_path)) { + + Ref<Animation> user_tracks = merged_anims[anim_path]; + for(int i=0;i<user_tracks->get_track_count();i++) { + + int idx = anim->get_track_count(); + anim->add_track(user_tracks->track_get_type(i)); + anim->track_set_path(idx,user_tracks->track_get_path(i)); + anim->track_set_interpolation_type(idx,user_tracks->track_get_interpolation_type(i)); + for(int j=0;j<user_tracks->track_get_key_count(i);j++) { + + float ofs = user_tracks->track_get_key_time(i,j); + float trans = user_tracks->track_get_key_transition(i,j); + Variant value = user_tracks->track_get_key_value(i,j); + + anim->track_insert_key(idx,ofs,value,trans); + } + } + } + } + } + + + + if (node->cast_to<MeshInstance>()) { + MeshInstance *mi=node->cast_to<MeshInstance>(); + Ref<Mesh> mesh = mi->get_mesh(); + if (mesh.is_valid() && mesh->get_name()!=String() && !tested_meshes.has(mesh)) { + + for(int i=0;i<mesh->get_surface_count();i++) { + String sname = mesh->get_name()+":surf:"+mesh->surface_get_name(i); + + if (materials.has(sname)) { + mesh->surface_set_material(i,materials[sname]); + } + } + + tested_meshes.insert(mesh); + } + } + + + + for(int i=0;i<node->get_child_count();i++) { + _merge_found_resources(scene,node->get_child(i),p_merge_material,materials,p_merge_anims,merged_anims,tested_meshes); + } + +} + Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, const Ref<ResourceImportMetadata>& p_from) { Error err=OK; @@ -2462,6 +2640,28 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c _filter_tracks(scene,animation_filter); + if (scene_flags&(SCENE_FLAG_MERGE_KEEP_MATERIALS|SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS) && FileAccess::exists(p_dest_path)) { + //must merge! + + Ref<PackedScene> pscene = ResourceLoader::load(p_dest_path,"PackedScene",true); + if (pscene.is_valid()) { + + Node *instance = pscene->instance(); + if (instance) { + Map<String,Ref<Animation> > merged_anims; + Map<String,Ref<Material> > merged_materials; + Set<Ref<Mesh> > tested_meshes; + + _find_resources_to_merge(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + tested_meshes.clear(); + _merge_found_resources(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes); + + memdelete(instance); + } + + } + + } /// BEFORE ANYTHING, RUN SCRIPT diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h index 8a2d30f1f6..c31d3a33d3 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.h +++ b/tools/editor/io_plugins/editor_scene_import_plugin.h @@ -116,6 +116,10 @@ class EditorSceneImportPlugin : public EditorImportPlugin { void _tag_import_paths(Node *p_scene,Node *p_node); + void _find_resources_to_merge(Node *scene, Node *node, bool p_merge_material, Map<String,Ref<Material> >&materials, bool p_merge_anims, Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes); + void _merge_found_resources(Node *scene, Node *node, bool p_merge_material, const Map<String, Ref<Material> > &materials, bool p_merge_anims, const Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes); + + public: enum SceneFlags { @@ -134,6 +138,9 @@ public: SCENE_FLAG_CREATE_NAVMESH=1<<17, SCENE_FLAG_DETECT_LIGHTMAP_LAYER=1<<18, + SCENE_FLAG_MERGE_KEEP_MATERIALS=1<<20, + SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS=1<<21, + SCENE_FLAG_REMOVE_NOIMP=1<<24, SCENE_FLAG_IMPORT_ANIMATIONS=1<<25, SCENE_FLAG_COMPRESS_GEOMETRY=1<<26, @@ -144,6 +151,7 @@ public: }; + virtual String get_name() const; virtual String get_visible_name() const; virtual void import_dialog(const String& p_from=""); diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp index 0c388b91ca..ac3c4637c2 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_scene_importer_fbxconv.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 "editor_scene_importer_fbxconv.h" #include "os/file_access.h" #include "os/os.h" diff --git a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h index 261b072b04..b0cbc07ba3 100644 --- a/tools/editor/io_plugins/editor_scene_importer_fbxconv.h +++ b/tools/editor/io_plugins/editor_scene_importer_fbxconv.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_scene_importer_fbxconv.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. */ +/*************************************************************************/ #ifndef EDITOR_SCENE_IMPORTER_FBXCONV_H #define EDITOR_SCENE_IMPORTER_FBXCONV_H diff --git a/tools/editor/multi_node_edit.cpp b/tools/editor/multi_node_edit.cpp index b5bae82ae0..4d27b8e349 100644 --- a/tools/editor/multi_node_edit.cpp +++ b/tools/editor/multi_node_edit.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* multi_node_edit.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 "multi_node_edit.h" #include "editor_node.h" @@ -7,9 +35,15 @@ bool MultiNodeEdit::_set(const StringName& p_name, const Variant& p_value){ if (!es) return false; + String name = p_name; + + if (name=="scripts/script") { // script/script set is intercepted at object level (check Variant Object::get() ) ,so use a different name + name="script/script"; + } + UndoRedo *ur=EditorNode::get_singleton()->get_undo_redo(); - ur->create_action(TTR("MultiNode Set")+" "+String(p_name)); + ur->create_action(TTR("MultiNode Set")+" "+String(name)); for (const List<NodePath>::Element *E=nodes.front();E;E=E->next()) { if (!es->has_node(E->get())) @@ -19,10 +53,13 @@ bool MultiNodeEdit::_set(const StringName& p_name, const Variant& p_value){ if (!n) continue; - ur->add_do_property(n,p_name,p_value); - ur->add_undo_property(n,p_name,n->get(p_name)); + ur->add_do_property(n,name,p_value); + ur->add_undo_property(n,name,n->get(name)); + } + ur->add_do_method(EditorNode::get_singleton()->get_property_editor(),"refresh"); + ur->add_undo_method(EditorNode::get_singleton()->get_property_editor(),"refresh"); ur->commit_action(); return true; @@ -34,6 +71,11 @@ bool MultiNodeEdit::_get(const StringName& p_name,Variant &r_ret) const { if (!es) return false; + String name=p_name; + if (name=="scripts/script") { // script/script set is intercepted at object level (check Variant Object::get() ) ,so use a different name + name="script/script"; + } + for (const List<NodePath>::Element *E=nodes.front();E;E=E->next()) { if (!es->has_node(E->get())) @@ -44,7 +86,7 @@ bool MultiNodeEdit::_get(const StringName& p_name,Variant &r_ret) const { continue; bool found; - r_ret=n->get(p_name,&found); + r_ret=n->get(name,&found); if (found) return true; @@ -79,6 +121,8 @@ void MultiNodeEdit::_get_property_list( List<PropertyInfo> *p_list) const{ for(List<PropertyInfo>::Element *F=plist.front();F;F=F->next()) { + if (F->get().name=="script/script") + continue; //added later manually, since this is intercepted before being set (check Variant Object::get() ) if (!usage.has(F->get().name)) { PLData pld; pld.uses=0; @@ -100,6 +144,8 @@ void MultiNodeEdit::_get_property_list( List<PropertyInfo> *p_list) const{ } } + p_list->push_back(PropertyInfo(Variant::OBJECT,"scripts/script",PROPERTY_HINT_RESOURCE_TYPE,"Script")); + } diff --git a/tools/editor/multi_node_edit.h b/tools/editor/multi_node_edit.h index 5a0cabf4be..fd50dc5bf4 100644 --- a/tools/editor/multi_node_edit.h +++ b/tools/editor/multi_node_edit.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* multi_node_edit.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. */ +/*************************************************************************/ #ifndef MULTI_NODE_EDIT_H #define MULTI_NODE_EDIT_H @@ -13,6 +41,7 @@ class MultiNodeEdit : public Reference { PropertyInfo info; }; + protected: bool _set(const StringName& p_name, const Variant& p_value); diff --git a/tools/editor/optimized_save_dialog.cpp b/tools/editor/optimized_save_dialog.cpp deleted file mode 100644 index 4814b3b021..0000000000 --- a/tools/editor/optimized_save_dialog.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/*************************************************************************/ -/* optimized_save_dialog.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. */ -/*************************************************************************/ diff --git a/tools/editor/optimized_save_dialog.h b/tools/editor/optimized_save_dialog.h deleted file mode 100644 index bdc36eddc1..0000000000 --- a/tools/editor/optimized_save_dialog.h +++ /dev/null @@ -1,34 +0,0 @@ -/*************************************************************************/ -/* optimized_save_dialog.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. */ -/*************************************************************************/ -#ifndef OPTIMIZED_SAVE_DIALOG_H -#define OPTIMIZED_SAVE_DIALOG_H - - - -#endif // OPTIMIZED_SAVE_DIALOG_H diff --git a/tools/editor/plugins/animation_data_editor_plugin.cpp b/tools/editor/plugins/animation_data_editor_plugin.cpp deleted file mode 100644 index a73c75056b..0000000000 --- a/tools/editor/plugins/animation_data_editor_plugin.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************/ -/* animation_data_editor_plugin.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 "animation_data_editor_plugin.h" - -AnimationDataEditorPlugin::AnimationDataEditorPlugin() -{ -} diff --git a/tools/editor/plugins/animation_data_editor_plugin.h b/tools/editor/plugins/animation_data_editor_plugin.h deleted file mode 100644 index 0a12638474..0000000000 --- a/tools/editor/plugins/animation_data_editor_plugin.h +++ /dev/null @@ -1,38 +0,0 @@ -/*************************************************************************/ -/* animation_data_editor_plugin.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. */ -/*************************************************************************/ -#ifndef ANIMATION_DATA_EDITOR_PLUGIN_H -#define ANIMATION_DATA_EDITOR_PLUGIN_H - -class AnimationDataEditorPlugin -{ -public: - AnimationDataEditorPlugin(); -}; - -#endif // ANIMATION_DATA_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp index 4bbcb396af..10c7bf79a3 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.cpp +++ b/tools/editor/plugins/animation_player_editor_plugin.cpp @@ -952,7 +952,7 @@ void AnimationPlayerEditor::_animation_duplicate() { } -void AnimationPlayerEditor::_seek_value_changed(float p_value) { +void AnimationPlayerEditor::_seek_value_changed(float p_value,bool p_set) { if (updating || !player || player->is_playing()) { return; @@ -980,7 +980,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { pos=anim->get_length(); } - if (player->is_valid()) { + if (player->is_valid() && !p_set) { float cpos = player->get_current_animation_pos(); player->seek_delta(pos,pos-cpos); @@ -988,6 +988,7 @@ void AnimationPlayerEditor::_seek_value_changed(float p_value) { player->seek(pos,true); } + key_editor->set_anim_pos(pos); updating=true; @@ -1078,6 +1079,7 @@ void AnimationPlayerEditor::_editor_load(){ void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) { + frame->set_max(p_len); } @@ -1092,7 +1094,7 @@ void AnimationPlayerEditor::_animation_key_editor_anim_step_changed(float p_len) } -void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { +void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos,bool p_drag) { if (!is_visible()) return; @@ -1102,7 +1104,11 @@ void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos) { if (player->is_playing() ) return; - frame->set_val(p_pos); + updating=true; + frame->set_val(p_pos); + updating=false; + _seek_value_changed(p_pos,!p_drag); + EditorNode::get_singleton()->get_property_editor()->refresh(); @@ -1254,7 +1260,7 @@ void AnimationPlayerEditor::_bind_methods() { ObjectTypeDB::bind_method(_MD("_animation_edit"),&AnimationPlayerEditor::_animation_edit); ObjectTypeDB::bind_method(_MD("_animation_resource_edit"),&AnimationPlayerEditor::_animation_resource_edit); ObjectTypeDB::bind_method(_MD("_dialog_action"),&AnimationPlayerEditor::_dialog_action); - ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed); + ObjectTypeDB::bind_method(_MD("_seek_value_changed"),&AnimationPlayerEditor::_seek_value_changed,DEFVAL(true)); ObjectTypeDB::bind_method(_MD("_animation_player_changed"),&AnimationPlayerEditor::_animation_player_changed); ObjectTypeDB::bind_method(_MD("_blend_edited"),&AnimationPlayerEditor::_blend_edited); // ObjectTypeDB::bind_method(_MD("_seek_frame_changed"),&AnimationPlayerEditor::_seek_frame_changed); @@ -1350,19 +1356,23 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/add_animation", TTR("Create new animation in player.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/add_animation")); add_anim->set_tooltip(TTR("Create new animation in player.")); hb->add_child(add_anim); load_anim = memnew( ToolButton ); + ED_SHORTCUT("animation_player_editor/load_from_disk", TTR("Load animation from disk.")); + add_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/load_from_disk")); load_anim->set_tooltip(TTR("Load an animation from disk.")); hb->add_child(load_anim); save_anim = memnew(MenuButton); save_anim->set_tooltip(TTR("Save the current animation")); - save_anim->get_popup()->add_item(TTR("Save"), ANIM_SAVE); - save_anim->get_popup()->add_item(TTR("Save As.."), ANIM_SAVE_AS); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save", TTR("Save")), ANIM_SAVE); + save_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/save_as", TTR("Save As")), ANIM_SAVE_AS); save_anim->set_focus_mode(Control::FOCUS_NONE); hb->add_child(save_anim); @@ -1372,15 +1382,21 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { duplicate_anim = memnew( ToolButton ); hb->add_child(duplicate_anim); + ED_SHORTCUT("animation_player_editor/duplicate_animation", TTR("Duplicate Animation")); + duplicate_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/duplicate_animation")); duplicate_anim->set_tooltip(TTR("Duplicate Animation")); rename_anim = memnew( ToolButton ); hb->add_child(rename_anim); + ED_SHORTCUT("animation_player_editor/rename_animation", TTR("Rename Animation")); + rename_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/rename_animation")); rename_anim->set_tooltip(TTR("Rename Animation")); remove_anim = memnew( ToolButton ); hb->add_child(remove_anim); + ED_SHORTCUT("animation_player_editor/remove_animation", TTR("Remove Animation")); + remove_anim->set_shortcut(ED_GET_SHORTCUT("animation_player_editor/remove_animation")); remove_anim->set_tooltip(TTR("Remove Animation")); @@ -1402,8 +1418,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { tool_anim = memnew( MenuButton); //tool_anim->set_flat(false); tool_anim->set_tooltip(TTR("Animation Tools")); - tool_anim->get_popup()->add_item(TTR("Copy Animation"),TOOL_COPY_ANIM); - tool_anim->get_popup()->add_item(TTR("Paste Animation"),TOOL_PASTE_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/copy_animation", TTR("Copy Animation")),TOOL_COPY_ANIM); + tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/paste_animation", TTR("Paste Animation")),TOOL_PASTE_ANIM); //tool_anim->get_popup()->add_separator(); //tool_anim->get_popup()->add_item("Edit Anim Resource",TOOL_PASTE_ANIM); hb->add_child(tool_anim); @@ -1487,8 +1503,8 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { animation->connect("item_selected", this,"_animation_selected",Vector<Variant>(),true); resource_edit_anim->connect("pressed", this,"_animation_resource_edit"); file->connect("file_selected", this,"_dialog_action"); - frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); - scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true); + frame->connect("value_changed", this, "_seek_value_changed",Vector<Variant>(),true); + scale->connect("text_entered", this, "_scale_changed",Vector<Variant>(),true); diff --git a/tools/editor/plugins/animation_player_editor_plugin.h b/tools/editor/plugins/animation_player_editor_plugin.h index 3f3cda25b2..b0c930b66e 100644 --- a/tools/editor/plugins/animation_player_editor_plugin.h +++ b/tools/editor/plugins/animation_player_editor_plugin.h @@ -145,7 +145,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _scale_changed(const String& p_scale); void _dialog_action(String p_file); void _seek_frame_changed(const String& p_frame); - void _seek_value_changed(float p_value); + void _seek_value_changed(float p_value, bool p_set=false); void _blend_editor_next_changed(const int p_idx); void _list_changed(); @@ -158,7 +158,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _animation_player_changed(Object *p_pl); - void _animation_key_editor_seek(float p_pos); + void _animation_key_editor_seek(float p_pos, bool p_drag); void _animation_key_editor_anim_len_changed(float p_new); void _animation_key_editor_anim_step_changed(float p_len); diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp index b6bb774364..1962f81e87 100644 --- a/tools/editor/plugins/baked_light_baker.cpp +++ b/tools/editor/plugins/baked_light_baker.cpp @@ -1,4 +1,31 @@ - +/*************************************************************************/ +/* baked_light_baker.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 "baked_light_baker.h" #include <stdlib.h> #include <cmath> diff --git a/tools/editor/plugins/baked_light_baker.h b/tools/editor/plugins/baked_light_baker.h index 5c172f79c6..d0fddf5563 100644 --- a/tools/editor/plugins/baked_light_baker.h +++ b/tools/editor/plugins/baked_light_baker.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* baked_light_baker.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. */ +/*************************************************************************/ #ifndef BAKED_LIGHT_BAKER_H #define BAKED_LIGHT_BAKER_H diff --git a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp index 42d3fc5276..c581995916 100644 --- a/tools/editor/plugins/baked_light_baker_cmpxchg.cpp +++ b/tools/editor/plugins/baked_light_baker_cmpxchg.cpp @@ -1,4 +1,31 @@ - +/*************************************************************************/ +/* baked_light_baker_cmpxchg.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 "typedefs.h" diff --git a/tools/editor/plugins/baked_light_editor_plugin.cpp b/tools/editor/plugins/baked_light_editor_plugin.cpp index 3e7d7b63a1..df76f28ae0 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.cpp +++ b/tools/editor/plugins/baked_light_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* baked_light_editor_plugin.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 "baked_light_editor_plugin.h" #include "scene/gui/box_container.h" #include "scene/3d/mesh_instance.h" diff --git a/tools/editor/plugins/baked_light_editor_plugin.h b/tools/editor/plugins/baked_light_editor_plugin.h index 27ab88d70b..4985d7513e 100644 --- a/tools/editor/plugins/baked_light_editor_plugin.h +++ b/tools/editor/plugins/baked_light_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* baked_light_editor_plugin.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. */ +/*************************************************************************/ #ifndef BAKED_LIGHT_EDITOR_PLUGIN_H #define BAKED_LIGHT_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp index 14a61d46b5..5ed9f8ab5f 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* collision_polygon_2d_editor_plugin.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 "collision_polygon_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h index f34405b355..982ba35fe8 100644 --- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* collision_polygon_2d_editor_plugin.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. */ +/*************************************************************************/ #ifndef COLLISION_POLYGON_2D_EDITOR_PLUGIN_H #define COLLISION_POLYGON_2D_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp index 296362447f..d0cd73dcad 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* collision_shape_2d_editor_plugin.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 "collision_shape_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h index 75e9b68ea7..1ee81eda43 100644 --- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h +++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* collision_shape_2d_editor_plugin.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. */ +/*************************************************************************/ #ifndef COLLISION_SHAPE_2D_EDITOR_PLUGIN_H #define COLLISION_SHAPE_2D_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/color_ramp_editor_plugin.cpp b/tools/editor/plugins/color_ramp_editor_plugin.cpp index 267f3aa5bd..cb7f6a1809 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.cpp +++ b/tools/editor/plugins/color_ramp_editor_plugin.cpp @@ -1,7 +1,31 @@ -/* - * color_ramp_editor_plugin.cpp - */ - +/*************************************************************************/ +/* color_ramp_editor_plugin.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 "color_ramp_editor_plugin.h" #include "spatial_editor_plugin.h" #include "canvas_item_editor_plugin.h" diff --git a/tools/editor/plugins/color_ramp_editor_plugin.h b/tools/editor/plugins/color_ramp_editor_plugin.h index 02d691239f..300a9030b9 100644 --- a/tools/editor/plugins/color_ramp_editor_plugin.h +++ b/tools/editor/plugins/color_ramp_editor_plugin.h @@ -1,7 +1,31 @@ -/* - * color_ramp_editor_plugin.h - */ - +/*************************************************************************/ +/* color_ramp_editor_plugin.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. */ +/*************************************************************************/ #ifndef TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ #define TOOLS_EDITOR_PLUGINS_COLOR_RAMP_EDITOR_PLUGIN_H_ diff --git a/tools/editor/plugins/control_editor_plugin.cpp b/tools/editor/plugins/control_editor_plugin.cpp deleted file mode 100644 index 9dff5e6ce4..0000000000 --- a/tools/editor/plugins/control_editor_plugin.cpp +++ /dev/null @@ -1,825 +0,0 @@ -/*************************************************************************/ -/* control_editor_plugin.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. */ -/*************************************************************************/ -#if 0 -#include "control_editor_plugin.h" -#include "print_string.h" -#include "editor_node.h" -#include "os/keyboard.h" -#include "scene/main/viewport.h" - -void ControlEditor::_add_control(Control *p_control,const EditInfo& p_info) { - - if (controls.has(p_control)) - return; - - controls.insert(p_control,p_info); - p_control->call_deferred("connect","visibility_changed",this,"_visibility_changed",varray(p_control->get_instance_ID())); -} - -void ControlEditor::_remove_control(Control *p_control) { - - p_control->call_deferred("disconnect","visibility_changed",this,"_visibility_changed"); - controls.erase(p_control); -} -void ControlEditor::_clear_controls(){ - - while(controls.size()) - _remove_control(controls.front()->key()); -} - -void ControlEditor::_visibility_changed(ObjectID p_control) { - - Object *c = ObjectDB::get_instance(p_control); - if (!c) - return; - Control *ct = c->cast_to<Control>(); - if (!ct) - return; - - _remove_control(ct); -} - - -void ControlEditor::_node_removed(Node *p_node) { - - Control *control = (Control*)p_node; //not a good cast, but safe - if (controls.has(control)) - _remove_control(control); - - if (current_window==p_node) { - _clear_controls(); - } - update(); -} - -// slow as hell -Control* ControlEditor::_select_control_at_pos(const Point2& p_pos,Node* p_node) { - - for (int i=p_node->get_child_count()-1;i>=0;i--) { - - Control *r=_select_control_at_pos(p_pos,p_node->get_child(i)); - if (r) - return r; - } - - Control *c=p_node->cast_to<Control>(); - - if (c) { - Rect2 rect = c->get_window_rect(); - if (c->get_window()==current_window) { - rect.pos=transform.xform(rect.pos).floor(); - } - if (rect.has_point(p_pos)) - return c; - } - - return NULL; -} - - -void ControlEditor::_key_move(const Vector2& p_dir, bool p_snap) { - - if (drag!=DRAG_NONE) - return; - - Vector2 motion=p_dir; - if (p_snap) - motion*=snap_val->get_text().to_double(); - - undo_redo->create_action("Edit Control"); - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - Control *control = E->key(); - undo_redo->add_do_method(control,"set_pos",control->get_pos()+motion); - undo_redo->add_undo_method(control,"set_pos",control->get_pos()); - } - undo_redo->commit_action(); -} - - -void ControlEditor::_input_event(InputEvent p_event) { - - if (p_event.type==InputEvent::MOUSE_BUTTON) { - - const InputEventMouseButton &b=p_event.mouse_button; - - if (b.button_index==BUTTON_RIGHT) { - - if (controls.size() && drag!=DRAG_NONE) { - //cancel drag - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - Control *control = E->key(); - control->set_pos(E->get().drag_pos); - control->set_size(E->get().drag_size); - } - - } else if (b.pressed) { - popup->set_pos(Point2(b.x,b.y)); - popup->popup(); - } - return; - } - //if (!controls.size()) - // return; - - if (b.button_index!=BUTTON_LEFT) - return; - - if (!b.pressed) { - - if (drag!=DRAG_NONE) { - - if (undo_redo) { - - undo_redo->create_action("Edit Control"); - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - Control *control = E->key(); - undo_redo->add_do_method(control,"set_pos",control->get_pos()); - undo_redo->add_do_method(control,"set_size",control->get_size()); - undo_redo->add_undo_method(control,"set_pos",E->get().drag_pos); - undo_redo->add_undo_method(control,"set_size",E->get().drag_size); - } - undo_redo->commit_action(); - } - - drag=DRAG_NONE; - - } - return; - } - - - if (controls.size()==1) { - //try single control edit - Control *control = controls.front()->key(); - ERR_FAIL_COND(!current_window); - - Rect2 rect=control->get_window_rect(); - Point2 ofs=Point2();//get_global_pos(); - Rect2 draw_rect=Rect2(rect.pos-ofs,rect.size); - Point2 click=Point2(b.x,b.y); - click = transform.affine_inverse().xform(click); - Size2 handle_size=Size2(handle_len,handle_len); - - drag = DRAG_NONE; - - if (Rect2(draw_rect.pos-handle_size,handle_size).has_point(click)) - drag=DRAG_TOP_LEFT; - else if (Rect2(draw_rect.pos+draw_rect.size,handle_size).has_point(click)) - drag=DRAG_BOTTOM_RIGHT; - else if(Rect2(draw_rect.pos+Point2(draw_rect.size.width,-handle_size.y),handle_size).has_point(click)) - drag=DRAG_TOP_RIGHT; - else if (Rect2(draw_rect.pos+Point2(-handle_size.x,draw_rect.size.height),handle_size).has_point(click)) - drag=DRAG_BOTTOM_LEFT; - else if (Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),-handle_size.height),handle_size).has_point(click)) - drag=DRAG_TOP; - else if( Rect2(draw_rect.pos+Point2(-handle_size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size).has_point(click)) - drag=DRAG_LEFT; - else if ( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),draw_rect.size.height),handle_size).has_point(click)) - drag=DRAG_BOTTOM; - else if( Rect2(draw_rect.pos+Point2(draw_rect.size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size).has_point(click)) - drag=DRAG_RIGHT; - - if (drag!=DRAG_NONE) { - drag_from=click; - controls[control].drag_pos=control->get_pos(); - controls[control].drag_size=control->get_size(); - controls[control].drag_limit=drag_from+controls[control].drag_size-control->get_minimum_size(); - return; - } - - - } - - //multi control edit - - Point2 click=Point2(b.x,b.y); - Node* scene = get_scene()->get_root_node()->cast_to<EditorNode>()->get_edited_scene(); - if (!scene) - return; - /* - if (current_window) { - //no window.... ? - click-=current_window->get_scroll(); - }*/ - Control *c=_select_control_at_pos(click, scene); - - Node* n = c; - while ((n && n != scene && n->get_owner() != scene) || (n && !n->is_type("Control"))) { - n = n->get_parent(); - }; - c = n->cast_to<Control>(); - - - if (b.mod.control) { //additive selection - - if (!c) - return; //nothing to add - - if (current_window && controls.size() && c->get_window()!=current_window) - return; //cant multiple select from multiple windows - - if (!controls.size()) - current_window=c->get_window(); - - if (controls.has(c)) { - //already in here, erase it - _remove_control(c); - update(); - return; - } - - //check parents! - Control *parent = c->get_parent()->cast_to<Control>(); - - while(parent) { - - if (controls.has(parent)) - return; //a parent is already selected, so this is pointless - parent=parent->get_parent()->cast_to<Control>(); - } - - //check childrens of everything! - List<Control*> to_erase; - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - parent = E->key()->get_parent()->cast_to<Control>(); - while(parent) { - if (parent==c) { - to_erase.push_back(E->key()); - break; - } - parent=parent->get_parent()->cast_to<Control>(); - } - } - - while(to_erase.size()) { - _remove_control(to_erase.front()->get()); - to_erase.pop_front(); - } - - _add_control(c,EditInfo()); - update(); - } else { - //regular selection - if (!c) { - _clear_controls(); - update(); - return; - } - - if (!controls.has(c)) { - _clear_controls(); - current_window=c->get_window(); - _add_control(c,EditInfo()); - //reselect - if (get_scene()->is_editor_hint()) { - get_scene()->get_root_node()->call("edit_node",c); - } - - } - - - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - EditInfo &ei=E->get(); - Control *control=E->key(); - ei.drag_pos=control->get_pos(); - ei.drag_size=control->get_size(); - ei.drag_limit=drag_from+ei.drag_size-control->get_minimum_size(); - } - - drag=DRAG_ALL; - drag_from=click; - update(); - } - - } - - if (p_event.type==InputEvent::MOUSE_MOTION) { - - const InputEventMouseMotion &m=p_event.mouse_motion; - - if (drag==DRAG_NONE || !current_window) - return; - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - Control *control = E->key(); - Point2 control_drag_pos=E->get().drag_pos; - Point2 control_drag_size=E->get().drag_size; - Point2 control_drag_limit=E->get().drag_limit; - - Point2 pos=Point2(m.x,m.y); - pos = transform.affine_inverse().xform(pos); - - switch(drag) { - case DRAG_ALL: { - - control->set_pos( snapify(control_drag_pos+(pos-drag_from)) ); - } break; - case DRAG_RIGHT: { - - control->set_size( snapify(Size2(control_drag_size.width+(pos-drag_from).x,control_drag_size.height)) ); - } break; - case DRAG_BOTTOM: { - - control->set_size( snapify(Size2(control_drag_size.width,control_drag_size.height+(pos-drag_from).y)) ); - } break; - case DRAG_BOTTOM_RIGHT: { - - control->set_size( snapify(control_drag_size+(pos-drag_from)) ); - } break; - case DRAG_TOP_LEFT: { - - if(pos.x>control_drag_limit.x) - pos.x=control_drag_limit.x; - if(pos.y>control_drag_limit.y) - pos.y=control_drag_limit.y; - - Point2 old_size = control->get_size(); - Point2 new_pos = snapify(control_drag_pos+(pos-drag_from)); - Point2 new_size = old_size + (control->get_pos() - new_pos); - - control->set_pos( new_pos ); - control->set_size( new_size ); - } break; - case DRAG_TOP: { - - if(pos.y>control_drag_limit.y) - pos.y=control_drag_limit.y; - - Point2 old_size = control->get_size(); - Point2 new_pos = snapify(control_drag_pos+Point2(0,pos.y-drag_from.y)); - Point2 new_size = old_size + (control->get_pos() - new_pos); - - control->set_pos( new_pos ); - control->set_size( new_size ); - } break; - case DRAG_LEFT: { - - if(pos.x>control_drag_limit.x) - pos.x=control_drag_limit.x; - - Point2 old_size = control->get_size(); - Point2 new_pos = snapify(control_drag_pos+Point2(pos.x-drag_from.x,0)); - Point2 new_size = old_size + (control->get_pos() - new_pos); - - control->set_pos( new_pos ); - control->set_size( new_size ); - - } break; - case DRAG_TOP_RIGHT: { - - if(pos.y>control_drag_limit.y) - pos.y=control_drag_limit.y; - - Point2 old_size = control->get_size(); - Point2 new_pos = snapify(control_drag_pos+Point2(0,pos.y-drag_from.y)); - - float new_size_y = Point2( old_size + (control->get_pos() - new_pos)).y; - float new_size_x = snapify(control_drag_size+Point2(pos.x-drag_from.x,0)).x; - - control->set_pos( new_pos ); - control->set_size( Point2(new_size_x, new_size_y) ); - } break; - case DRAG_BOTTOM_LEFT: { - - if(pos.x>control_drag_limit.x) - pos.x=control_drag_limit.x; - - Point2 old_size = control->get_size(); - Point2 new_pos = snapify(control_drag_pos+Point2(pos.x-drag_from.x,0)); - - float new_size_y = snapify(control_drag_size+Point2(0,pos.y-drag_from.y)).y; - float new_size_x = Point2( old_size + (control->get_pos() - new_pos)).x; - - control->set_pos( new_pos ); - control->set_size( Point2(new_size_x, new_size_y) ); - - - } break; - - default:{} - } - } - } - - if (p_event.type==InputEvent::KEY) { - - const InputEventKey &k=p_event.key; - - if (k.pressed) { - - if (k.scancode==KEY_UP) - _key_move(Vector2(0,-1),k.mod.shift); - else if (k.scancode==KEY_DOWN) - _key_move(Vector2(0,1),k.mod.shift); - else if (k.scancode==KEY_LEFT) - _key_move(Vector2(-1,0),k.mod.shift); - else if (k.scancode==KEY_RIGHT) - _key_move(Vector2(1,0),k.mod.shift); - } - - } - - -} - - -bool ControlEditor::get_remove_list(List<Node*> *p_list) { - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - p_list->push_back(E->key()); - } - - return !p_list->empty(); -} - -void ControlEditor::_update_scroll(float) { - - if (updating_scroll) - return; - - if (!current_window) - return; - - Point2 ofs; - ofs.x=h_scroll->get_val(); - ofs.y=v_scroll->get_val(); - -// current_window->set_scroll(-ofs); - - transform=Matrix32(); - - transform.scale_basis(Size2(zoom,zoom)); - transform.elements[2]=-ofs*zoom; - - - RID viewport = editor->get_scene_root()->get_viewport(); - - VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport,transform); - - update(); - -} - -void ControlEditor::_notification(int p_what) { - - if (p_what==NOTIFICATION_PROCESS) { - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - Control *control = E->key(); - Rect2 r=control->get_window_rect(); - if (r != E->get().last_rect ) { - update(); - E->get().last_rect=r; - } - } - - } - - if (p_what==NOTIFICATION_CHILDREN_CONFIGURED) { - - get_scene()->connect("node_removed",this,"_node_removed"); - } - - if (p_what==NOTIFICATION_DRAW) { - - // TODO fetch the viewport? - /* - if (!control) { - h_scroll->hide(); - v_scroll->hide(); - return; - } - */ - _update_scrollbars(); - - if (!current_window) - return; - - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - Control *control = E->key(); - - Rect2 rect=control->get_window_rect(); - RID ci=get_canvas_item(); - VisualServer::get_singleton()->canvas_item_set_clip(ci,true); - Point2 ofs=Point2();//get_global_pos(); - Rect2 draw_rect=Rect2(rect.pos-ofs,rect.size); - draw_rect.pos = transform.xform(draw_rect.pos); - Color light_edit_color=Color(1.0,0.8,0.8); - Color dark_edit_color=Color(0.4,0.1,0.1); - Size2 handle_size=Size2(handle_len,handle_len); - -#define DRAW_RECT( m_rect, m_color )\ -VisualServer::get_singleton()->canvas_item_add_rect(ci,m_rect,m_color); - -#define DRAW_EMPTY_RECT( m_rect, m_color )\ - DRAW_RECT( Rect2(m_rect.pos,Size2(m_rect.size.width,1)), m_color );\ - DRAW_RECT(Rect2(Point2(m_rect.pos.x,m_rect.pos.y+m_rect.size.height-1),Size2(m_rect.size.width,1)), m_color);\ - DRAW_RECT(Rect2(m_rect.pos,Size2(1,m_rect.size.height)), m_color);\ - DRAW_RECT(Rect2(Point2(m_rect.pos.x+m_rect.size.width-1,m_rect.pos.y),Size2(1,m_rect.size.height)), m_color); - -#define DRAW_BORDER_RECT( m_rect, m_border_color,m_color )\ - DRAW_RECT( m_rect, m_color );\ - DRAW_EMPTY_RECT( m_rect, m_border_color ); - - DRAW_EMPTY_RECT( draw_rect.grow(2), light_edit_color ); - DRAW_EMPTY_RECT( draw_rect.grow(1), dark_edit_color ); - - if (controls.size()==1) { - DRAW_BORDER_RECT( Rect2(draw_rect.pos-handle_size,handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+draw_rect.size,handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(draw_rect.size.width,-handle_size.y),handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(-handle_size.x,draw_rect.size.height),handle_size), light_edit_color,dark_edit_color ); - - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),-handle_size.height),handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(-handle_size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(Math::floor((draw_rect.size.width-handle_size.x)/2.0),draw_rect.size.height),handle_size), light_edit_color,dark_edit_color ); - DRAW_BORDER_RECT( Rect2(draw_rect.pos+Point2(draw_rect.size.width,Math::floor((draw_rect.size.height-handle_size.y)/2.0)),handle_size), light_edit_color,dark_edit_color ); - } - - //DRAW_EMPTY_RECT( Rect2( current_window->get_scroll()-Point2(1,1), get_size()+Size2(2,2)), Color(0.8,0.8,1.0,0.8) ); - E->get().last_rect = rect; - } - } -} - -void ControlEditor::edit(Control *p_control) { - - drag=DRAG_NONE; - - _clear_controls(); - _add_control(p_control,EditInfo()); - current_window=p_control->get_window(); - update(); - -} - - -void ControlEditor::_find_controls_span(Node *p_node, Rect2& r_rect) { - - if (!editor->get_scene()) - return; - - if (p_node!=editor->get_edited_scene() && p_node->get_owner()!=editor->get_edited_scene()) - return; - - if (p_node->cast_to<Control>()) { - Control *c = p_node->cast_to<Control>(); - if (c->get_viewport() != editor->get_viewport()->get_viewport()) - return; //bye, it's in another viewport - - if (!c->get_parent_control()) { - - Rect2 span = c->get_subtree_span_rect(); - r_rect.merge(span); - } - } - - for(int i=0;i<p_node->get_child_count();i++) { - - _find_controls_span(p_node->get_child(i),r_rect); - } -} - -void ControlEditor::_update_scrollbars() { - - - if (!editor->get_scene()) { - h_scroll->hide(); - v_scroll->hide(); - return; - } - - updating_scroll=true; - - - Size2 size = get_size(); - Size2 hmin = h_scroll->get_minimum_size(); - Size2 vmin = v_scroll->get_minimum_size(); - - v_scroll->set_begin( Point2(size.width - vmin.width, 0) ); - v_scroll->set_end( Point2(size.width, size.height) ); - - h_scroll->set_begin( Point2( 0, size.height - hmin.height) ); - h_scroll->set_end( Point2(size.width-vmin.width, size.height) ); - - - Rect2 local_rect = Rect2(Point2(),get_size()-Size2(vmin.width,hmin.height)); - - Rect2 control_rect=local_rect; - if (editor->get_edited_scene()) - _find_controls_span(editor->get_edited_scene(),control_rect); - control_rect.pos*=zoom; - control_rect.size*=zoom; - - /* - for(ControlMap::Element *E=controls.front();E;E=E->next()) { - - Control *control = E->key(); - Rect2 r = control->get_window()->get_subtree_span_rect(); - if (E==controls.front()) { - control_rect = r.merge(local_rect); - } else { - control_rect = control_rect.merge(r); - } - } - - */ - Point2 ofs; - - - if (control_rect.size.height <= local_rect.size.height) { - - v_scroll->hide(); - ofs.y=0; - } else { - - v_scroll->show(); - v_scroll->set_min(control_rect.pos.y); - v_scroll->set_max(control_rect.pos.y+control_rect.size.y); - v_scroll->set_page(local_rect.size.y); - ofs.y=-v_scroll->get_val(); - } - - if (control_rect.size.width <= local_rect.size.width) { - - h_scroll->hide(); - ofs.x=0; - } else { - - h_scroll->show(); - h_scroll->set_min(control_rect.pos.x); - h_scroll->set_max(control_rect.pos.x+control_rect.size.x); - h_scroll->set_page(local_rect.size.x); - ofs.x=-h_scroll->get_val(); - } - -// transform=Matrix32(); - transform.elements[2]=ofs*zoom; - RID viewport = editor->get_scene_root()->get_viewport(); - VisualServer::get_singleton()->viewport_set_global_canvas_transform(viewport,transform); - -// transform.scale_basis(Vector2(zoom,zoom)); - updating_scroll=false; - -} - - -Point2i ControlEditor::snapify(const Point2i& p_pos) const { - - bool active=popup->is_item_checked(0); - int snap = snap_val->get_text().to_int(); - - if (!active || snap<1) - return p_pos; - - Point2i pos=p_pos; - pos.x-=pos.x%snap; - pos.y-=pos.y%snap; - return pos; - - -} -void ControlEditor::_popup_callback(int p_op) { - - switch(p_op) { - - case SNAP_USE: { - - popup->set_item_checked(0,!popup->is_item_checked(0)); - } break; - case SNAP_CONFIGURE: { - snap_dialog->popup_centered(Size2(200,85)); - } break; - } -} - -void ControlEditor::_bind_methods() { - - ObjectTypeDB::bind_method("_input_event",&ControlEditor::_input_event); - ObjectTypeDB::bind_method("_node_removed",&ControlEditor::_node_removed); - ObjectTypeDB::bind_method("_update_scroll",&ControlEditor::_update_scroll); - ObjectTypeDB::bind_method("_popup_callback",&ControlEditor::_popup_callback); - ObjectTypeDB::bind_method("_visibility_changed",&ControlEditor::_visibility_changed); -} - -ControlEditor::ControlEditor(EditorNode *p_editor) { - - editor=p_editor; - h_scroll = memnew( HScrollBar ); - v_scroll = memnew( VScrollBar ); - - add_child(h_scroll); - add_child(v_scroll); - h_scroll->connect("value_changed", this,"_update_scroll",Vector<Variant>(),true); - v_scroll->connect("value_changed", this,"_update_scroll",Vector<Variant>(),true); - - - updating_scroll=false; - set_focus_mode(FOCUS_ALL); - handle_len=10; - - popup=memnew( PopupMenu ); - popup->add_check_item("Use Snap"); - popup->add_item("Configure Snap.."); - add_child(popup); - - snap_dialog = memnew( ConfirmationDialog ); - snap_dialog->get_ok()->hide(); - snap_dialog->get_cancel()->set_text("Close"); - add_child(snap_dialog); - - Label *l = memnew(Label); - l->set_text("Snap:"); - l->set_pos(Point2(5,5)); - snap_dialog->add_child(l); - - snap_val=memnew(LineEdit); - snap_val->set_text("5"); - snap_val->set_anchor(MARGIN_RIGHT,ANCHOR_END); - snap_val->set_begin(Point2(15,25)); - snap_val->set_end(Point2(10,25)); - snap_dialog->add_child(snap_val); - - popup->connect("item_pressed", this,"_popup_callback"); - current_window=NULL; - - zoom=0.5; -} - - -void ControlEditorPlugin::edit(Object *p_object) { - - control_editor->set_undo_redo(&get_undo_redo()); - control_editor->edit(p_object->cast_to<Control>()); -} - -bool ControlEditorPlugin::handles(Object *p_object) const { - - return p_object->is_type("Control"); -} - -void ControlEditorPlugin::make_visible(bool p_visible) { - - if (p_visible) { - control_editor->show(); - control_editor->set_process(true); - } else { - - control_editor->hide(); - control_editor->set_process(false); - } - -} - -ControlEditorPlugin::ControlEditorPlugin(EditorNode *p_node) { - - editor=p_node; - control_editor = memnew( ControlEditor(editor) ); - editor->get_viewport()->add_child(control_editor); - control_editor->set_area_as_parent_rect(); - control_editor->hide(); - - - -} - - -ControlEditorPlugin::~ControlEditorPlugin() -{ -} - - -#endif diff --git a/tools/editor/plugins/control_editor_plugin.h b/tools/editor/plugins/control_editor_plugin.h deleted file mode 100644 index 6234698ee8..0000000000 --- a/tools/editor/plugins/control_editor_plugin.h +++ /dev/null @@ -1,141 +0,0 @@ -/*************************************************************************/ -/* control_editor_plugin.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. */ -/*************************************************************************/ -#ifndef CONTROL_EDITOR_PLUGIN_H -#define CONTROL_EDITOR_PLUGIN_H - -#include "tools/editor/editor_plugin.h" -#include "tools/editor/editor_node.h" -/** - @author Juan Linietsky <reduzio@gmail.com> -*/ - -#if 0 -class ControlEditor : public Control { - - OBJ_TYPE(ControlEditor, Control ); - - EditorNode *editor; - - enum { - SNAP_USE, - SNAP_CONFIGURE - }; - - enum DragType { - DRAG_NONE, - DRAG_LEFT, - DRAG_TOP_LEFT, - DRAG_TOP, - DRAG_TOP_RIGHT, - DRAG_RIGHT, - DRAG_BOTTOM_RIGHT, - DRAG_BOTTOM, - DRAG_BOTTOM_LEFT, - DRAG_ALL - }; - - HScrollBar *h_scroll; - VScrollBar *v_scroll; - - Matrix32 transform; - float zoom; - - Control *current_window; - PopupMenu *popup; - DragType drag; - Point2 drag_from; - - struct EditInfo { - - Point2 drag_pos; - Point2 drag_size; - Point2 drag_limit; - Rect2 last_rect; - }; - - typedef Map<Control*,EditInfo> ControlMap; - ControlMap controls; - int handle_len; - Control* _select_control_at_pos(const Point2& p_pos,Node* p_node); - - ConfirmationDialog *snap_dialog; - LineEdit *snap_val; - - void _add_control(Control *p_control,const EditInfo& p_info); - void _remove_control(Control *p_control); - void _clear_controls(); - void _visibility_changed(ObjectID p_control); - void _key_move(const Vector2& p_dir, bool p_snap); - - - Point2i snapify(const Point2i& p_pos) const; - void _popup_callback(int p_op); - bool updating_scroll; - void _update_scroll(float); - void _update_scrollbars(); - UndoRedo *undo_redo; - - void _find_controls_span(Node *p_node, Rect2& r_rect); - -protected: - void _notification(int p_what); - void _input_event(InputEvent p_event); - void _node_removed(Node *p_node); - static void _bind_methods(); -public: - - bool get_remove_list(List<Node*> *p_list); - void set_undo_redo(UndoRedo *p_undo_redo) {undo_redo=p_undo_redo; } - void edit(Control *p_control); - ControlEditor(EditorNode *p_editor); -}; - -class ControlEditorPlugin : public EditorPlugin { - - OBJ_TYPE( ControlEditorPlugin, EditorPlugin ); - - ControlEditor *control_editor; - EditorNode *editor; - -public: - - virtual String get_name() const { return "GUI"; } - bool has_main_screen() const { return true; } - virtual void edit(Object *p_object); - virtual bool handles(Object *p_object) const; - virtual void make_visible(bool p_visible); - virtual bool get_remove_list(List<Node*> *p_list) { return control_editor->get_remove_list(p_list); } - - - ControlEditorPlugin(EditorNode *p_node); - ~ControlEditorPlugin(); - -}; -#endif -#endif diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index 300e35f94d..a057e6c2a1 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_preview_plugins.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 "editor_preview_plugins.h" #include "io/resource_loader.h" #include "tools/editor/editor_settings.h" @@ -641,7 +669,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -659,8 +687,8 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -671,7 +699,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -687,7 +715,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) { for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) diff --git a/tools/editor/plugins/editor_preview_plugins.h b/tools/editor/plugins/editor_preview_plugins.h index b3bfda8045..b33aefaa23 100644 --- a/tools/editor/plugins/editor_preview_plugins.h +++ b/tools/editor/plugins/editor_preview_plugins.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* editor_preview_plugins.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. */ +/*************************************************************************/ #ifndef EDITORPREVIEWPLUGINS_H #define EDITORPREVIEWPLUGINS_H diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp index bf3b2fa68d..14e7b14fc3 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* light_occluder_2d_editor_plugin.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 "light_occluder_2d_editor_plugin.h" #include "canvas_item_editor_plugin.h" diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h index 5fb5631d05..b570fff506 100644 --- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h +++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* light_occluder_2d_editor_plugin.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. */ +/*************************************************************************/ #ifndef LIGHT_OCCLUDER_2D_EDITOR_PLUGIN_H #define LIGHT_OCCLUDER_2D_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/mesh_editor_plugin.cpp b/tools/editor/plugins/mesh_editor_plugin.cpp index 51a436e58d..71cf33ba1b 100644 --- a/tools/editor/plugins/mesh_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* mesh_editor_plugin.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 "mesh_editor_plugin.h" void MeshEditor::_input_event(InputEvent p_event) { diff --git a/tools/editor/plugins/mesh_editor_plugin.h b/tools/editor/plugins/mesh_editor_plugin.h index 190dfca464..0715a96e74 100644 --- a/tools/editor/plugins/mesh_editor_plugin.h +++ b/tools/editor/plugins/mesh_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* mesh_editor_plugin.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. */ +/*************************************************************************/ #ifndef MESH_EDITOR_PLUGIN_H #define MESH_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/mesh_instance_editor_plugin.cpp b/tools/editor/plugins/mesh_instance_editor_plugin.cpp index f604e4c57c..c952feb1da 100644 --- a/tools/editor/plugins/mesh_instance_editor_plugin.cpp +++ b/tools/editor/plugins/mesh_instance_editor_plugin.cpp @@ -183,6 +183,12 @@ void MeshInstanceEditor::_create_outline_mesh() { return; } + if (mesh->get_surface_count() == 0) { + err_dialog->set_text(TTR("Mesh has not surface to create outlines from!")); + err_dialog->popup_centered_minsize(); + return; + } + Ref<Mesh> mesho = mesh->create_outline(outline_size->get_val()); if (mesho.is_null()) { diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp index 1ee388ca18..5a8cd8791e 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* navigation_polygon_editor_plugin.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 "navigation_polygon_editor_plugin.h" #include "canvas_item_editor_plugin.h" diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h index f742cb011d..503b4c2662 100644 --- a/tools/editor/plugins/navigation_polygon_editor_plugin.h +++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* navigation_polygon_editor_plugin.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. */ +/*************************************************************************/ #ifndef NAVIGATIONPOLYGONEDITORPLUGIN_H #define NAVIGATIONPOLYGONEDITORPLUGIN_H diff --git a/tools/editor/plugins/path_2d_editor_plugin.cpp b/tools/editor/plugins/path_2d_editor_plugin.cpp index 107ec30a91..95f330a1d5 100644 --- a/tools/editor/plugins/path_2d_editor_plugin.cpp +++ b/tools/editor/plugins/path_2d_editor_plugin.cpp @@ -633,35 +633,35 @@ Path2DEditor::Path2DEditor(EditorNode *p_editor) { sep = memnew( VSeparator); base_hb->add_child(sep); curve_edit = memnew( ToolButton ); - curve_edit->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveEdit","EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit","EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points")+"\n"+TTR("Shift+Drag: Select Control Points")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Click: Add Point")+"\n"+TTR("Right Click: Delete Point")); curve_edit->connect("pressed",this,"_mode_selected",varray(MODE_EDIT)); base_hb->add_child(curve_edit); curve_edit_curve = memnew( ToolButton ); - curve_edit_curve->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCurve","EditorIcons")); + curve_edit_curve->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCurve","EditorIcons")); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); curve_edit_curve->connect("pressed",this,"_mode_selected",varray(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); curve_create = memnew( ToolButton ); - curve_create->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveCreate","EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate","EditorIcons")); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")+"\n"+TTR("Split Segment (in curve)")); curve_create->connect("pressed",this,"_mode_selected",varray(MODE_CREATE)); base_hb->add_child(curve_create); curve_del = memnew( ToolButton ); - curve_del->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveDelete","EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete","EditorIcons")); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); curve_del->connect("pressed",this,"_mode_selected",varray(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew( ToolButton ); - curve_close->set_icon(CanvasItemEditor::get_singleton()->get_icon("CurveClose","EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose","EditorIcons")); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); curve_close->connect("pressed",this,"_mode_selected",varray(ACTION_CLOSE)); diff --git a/tools/editor/plugins/path_editor_plugin.cpp b/tools/editor/plugins/path_editor_plugin.cpp index d7cc2bd157..33ef71efab 100644 --- a/tools/editor/plugins/path_editor_plugin.cpp +++ b/tools/editor/plugins/path_editor_plugin.cpp @@ -542,28 +542,28 @@ PathEditorPlugin::PathEditorPlugin(EditorNode *p_node) { sep->hide(); SpatialEditor::get_singleton()->add_control_to_menu_panel(sep); curve_edit = memnew( ToolButton ); - curve_edit->set_icon(SpatialEditor::get_singleton()->get_icon("CurveEdit","EditorIcons")); + curve_edit->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveEdit","EditorIcons")); curve_edit->set_toggle_mode(true); curve_edit->hide(); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip(TTR("Select Points")+"\n"+TTR("Shift+Drag: Select Control Points")+"\n"+keycode_get_string(KEY_MASK_CMD)+TTR("Click: Add Point")+"\n"+TTR("Right Click: Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_edit); curve_create = memnew( ToolButton ); - curve_create->set_icon(SpatialEditor::get_singleton()->get_icon("CurveCreate","EditorIcons")); + curve_create->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveCreate","EditorIcons")); curve_create->set_toggle_mode(true); curve_create->hide(); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip(TTR("Add Point (in empty space)")+"\n"+TTR("Split Segment (in curve)")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_create); curve_del = memnew( ToolButton ); - curve_del->set_icon(SpatialEditor::get_singleton()->get_icon("CurveDelete","EditorIcons")); + curve_del->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveDelete","EditorIcons")); curve_del->set_toggle_mode(true); curve_del->hide(); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip(TTR("Delete Point")); SpatialEditor::get_singleton()->add_control_to_menu_panel(curve_del); curve_close = memnew( ToolButton ); - curve_close->set_icon(SpatialEditor::get_singleton()->get_icon("CurveClose","EditorIcons")); + curve_close->set_icon(EditorNode::get_singleton()->get_gui_base()->get_icon("CurveClose","EditorIcons")); curve_close->hide(); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip(TTR("Close Curve")); diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp index f873b43fd9..d78508c429 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* collision_polygon_editor_plugin.cpp */ +/* polygon_2d_editor_plugin.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h index 0939c44264..d8b951ec44 100644 --- a/tools/editor/plugins/polygon_2d_editor_plugin.h +++ b/tools/editor/plugins/polygon_2d_editor_plugin.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* polygon_2d_editor_plugin.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. */ +/*************************************************************************/ #ifndef POLYGON_2D_EDITOR_PLUGIN_H #define POLYGON_2D_EDITOR_PLUGIN_H diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index a3891a648b..b094184a29 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -211,7 +211,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -229,8 +229,8 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag float max[2]={-1e10,-1e10}; float min[2]={1e10,1e10}; int c=stereo?2:1; - int from = i*len/w; - int to = (i+1)*len/w; + int from = uint64_t(i)*len/w; + int to = (uint64_t(i)+1)*len/w; if (to>=len) to=len-1; @@ -241,7 +241,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/32768.0; + float v = src[uint64_t(k)*c+j]/32768.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -257,7 +257,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int k=from;k<=to;k++) { - float v = src[k*c+j]/128.0; + float v = src[uint64_t(k)*c+j]/128.0; if (v>max[j]) max[j]=v; if (v<min[j]) @@ -270,7 +270,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag if (!stereo) { for(int j=0;j<h;j++) { float v = (j/(float)h) * 2.0 - 1.0; - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[0] && v<max[0]) { imgofs[0]=255; imgofs[1]=150; @@ -297,7 +297,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } - uint8_t* imgofs = &imgw[(j*w+i)*3]; + uint8_t* imgofs = &imgw[(uint64_t(j)*w+i)*3]; if (v>min[half] && v<max[half]) { imgofs[0]=255; imgofs[1]=150; diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index a313b0053a..7de80e767b 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -531,7 +531,7 @@ static void _find_changed_scripts_for_external_editor(Node* p_base, Node*p_curre } -void ScriptEditor::_update_modified_scripts_for_external_editor() { +void ScriptEditor::_update_modified_scripts_for_external_editor(Ref<Script> p_for_script) { if (!bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor"))) return; @@ -547,6 +547,9 @@ void ScriptEditor::_update_modified_scripts_for_external_editor() { Ref<Script> script = E->get(); + if (p_for_script.is_valid() && p_for_script!=script) + continue; + if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) { continue; //internal script, who cares, though weird @@ -900,7 +903,7 @@ void ScriptEditor::_live_auto_reload_running_scripts() { } -bool ScriptEditor::_test_script_times_on_disk() { +bool ScriptEditor::_test_script_times_on_disk(Ref<Script> p_for_script) { disk_changed_list->clear(); @@ -920,6 +923,9 @@ bool ScriptEditor::_test_script_times_on_disk() { Ref<Script> script = ste->get_edited_script(); + if (p_for_script.is_valid() && p_for_script!=script) + continue; + if (script->get_path()=="" || script->get_path().find("local://")!=-1 || script->get_path().find("::")!=-1) continue; //internal script, who cares @@ -2128,6 +2134,12 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { if (!restoring_layout) { EditorNode::get_singleton()->save_layout(); } + + //test for modification, maybe the script was not edited but was loaded + + _test_script_times_on_disk(p_script); + _update_modified_scripts_for_external_editor(p_script); + } void ScriptEditor::save_all_scripts() { @@ -2201,7 +2213,7 @@ void ScriptEditor::_editor_stop() { void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const StringArray& p_args) { - print_line("add callback! hohoho"); + //print_line("add callback! hohoho"); kinda sad to remove this ERR_FAIL_COND(!p_obj); Ref<Script> script = p_obj->get_script(); ERR_FAIL_COND( !script.is_valid() ); @@ -2243,7 +2255,6 @@ void ScriptEditor::_add_callback(Object *p_obj, const String& p_function, const void ScriptEditor::_editor_settings_changed() { - print_line("settings changed"); trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/trim_trailing_whitespace_on_save"); float autosave_time = EditorSettings::get_singleton()->get("text_editor/autosave_interval_secs"); if (autosave_time>0) { @@ -2284,7 +2295,6 @@ void ScriptEditor::_editor_settings_changed() { void ScriptEditor::_autosave_scripts() { - print_line("autosaving"); save_all_scripts(); } @@ -2625,7 +2635,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save", TTR("Save"), KEY_MASK_ALT|KEY_MASK_CMD|KEY_S), FILE_SAVE); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_as", TTR("Save As..")), FILE_SAVE_AS); - file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_S), FILE_SAVE_ALL); + file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/save_all", TTR("Save All"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_MASK_ALT|KEY_S), FILE_SAVE_ALL); file_menu->get_popup()->add_separator(); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_previous", TTR("History Prev"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_LEFT), WINDOW_PREV); file_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/history_next", TTR("History Next"), KEY_MASK_CTRL|KEY_MASK_ALT|KEY_RIGHT), WINDOW_NEXT); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 3d723adfe9..0636190a41 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -232,7 +232,7 @@ class ScriptEditor : public VBoxContainer { void _resave_scripts(const String& p_str); void _reload_scripts(); - bool _test_script_times_on_disk(); + bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>()); void _close_current_tab(); @@ -291,7 +291,7 @@ class ScriptEditor : public VBoxContainer { void _go_to_tab(int p_idx); void _update_history_pos(int p_new_pos); void _update_script_colors(); - void _update_modified_scripts_for_external_editor(); + void _update_modified_scripts_for_external_editor(Ref<Script> p_for_script=Ref<Script>()); int file_dialog_option; void _file_dialog_action(String p_file); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index f4b294daa5..83db650952 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -30,6 +30,7 @@ #include "tools/editor/editor_settings.h" #include "spatial_editor_plugin.h" +#include "scene/resources/shader_graph.h" #include "io/resource_loader.h" #include "io/resource_saver.h" #include "os/keyboard.h" @@ -144,8 +145,6 @@ void ShaderTextEditor::_validate_script() { //List<StringName> params; //shader->get_param_list(¶ms); - print_line("compile: type: "+itos(type)+" code:\n"+code); - Error err = ShaderLanguage::compile(code,type,NULL,NULL,&errortxt,&line,&col); if (err!=OK) { @@ -557,34 +556,41 @@ ShaderEditor::ShaderEditor() { void ShaderEditorPlugin::edit(Object *p_object) { - if (!p_object->cast_to<Shader>()) + Shader* s = p_object->cast_to<Shader>(); + if (!s || s->cast_to<ShaderGraph>()) { + shader_editor->hide(); //Dont edit ShaderGraph return; + } - shader_editor->edit(p_object->cast_to<Shader>()); + if (_2d && s->get_mode()==Shader::MODE_CANVAS_ITEM) + shader_editor->edit(s); + else if (!_2d && s->get_mode()==Shader::MODE_MATERIAL) + shader_editor->edit(s); } bool ShaderEditorPlugin::handles(Object *p_object) const { + bool handles = true; Shader *shader=p_object->cast_to<Shader>(); - if (!shader) - return false; - if (_2d) - return shader->get_mode()==Shader::MODE_CANVAS_ITEM; - else + if (!shader || shader->cast_to<ShaderGraph>()) // Dont handle ShaderGraph's + handles = false; + if (handles && _2d) + handles = shader->get_mode()==Shader::MODE_CANVAS_ITEM; + else if (handles && !_2d) return shader->get_mode()==Shader::MODE_MATERIAL; + + if (!handles) + shader_editor->hide(); + return handles; } void ShaderEditorPlugin::make_visible(bool p_visible) { if (p_visible) { shader_editor->show(); - //shader_editor->set_process(true); } else { - shader_editor->apply_shaders(); - //shader_editor->hide(); - //shader_editor->set_process(false); } } diff --git a/tools/editor/plugins/shader_graph_editor_plugin.h b/tools/editor/plugins/shader_graph_editor_plugin.h index 8d1d08ee1d..67ee5e2d45 100644 --- a/tools/editor/plugins/shader_graph_editor_plugin.h +++ b/tools/editor/plugins/shader_graph_editor_plugin.h @@ -33,7 +33,6 @@ #include "tools/editor/editor_plugin.h" #include "tools/editor/editor_node.h" #include "scene/resources/shader.h" -#include "servers/visual/shader_graph.h" #include "scene/gui/tree.h" #include "scene/gui/button.h" #include "scene/gui/graph_edit.h" diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp index fdb654571a..8d72178f23 100644 --- a/tools/editor/plugins/spatial_editor_plugin.cpp +++ b/tools/editor/plugins/spatial_editor_plugin.cpp @@ -1580,7 +1580,7 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) { nav_mode = NAVIGATION_PAN; } - } else if (EditorSettings::get_singleton()->get("3d_editor/trackpad_hint")) { + } else if (EditorSettings::get_singleton()->get("3d_editor/emulate_3_button_mouse")) { // Handle trackpad (no external mouse) use case int mod = 0; if (m.mod.shift) diff --git a/tools/editor/plugins/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 2673948365..5db331ba45 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -348,7 +348,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_icon_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_icon(E->get(),fromtype,Theme::get_default()->get_icon(E->get(),fromtype)); + theme->set_icon(E->get(),fromtype,Ref<Texture>()); } @@ -357,7 +357,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_stylebox_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_stylebox(E->get(),fromtype,Theme::get_default()->get_stylebox(E->get(),fromtype)); + theme->set_stylebox(E->get(),fromtype,Ref<StyleBox>()); } @@ -366,7 +366,7 @@ void ThemeEditor::_dialog_cbk() { names.clear(); Theme::get_default()->get_font_list(fromtype,&names); for(List<StringName>::Element *E=names.front();E;E=E->next()) { - theme->set_font(E->get(),fromtype,Theme::get_default()->get_font(E->get(),fromtype)); + theme->set_font(E->get(),fromtype,Ref<Font>()); } } @@ -454,11 +454,73 @@ void ThemeEditor::_dialog_cbk() { void ThemeEditor::_theme_menu_cbk(int p_option) { - if (p_option==POPUP_CREATE_TEMPLATE) { + if (p_option==POPUP_CREATE_EMPTY || p_option==POPUP_CREATE_EDITOR_EMPTY) { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); - file_dialog->set_current_path("custom.theme"); - file_dialog->popup_centered_ratio(); + + Ref<Theme> base_theme; + + if (p_option==POPUP_CREATE_EMPTY) { + base_theme = Theme::get_default(); + } else { + base_theme = EditorNode::get_singleton()->get_theme_base()->get_theme(); + } + + + { + + List<StringName> types; + base_theme->get_type_list(&types); + + + for (List<StringName>::Element *T=types.front();T;T=T->next()) { + StringName type = T->get(); + + List<StringName> icons; + base_theme->get_icon_list(type,&icons); + + for (List<StringName>::Element *E=icons.front();E;E=E->next()) { + theme->set_icon(E->get(),type,Ref<Texture>()); + } + + List<StringName> shaders; + base_theme->get_shader_list(type,&shaders); + + for (List<StringName>::Element *E=shaders.front();E;E=E->next()) { + theme->set_shader(E->get(),type,Ref<Shader>()); + } + + List<StringName> styleboxs; + base_theme->get_stylebox_list(type,&styleboxs); + + for (List<StringName>::Element *E=styleboxs.front();E;E=E->next()) { + theme->set_stylebox(E->get(),type,Ref<StyleBox>()); + } + + List<StringName> fonts; + base_theme->get_font_list(type,&fonts); + + for (List<StringName>::Element *E=fonts.front();E;E=E->next()) { + theme->set_font(E->get(),type,Ref<Font>()); + } + + List<StringName> colors; + base_theme->get_color_list(type,&colors); + + for (List<StringName>::Element *E=colors.front();E;E=E->next()) { + theme->set_color(E->get(),type,Color()); + } + + + List<StringName> constants; + base_theme->get_constant_list(type,&constants); + + for (List<StringName>::Element *E=constants.front();E;E=E->next()) { + theme->set_constant(E->get(),type,base_theme->get_constant(type,E->get())); + } + + } + + } return; } @@ -475,7 +537,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Add Item")); add_del_dialog->get_ok()->set_text(TTR("Add")); - add_del_dialog->popup_centered(Size2(490,85)); + add_del_dialog->popup_centered(Size2(490,85)*EDSCALE); base_theme=Theme::get_default(); @@ -483,7 +545,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Add All Items")); add_del_dialog->get_ok()->set_text(TTR("Add All")); - add_del_dialog->popup_centered(Size2(240,85)); + add_del_dialog->popup_centered(Size2(240,85)*EDSCALE); base_theme=Theme::get_default(); @@ -497,7 +559,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title(TTR("Remove Item")); add_del_dialog->get_ok()->set_text(TTR("Remove")); - add_del_dialog->popup_centered(Size2(490,85)); + add_del_dialog->popup_centered(Size2(490,85)*EDSCALE); base_theme=theme; @@ -505,7 +567,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { add_del_dialog->set_title("Remove All Items"); add_del_dialog->get_ok()->set_text("Remove All"); - add_del_dialog->popup_centered(Size2(240,85)); + add_del_dialog->popup_centered(Size2(240,85)*EDSCALE); base_theme=Theme::get_default(); @@ -521,12 +583,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { List<StringName> types; base_theme->get_type_list(&types); + type_menu->get_popup()->clear();; if (p_option==0 || p_option==1) {//add List<StringName> new_types; theme->get_type_list(&new_types); + //uh kind of sucks for(List<StringName>::Element *F=new_types.front();F;F=F->next()) { @@ -544,8 +608,8 @@ void ThemeEditor::_theme_menu_cbk(int p_option) { } } - types.sort(); - + //types.sort(); + types.sort_custom<StringName::AlphCompare>(); for(List<StringName>::Element *E=types.front();E;E=E->next()) { type_menu->get_popup()->add_item( E->get() ); @@ -579,15 +643,23 @@ ThemeEditor::ThemeEditor() { time_left=0; + scroll = memnew( ScrollContainer ); + add_child(scroll); + scroll->set_area_as_parent_rect(3); + scroll->set_margin(MARGIN_TOP,30*EDSCALE); + //scroll->set_enable_h_scroll(true); + scroll->set_enable_v_scroll(true); + scroll->set_enable_h_scroll(false); + Panel * panel = memnew( Panel ); - add_child(panel); - panel->set_area_as_parent_rect(0); - panel->set_margin(MARGIN_TOP,25); + scroll->add_child(panel); + panel->set_custom_minimum_size(Size2(500,800)*EDSCALE); panel->set_theme(Theme::get_default()); + panel->set_h_size_flags(SIZE_EXPAND_FILL); main_vb= memnew( VBoxContainer ); panel->add_child(main_vb); - main_vb->set_area_as_parent_rect(4); + main_vb->set_area_as_parent_rect(4*EDSCALE); HBoxContainer *hb_menu = memnew(HBoxContainer); @@ -602,8 +674,11 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item(TTR("Remove Item"),POPUP_REMOVE); theme_menu->get_popup()->add_item(TTR("Remove Class Items"),POPUP_CLASS_REMOVE); theme_menu->get_popup()->add_separator(); - theme_menu->get_popup()->add_item(TTR("Create Template"),POPUP_CREATE_TEMPLATE); - hb_menu->add_child(theme_menu); + theme_menu->get_popup()->add_item(TTR("Create Empty Template"),POPUP_CREATE_EMPTY); + theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"),POPUP_CREATE_EDITOR_EMPTY); + + add_child(theme_menu); + theme_menu->set_pos(Vector2(3,3)*EDSCALE); theme_menu->get_popup()->connect("item_pressed", this,"_theme_menu_cbk"); @@ -678,26 +753,26 @@ ThemeEditor::ThemeEditor() { pb->set_val(50); first_vb->add_child( pb); Panel *pn=memnew( Panel ); - pn->set_custom_minimum_size(Size2(40,40)); + pn->set_custom_minimum_size(Size2(40,40)*EDSCALE); first_vb->add_child( pn); - first_vb->add_constant_override("separation",10); + first_vb->add_constant_override("separation",10*EDSCALE); VBoxContainer *second_vb = memnew( VBoxContainer ); second_vb->set_h_size_flags(SIZE_EXPAND_FILL); main_hb->add_child(second_vb); - second_vb->add_constant_override("separation",10); + second_vb->add_constant_override("separation",10*EDSCALE); LineEdit *le = memnew( LineEdit ); le->set_text("LineEdit"); second_vb->add_child(le); TextEdit *te = memnew( TextEdit ); te->set_text("TextEdit"); //te->set_v_size_flags(SIZE_EXPAND_FILL); - te->set_custom_minimum_size(Size2(0,160)); + te->set_custom_minimum_size(Size2(0,160)*EDSCALE); second_vb->add_child(te); Tree *test_tree = memnew(Tree); second_vb->add_child(test_tree); - test_tree->set_custom_minimum_size(Size2(0,160)); + test_tree->set_custom_minimum_size(Size2(0,160)*EDSCALE); TreeItem *item = test_tree->create_item(); @@ -725,7 +800,7 @@ ThemeEditor::ThemeEditor() { main_hb->add_child(third_vb); HBoxContainer *vhb = memnew( HBoxContainer ); - vhb->set_custom_minimum_size(Size2(0,160)); + vhb->set_custom_minimum_size(Size2(0,160)*EDSCALE); vhb->add_child(memnew(VSeparator)); vhb->add_child(memnew(VSlider)); vhb->add_child(memnew(VScrollBar)); @@ -733,7 +808,7 @@ ThemeEditor::ThemeEditor() { TabContainer *tc = memnew( TabContainer ); third_vb->add_child(tc); - tc->set_custom_minimum_size(Size2(0,160)); + tc->set_custom_minimum_size(Size2(0,160)*EDSCALE); Control *tcc = memnew( Control ); tcc->set_name(TTR("Tab 1")); tc->add_child(tcc); @@ -744,7 +819,7 @@ ThemeEditor::ThemeEditor() { tcc->set_name(TTR("Tab 3")); tc->add_child(tcc); - main_hb->add_constant_override("separation",20); + main_hb->add_constant_override("separation",20*EDSCALE); @@ -807,37 +882,37 @@ ThemeEditor::ThemeEditor() { Label *l = memnew( Label ); - l->set_pos( Point2(5,5) ); + l->set_pos( Point2(5,5)*EDSCALE ); l->set_text(TTR("Type:")); add_del_dialog->add_child(l); dtype_select_label=l; type_edit = memnew( LineEdit ); - type_edit->set_pos(Point2(5,25)); - type_edit->set_size(Point2(150,5)); + type_edit->set_pos(Point2(5,25)*EDSCALE); + type_edit->set_size(Point2(150,5)*EDSCALE); add_del_dialog->add_child(type_edit); type_menu = memnew( MenuButton ); - type_menu->set_pos(Point2(160,25)); - type_menu->set_size(Point2(30,5)); + type_menu->set_pos(Point2(160,25)*EDSCALE); + type_menu->set_size(Point2(30,5)*EDSCALE); type_menu->set_text(".."); add_del_dialog->add_child(type_menu); type_menu->get_popup()->connect("item_pressed", this,"_type_menu_cbk"); l = memnew( Label ); - l->set_pos( Point2(200,5) ); + l->set_pos( Point2(200,5)*EDSCALE ); l->set_text(TTR("Name:")); add_del_dialog->add_child(l); name_select_label=l; name_edit = memnew( LineEdit ); - name_edit->set_pos(Point2(200,25)); - name_edit->set_size(Point2(150,5)); + name_edit->set_pos(Point2(200,25)*EDSCALE); + name_edit->set_size(Point2(150,5)*EDSCALE); add_del_dialog->add_child(name_edit); name_menu = memnew( MenuButton ); - name_menu->set_pos(Point2(360,25)); - name_menu->set_size(Point2(30,5)); + name_menu->set_pos(Point2(360,25)*EDSCALE); + name_menu->set_size(Point2(30,5)*EDSCALE); name_menu->set_text(".."); add_del_dialog->add_child(name_menu); @@ -846,7 +921,7 @@ ThemeEditor::ThemeEditor() { name_menu->get_popup()->connect("item_pressed", this,"_name_menu_cbk"); type_select_label= memnew( Label ); - type_select_label->set_pos( Point2(400,5) ); + type_select_label->set_pos( Point2(400,5)*EDSCALE ); type_select_label->set_text(TTR("Data Type:")); add_del_dialog->add_child(type_select_label); @@ -856,8 +931,8 @@ ThemeEditor::ThemeEditor() { type_select->add_item(TTR("Font")); type_select->add_item(TTR("Color")); type_select->add_item(TTR("Constant")); - type_select->set_pos( Point2( 400,25 ) ); - type_select->set_size( Point2( 80,5 ) ); + type_select->set_pos( Point2( 400,25 )*EDSCALE ); + type_select->set_size( Point2( 80,5 )*EDSCALE ); add_del_dialog->add_child(type_select); @@ -910,7 +985,7 @@ ThemeEditorPlugin::ThemeEditorPlugin(EditorNode *p_node) { editor=p_node; theme_editor = memnew( ThemeEditor ); - theme_editor->set_custom_minimum_size(Size2(0,500)); + theme_editor->set_custom_minimum_size(Size2(0,200)); // p_node->get_viewport()->add_child(theme_editor); button=editor->add_bottom_panel_item("Theme",theme_editor); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 49d5ae3096..ea8f8c1d3c 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -35,16 +35,19 @@ #include "scene/gui/file_dialog.h" #include "scene/gui/check_box.h" #include "scene/gui/button_group.h" +#include "scene/gui/scroll_container.h" #include "tools/editor/editor_node.h" + class ThemeEditor : public Control { OBJ_TYPE( ThemeEditor, Control ); + ScrollContainer *scroll; VBoxContainer *main_vb; Ref<Theme> theme; @@ -68,7 +71,8 @@ class ThemeEditor : public Control { POPUP_CLASS_ADD, POPUP_REMOVE, POPUP_CLASS_REMOVE, - POPUP_CREATE_TEMPLATE + POPUP_CREATE_EMPTY, + POPUP_CREATE_EDITOR_EMPTY }; int popup_mode; diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index 5a40777665..d5f85d3333 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -893,59 +893,53 @@ bool TileMapEditor::forward_input_event(const InputEvent& p_event) { if (tool!=TOOL_NONE || !mouse_over) return false; - if (k.scancode==KEY_DELETE) { - + if (ED_IS_SHORTCUT("tile_map_editor/erase_selection", p_event)) { _menu_option(OPTION_ERASE_SELECTION); return true; } + if (ED_IS_SHORTCUT("tile_map_editor/select", p_event)) { + tool=TOOL_SELECTING; + selection_active=false; - if (k.mod.command) { - - if (k.scancode==KEY_F) { - - search_box->select_all(); - search_box->grab_focus(); + canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_B) { + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/duplicate_selection", p_event)) { + _update_copydata(); - tool=TOOL_SELECTING; - selection_active=false; + if (selection_active) { + tool=TOOL_DUPLICATING; canvas_item_editor->update(); return true; } - if (k.scancode==KEY_D) { - - _update_copydata(); - - if (selection_active) { - tool=TOOL_DUPLICATING; - - canvas_item_editor->update(); - - return true; - } - } - } else { - - if (k.scancode==KEY_A) { - - flip_h=!flip_h; - mirror_x->set_pressed(flip_h); - canvas_item_editor->update(); - return true; - } - if (k.scancode==KEY_S) { + } + if (ED_IS_SHORTCUT("tile_map_editor/find_tile", p_event)) { + search_box->select_all(); + search_box->grab_focus(); - flip_v=!flip_v; - mirror_y->set_pressed(flip_v); - canvas_item_editor->update(); - return true; - } + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_x", p_event)) { + flip_h=!flip_h; + mirror_x->set_pressed(flip_h); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/mirror_y", p_event)) { + flip_v=!flip_v; + mirror_y->set_pressed(flip_v); + canvas_item_editor->update(); + return true; + } + if (ED_IS_SHORTCUT("tile_map_editor/transpose", p_event)) { + transpose = !transpose; + transp->set_pressed(transpose); + canvas_item_editor->update(); + return true; } } break; } @@ -1308,6 +1302,12 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { flip_v=false; transpose=false; + ED_SHORTCUT("tile_map_editor/erase_selection", TTR("Erase selection"), KEY_DELETE); + ED_SHORTCUT("tile_map_editor/find_tile", TTR("Find tile"), KEY_MASK_CMD+KEY_F); + ED_SHORTCUT("tile_map_editor/transpose", TTR("Transpose")); + ED_SHORTCUT("tile_map_editor/mirror_x", TTR("Mirror X"), KEY_A); + ED_SHORTCUT("tile_map_editor/mirror_y", TTR("Mirror Y"), KEY_S); + search_box = memnew( LineEdit ); search_box->set_h_size_flags(SIZE_EXPAND_FILL); search_box->connect("text_entered", this, "_text_entered"); @@ -1349,9 +1349,9 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { p->add_separator(); p->add_item(TTR("Pick Tile"), OPTION_PICK_TILE, KEY_CONTROL); p->add_separator(); - p->add_item(TTR("Select"), OPTION_SELECT, KEY_MASK_CMD+KEY_B); - p->add_item(TTR("Duplicate Selection"), OPTION_DUPLICATE, KEY_MASK_CMD+KEY_D); - p->add_item(TTR("Erase Selection"), OPTION_ERASE_SELECTION, KEY_DELETE); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/select", TTR("Select"), KEY_MASK_CMD+KEY_B), OPTION_SELECT); + p->add_shortcut(ED_SHORTCUT("tile_map_editor/duplicate_selection", TTR("Duplicate Selection"), KEY_MASK_CMD+KEY_D), OPTION_DUPLICATE); + p->add_shortcut(ED_GET_SHORTCUT("tile_map_editor/erase_selection"), OPTION_ERASE_SELECTION); p->connect("item_pressed", this, "_menu_option"); @@ -1361,19 +1361,19 @@ TileMapEditor::TileMapEditor(EditorNode *p_editor) { transp = memnew( ToolButton ); transp->set_toggle_mode(true); - transp->set_tooltip(TTR("Transpose")); + transp->set_tooltip(TTR("Transpose") + " ("+ED_GET_SHORTCUT("tile_map_editor/transpose")->get_as_text()+")"); transp->set_focus_mode(FOCUS_NONE); transp->connect("pressed", this, "_update_transform_buttons", make_binds(transp)); toolbar->add_child(transp); mirror_x = memnew( ToolButton ); mirror_x->set_toggle_mode(true); - mirror_x->set_tooltip(TTR("Mirror X (A)")); + mirror_x->set_tooltip(TTR("Mirror X") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_x")->get_as_text()+")"); mirror_x->set_focus_mode(FOCUS_NONE); mirror_x->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_x)); toolbar->add_child(mirror_x); mirror_y = memnew( ToolButton ); mirror_y->set_toggle_mode(true); - mirror_y->set_tooltip(TTR("Mirror Y (S)")); + mirror_y->set_tooltip(TTR("Mirror Y") + " ("+ED_GET_SHORTCUT("tile_map_editor/mirror_y")->get_as_text()+")"); mirror_y->set_focus_mode(FOCUS_NONE); mirror_y->connect("pressed", this, "_update_transform_buttons", make_binds(mirror_y)); toolbar->add_child(mirror_y); diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp index 3b02c73189..3f82199fc3 100644 --- a/tools/editor/project_export.cpp +++ b/tools/editor/project_export.cpp @@ -36,7 +36,6 @@ #include "io/resource_saver.h" #include "os/os.h" #include "scene/gui/box_container.h" -#include "default_saver.h" #include "scene/gui/tab_container.h" #include "scene/gui/scroll_container.h" diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp index 419f05f2cf..d8814fd50e 100644 --- a/tools/editor/project_manager.cpp +++ b/tools/editor/project_manager.cpp @@ -45,8 +45,7 @@ #include "scene/gui/margin_container.h" #include "io/resource_saver.h" -#include "editor_icons.h" -#include "editor_fonts.h" +#include "editor_themes.h" #include "editor_scale.h" @@ -846,21 +845,16 @@ ProjectManager::ProjectManager() { set_area_as_parent_rect(); - Ref<Theme> theme = Ref<Theme>( memnew( Theme ) ); - set_theme(theme); - editor_register_icons(theme); - editor_register_fonts(theme); + gui_base = memnew( Control ); + add_child(gui_base); + gui_base->set_area_as_parent_rect(); - String global_font = EditorSettings::get_singleton()->get("global/font"); - if (global_font!="") { - Ref<Font> fnt = ResourceLoader::load(global_font); - if (fnt.is_valid()) { - theme->set_default_theme_font(fnt); - } - } + set_theme(create_default_theme()); + Ref<Theme> theme = create_editor_theme(); + gui_base->set_theme(theme); Panel *panel = memnew( Panel ); - add_child(panel); + gui_base->add_child(panel); panel->set_area_as_parent_rect(); VBoxContainer *vb = memnew( VBoxContainer ); @@ -961,7 +955,7 @@ ProjectManager::ProjectManager() { scan_dir->set_access(FileDialog::ACCESS_FILESYSTEM); scan_dir->set_mode(FileDialog::MODE_OPEN_DIR); scan_dir->set_current_dir( EditorSettings::get_singleton()->get("global/default_project_path") ); - add_child(scan_dir); + gui_base->add_child(scan_dir); scan_dir->connect("dir_selected",this,"_scan_begin"); @@ -1010,26 +1004,26 @@ ProjectManager::ProjectManager() { erase_ask->get_ok()->set_text(TTR("Remove")); erase_ask->get_ok()->connect("pressed", this,"_erase_project_confirm"); - add_child(erase_ask); + gui_base->add_child(erase_ask); multi_open_ask = memnew( ConfirmationDialog ); multi_open_ask->get_ok()->set_text(TTR("Edit")); multi_open_ask->get_ok()->connect("pressed", this, "_open_project_confirm"); - add_child(multi_open_ask); + gui_base->add_child(multi_open_ask); multi_run_ask = memnew( ConfirmationDialog ); multi_run_ask->get_ok()->set_text(TTR("Run")); multi_run_ask->get_ok()->connect("pressed", this, "_run_project_confirm"); - add_child(multi_run_ask); + gui_base->add_child(multi_run_ask); OS::get_singleton()->set_low_processor_usage_mode(true); npdialog = memnew( NewProjectDialog ); - add_child(npdialog); + gui_base->add_child(npdialog); npdialog->connect("project_created", this,"_load_recent_projects"); _load_recent_projects(); diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h index cfedfd7a69..2db1bb839e 100644 --- a/tools/editor/project_manager.h +++ b/tools/editor/project_manager.h @@ -67,6 +67,8 @@ class ProjectManager : public Control { TabContainer *tabs; + Control *gui_base; + void _item_doubleclicked(); diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h index 5108378ff7..79e1acf75e 100644 --- a/tools/editor/project_settings.h +++ b/tools/editor/project_settings.h @@ -31,7 +31,6 @@ #include "scene/gui/dialogs.h" #include "property_editor.h" -#include "optimized_save_dialog.h" #include "undo_redo.h" #include "editor_data.h" #include "scene/gui/tab_container.h" diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index 763734f035..246785932d 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -2142,6 +2142,7 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String& p if (obj->get( p_name ).get_type() == Variant::NIL || obj->get( p_name ).operator RefPtr().is_null()) { p_item->set_text(1,"<null>"); + p_item->set_icon(1,Ref<Texture>()); Dictionary d = p_item->get_metadata(0); int hint=d.has("hint")?d["hint"].operator int():-1; @@ -3349,6 +3350,7 @@ void PropertyEditor::update_tree() { if (obj->get( p.name ).get_type() == Variant::NIL || obj->get( p.name ).operator RefPtr().is_null()) { item->set_text(1,"<null>"); + item->set_icon(1,Ref<Texture>()); } else { RES res = obj->get( p.name ).operator RefPtr(); @@ -3934,6 +3936,7 @@ void PropertyEditor::_bind_methods() { ObjectTypeDB::bind_method( "_filter_changed",&PropertyEditor::_filter_changed); ObjectTypeDB::bind_method( "update_tree",&PropertyEditor::update_tree); ObjectTypeDB::bind_method( "_resource_preview_done",&PropertyEditor::_resource_preview_done); + ObjectTypeDB::bind_method( "refresh",&PropertyEditor::refresh); ObjectTypeDB::bind_method(_MD("get_drag_data_fw"), &PropertyEditor::get_drag_data_fw); ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &PropertyEditor::can_drop_data_fw); diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 5124505b90..30ffdf6664 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -49,11 +49,37 @@ void SceneTreeDock::_unhandled_key_input(InputEvent p_event) { if (!p_event.key.pressed || p_event.key.echo) return; + if (ED_IS_SHORTCUT("scene_tree/add_child_node", p_event)) { + _tool_selected(TOOL_NEW); + } + else if (ED_IS_SHORTCUT("scene_tree/instance_scene", p_event)) { + _tool_selected(TOOL_INSTANCE); + } + else if (ED_IS_SHORTCUT("scene_tree/change_node_type", p_event)) { + _tool_selected(TOOL_REPLACE); + } + else if (ED_IS_SHORTCUT("scene_tree/duplicate", p_event)) { + _tool_selected(TOOL_DUPLICATE); + } + else if (ED_IS_SHORTCUT("scene_tree/add_script", p_event)) { + _tool_selected(TOOL_SCRIPT); + } + else if (ED_IS_SHORTCUT("scene_tree/move_up", p_event)) { + _tool_selected(TOOL_MOVE_UP); + } + else if (ED_IS_SHORTCUT("scene_tree/move_down", p_event)) { + _tool_selected(TOOL_MOVE_DOWN); + } + else if (ED_IS_SHORTCUT("scene_tree/reparent", p_event)) { + _tool_selected(TOOL_REPARENT); + } + else if (ED_IS_SHORTCUT("scene_tree/merge_from_scene", p_event)) { + _tool_selected(TOOL_MERGE_FROM_SCENE); + } + else if (ED_IS_SHORTCUT("scene_tree/save_branch_as_scene", p_event)) { + _tool_selected(TOOL_NEW_SCENE_FROM); + } switch(sc) { - case KEY_MASK_CMD|KEY_A: { _tool_selected(TOOL_NEW); } break; - case KEY_MASK_CMD|KEY_D: { _tool_selected(TOOL_DUPLICATE); } break; - case KEY_MASK_CMD|KEY_UP: { _tool_selected(TOOL_MOVE_UP); } break; - case KEY_MASK_CMD|KEY_DOWN: { _tool_selected(TOOL_MOVE_DOWN); } break; case KEY_MASK_SHIFT|KEY_DELETE: { _tool_selected(TOOL_ERASE, true); } break; case KEY_DELETE: { _tool_selected(TOOL_ERASE); } break; } @@ -1362,6 +1388,13 @@ void SceneTreeDock::_create() { } String newname=n->get_name(); + + List<Node*> to_erase; + for(int i=0;i<n->get_child_count();i++) { + if (n->get_child(i)->get_owner()==NULL && n->is_owned_by_parent()) { + to_erase.push_back(n->get_child(i)); + } + } n->replace_by(newnode,true); if (n==edited_scene) { @@ -1382,6 +1415,11 @@ void SceneTreeDock::_create() { memdelete(n); + while(to_erase.front()) { + memdelete(to_erase.front()->get()); + to_erase.pop_front(); + } + } @@ -1512,12 +1550,18 @@ static bool _has_visible_children(Node* p_node) { } + static Node* _find_last_visible(Node*p_node) { Node*last=NULL; - for(int i=0;i<p_node->get_child_count();i++) { - if (_is_node_visible(p_node->get_child(i))) { - last=p_node->get_child(i); + + bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false; + + if (!collapsed) { + for(int i=0;i<p_node->get_child_count();i++) { + if (_is_node_visible(p_node->get_child(i))) { + last=p_node->get_child(i); + } } } @@ -1588,18 +1632,27 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) { Node* lower_sibling=NULL; - for(int i=to_node->get_index()+1;i<to_node->get_parent()->get_child_count();i++) { - Node *c =to_node->get_parent()->get_child(i); - if (_is_node_visible(c)) { - lower_sibling=c; + + + if (_has_visible_children(to_node) ) { + to_pos=0; + } else { + + + for(int i=to_node->get_index()+1;i<to_node->get_parent()->get_child_count();i++) { + Node *c =to_node->get_parent()->get_child(i); + if (_is_node_visible(c)) { + lower_sibling=c; + break; + } + } + + if (lower_sibling) { + to_pos=lower_sibling->get_index(); } - } - if (lower_sibling) { - to_pos=lower_sibling->get_index(); + to_node=to_node->get_parent(); } - - to_node=to_node->get_parent(); #if 0 //quite complicated, look for next visible in tree upper_sibling=_find_last_visible(upper_sibling); @@ -1660,13 +1713,11 @@ void SceneTreeDock::_nodes_dragged(Array p_nodes,NodePath p_to,int p_type) { } void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) { - - if (!EditorNode::get_singleton()->get_edited_scene()) { menu->clear(); - menu->add_icon_item(get_icon("Add","EditorIcons"),TTR("New Scene Root"),TOOL_NEW,KEY_MASK_CMD|KEY_A); - menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Inherit Scene"),TOOL_INSTANCE); + menu->add_icon_shortcut(get_icon("Add","EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); + menu->add_icon_shortcut(get_icon("Instance","EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); menu->set_size(Size2(1,1)); menu->set_pos(p_menu_pos); @@ -1683,31 +1734,31 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) { if (selection.size()==1) { - menu->add_icon_item(get_icon("Add","EditorIcons"),TTR("Add Child Node"),TOOL_NEW,KEY_MASK_CMD|KEY_A); - menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Instance Child Scene"),TOOL_INSTANCE); + menu->add_icon_shortcut(get_icon("Add","EditorIcons"), ED_GET_SHORTCUT("scene_tree/add_child_node"), TOOL_NEW); + menu->add_icon_shortcut(get_icon("Instance","EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); menu->add_separator(); - menu->add_icon_item(get_icon("Reload","EditorIcons"),TTR("Change Type"),TOOL_REPLACE); + menu->add_icon_shortcut(get_icon("Reload","EditorIcons"),ED_GET_SHORTCUT("scene_tree/change_node_type"), TOOL_REPLACE); //menu->add_separator(); moved to their own dock //menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP); //menu->add_icon_item(get_icon("Connect","EditorIcons"),TTR("Edit Connections"),TOOL_CONNECT); menu->add_separator(); - menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("Add Script"),TOOL_SCRIPT); + menu->add_icon_shortcut(get_icon("Script","EditorIcons"),ED_GET_SHORTCUT("scene_tree/add_script"), TOOL_SCRIPT); menu->add_separator(); } - menu->add_icon_item(get_icon("Up","EditorIcons"),TTR("Move Up"),TOOL_MOVE_UP,KEY_MASK_CMD|KEY_UP); - menu->add_icon_item(get_icon("Down","EditorIcons"),TTR("Move Down"),TOOL_MOVE_DOWN,KEY_MASK_CMD|KEY_DOWN); - menu->add_icon_item(get_icon("Duplicate","EditorIcons"),TTR("Duplicate"),TOOL_DUPLICATE,KEY_MASK_CMD|KEY_D); - menu->add_icon_item(get_icon("Reparent","EditorIcons"),TTR("Reparent"),TOOL_REPARENT); + menu->add_icon_shortcut(get_icon("Up","EditorIcons"),ED_GET_SHORTCUT("scene_tree/move_up"), TOOL_MOVE_UP); + menu->add_icon_shortcut(get_icon("Down","EditorIcons"),ED_GET_SHORTCUT("scene_tree/move_down"), TOOL_MOVE_DOWN); + menu->add_icon_shortcut(get_icon("Duplicate","EditorIcons"),ED_GET_SHORTCUT("scene_tree/duplicate"), TOOL_DUPLICATE); + menu->add_icon_shortcut(get_icon("Reparent","EditorIcons"),ED_GET_SHORTCUT("scene_tree/reparent"), TOOL_REPARENT); if (selection.size()==1) { menu->add_separator(); - menu->add_icon_item(get_icon("Blend","EditorIcons"),TTR("Merge From Scene"),TOOL_MERGE_FROM_SCENE); - menu->add_icon_item(get_icon("Save","EditorIcons"),TTR("Save Branch as Scene"),TOOL_NEW_SCENE_FROM); + menu->add_icon_shortcut(get_icon("Blend","EditorIcons"),ED_GET_SHORTCUT("scene_tree/merge_from_scene"), TOOL_MERGE_FROM_SCENE); + menu->add_icon_shortcut(get_icon("Save","EditorIcons"),ED_GET_SHORTCUT("scene_tree/save_branch_as_scene"), TOOL_NEW_SCENE_FROM); } menu->add_separator(); - menu->add_icon_item(get_icon("Remove","EditorIcons"),TTR("Delete Node(s)"),TOOL_ERASE,KEY_DELETE); + menu->add_icon_item(get_icon("Remove","EditorIcons"),TTR("Delete Node(s)"), TOOL_ERASE, KEY_DELETE); menu->set_size(Size2(1,1)); menu->set_pos(p_menu_pos); @@ -1774,15 +1825,28 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec HBoxContainer *filter_hbc = memnew( HBoxContainer ); ToolButton *tb; + ED_SHORTCUT("scene_tree/add_child_node",TTR("Add Child Node"), KEY_MASK_CMD|KEY_A); + ED_SHORTCUT("scene_tree/instance_scene",TTR("Instance Child Scene")); + ED_SHORTCUT("scene_tree/change_node_type", TTR("Change Type")); + ED_SHORTCUT("scene_tree/add_script", TTR("Add Script")); + ED_SHORTCUT("scene_tree/move_up", TTR("Move Up"), KEY_MASK_CMD | KEY_UP); + ED_SHORTCUT("scene_tree/move_down", TTR("Move Down"), KEY_MASK_CMD | KEY_DOWN); + ED_SHORTCUT("scene_tree/duplicate", TTR("Duplicate"),KEY_MASK_CMD | KEY_D); + ED_SHORTCUT("scene_tree/reparent", TTR("Reparent")); + ED_SHORTCUT("scene_tree/merge_from_scene", TTR("Merge From Scene")); + ED_SHORTCUT("scene_tree/save_branch_as_scene", TTR("Save Branch as Scene")); + tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false)); - tb->set_tooltip(TTR("Add/Create a New Node")+"\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")"); + tb->set_tooltip(TTR("Add/Create a New Node")); + tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node")); filter_hbc->add_child(tb); button_add=tb; tb = memnew( ToolButton ); tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false)); tb->set_tooltip(TTR("Instance a scene file as a Node. Creates an inherited scene if no root node exists.")); + tb->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene")); filter_hbc->add_child(tb); button_instance=tb; diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index 2de6fc5cf2..a155f0c0cf 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -653,6 +653,8 @@ void SceneTreeEditor::_notification(int p_what) { inheritance_menu->set_item_icon(2,get_icon("Load","EditorIcons")); clear_inherit_confirm->connect("confirmed",this,"_subscene_option",varray(SCENE_MENU_CLEAR_INHERITANCE_CONFIRM)); + EditorSettings::get_singleton()->connect("settings_changed",this,"_editor_settings_changed"); + // get_scene()->connect("tree_changed",this,"_tree_changed",Vector<Variant>(),CONNECT_DEFERRED); // get_scene()->connect("node_removed",this,"_node_removed",Vector<Variant>(),CONNECT_DEFERRED); @@ -665,6 +667,7 @@ void SceneTreeEditor::_notification(int p_what) { tree->disconnect("item_collapsed",this,"_cell_collapsed"); clear_inherit_confirm->disconnect("confirmed",this,"_subscene_option"); get_tree()->disconnect("node_configuration_warning_changed",this,"_warning_changed"); + EditorSettings::get_singleton()->disconnect("settings_changed",this,"_editor_settings_changed"); } } @@ -1048,6 +1051,21 @@ void SceneTreeEditor::_warning_changed(Node* p_for_node) { } + +void SceneTreeEditor::_editor_settings_changed() { + bool enable_rl = EditorSettings::get_singleton()->get("scenetree_editor/draw_relationship_lines"); + Color rl_color = EditorSettings::get_singleton()->get("scenetree_editor/relationship_line_color"); + + if (enable_rl) { + tree->add_constant_override("draw_relationship_lines",1); + tree->add_color_override("relationship_line_color", rl_color); + } + else + tree->add_constant_override("draw_relationship_lines",0); + +} + + void SceneTreeEditor::_bind_methods() { ObjectTypeDB::bind_method("_tree_changed",&SceneTreeEditor::_tree_changed); @@ -1068,6 +1086,8 @@ void SceneTreeEditor::_bind_methods() { ObjectTypeDB::bind_method("_node_script_changed",&SceneTreeEditor::_node_script_changed); ObjectTypeDB::bind_method("_node_visibility_changed",&SceneTreeEditor::_node_visibility_changed); + ObjectTypeDB::bind_method("_editor_settings_changed", &SceneTreeEditor::_editor_settings_changed); + ObjectTypeDB::bind_method(_MD("get_drag_data_fw"), &SceneTreeEditor::get_drag_data_fw); ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw); ObjectTypeDB::bind_method(_MD("drop_data_fw"), &SceneTreeEditor::drop_data_fw); @@ -1252,4 +1272,3 @@ SceneTreeDialog::SceneTreeDialog() { SceneTreeDialog::~SceneTreeDialog() { } - diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h index e184891200..79b7a64468 100644 --- a/tools/editor/scene_tree_editor.h +++ b/tools/editor/scene_tree_editor.h @@ -34,6 +34,7 @@ #include "scene/gui/dialogs.h" #include "undo_redo.h" #include "editor_data.h" +#include "editor_settings.h" /** @author Juan Linietsky <reduzio@gmail.com> */ @@ -132,6 +133,8 @@ class SceneTreeEditor : public Control { void _warning_changed(Node* p_for_node); + void _editor_settings_changed(); + Timer* update_timer; public: diff --git a/tools/editor/scenes.h b/tools/editor/scenes.h deleted file mode 100644 index bae9ef65f0..0000000000 --- a/tools/editor/scenes.h +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************/ -/* scenes.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. */ -/*************************************************************************/ -#ifndef SCENES_H -#define SCENES_H - -class Scenes{ -public: - Scenes(); -}; - -#endif // SCENES_H diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index e88d603b30..e93a40efbc 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -185,6 +185,7 @@ void ScriptCreateDialog::_built_in_pressed() { void ScriptCreateDialog::_browse_path() { file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_browse->set_disable_overwrite_warning(true); file_browse->clear_filters(); List<String> extensions; |