diff options
Diffstat (limited to 'tools')
95 files changed, 2116 insertions, 1710 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/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/default_saver.h b/tools/editor/default_saver.h deleted file mode 100644 index 2b1a1edb23..0000000000 --- a/tools/editor/default_saver.h +++ /dev/null @@ -1,35 +0,0 @@ -/*************************************************************************/ -/* default_saver.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 DEFAULT_SAVER_H -#define DEFAULT_SAVER_H - - - - -#endif // DEFAULT_SAVER_H 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..5afc4a7192 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" @@ -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>(); diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index a8f62a5226..5de33e2597 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 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 2e8bf0f311..153260ff71 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -171,6 +171,19 @@ void EditorNode::_unhandled_input(const InputEvent& p_event) { if (p_event.type==InputEvent::KEY && p_event.key.pressed && !p_event.key.echo && !gui_base->get_viewport()->gui_has_modal_stack()) { + + if (ED_IS_SHORTCUT("editor/fullscreen_mode", p_event)) { + if (distraction_free_mode) { + distraction_free_mode = false; + _update_top_menu_visibility(); + } else { + set_docks_visible(!get_docks_visible()); + } + } + if (ED_IS_SHORTCUT("editor/distraction_free_mode", p_event)) { + set_distraction_free_mode(!get_distraction_free_mode()); + } + switch(p_event.key.scancode) { /*case KEY_F1: @@ -193,18 +206,6 @@ 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_F11: { - if (p_event.key.mod.shift) { - if (p_event.key.mod.control) { - set_distraction_free_mode(!get_distraction_free_mode()); - } else if (distraction_free_mode) { - distraction_free_mode = false; - _update_top_menu_visibility(); - } else { - set_docks_visible(!get_docks_visible()); - } - } - } break; } } @@ -742,100 +743,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) { @@ -2214,7 +2121,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); @@ -5317,15 +5224,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 ); + theme_base->set_theme( theme ); editor_register_icons(theme); editor_register_fonts(theme); @@ -5340,6 +5250,8 @@ EditorNode::EditorNode() { } } + + Ref<StyleBoxTexture> focus_sbt=memnew( StyleBoxTexture ); focus_sbt->set_texture(theme->get_icon("EditorFocus","EditorIcons")); for(int i=0;i<4;i++) { @@ -5350,6 +5262,16 @@ EditorNode::EditorNode() { theme->set_stylebox("EditorFocus","EditorStyles",focus_sbt); + String custom_theme = EditorSettings::get_singleton()->get("global/custom_theme"); + if (custom_theme!="") { + Ref<Theme> theme = ResourceLoader::load(custom_theme); + if (theme.is_valid()) { + gui_base->set_theme(theme); + } + } + + + resource_preview = memnew( EditorResourcePreview ); add_child(resource_preview); progress_dialog = memnew( ProgressDialog ); @@ -5604,6 +5526,8 @@ EditorNode::EditorNode() { prev_scene->set_pos(Point2(3,24)); prev_scene->hide(); + ED_SHORTCUT("editor/fullscreen_mode",TTR("Fullscreen Mode"),KEY_MASK_SHIFT|KEY_F11); + ED_SHORTCUT("editor/distraction_free_mode",TTR("Distraction Free Mode"),KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_F11); Separator *vs=NULL; @@ -5632,8 +5556,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(); @@ -6537,12 +6461,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..4100644311 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -381,7 +381,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(); @@ -518,6 +518,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { 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); 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 +567,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); 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/icon_loop_interpolation.png b/tools/editor/icons/icon_loop_interpolation.png Binary files differnew file mode 100644 index 0000000000..2f92ab7bf3 --- /dev/null +++ b/tools/editor/icons/icon_loop_interpolation.png diff --git a/tools/editor/icons/source/icon_zoom_less.svg b/tools/editor/icons/source/icon_zoom_less.svg new file mode 100644 index 0000000000..970b1954bb --- /dev/null +++ b/tools/editor/icons/source/icon_zoom_less.svg @@ -0,0 +1,79 @@ +<?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_add_track.png" + inkscape:export-xdpi="45" + inkscape:export-ydpi="45" + sodipodi:docname="icon_zoom_less.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.000001" + inkscape:cx="3.0997291" + inkscape:cy="9.8345523" + 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: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)"> + <rect + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4137" + width="14" + height="1.9999478" + x="1" + y="1043.3622" /> + </g> +</svg> diff --git a/tools/editor/icons/source/icon_zoom_reset.svg b/tools/editor/icons/source/icon_zoom_reset.svg new file mode 100644 index 0000000000..a82f93dfea --- /dev/null +++ b/tools/editor/icons/source/icon_zoom_reset.svg @@ -0,0 +1,112 @@ +<?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_add_track.png" + inkscape:export-xdpi="45" + inkscape:export-ydpi="45" + sodipodi:docname="icon_zoom_reset.svg"> + <defs + id="defs4" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="16.000001" + inkscape:cx="-8.8962151" + inkscape:cy="11.998138" + 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: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)"> + <rect + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4137" + width="2" + height="14.000017" + x="3" + y="1037.3622" /> + <rect + y="1037.3622" + x="12" + height="14.000017" + width="2" + id="rect4156" + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <rect + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + id="rect4160" + width="2" + height="1.9999995" + x="7" + y="1046.3622" /> + <rect + y="1040.3622" + x="7" + height="1.9999995" + width="2" + id="rect4162" + style="fill:#e0e0e0;fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + <path + style="fill:#e0e0e0;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + d="m 1,1040.3622 2,-3 2,0 0,3 z" + id="path4164" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccccc" /> + <path + sodipodi:nodetypes="ccccc" + inkscape:connector-curvature="0" + id="path4166" + d="m 10,1040.3622 2,-3 2,0 0,3 z" + style="fill:#e0e0e0;fill-opacity:1;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/svgs_2_pngs.py b/tools/editor/icons/svgs_2_pngs.py deleted file mode 100644 index d47d8ed798..0000000000 --- a/tools/editor/icons/svgs_2_pngs.py +++ /dev/null @@ -1,99 +0,0 @@ -# -*- coding: utf-8 -*- - -# Basic exporter for svg icons (requires Inkscape) - -import os.path -from os import listdir -from os.path import isfile, join -import subprocess -import sys - -import rsvg -import cairo - -SVGS_PATH = 'source/' -OUT_DIR = './' -DPI = 90 - -if len(sys.argv) >= 2: - try: - scale = int(sys.argv[1]) - if scale > 1: - OUT_DIR = '%sx/' % scale - DPI *= scale - except: - pass - -rsvg.set_default_dpi(DPI) - -last_svg_path = None -last_svg_data = None - -def svg_to_png(svg_path, png_path, dpi): - global last_svg_path, last_svg_data - - zoom = int(dpi / 90) - if last_svg_path != svg_path: - last_svg_data = open(svg_path, 'r').read() - last_svg_path = svg_path - svg = rsvg.Handle(data=last_svg_data) - img = cairo.ImageSurface( - cairo.FORMAT_ARGB32, - svg.props.width * zoom, - svg.props.height * zoom - ) - ctx = cairo.Context(img) - ctx.set_antialias(cairo.ANTIALIAS_DEFAULT) - ctx.scale(zoom, zoom) - svg.render_cairo(ctx) - img.write_to_png('%s.png' % png_path) - svg.close() - - -def export_all(svgs_path=SVGS_PATH, out_dir=OUT_DIR, dpi=DPI): - if not os.path.isdir(out_dir): - os.makedirs(out_dir) - - file_names = [f for f in listdir(svgs_path) if isfile(join(svgs_path, f))] - - for file_name in file_names: - # name without extensions - name_only = file_name.replace('.svg', '') - - icon_from_name = name_only - out_icon_names = [name_only] # export to a png with the same file name - rotations = [] - transforms = [] - - # special cases - if special_icons.has_key(name_only): - special_icon = special_icons[name_only] - if type(special_icon) is dict: - if special_icon.has_key('output_names'): - out_icon_names += special_icon['output_names'] - - svg_file_path = '%s%s.svg' % (svgs_path, icon_from_name) - - for index, out_icon_name in enumerate(out_icon_names): - svg_to_png(svg_file_path, out_dir + out_icon_name, dpi) - - -# special cases for icons that will be exported to multiple target pngs or that require transforms. -special_icons = { - 'icon_add_track': dict( output_names=['icon_add'] ), - 'icon_new': dict( output_names=['icon_file'] ), - 'icon_animation_tree_player': dict( output_names=['icon_animation_tree'] ), - 'icon_tool_rotate': dict( output_names=['icon_reload'] ), - 'icon_multi_edit': dict( output_names=['icon_multi_node_edit'] ), - 'icon_folder': dict( output_names=['icon_load', 'icon_open'] ), - 'icon_file_list': dict( output_names=['icon_enum'] ), - 'icon_collision_2d': dict( output_names=['icon_collision_polygon_2d', 'icon_polygon_2d'] ), - 'icon_class_list': dict( output_names=['icon_filesystem'] ), - 'icon_color_ramp': dict( output_names=['icon_graph_color_ramp'] ), - 'icon_translation': dict( output_names=['icon_p_hash_translation'] ), - 'icon_shader': dict( output_names=['icon_shader_material', 'icon_material_shader'] ), - 'icon_canvas_item_shader_graph': dict( output_names=['icon_material_shader_graph'] ), - -} - -export_all() 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..a6de849e44 100644 --- a/tools/editor/io_plugins/editor_font_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp @@ -489,18 +489,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 +528,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("Invalid file extension. \nPlease use .fnt"); + error_dialog->popup_centered(Size2(200,100)); + return; + } + Ref<ResourceImportMetadata> rimd = get_rimd(); if (rimd.is_null()) { 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..ed766c6598 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" @@ -1073,7 +1074,7 @@ const EditorSceneImportDialog::FlagInfo EditorSceneImportDialog::scene_flag_name {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_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 +1746,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>()) { 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/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 31b6333975..1fa7a50515 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -1144,6 +1144,7 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc if (!p_external) { from->set_editor(get_name()); + from->set_source_md5(0,FileAccess::get_md5(src_path)); existing->set_path(p_path); existing->set_import_metadata(from); } diff --git a/tools/editor/multi_node_edit.cpp b/tools/editor/multi_node_edit.cpp index b5bae82ae0..fcf6e295de 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" diff --git a/tools/editor/multi_node_edit.h b/tools/editor/multi_node_edit.h index 5a0cabf4be..6c59765227 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 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..f5470451ba 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" 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/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/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/theme_editor_plugin.cpp b/tools/editor/plugins/theme_editor_plugin.cpp index 2673948365..77097b11f6 100644 --- a/tools/editor/plugins/theme_editor_plugin.cpp +++ b/tools/editor/plugins/theme_editor_plugin.cpp @@ -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; } @@ -602,7 +664,9 @@ 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); + 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); + hb_menu->add_child(theme_menu); theme_menu->get_popup()->connect("item_pressed", this,"_theme_menu_cbk"); diff --git a/tools/editor/plugins/theme_editor_plugin.h b/tools/editor/plugins/theme_editor_plugin.h index 49d5ae3096..1384fa6b69 100644 --- a/tools/editor/plugins/theme_editor_plugin.h +++ b/tools/editor/plugins/theme_editor_plugin.h @@ -68,7 +68,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_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/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp index 5124505b90..16ae14c0b5 100644 --- a/tools/editor/scene_tree_dock.cpp +++ b/tools/editor/scene_tree_dock.cpp @@ -1512,12 +1512,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 +1594,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); 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.cpp b/tools/editor/scenes.cpp deleted file mode 100644 index e6569c98a9..0000000000 --- a/tools/editor/scenes.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/*************************************************************************/ -/* scenes.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 "scenes.h" - -Scenes::Scenes() -{ -} 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/pck/pck_packer.cpp b/tools/pck/pck_packer.cpp index 228d37df7c..04b88ea028 100644 --- a/tools/pck/pck_packer.cpp +++ b/tools/pck/pck_packer.cpp @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* pkc_packer.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "pck_packer.h" #include "core/os/file_access.h" diff --git a/tools/pck/pck_packer.h b/tools/pck/pck_packer.h index 2bb51128e9..b1182335e2 100644 --- a/tools/pck/pck_packer.h +++ b/tools/pck/pck_packer.h @@ -1,3 +1,31 @@ +/*************************************************************************/ +/* pck_packer.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "core/reference.h" class FileAccess; diff --git a/tools/scripts/svgs_2_pngs.py b/tools/scripts/svgs_2_pngs.py new file mode 100644 index 0000000000..acb50892c3 --- /dev/null +++ b/tools/scripts/svgs_2_pngs.py @@ -0,0 +1,137 @@ +# -*- coding: utf-8 -*- + +# Basic exporter for svg icons + +from os import listdir +from os.path import isfile, join, dirname, realpath +import subprocess +import sys + +import rsvg +import cairo + +last_svg_path = None +last_svg_data = None + +SCRIPT_FOLDER = dirname(realpath(__file__)) + '/' +theme_dir_base = SCRIPT_FOLDER + '../../scene/resources/default_theme/' +theme_dir_source = theme_dir_base + 'source/' +icons_dir_base = SCRIPT_FOLDER + '../editor/icons/' +icons_dir_2x = icons_dir_base + '2x/' +icons_dir_source = icons_dir_base + 'source/' + + +def svg_to_png(svg_path, png_path, dpi): + global last_svg_path, last_svg_data + + zoom = int(dpi / 90) + if last_svg_path != svg_path: + last_svg_data = open(svg_path, 'r').read() + last_svg_path = svg_path + svg = rsvg.Handle(data=last_svg_data) + img = cairo.ImageSurface( + cairo.FORMAT_ARGB32, + svg.props.width * zoom, + svg.props.height * zoom + ) + ctx = cairo.Context(img) + ctx.set_antialias(cairo.ANTIALIAS_DEFAULT) + ctx.scale(zoom, zoom) + svg.render_cairo(ctx) + img.write_to_png('%s.png' % png_path) + svg.close() + + +def export_icons(): + svgs_path = icons_dir_source + + file_names = [f for f in listdir(svgs_path) if isfile(join(svgs_path, f))] + + for file_name in file_names: + # name without extensions + name_only = file_name.replace('.svg', '') + + out_icon_names = [name_only] # export to a png with the same file name + theme_out_icon_names = [] + # special cases + if special_icons.has_key(name_only): + special_icon = special_icons[name_only] + if type(special_icon) is dict: + if special_icon.get('avoid_self'): + out_icon_names = [] + if special_icon.has_key('output_names'): + out_icon_names += special_icon['output_names'] + if special_icon.has_key('theme_output_names'): + theme_out_icon_names += special_icon['theme_output_names'] + + source_path = '%s%s.svg' % (svgs_path, name_only) + + for out_icon_name in out_icon_names: + svg_to_png(source_path, icons_dir_base + out_icon_name, 90) + svg_to_png(source_path, icons_dir_2x + out_icon_name, 180) + for theme_out_icon_name in theme_out_icon_names: + svg_to_png(source_path, theme_dir_base + theme_out_icon_name, 90) + + + +def export_theme(): + svgs_path = theme_dir_source + file_names = [f for f in listdir(svgs_path) if isfile(join(svgs_path, f))] + + for file_name in file_names: + # name without extensions + name_only = file_name.replace('.svg', '') + + out_icon_names = [name_only] # export to a png with the same file name + # special cases + if theme_icons.has_key(name_only): + special_icon = theme_icons[name_only] + if type(special_icon) is dict: + if special_icon.has_key('output_names'): + out_icon_names += special_icon['output_names'] + + source_path = '%s%s.svg' % (svgs_path, name_only) + + for out_icon_name in out_icon_names: + svg_to_png(source_path, theme_dir_base + out_icon_name, 90) + + +# special cases for icons that will be exported to multiple target pngs or that require transforms. +special_icons = { + 'icon_add_track': dict( + output_names=['icon_add'], + theme_output_names=['icon_add', 'icon_zoom_more'] + ), + 'icon_new': dict( output_names=['icon_file'] ), + 'icon_animation_tree_player': dict( output_names=['icon_animation_tree'] ), + 'icon_tool_rotate': dict( + output_names=['icon_reload'], + theme_output_names= ['icon_reload'] + ), + 'icon_multi_edit': dict( output_names=['icon_multi_node_edit'] ), + 'icon_folder': dict( + output_names=['icon_load', 'icon_open'], + theme_output_names= ['icon_folder'] + ), + 'icon_file_list': dict( output_names=['icon_enum'] ), + 'icon_collision_2d': dict( output_names=['icon_collision_polygon_2d', 'icon_polygon_2d'] ), + 'icon_class_list': dict( output_names=['icon_filesystem'] ), + 'icon_color_ramp': dict( output_names=['icon_graph_color_ramp'] ), + 'icon_translation': dict( output_names=['icon_p_hash_translation'] ), + 'icon_shader': dict( output_names=['icon_shader_material', 'icon_material_shader'] ), + 'icon_canvas_item_shader_graph': dict( output_names=['icon_material_shader_graph'] ), + + 'icon_color_pick': dict( theme_output_names= ['icon_color_pick'], avoid_self=True ), + 'icon_play': dict( theme_output_names= ['icon_play'] ), + 'icon_stop': dict( theme_output_names= ['icon_stop'] ), + 'icon_zoom_less': dict( theme_output_names= ['icon_zoom_less'], avoid_self=True ), + 'icon_zoom_reset': dict( theme_output_names= ['icon_zoom_reset'], avoid_self=True ) +} + +theme_icons = { + 'icon_close': dict(output_names=['close', 'close_hl']), + 'tab_menu': dict(output_names=['tab_menu_hl']) +} + +export_icons() +export_theme() |