summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/collada/collada.cpp7
-rw-r--r--tools/doc/doc_data.cpp30
-rw-r--r--tools/editor/animation_editor.cpp5
-rw-r--r--tools/editor/asset_library_editor_plugin.cpp2
-rw-r--r--tools/editor/dependency_editor.cpp3
-rw-r--r--tools/editor/editor_dir_dialog.cpp18
-rw-r--r--tools/editor/editor_file_system.cpp7
-rw-r--r--tools/editor/editor_file_system.h1
-rw-r--r--tools/editor/editor_node.cpp29
-rw-r--r--tools/editor/editor_node.h5
-rw-r--r--tools/editor/editor_path.cpp1
-rw-r--r--tools/editor/editor_plugin.cpp1
-rw-r--r--tools/editor/editor_resource_preview.cpp36
-rw-r--r--tools/editor/editor_resource_preview.h4
-rw-r--r--tools/editor/editor_settings.cpp23
-rw-r--r--tools/editor/editor_settings.h3
-rw-r--r--tools/editor/groups_editor.cpp30
-rw-r--r--tools/editor/import_settings.cpp301
-rw-r--r--tools/editor/import_settings.h82
-rw-r--r--tools/editor/io_plugins/editor_atlas.cpp6
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp6
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp89
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp4
-rw-r--r--tools/editor/io_plugins/editor_translation_import_plugin.cpp2
-rw-r--r--tools/editor/output_strings.cpp1
-rw-r--r--tools/editor/plugins/animation_player_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/animation_tree_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/baked_light_baker.cpp11
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp58
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/collision_polygon_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/editor_preview_plugins.cpp12
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/particles_editor_plugin.cpp1
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.cpp2
-rw-r--r--tools/editor/plugins/sample_editor_plugin.cpp15
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp101
-rw-r--r--tools/editor/plugins/script_editor_plugin.h6
-rw-r--r--tools/editor/plugins/shader_editor_plugin.cpp9
-rw-r--r--tools/editor/plugins/shader_graph_editor_plugin.cpp7
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp338
-rw-r--r--tools/editor/plugins/sprite_frames_editor_plugin.cpp63
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.cpp2
-rw-r--r--tools/editor/project_export.cpp1
-rw-r--r--tools/editor/project_manager.cpp13
-rw-r--r--tools/editor/property_editor.cpp11
-rw-r--r--tools/editor/quick_open.cpp84
-rw-r--r--tools/editor/quick_open.h4
-rw-r--r--tools/editor/scene_tree_dock.cpp49
-rw-r--r--tools/editor/scene_tree_dock.h2
-rw-r--r--tools/editor/scenes_dock.cpp86
-rw-r--r--tools/editor/scenes_dock.h2
-rw-r--r--tools/editor/script_editor_debugger.cpp1
-rw-r--r--tools/editor/settings_config_dialog.cpp66
-rw-r--r--tools/editor/settings_config_dialog.h6
-rw-r--r--tools/editor/spatial_editor_gizmos.cpp78
57 files changed, 724 insertions, 1012 deletions
diff --git a/tools/collada/collada.cpp b/tools/collada/collada.cpp
index 11a0e1726b..268d42a613 100644
--- a/tools/collada/collada.cpp
+++ b/tools/collada/collada.cpp
@@ -681,9 +681,6 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
} else {
String uri = effect.params[surface];
- int channel=0;
- //if (parser.has_attribute("texcoord"))
-
if (what=="diffuse") {
effect.diffuse.texture=uri;
@@ -759,9 +756,6 @@ void Collada::_parse_effect_material(XMLParser& parser,Effect &effect,String &id
} else {
String uri = effect.params[surface];
- int channel=0;
- //if (parser.has_attribute("texcoord"))
-
if (parser.has_attribute("bumptype") && parser.get_attribute_value("bumptype")!="NORMALMAP") {
WARN_PRINT("'bump' texture type is not NORMALMAP, only NORMALMAP is supported.")
}
@@ -2636,7 +2630,6 @@ void Collada::_find_morph_nodes(VisualScene *p_vscene,Node *p_node) {
base=sk.base;
} else if (state.morph_controller_data_map.has(base)) {
- MorphControllerData &sk = state.morph_controller_data_map[base];
state.morph_ownership_map[base]=nj->id;
break;
} else {
diff --git a/tools/doc/doc_data.cpp b/tools/doc/doc_data.cpp
index e3689cf13d..398267937b 100644
--- a/tools/doc/doc_data.cpp
+++ b/tools/doc/doc_data.cpp
@@ -36,21 +36,6 @@
#include "io/compression.h"
#include "scene/resources/theme.h"
-struct _ConstantComparator {
-
- inline bool operator()(const DocData::ConstantDoc &a, const DocData::ConstantDoc &b) const {
- String left_a = a.name.find("_") == -1 ? a.name : a.name.substr(0, a.name.find("_"));
- String left_b = b.name.find("_") == -1 ? b.name : b.name.substr(0, b.name.find("_"));
- if (left_a == left_b) // If they have the same prefix
- if (a.value == b.value)
- return a.name < b.name; // Sort by name if the values are the same
- else
- return a.value < b.value; // Sort by value otherwise
- else
- return left_a < left_b; // Sort by name if the prefixes aren't the same
- }
-};
-
void DocData::merge_from(const DocData& p_data) {
for( Map<String,ClassDoc>::Element *E=class_list.front();E;E=E->next()) {
@@ -455,6 +440,12 @@ void DocData::generate(bool p_basic_types) {
}
+ {
+ //so it can be documented that it does not exist
+ class_list["Variant"]=ClassDoc();
+ class_list["Variant"].name="Variant";
+ }
+
if (!p_basic_types)
return;
@@ -949,11 +940,11 @@ Error DocData::save(const String& p_path) {
_write_string(f,0,header);
_write_string(f,1,"<brief_description>");
if (c.brief_description!="")
- _write_string(f,1,c.brief_description.xml_escape());
+ _write_string(f,2,c.brief_description.xml_escape());
_write_string(f,1,"</brief_description>");
_write_string(f,1,"<description>");
if (c.description!="")
- _write_string(f,1,c.description.xml_escape());
+ _write_string(f,2,c.description.xml_escape());
_write_string(f,1,"</description>");
_write_string(f,1,"<methods>");
@@ -989,7 +980,7 @@ Error DocData::save(const String& p_path) {
_write_string(f,3,"<description>");
if (m.description!="")
- _write_string(f,3,m.description.xml_escape());
+ _write_string(f,4,m.description.xml_escape());
_write_string(f,3,"</description>");
_write_string(f,2,"</method>");
@@ -1035,7 +1026,7 @@ Error DocData::save(const String& p_path) {
_write_string(f,3,"<description>");
if (m.description!="")
- _write_string(f,3,m.description.xml_escape());
+ _write_string(f,4,m.description.xml_escape());
_write_string(f,3,"</description>");
_write_string(f,2,"</signal>");
@@ -1046,7 +1037,6 @@ Error DocData::save(const String& p_path) {
_write_string(f,1,"<constants>");
- c.constants.sort_custom<_ConstantComparator>();
for(int i=0;i<c.constants.size();i++) {
diff --git a/tools/editor/animation_editor.cpp b/tools/editor/animation_editor.cpp
index 7582162b72..c7b78b980f 100644
--- a/tools/editor/animation_editor.cpp
+++ b/tools/editor/animation_editor.cpp
@@ -85,7 +85,6 @@ private:
int points = 48;
if (mode==MODE_MULTIPLE) {
- int max_draw = 16;
Color mcolor=color;
mcolor.a*=0.3;
@@ -1356,7 +1355,6 @@ void AnimationKeyEditor::_track_editor_draw() {
}
}
- Color sep_color=color;
color.a*=0.5;
for(int i=0;i<fit;i++) {
@@ -1806,8 +1804,6 @@ void AnimationKeyEditor::_track_editor_input_event(const InputEvent& p_input) {
Ref<Font> font = te->get_font("font","Tree");
int sep = get_constant("vseparation","Tree");
int hsep = get_constant("hseparation","Tree");
- Color color = get_color("font_color","Tree");
- Color sepcolor = get_color("guide_color","Tree");
Ref<Texture> remove_icon = get_icon("Remove","EditorIcons");
Ref<Texture> move_up_icon = get_icon("MoveUp","EditorIcons");
Ref<Texture> move_down_icon = get_icon("MoveDown","EditorIcons");
@@ -3007,7 +3003,6 @@ void AnimationKeyEditor::_update_menu() {
updating=true;
- bool empty= !animation.is_valid();
if (animation.is_valid()) {
length->set_val(animation->get_length());
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp
index a2448921d7..ee535310bc 100644
--- a/tools/editor/asset_library_editor_plugin.cpp
+++ b/tools/editor/asset_library_editor_plugin.cpp
@@ -1366,7 +1366,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
repository = memnew( OptionButton );
repository->add_item("Godot");
- repository->set_item_metadata(0, "http://godotengine.org/asset-library/api");
+ repository->set_item_metadata(0, "https://godotengine.org/asset-library/api");
repository->add_item("Localhost"); // TODO: Maybe remove?
repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api");
repository->connect("item_selected",this,"_repository_changed");
diff --git a/tools/editor/dependency_editor.cpp b/tools/editor/dependency_editor.cpp
index ad2eb57f00..ef667b75e1 100644
--- a/tools/editor/dependency_editor.cpp
+++ b/tools/editor/dependency_editor.cpp
@@ -80,8 +80,6 @@ void DependencyEditor::_fix_and_find(EditorFileSystemDirectory *efsd, Map<String
continue;
String path = efsd->get_file_path(i);
- Map<String,String> &ss = candidates[file];
-
for(Map<String,String>::Element *E=candidates[file].front();E;E=E->next()) {
@@ -420,7 +418,6 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
exist=false;
owners->clear();
files.clear();
- TreeItem *root=owners->create_item();
for(int i=0;i<to_erase.size();i++) {
files[to_erase[i]]=NULL;
}
diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp
index a6e231cf18..f6ce7bf3f8 100644
--- a/tools/editor/editor_dir_dialog.cpp
+++ b/tools/editor/editor_dir_dialog.cpp
@@ -99,8 +99,14 @@ 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 (!tree->is_connected("item_collapsed",this,"_item_collapsed")) {
+ tree->connect("item_collapsed",this,"_item_collapsed",varray(),CONNECT_DEFERRED);
+ }
+
+ if (!EditorFileSystem::get_singleton()->is_connected("filesystem_changed",this,"reload")) {
+ EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"reload");
+ }
}
@@ -185,10 +191,14 @@ void EditorDirDialog::ok_pressed() {
void EditorDirDialog::_make_dir() {
TreeItem *ti=tree->get_selected();
- if (!ti)
+ if (!ti) {
+ mkdirerr->set_text("Please select a base directory first");
+ mkdirerr->popup_centered_minsize();
return;
+ }
makedialog->popup_centered_minsize(Size2(250,80));
+ makedirname->grab_focus();
}
void EditorDirDialog::_make_dir_confirm() {
@@ -198,9 +208,11 @@ void EditorDirDialog::_make_dir_confirm() {
return;
String dir = ti->get_metadata(0);
+
DirAccess *d = DirAccess::open(dir);
ERR_FAIL_COND(!d);
Error err = d->make_dir(makedirname->get_text());
+
if (err!=OK) {
mkdirerr->popup_centered_minsize(Size2(250,80));
} else {
diff --git a/tools/editor/editor_file_system.cpp b/tools/editor/editor_file_system.cpp
index 1f414f80a0..cb7cefea26 100644
--- a/tools/editor/editor_file_system.cpp
+++ b/tools/editor/editor_file_system.cpp
@@ -34,6 +34,7 @@
#include "editor_node.h"
#include "io/resource_saver.h"
#include "editor_settings.h"
+#include "editor_resource_preview.h"
EditorFileSystem *EditorFileSystem::singleton=NULL;
@@ -848,6 +849,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
continue;
}
+
if (_check_meta_sources(p_dir->files[i]->meta)) {
ItemAction ia;
ia.action=ItemAction::ACTION_FILE_SOURCES_CHANGED;
@@ -858,6 +860,8 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir,const S
} else {
p_dir->files[i]->meta.sources_changed=false;
}
+
+ EditorResourcePreview::get_singleton()->check_for_invalidation(p_dir->get_file_path(i));
}
for(int i=0;i<p_dir->subdirs.size();i++) {
@@ -1328,6 +1332,7 @@ void EditorFileSystem::update_file(const String& p_file) {
fs->files[cpos]->modified_time=FileAccess::get_modified_time(p_file);
fs->files[cpos]->meta=_get_meta(p_file);
+ EditorResourcePreview::get_singleton()->call_deferred("check_for_invalidation",p_file);
call_deferred("emit_signal","filesystem_changed"); //update later
}
@@ -1341,6 +1346,8 @@ void EditorFileSystem::_bind_methods() {
}
+
+
EditorFileSystem::EditorFileSystem() {
diff --git a/tools/editor/editor_file_system.h b/tools/editor/editor_file_system.h
index b96e947569..fb768fb358 100644
--- a/tools/editor/editor_file_system.h
+++ b/tools/editor/editor_file_system.h
@@ -236,6 +236,7 @@ public:
EditorFileSystemDirectory *get_path(const String& p_path);
String get_file_type(const String& p_file) const;
EditorFileSystemDirectory* find_file(const String& p_file,int* r_index) const;
+
EditorFileSystem();
~EditorFileSystem();
};
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 9e897a41d9..001a94f251 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -508,8 +508,6 @@ void EditorNode::_rebuild_import_menu()
for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) {
p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i);
}
- //p->add_separator();
- //p->add_item(TTR("Re-Import.."), SETTINGS_IMPORT);
}
void EditorNode::_node_renamed() {
@@ -597,7 +595,6 @@ void EditorNode::save_resource(const Ref<Resource>& p_resource) {
void EditorNode::save_resource_as(const Ref<Resource>& p_resource,const String& p_at_path) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool());
current_option=RESOURCE_SAVE_AS;
List<String> extensions;
@@ -1551,9 +1548,10 @@ void EditorNode::_property_editor_back() {
void EditorNode::_imported(Node *p_node) {
- Node *scene = editor_data.get_edited_scene_root();
-// add_edited_scene(p_node);
/*
+ Node *scene = editor_data.get_edited_scene_root();
+ add_edited_scene(p_node);
+
if (scene) {
String path = scene->get_filename();
p_node->set_filename(path);
@@ -2129,7 +2127,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
}
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool());
List<String> extensions;
@@ -2210,8 +2207,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
}
- bool relpaths = (scene->has_meta("__editor_relpaths__") && scene->get_meta("__editor_relpaths__").operator bool());
-
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file->set_current_path(cpath);
@@ -2220,8 +2215,8 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case FILE_SAVE_OPTIMIZED: {
- Node *scene = editor_data.get_edited_scene_root();
#if 0
+ Node *scene = editor_data.get_edited_scene_root();
if (!scene) {
current_option=-1;
@@ -2782,10 +2777,6 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
settings_config_dialog->popup_edit_settings();
} break;
- case SETTINGS_IMPORT: {
-
- import_settings->popup_import_settings();
- } break;
case SETTINGS_OPTIMIZED_PRESETS: {
//optimized_presets->popup_centered_ratio();
@@ -2846,6 +2837,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
if (mt!=E->get()->get_last_modified_time()) {
E->get()->reload_from_file();
}
+
}
@@ -3132,6 +3124,11 @@ void EditorNode::_remove_edited_scene() {
new_index=1;
}
+
+
+ if (editor_data.get_scene_path(old_index)!=String()) {
+ ScriptEditor::get_singleton()->close_builtin_scripts_from_scene(editor_data.get_scene_path(old_index));
+ }
_scene_tab_changed(new_index);
editor_data.remove_scene(old_index);
editor_data.get_undo_redo().clear_history();
@@ -3431,7 +3428,7 @@ Dictionary EditorNode::_get_main_scene_state() {
void EditorNode::_set_main_scene_state(Dictionary p_state,Node* p_for_scene) {
- if (get_edited_scene()!=p_for_scene)
+ if (get_edited_scene()!=p_for_scene && p_for_scene!=NULL)
return; //not for this scene
//print_line("set current 7 ");
@@ -5638,8 +5635,6 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/prev_tab", TTR("Previous tab"), KEY_MASK_CMD+KEY_MASK_SHIFT+KEY_TAB);
- Separator *vs=NULL;
-
file_menu->set_tooltip(TTR("Operations with scene files."));
p=file_menu->get_popup();
p->add_shortcut(ED_SHORTCUT("editor/new_scene",TTR("New Scene")),FILE_NEW_SCENE);
@@ -6288,8 +6283,6 @@ EditorNode::EditorNode() {
open_recent_confirmation->connect("confirmed",this,"_open_recent_scene_confirm");
- import_settings= memnew(ImportSettingsDialog(this));
- gui_base->add_child(import_settings);
run_settings_dialog = memnew( RunSettingsDialog );
gui_base->add_child( run_settings_dialog );
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 9b0edda75e..c4414d5c36 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -74,7 +74,6 @@
#include "tools/editor/editor_sub_scene.h"
#include "editor_import_export.h"
#include "editor_reimport_dialog.h"
-#include "import_settings.h"
#include "tools/editor/editor_plugin.h"
#include "tools/editor/editor_name_dialog.h"
@@ -177,7 +176,6 @@ private:
RUN_RELOAD_SCRIPTS,
SETTINGS_UPDATE_ALWAYS,
SETTINGS_UPDATE_CHANGES,
- SETTINGS_IMPORT,
SETTINGS_EXPORT_PREFERENCES,
SETTINGS_PREFERENCES,
SETTINGS_OPTIMIZED_PRESETS,
@@ -338,7 +336,6 @@ private:
Vector<EditorPlugin*> editor_table;
EditorReImportDialog *reimport_dialog;
- ImportSettingsDialog *import_settings;
ProgressDialog *progress_dialog;
BackgroundProgress *progress_hb;
@@ -762,7 +759,7 @@ public:
plugins_list = p_plugins_list;
}
- Vector<EditorPlugin*> get_plugins_list() {
+ Vector<EditorPlugin*>& get_plugins_list() {
return plugins_list;
}
diff --git a/tools/editor/editor_path.cpp b/tools/editor/editor_path.cpp
index 4cf98e832c..6b804b6a24 100644
--- a/tools/editor/editor_path.cpp
+++ b/tools/editor/editor_path.cpp
@@ -38,7 +38,6 @@ void EditorPath::_notification(int p_what) {
RID ci=get_canvas_item();
Ref<Font> label_font = get_font("font","Label");
- Color label_color = get_color("font_color","Label");
Size2i size = get_size();
Ref<Texture> sn = get_icon("SmallNext","EditorIcons");
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 138e532ce8..01e6b613c0 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -27,6 +27,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "editor_plugin.h"
+#include "scene/3d/camera.h"
#include "plugins/canvas_item_editor_plugin.h"
#include "plugins/spatial_editor_plugin.h"
#include "tools/editor/editor_node.h"
diff --git a/tools/editor/editor_resource_preview.cpp b/tools/editor/editor_resource_preview.cpp
index 8975c0ec35..6e38d6460b 100644
--- a/tools/editor/editor_resource_preview.cpp
+++ b/tools/editor/editor_resource_preview.cpp
@@ -66,16 +66,20 @@ void EditorResourcePreview::_preview_ready(const String& p_str,const Ref<Texture
String path = p_str;
uint32_t hash=0;
+ uint64_t modified_time=0;
if (p_str.begins_with("ID:")) {
hash=p_str.get_slicec(':',2).to_int();
path="ID:"+p_str.get_slicec(':',1);
+ } else {
+ modified_time = FileAccess::get_modified_time(path);
}
Item item;
item.order=order++;
item.preview=p_texture;
item.last_hash=hash;
+ item.modified_time=modified_time;
cache[path]=item;
@@ -263,6 +267,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p
preview_mutex->lock();
String path_id = "ID:"+itos(p_res->get_instance_ID());
+
+
if (cache.has(path_id) && cache[path_id].last_hash==p_res->hash_edited_version()) {
cache[path_id].order=order++;
@@ -272,6 +278,8 @@ void EditorResourcePreview::queue_edited_resource_preview(const Ref<Resource>& p
}
+ cache.erase(path_id); //erase if exists, since it will be regen
+
//print_line("send to thread "+p_path);
QueueItem item;
item.function=p_receiver_func;
@@ -322,6 +330,34 @@ EditorResourcePreview* EditorResourcePreview::get_singleton() {
void EditorResourcePreview::_bind_methods() {
ObjectTypeDB::bind_method("_preview_ready",&EditorResourcePreview::_preview_ready);
+ ObjectTypeDB::bind_method(_MD("check_for_invalidation","path"),&EditorResourcePreview::check_for_invalidation);
+
+
+ ADD_SIGNAL(MethodInfo("preview_invalidated",PropertyInfo(Variant::STRING,"path")));
+}
+
+void EditorResourcePreview::check_for_invalidation(const String& p_path) {
+
+ preview_mutex->lock();
+
+ bool call_invalidated=false;
+ if (cache.has(p_path)) {
+
+ uint64_t modified_time = FileAccess::get_modified_time(p_path);
+ if (modified_time!=cache[p_path].modified_time) {
+ cache.erase(p_path);
+ call_invalidated=true;
+ }
+ }
+
+ preview_mutex->unlock();
+
+ if (call_invalidated) {//do outside mutex
+ call_deferred("emit_signal","preview_invalidated",p_path);
+ }
+
+
+
}
EditorResourcePreview::EditorResourcePreview() {
diff --git a/tools/editor/editor_resource_preview.h b/tools/editor/editor_resource_preview.h
index 63dc5c3dd3..51a00965eb 100644
--- a/tools/editor/editor_resource_preview.h
+++ b/tools/editor/editor_resource_preview.h
@@ -93,6 +93,7 @@ class EditorResourcePreview : public Node {
Ref<Texture> preview;
int order;
uint32_t last_hash;
+ uint64_t modified_time;
};
int order;
@@ -106,6 +107,8 @@ class EditorResourcePreview : public Node {
void _thread();
Vector<Ref<EditorResourcePreviewGenerator> > preview_generators;
+
+
protected:
static void _bind_methods();
@@ -118,6 +121,7 @@ public:
void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
+ void check_for_invalidation(const String& p_path);
EditorResourcePreview();
~EditorResourcePreview();
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index b89863289a..2ce9502293 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -104,12 +104,18 @@ bool EditorSettings::_get(const StringName& p_name,Variant &r_ret) const {
for (const Map<String,Ref<ShortCut> >::Element *E=shortcuts.front();E;E=E->next()) {
Ref<ShortCut> sc=E->get();
- if (!sc->has_meta("original"))
- continue; //this came from settings but is not any longer used
- InputEvent original = sc->get_meta("original");
- if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE))
- continue; //not changed from default, don't save
+ if (optimize_save) {
+ if (!sc->has_meta("original")) {
+ continue; //this came from settings but is not any longer used
+ }
+
+ InputEvent original = sc->get_meta("original");
+ if (sc->is_shortcut(original) || (original.type==InputEvent::NONE && sc->get_shortcut().type==InputEvent::NONE))
+ continue; //not changed from default, don't save
+ }
+
+ print_line("SAVING: "+E->key());
arr.push_back(E->key());
arr.push_back(sc->get_shortcut());
}
@@ -161,7 +167,7 @@ void EditorSettings::_get_property_list(List<PropertyInfo> *p_list) const {
for(Set<_EVCSort>::Element *E=vclist.front();E;E=E->next()) {
int pinfo = 0;
- if (E->get().save) {
+ if (E->get().save || !optimize_save) {
pinfo|=PROPERTY_USAGE_STORAGE;
}
@@ -976,6 +982,10 @@ void EditorSettings::get_shortcut_list(List<String> *r_shortcuts) {
}
}
+void EditorSettings::set_optimize_save(bool p_optimize) {
+
+ optimize_save=p_optimize;
+}
void EditorSettings::_bind_methods() {
@@ -998,6 +1008,7 @@ EditorSettings::EditorSettings() {
//singleton=this;
last_order=0;
+ optimize_save=true;
save_changed_setting=true;
EditorTranslationList *etl=_editor_translations;
diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h
index d975a7ef86..937956a366 100644
--- a/tools/editor/editor_settings.h
+++ b/tools/editor/editor_settings.h
@@ -88,6 +88,7 @@ private:
bool save_changed_setting;
+ bool optimize_save; //do not save stuff that came from config but was not set from engine
void _load_defaults(Ref<ConfigFile> p_extra_config = NULL);
void _load_default_text_editor_theme();
@@ -155,6 +156,8 @@ public:
Ref<ShortCut> get_shortcut(const String&p_name) const;
void get_shortcut_list(List<String> *r_shortcuts);
+ void set_optimize_save(bool p_optimize);
+
EditorSettings();
~EditorSettings();
diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp
index 898e1e115e..5b7bc1da78 100644
--- a/tools/editor/groups_editor.cpp
+++ b/tools/editor/groups_editor.cpp
@@ -31,7 +31,7 @@
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
#include "editor_node.h"
-
+#include "scene/resources/packed_scene.h"
void GroupsEditor::_add_group(const String& p_group) {
if (!node)
@@ -107,9 +107,35 @@ void GroupsEditor::update_tree() {
if (!gi.persistent)
continue;
+ Node *n = node;
+ bool can_be_deleted=true;
+
+ while(n) {
+
+ Ref<SceneState> ss = (n==EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
+
+ if (ss.is_valid()) {
+
+ int path = ss->find_node_by_path(n->get_path_to(node));
+ if (path!=-1) {
+ if (ss->is_node_in_group(path,gi.name)) {
+ can_be_deleted=false;
+ }
+ }
+ }
+
+ n=n->get_owner();
+ }
+
+
TreeItem *item=tree->create_item(root);
item->set_text(0, gi.name);
- item->add_button(0, get_icon("Remove", "EditorIcons"), 0);
+ if (can_be_deleted) {
+ item->add_button(0, get_icon("Remove", "EditorIcons"), 0);
+ } else {
+ item->set_selectable(0,false);
+ }
+
}
}
diff --git a/tools/editor/import_settings.cpp b/tools/editor/import_settings.cpp
deleted file mode 100644
index dfaeca03db..0000000000
--- a/tools/editor/import_settings.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-/*************************************************************************/
-/* import_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 "import_settings.h"
-#include "os/os.h"
-#include "editor_node.h"
-
-void ImportSettingsDialog::_item_pressed(int p_idx) {
-
- if (!edited)
- return;
-
- String p=edited->get_metadata(0);
-#if 0
- if (EditorImportDB::get_singleton()->is_image(p)) {
-
- uint32_t flags = EditorImportDB::get_singleton()->get_image_flags(p);
- bool pressed = !popup->is_item_checked(p_idx);
- if (pressed)
- flags|=(1<<p_idx);
- else
- flags&=~(1<<p_idx);
-
-
- EditorImportDB::get_singleton()->set_image_flags(p,flags);
- edited->set_text(2,_str_from_flags(flags));
- }
-#endif
-}
-
-void ImportSettingsDialog::_item_edited() {
-
- if (updating)
- return;
- TreeItem *it=tree->get_selected();
- int ec=tree->get_edited_column();
-
- String p=it->get_metadata(0);
-#if 0
- if (EditorImportDB::get_singleton()->is_image(p)) {
-
- if (ec==1) {
-
-
- EditorImportDB::get_singleton()->set_image_format(p,EditorImport::ImageFormat(int(it->get_range(1))));
-
- } else if (ec==2) {
-
-
- int flags = EditorImportDB::get_singleton()->get_image_flags(p);
- for(int i=0;i<popup->get_item_count();i++) {
-
- popup->set_item_checked(i,flags&(1<<i));
- }
-
- Rect2 r = tree->get_custom_popup_rect();
- popup->set_size(Size2(r.size.width,1));
- popup->set_pos(/*tree->get_global_pos()+*/r.pos+Point2(0,r.size.height));
- popup->popup();
- }
-
- edited=it;
-
- }
-#endif
-
-
-}
-
-
-void ImportSettingsDialog::_button_pressed(Object *p_button, int p_col, int p_id) {
-
- TreeItem *ti=p_button->cast_to<TreeItem>();
- if (!ti)
- return;
- String path = ti->get_metadata(0);
- print_line("PATH: "+path);
- Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path);
- ERR_FAIL_COND(rimd.is_null());
- Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
- ERR_FAIL_COND(!rimp.is_valid());
- rimp->import_dialog(path);
- hide();
-}
-
-bool ImportSettingsDialog::_generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) {
-
- bool valid=false;
-
-
- for(int i=0;i<p_dir->get_subdir_count();i++) {
-
- EditorFileSystemDirectory *sd=p_dir->get_subdir(i);
- TreeItem *ti = tree->create_item(p_parent);
- ti->set_text(0,sd->get_name()+"/");
- ti->set_icon(0,get_icon("Folder","EditorIcons"));
-
- if (!_generate_fs(ti,sd)) {
- memdelete(ti);
- } else {
- valid=true;
- }
- }
-
-
- for(int i=0;i<p_dir->get_file_count();i++) {
-
- String path=p_dir->get_file_path(i);
- if (!p_dir->get_file_meta(i))
- continue;
-
- valid=true;
-
- String f = p_dir->get_file(i);
- TreeItem *ti = tree->create_item(p_parent);
- String type = p_dir->get_file_type(i);
- Ref<Texture> t;
- if (has_icon(type,"EditorIcons"))
- t = get_icon(type,"EditorIcons");
- else
- t = get_icon("Object","EditorIcons");
-
-
- ti->set_icon(0,t);
- ti->set_text(0,f);
-// ti->add_button(0,get_icon("Reload","EditorIcons"));
- ti->set_metadata(0,p_dir->get_file_path(i));
- String tt = p_dir->get_file_path(i);
-
- if (p_dir->is_missing_sources(i)) {
- ti->set_icon(1,get_icon("ImportFail","EditorIcons"));
- Vector<String> missing = p_dir->get_missing_sources(i);
- for(int j=0;j<missing.size();j++) {
- tt+="\nmissing: "+missing[j];
- }
-
- } else
- ti->set_icon(1,get_icon("ImportCheck","EditorIcons"));
-
- ti->set_tooltip(0,tt);
- ti->set_tooltip(1,tt);
-
- }
-
-#if 0
- if (!EditorImportDB::get_singleton()->is_image(path) && !EditorImportDB::get_singleton()->is_scene(path))
- continue;
-
- String f = p_dir->get_file(i);
- TreeItem *ti = tree->create_item(p_parent);
- ti->set_text(0,f);
- String type = p_dir->get_file_type(i);
- Ref<Texture> icon = get_icon( (has_icon(type,"EditorIcons")?type:String("Object")),"EditorIcons");
-
-
- if (EditorImportDB::get_singleton()->is_image(path)) {
-
-
- ti->set_tooltip(0,"Type: Image\nSource: "+EditorImportDB::get_singleton()->get_file_source(path)+"\nSource MD5: "+EditorImportDB::get_singleton()->get_file_md5(path));
- ti->set_cell_mode(1,TreeItem::CELL_MODE_RANGE);
- ti->set_editable(1,true);
- ti->set_range_config(1,0,3,1);
- ti->set_range(1,EditorImportDB::get_singleton()->get_image_format(path));
- ti->set_text(1,texformat);
- ti->set_cell_mode(2,TreeItem::CELL_MODE_CUSTOM);
- ti->set_editable(2,true);
- ti->set_metadata(0,path);
-
- String txt;
- uint32_t flags=EditorImportDB::get_singleton()->get_image_flags(path);
- txt=_str_from_flags(flags);
-
- ti->set_text(2,txt);
- }
-
- ti->set_icon(0, icon);
- valid=true;
-#endif
-
-
- return valid;
-}
-
-void ImportSettingsDialog::update_tree() {
-
- updating=true;
- tree->clear();
- edited=NULL;
-
-
- TreeItem *root = tree->create_item();
- EditorFileSystemDirectory *fs = EditorFileSystem::get_singleton()->get_filesystem();
-
- _generate_fs(root,fs);
- updating=false;
-
-
-}
-
-void ImportSettingsDialog::_notification(int p_what) {
-
- if (p_what==NOTIFICATION_ENTER_TREE) {
-
- EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"update_tree");
- }
-}
-
-
-void ImportSettingsDialog::_bind_methods() {
-
- ObjectTypeDB::bind_method("update_tree",&ImportSettingsDialog::update_tree);
- ObjectTypeDB::bind_method("_item_edited",&ImportSettingsDialog::_item_edited);
- ObjectTypeDB::bind_method("_item_pressed",&ImportSettingsDialog::_item_pressed);
- ObjectTypeDB::bind_method("_button_pressed",&ImportSettingsDialog::_button_pressed);
-
-
-}
-
-
-void ImportSettingsDialog::popup_import_settings() {
-
- update_tree();
- popup_centered_ratio();
-}
-
-void ImportSettingsDialog::ok_pressed() {
-
-
- TreeItem *ti = tree->get_selected();
- if (!ti)
- return;
-
- String path = ti->get_metadata(0);
- print_line("PATH: "+path);
- Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(path);
- ERR_FAIL_COND(rimd.is_null());
- Ref<EditorImportPlugin> rimp = EditorImportExport::get_singleton()->get_import_plugin_by_name(rimd->get_editor());
- ERR_FAIL_COND(!rimp.is_valid());
- rimp->import_dialog(path);
- hide();
-
-
-}
-
-ImportSettingsDialog::ImportSettingsDialog(EditorNode *p_editor) {
-
- editor=p_editor;
-
- get_ok()->set_text(TTR("Close"));
-
- tree = memnew( Tree );
- add_child(tree);
- set_child_rect(tree);
- set_title(TTR("Imported Resources"));
-
-// texformat="Keep,None,Disk,VRAM";
-
- tree->set_hide_root(true);
- tree->set_columns(2);
- tree->set_column_expand(1,false);
- tree->set_column_min_width(1,20);
-
- tree->connect("item_edited",this,"_item_edited");
- tree->connect("button_pressed",this,"_button_pressed");
-
-// add_button("Re-Import","reimport");
- get_ok()->set_text(TTR("Re-Import"));
- get_cancel()->set_text(TTR("Close"));
-
- updating=false;
- edited=NULL;
- set_hide_on_ok(false);
-
-
-}
-
diff --git a/tools/editor/import_settings.h b/tools/editor/import_settings.h
deleted file mode 100644
index 5a383a1a1a..0000000000
--- a/tools/editor/import_settings.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*************************************************************************/
-/* import_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 IMPORT_SETTINGS_H
-#define IMPORT_SETTINGS_H
-
-#include "object.h"
-#include "scene/gui/dialogs.h"
-#include "scene/gui/tree.h"
-#include "scene/gui/label.h"
-#include "scene/gui/option_button.h"
-#include "scene/gui/line_edit.h"
-#include "scene/gui/file_dialog.h"
-#include "scene/gui/progress_bar.h"
-#include "scene/gui/slider.h"
-#include "scene/gui/spin_box.h"
-#include "scene/resources/mesh.h"
-#include "editor_import_export.h"
-#include "editor_file_system.h"
-#include "editor_dir_dialog.h"
-class EditorNode;
-
-
-class ImportSettingsDialog : public ConfirmationDialog {
-
- OBJ_TYPE(ImportSettingsDialog,ConfirmationDialog);
-
- TreeItem *edited;
- EditorNode *editor;
- Tree *tree;
- bool updating;
-
- void _button_pressed(Object *p_button, int p_col, int p_id);
- void _item_pressed(int p_idx);
- bool _generate_fs(TreeItem *p_parent,EditorFileSystemDirectory *p_dir);
-
- String texformat;
-
- void _item_edited();
- virtual void ok_pressed();
-
-protected:
-
-
- void _notification(int p_what);
- static void _bind_methods();
-public:
-
- void update_tree();
-
-
- void popup_import_settings();
- ImportSettingsDialog(EditorNode *p_editor);
-
-};
-
-#endif // IMPORT_SETTINGS_H
diff --git a/tools/editor/io_plugins/editor_atlas.cpp b/tools/editor/io_plugins/editor_atlas.cpp
index f894e7e8b2..f69e383fb0 100644
--- a/tools/editor/io_plugins/editor_atlas.cpp
+++ b/tools/editor/io_plugins/editor_atlas.cpp
@@ -82,7 +82,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
//place them
int ofs=0;
- int limit_h=0;
for(int j=0;j<wrects.size();j++) {
@@ -106,8 +105,6 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
int end_h = from_y+wrects[j].s.height;
int end_w = ofs+wrects[j].s.width;
- if (ofs==0)
- limit_h=end_h;
for(int k=0;k<wrects[j].s.width;k++) {
@@ -120,8 +117,7 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
if (end_w > max_w)
max_w=end_w;
- //if (ofs==0 || end_h>limit_h ) //while h limit not reched, keep stacking
- ofs+=wrects[j].s.width;
+ ofs+=wrects[j].s.width;
}
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index 363cba3678..fc45b51a98 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -2278,12 +2278,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
NodeMap &nm = node_map[at.target];
String path = scene->get_path_to(nm.node);
- Collada::Node *cn = collada.state.scene_map[at.target];
- //if (cn->ignore_anim) {
- // print_line("warning, ignoring property animation on node: "+nm.path);
- //continue;
- //}
-
animation->add_track(Animation::TYPE_VALUE);
int track = animation->get_track_count() -1;
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index b27539b933..e24412d4ef 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -2459,7 +2459,7 @@ void EditorSceneImportPlugin::_optimize_animations(Node *scene, float p_max_lin_
void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node, bool p_merge_material, Map<String, Ref<Material> > &materials, bool p_merge_anims, Map<String,Ref<Animation> >& merged_anims,Set<Ref<Mesh> > &tested_meshes) {
- if (node->get_owner()!=scene)
+ if (node!=scene && node->get_owner()!=scene)
return;
String path = scene->get_path_to(node);
@@ -2507,11 +2507,43 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node,
for(int i=0;i<mesh->get_surface_count();i++) {
Ref<Material> material = mesh->surface_get_material(i);
- materials[mesh->get_name()+":surf:"+mesh->surface_get_name(i)]=material;
+
+ if (material.is_valid()) {
+
+ String sname = mesh->surface_get_name(i);
+ if (sname=="")
+ sname="surf_"+itos(i);
+
+ sname=mesh->get_name()+":surf:"+sname;
+ materials[sname]=material;
+ }
}
tested_meshes.insert(mesh);
}
+
+ if (mesh.is_valid()) {
+
+ for(int i=0;i<mesh->get_surface_count();i++) {
+ Ref<Material> material = mi->get_surface_material(i);
+ if (material.is_valid()) {
+ String sname = mesh->surface_get_name(i);
+ if (sname=="")
+ sname="surf_"+itos(i);
+
+ sname=path+":inst_surf:"+sname;
+ materials[sname]=material;
+ }
+ }
+
+ }
+
+ Ref<Material> override = mi->get_material_override();
+
+ if (override.is_valid()) {
+
+ materials[path+":override"]=override;
+ }
}
@@ -2525,11 +2557,13 @@ void EditorSceneImportPlugin::_find_resources_to_merge(Node *scene, Node *node,
void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bool p_merge_material, const Map<String, Ref<Material> > &materials, bool p_merge_anims, const Map<String,Ref<Animation> >& merged_anims, Set<Ref<Mesh> > &tested_meshes) {
- if (node->get_owner()!=scene)
+ if (node!=scene && node->get_owner()!=scene)
return;
String path = scene->get_path_to(node);
+ print_line("at path: "+path);
+
if (node->cast_to<AnimationPlayer>()) {
AnimationPlayer *ap = node->cast_to<AnimationPlayer>();
@@ -2570,15 +2604,48 @@ void EditorSceneImportPlugin::_merge_found_resources(Node *scene, Node *node, bo
if (mesh.is_valid() && mesh->get_name()!=String() && !tested_meshes.has(mesh)) {
for(int i=0;i<mesh->get_surface_count();i++) {
- String sname = mesh->get_name()+":surf:"+mesh->surface_get_name(i);
+
+ String sname = mesh->surface_get_name(i);
+ if (sname=="")
+ sname="surf_"+itos(i);
+
+ sname=mesh->get_name()+":surf:"+sname;
+
if (materials.has(sname)) {
+
mesh->surface_set_material(i,materials[sname]);
}
}
tested_meshes.insert(mesh);
}
+
+ if (mesh.is_valid()) {
+
+ for(int i=0;i<mesh->get_surface_count();i++) {
+
+ String sname = mesh->surface_get_name(i);
+ if (sname=="")
+ sname="surf_"+itos(i);
+
+ sname=path+":inst_surf:"+sname;
+
+
+ if (materials.has(sname)) {
+
+ mi->set_surface_material(i,materials[sname]);
+ }
+ }
+
+ }
+
+
+ String opath = path+":override";
+ if (materials.has(opath)) {
+ mi->set_material_override(materials[opath]);
+ }
+
}
@@ -2613,12 +2680,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
progress.step(TTR("Importing Scene.."),2);
- bool reimport = bool(from->get_option("reimport"));
- int this_time_action = from->get_option("import_this_time");
- int next_time_action = from->get_option("import_next_time");
-
- int import_action = reimport?this_time_action:next_time_action;
-
from->set_source_md5(0,FileAccess::get_md5(src_path));
from->set_editor(get_name());
@@ -2627,8 +2688,6 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
Map<Ref<Mesh>,Ref<Shape> > collision_map;
- Ref<ResourceImportMetadata> imd = memnew(ResourceImportMetadata);
-
Map< Ref<ImageTexture>,TextureRole > imagemap;
scene=_fix_node(scene,scene,collision_map,scene_flags,imagemap);
@@ -2643,6 +2702,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
if (scene_flags&(SCENE_FLAG_MERGE_KEEP_MATERIALS|SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS) && FileAccess::exists(p_dest_path)) {
//must merge!
+ print_line("MUST MERGE");
Ref<PackedScene> pscene = ResourceLoader::load(p_dest_path,"PackedScene",true);
if (pscene.is_valid()) {
@@ -2653,8 +2713,9 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
Set<Ref<Mesh> > tested_meshes;
_find_resources_to_merge(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes);
+
tested_meshes.clear();
- _merge_found_resources(instance,instance,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes);
+ _merge_found_resources(scene,scene,scene_flags&SCENE_FLAG_MERGE_KEEP_MATERIALS,merged_materials,scene_flags&SCENE_FLAG_MERGE_KEEP_EXTRA_ANIM_TRACKS,merged_anims,tested_meshes);
memdelete(instance);
}
@@ -2742,7 +2803,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
target_path=target_path.basename()+".tex";
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
- print_line("flags: "+itos(image_flags));
+
uint32_t flags = image_flags;
if (E->get()==TEXTURE_ROLE_DIFFUSE && scene_flags&SCENE_FLAG_LINEARIZE_DIFFUSE_TEXTURES)
flags|=EditorTextureImportPlugin::IMAGE_FLAG_CONVERT_TO_LINEAR;
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index 16ea803da4..1d8319d460 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -1192,8 +1192,6 @@ Error EditorTextureImportPlugin::import2(const String& p_path, const Ref<Resourc
}
ep.step(TTR("Converting Images"),sources.size());
- int base_index=0;
-
Map<uint64_t,int> source_md5;
Map<int,List<int> > source_map;
@@ -1760,7 +1758,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_
Vector<String> valid;
- bool warning=false;
for(int i=0;i<p_list.size();i++) {
Ref<ResourceImportMetadata> rimd = ResourceLoader::load_import_metadata(p_list[i]);
@@ -1768,7 +1765,6 @@ void EditorTextureImportPlugin::reimport_multiple_files(const Vector<String>& p_
if (type=="texture" || type.begins_with("texture_")) {
if ((rimd->has_option("atlas") && rimd->get_option("atlas")) || (rimd->has_option("large") && rimd->get_option("large"))) {
- warning=true;
continue;
}
diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
index aa36fefdb7..9ee3e98486 100644
--- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
@@ -425,7 +425,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso
ERR_FAIL_COND_V( !f, ERR_INVALID_PARAMETER );
- bool first=false;
bool skip_first = from->get_option("skip_first");
int index = from->get_option("index");
index+=1;
@@ -439,7 +438,6 @@ Error EditorTranslationImportPlugin::import(const String& p_path, const Ref<Reso
while(line.size()>1) {
-
if (!skip_first) {
ERR_FAIL_INDEX_V(index,line.size(),ERR_INVALID_DATA );
translation->add_message(line[0].strip_edges(),line[index]);
diff --git a/tools/editor/output_strings.cpp b/tools/editor/output_strings.cpp
index f1b49d2326..a6126466c4 100644
--- a/tools/editor/output_strings.cpp
+++ b/tools/editor/output_strings.cpp
@@ -32,7 +32,6 @@
void OutputStrings::update_scrollbars() {
- Size2 size = get_size();
Size2 hmin = h_scroll->get_combined_minimum_size();
Size2 vmin = v_scroll->get_combined_minimum_size();
diff --git a/tools/editor/plugins/animation_player_editor_plugin.cpp b/tools/editor/plugins/animation_player_editor_plugin.cpp
index 10c7bf79a3..98ba25b482 100644
--- a/tools/editor/plugins/animation_player_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_player_editor_plugin.cpp
@@ -407,7 +407,6 @@ void AnimationPlayerEditor::_animation_save(const Ref<Resource>& p_resource) {
void AnimationPlayerEditor::_animation_save_as(const Ref<Resource>& p_resource) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
- bool relpaths = (p_resource->has_meta("__editor_relpaths__") && p_resource->get_meta("__editor_relpaths__").operator bool());
List<String> extensions;
ResourceSaver::get_recognized_extensions(p_resource, &extensions);
@@ -1404,6 +1403,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) {
hb->add_child(animation);
animation->set_h_size_flags(SIZE_EXPAND_FILL);
animation->set_tooltip(TTR("Display list of animations in player."));
+ animation->set_clip_text(true);
autoplay = memnew( ToolButton );
hb->add_child(autoplay);
diff --git a/tools/editor/plugins/animation_tree_editor_plugin.cpp b/tools/editor/plugins/animation_tree_editor_plugin.cpp
index a381ec4678..24914e4bc5 100644
--- a/tools/editor/plugins/animation_tree_editor_plugin.cpp
+++ b/tools/editor/plugins/animation_tree_editor_plugin.cpp
@@ -90,7 +90,6 @@ Size2 AnimationTreeEditor::get_node_size(const StringName& p_node) const {
Ref<StyleBox> style = get_stylebox("panel","PopupMenu");
Ref<Font> font = get_font("font","PopupMenu");
- Color font_color = get_color("font_color","PopupMenu");
Size2 size = style->get_minimum_size();
@@ -633,7 +632,6 @@ AnimationTreeEditor::ClickType AnimationTreeEditor::_locate_click(const Point2&
Ref<StyleBox> style = get_stylebox("panel","PopupMenu");
Ref<Font> font = get_font("font","PopupMenu");
- Color font_color = get_color("font_color","PopupMenu");
float h = (font->get_height()+get_constant("vseparation","PopupMenu"));
diff --git a/tools/editor/plugins/baked_light_baker.cpp b/tools/editor/plugins/baked_light_baker.cpp
index 1962f81e87..6a88ba4cbe 100644
--- a/tools/editor/plugins/baked_light_baker.cpp
+++ b/tools/editor/plugins/baked_light_baker.cpp
@@ -645,7 +645,6 @@ void BakedLightBaker::_octree_insert(int p_octant,Triangle* p_triangle, int p_de
leaf_list=child_idx;
cell_count++;
- int lz = lights.size();
for(int ci=0;ci<8;ci++) {
child->light_accum[ci][0]=0;
child->light_accum[ci][1]=0;
@@ -1016,8 +1015,6 @@ float BakedLightBaker::_throw_ray(ThreadStack& thread_stack,bool p_bake_direct,c
//ray_aabb.expand_to(p_end);
- const BVH *bvhptr = bvh;
-
bstack[0]=bvh;
stack[0]=TEST_AABB_BIT;
@@ -1693,7 +1690,7 @@ void BakedLightBaker::throw_rays(ThreadStack& thread_stack,int p_amount) {
Vector3 from = dl.pos;
double r1 = double(rand())/RAND_MAX;
- double r2 = double(rand())/RAND_MAX;
+ //double r2 = double(rand())/RAND_MAX;
double r3 = double(rand())/RAND_MAX;
float d=Math::tan(Math::deg2rad(dl.spot_angle));
@@ -1994,7 +1991,6 @@ void BakedLightBaker::update_octree_images(DVector<uint8_t> &p_octree,DVector<ui
const double *normptr=norm_arr.ptr();
*/
double norm = 1.0/double(total_rays);
- int lz=lights.size();
mult/=multiplier;
double saturation = baked_light->get_saturation();
@@ -2261,8 +2257,6 @@ void BakedLightBaker::_plot_pixel_to_lightmap(int x, int y, int width, int heigh
continue;
n/=len;
- const BVH *bvhptr = bvh;
-
bstack[0]=bvh;
stack[0]=TEST_RAY_BIT;
@@ -2404,8 +2398,6 @@ Error BakedLightBaker::transfer_to_lightmaps() {
float gamma = baked_light->get_gamma_adjust();
float mult = baked_light->get_energy_multiplier();
-
- const double *normptr=norm_arr.ptr();
for(int i=0;i<triangles.size();i++) {
if (i%200==0) {
@@ -2538,7 +2530,6 @@ Error BakedLightBaker::transfer_to_lightmaps() {
Vector<uint8_t> copy_data=bt.data;
uint8_t *data=bt.data.ptr();
- uint8_t *src_data=copy_data.ptr();
const int max_radius=8;
const int shadow_radius=2;
const int max_dist=0x7FFFFFFF;
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 81601a81a7..db500cdcdf 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1940,8 +1940,6 @@ void CanvasItemEditor::_viewport_draw() {
Map<Node*,Object*> &selection = editor_selection->get_selection();
- CanvasItem *single_item=NULL;
-
bool pivot_found=false;
for(Map<Node*,Object*>::Element *E=selection.front();E;E=E->next()) {
@@ -1961,15 +1959,6 @@ void CanvasItemEditor::_viewport_draw() {
Matrix32 xform=transform * canvas_item->get_global_transform_with_canvas();
VisualServer::get_singleton()->canvas_item_add_set_transform(ci,xform);
- Point2 ofs=Point2();//get_global_pos();
- Rect2 draw_rect=rect;
- 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);
-
- //select_sb->draw(ci,draw_rect.grow(2));
- //DRAW_EMPTY_RECT( draw_rect.grow(2), light_edit_color );
- //DRAW_EMPTY_RECT( draw_rect.grow(1), dark_edit_color );
Vector2 endpoints[4]={
@@ -3374,25 +3363,25 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
PopupMenu *p;
p = edit_menu->get_popup();
- p->add_check_item(TTR("Use Snap"),SNAP_USE);
- p->add_check_item(TTR("Show Grid"),SNAP_SHOW_GRID);
- p->add_check_item(TTR("Use Rotation Snap"),SNAP_USE_ROTATION);
- p->add_check_item(TTR("Snap Relative"),SNAP_RELATIVE);
- p->add_item(TTR("Configure Snap.."),SNAP_CONFIGURE);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_snap", TTR("Use Snap")), SNAP_USE);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/show_grid", TTR("Show Grid")), SNAP_SHOW_GRID);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_rotation_snap", TTR("Use Rotation Snap")), SNAP_USE_ROTATION);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/snap_relative", TTR("Snap Relative")), SNAP_RELATIVE);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/configure_snap", TTR("Configure Snap..")), SNAP_CONFIGURE);
p->add_separator();
- p->add_check_item(TTR("Use Pixel Snap"),SNAP_USE_PIXEL);
+ p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/use_pixel_snap", TTR("Use Pixel Snap")), SNAP_USE_PIXEL);
p->add_separator();
- p->add_item(TTR("Expand to Parent"),EXPAND_TO_PARENT,KEY_MASK_CMD|KEY_P);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/expand_to_parent", TTR("Expand to Parent"), KEY_MASK_CMD | KEY_P), EXPAND_TO_PARENT);
p->add_separator();
p->add_submenu_item(TTR("Skeleton.."),"skeleton");
PopupMenu *p2 = memnew(PopupMenu);
p->add_child(p2);
p2->set_name("skeleton");
- p2->add_item(TTR("Make Bones"),SKELETON_MAKE_BONES,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_B);
- p2->add_item(TTR("Clear Bones"),SKELETON_CLEAR_BONES);
+ p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_make_bones", TTR("Make Bones"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_B ),SKELETON_MAKE_BONES);
+ p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_bones", TTR("Clear Bones")), SKELETON_CLEAR_BONES);
p2->add_separator();
- p2->add_item(TTR("Make IK Chain"),SKELETON_SET_IK_CHAIN);
- p2->add_item(TTR("Clear IK Chain"),SKELETON_CLEAR_IK_CHAIN);
+ p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_set_ik_chain", TTR("Make IK Chain")), SKELETON_SET_IK_CHAIN);
+ p2->add_shortcut(ED_SHORTCUT("canvas_item_editor/skeleton_clear_ik_chain", TTR("Clear IK Chain")), SKELETON_CLEAR_IK_CHAIN);
p2->connect("item_pressed", this,"_popup_callback");
@@ -3409,13 +3398,13 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p = view_menu->get_popup();
- p->add_item(TTR("Zoom In"),ZOOM_IN);
- p->add_item(TTR("Zoom Out"),ZOOM_OUT);
- p->add_item(TTR("Zoom Reset"),ZOOM_RESET);
- p->add_item(TTR("Zoom Set.."),ZOOM_SET);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_in", TTR("Zoom In")), ZOOM_IN);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_out", TTR("Zoom Out")), ZOOM_OUT);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_reset", TTR("Zoom Reset")), ZOOM_RESET);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_set", TTR("Zoom Set..")), ZOOM_SET);
p->add_separator();
- p->add_item(TTR("Center Selection"), VIEW_CENTER_TO_SELECTION, KEY_F);
- p->add_item(TTR("Frame Selection"), VIEW_FRAME_TO_SELECTION, KEY_MASK_CMD|KEY_F);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_CMD | KEY_F), VIEW_FRAME_TO_SELECTION);
anchor_menu = memnew( MenuButton );
anchor_menu->set_text(TTR("Anchor"));
@@ -3458,7 +3447,8 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
key_insert_button = memnew( Button );
key_insert_button->set_focus_mode(FOCUS_NONE);
key_insert_button->connect("pressed",this,"_popup_callback",varray(ANIM_INSERT_KEY));
- key_insert_button->set_tooltip(TTR("Insert Keys (Ins)"));
+ key_insert_button->set_tooltip(TTR("Insert Keys"));
+ key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), KEY_INSERT));
animation_hb->add_child(key_insert_button);
@@ -3469,12 +3459,12 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) {
p = animation_menu->get_popup();
- p->add_item(TTR("Insert Key"),ANIM_INSERT_KEY,KEY_INSERT);
- p->add_item(TTR("Insert Key (Existing Tracks)"),ANIM_INSERT_KEY_EXISTING,KEY_MASK_CMD+KEY_INSERT);
+ p->add_shortcut(ED_GET_SHORTCUT("canvas_item_editor/anim_insert_key"), ANIM_INSERT_KEY);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key_existing_tracks", TTR("Insert Key (Existing Tracks)"), KEY_MASK_CMD+KEY_INSERT), ANIM_INSERT_KEY_EXISTING);
p->add_separator();
- p->add_item(TTR("Copy Pose"),ANIM_COPY_POSE);
- p->add_item(TTR("Paste Pose"),ANIM_PASTE_POSE);
- p->add_item(TTR("Clear Pose"),ANIM_CLEAR_POSE,KEY_MASK_SHIFT|KEY_K);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_copy_pose", TTR("Copy Pose")), ANIM_COPY_POSE);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_paste_pose", TTR("Paste Pose")), ANIM_PASTE_POSE);
+ p->add_shortcut(ED_SHORTCUT("canvas_item_editor/anim_clear_pose", TTR("Clear Pose"), KEY_MASK_SHIFT | KEY_K), ANIM_CLEAR_POSE);
snap_dialog = memnew( SnapDialog );
snap_dialog->connect("confirmed",this,"_snap_changed");
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
index 5ed9f8ab5f..95364e8921 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.cpp
@@ -349,8 +349,6 @@ void CollisionPolygon2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
- int len = poly.size();
-
for(int i=0;i<poly.size();i++) {
diff --git a/tools/editor/plugins/collision_polygon_editor_plugin.cpp b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
index b18afe7838..55e38cebcc 100644
--- a/tools/editor/plugins/collision_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/collision_polygon_editor_plugin.cpp
@@ -381,8 +381,6 @@ void CollisionPolygonEditor::_polygon_draw() {
poly=node->get_polygon();
-
- int len = poly.size();
float depth = node->get_depth()*0.5;
imgeom->clear();
diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp
index a057e6c2a1..b1bce60484 100644
--- a/tools/editor/plugins/editor_preview_plugins.cpp
+++ b/tools/editor/plugins/editor_preview_plugins.cpp
@@ -36,6 +36,7 @@
#include "scene/resources/mesh.h"
#include "scene/resources/bit_mask.h"
#include "tools/editor/editor_scale.h"
+
bool EditorTexturePreviewPlugin::handles(const String& p_type) const {
return (ObjectTypeDB::is_type(p_type,"ImageTexture") || ObjectTypeDB::is_type(p_type, "AtlasTexture"));
@@ -442,7 +443,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES& p_from) {
Color keyword_color = EditorSettings::get_singleton()->get("text_editor/keyword_color");
Color text_color = EditorSettings::get_singleton()->get("text_editor/text_color");
Color symbol_color = EditorSettings::get_singleton()->get("text_editor/symbol_color");
- Color comment_color = EditorSettings::get_singleton()->get("text_editor/comment_color");
for(int i=0;i<thumbnail_size;i++) {
@@ -607,7 +607,7 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
-1, -1, -1, -1, 2, 4, 6, 8
};
- int16_t nibble,signed_nibble,diff,step;
+ int16_t nibble,diff,step;
ima_adpcm.last_nibble++;
const uint8_t *src_ptr=sdata;
@@ -628,10 +628,6 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
if (ima_adpcm.step_index>88)
ima_adpcm.step_index=88;
- /*
- signed_nibble = (nibble&7) * ((nibble&8)?-1:1);
- diff = (2 * signed_nibble + 1) * step / 4; */
-
diff = step >> 3 ;
if (nibble & 1)
diff += step >> 2 ;
@@ -748,15 +744,13 @@ Ref<Texture> EditorSamplePreviewPlugin::generate(const RES& p_from) {
for(int j=0;j<h;j++) {
- int half,ofs;
+ int half;
float v;
if (j<(h/2)) {
half=0;
- ofs=0;
v = (j/(float)(h/2)) * 2.0 - 1.0;
} else {
half=1;
- ofs=h/2;
if( (float)(h/2) != 0 ) {
v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
} else {
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
index 14e7b14fc3..56e58bc983 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.cpp
@@ -364,8 +364,6 @@ void LightOccluder2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
- int len = poly.size();
-
for(int i=0;i<poly.size();i++) {
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
index 5a8cd8791e..22546c72f3 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -427,8 +427,6 @@ void NavigationPolygonEditor::_canvas_draw() {
poly = Variant(node->get_navigation_polygon()->get_outline(j));
}
- int len = poly.size();
-
for(int i=0;i<poly.size();i++) {
diff --git a/tools/editor/plugins/particles_editor_plugin.cpp b/tools/editor/plugins/particles_editor_plugin.cpp
index 93e2fb2f38..7e20cc3f54 100644
--- a/tools/editor/plugins/particles_editor_plugin.cpp
+++ b/tools/editor/plugins/particles_editor_plugin.cpp
@@ -283,7 +283,6 @@ void ParticlesEditor::_generate_emission_points() {
ofs=(Vector3(1,1,1)-dir)*Vector3(Math::randf(),Math::randf(),Math::randf())*aabb.size;
ofs+=aabb.pos;
- Vector3 dirv = -dir;
Vector3 ofsv = ofs + aabb.size * dir;
//space it a little
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.cpp b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
index d78508c429..19d1ccc06f 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.cpp
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.cpp
@@ -466,8 +466,6 @@ void Polygon2DEditor::_canvas_draw() {
Matrix32 xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Ref<Texture> handle= get_icon("EditorHandle","EditorIcons");
- int len = poly.size();
-
for(int i=0;i<poly.size();i++) {
diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp
index b094184a29..7965fa54ae 100644
--- a/tools/editor/plugins/sample_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_editor_plugin.cpp
@@ -151,7 +151,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
-1, -1, -1, -1, 2, 4, 6, 8
};
- int16_t nibble,signed_nibble,diff,step;
+ int16_t nibble,diff,step;
ima_adpcm.last_nibble++;
const uint8_t *src_ptr=sdata;
@@ -172,10 +172,6 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
if (ima_adpcm.step_index>88)
ima_adpcm.step_index=88;
- /*
- signed_nibble = (nibble&7) * ((nibble&8)?-1:1);
- diff = (2 * signed_nibble + 1) * step / 4; */
-
diff = step >> 3 ;
if (nibble & 1)
diff += step >> 2 ;
@@ -285,15 +281,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
for(int j=0;j<h;j++) {
- int half,ofs;
+ int half;
float v;
if (j<(h/2)) {
half=0;
- ofs=0;
v = (j/(float)(h/2)) * 2.0 - 1.0;
} else {
half=1;
- ofs=h/2;
v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0;
}
@@ -324,12 +318,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
void SampleEditor::_update_sample() {
player->stop_all();
- if (sample->get_format()==Sample::FORMAT_IMA_ADPCM)
- return; //bye or unsupported
generate_preview_texture(sample,peakdisplay);
info_label->set_text(TTR("Length:")+" "+String::num(sample->get_length()/(float)sample->get_mix_rate(),2)+"s");
+ if (library->has_sample("default"))
+ library->remove_sample("default");
+
library->add_sample("default",sample);
}
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index 10e4fc8475..d7d495ff5d 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -43,6 +43,28 @@
/*** SCRIPT EDITOR ****/
+static bool _can_open_in_editor(Script* p_script) {
+
+ String path = p_script->get_path();
+
+ if (path.find("::")!=-1) {
+ //refuse handling this if it can't be edited
+
+ bool valid=false;
+ for(int i=0;i<EditorNode::get_singleton()->get_editor_data().get_edited_scene_count();i++) {
+ if (path.begins_with(EditorNode::get_singleton()->get_editor_data().get_scene_path(i))) {
+ valid=true;
+ break;
+ }
+ }
+
+ return valid;
+ }
+
+ return true;
+}
+
+
class EditorScriptCodeCompletionCache : public ScriptCodeCompletionCache {
@@ -585,7 +607,6 @@ void ScriptTextEditor::_code_complete_script(const String& p_code, List<String>*
Error err = script->get_language()->complete_code(p_code,script->get_path().get_base_dir(),base,r_options,hint);
if (hint!="") {
get_text_edit()->set_code_hint(hint);
- print_line("hint: "+hint.replace(String::chr(0xFFFF),"|"));
}
}
@@ -748,9 +769,9 @@ void ScriptEditor::_go_to_tab(int p_idx) {
_update_script_colors();
}
-void ScriptEditor::_close_current_tab() {
+void ScriptEditor::_close_tab(int p_idx) {
- int selected = tab_container->get_current_tab();
+ int selected = p_idx;
if (selected<0 || selected>=tab_container->get_child_count())
return;
@@ -796,6 +817,11 @@ void ScriptEditor::_close_current_tab() {
_update_script_names();
EditorNode::get_singleton()->save_layout();
+}
+
+void ScriptEditor::_close_current_tab() {
+
+ _close_tab(tab_container->get_current_tab());
}
@@ -1682,6 +1708,33 @@ void ScriptEditor::_notification(int p_what) {
}
+
+void ScriptEditor::close_builtin_scripts_from_scene(const String& p_scene) {
+
+
+
+ for(int i=0;i<tab_container->get_child_count();i++) {
+
+ ScriptTextEditor *ste = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
+
+ if (ste) {
+
+ Ref<Script> script = ste->get_edited_script();
+ if (!script.is_valid())
+ continue;
+
+ if (script->get_path().find("::")!=-1 && script->get_path().begins_with(p_scene)) { //is an internal script and belongs to scene being closed
+ _close_tab(i);
+ i--;
+
+ }
+ }
+
+ }
+
+
+}
+
void ScriptEditor::edited_scene_changed() {
_update_modified_scripts_for_external_editor();
@@ -2060,11 +2113,18 @@ void ScriptEditor::_update_script_names() {
}
+
+
void ScriptEditor::edit(const Ref<Script>& p_script) {
if (p_script.is_null())
return;
+ // refuse to open built-in if scene is not loaded
+
+
+
+
// see if already has it
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change");
@@ -2316,6 +2376,22 @@ void ScriptEditor::_script_split_dragged(float) {
EditorNode::get_singleton()->save_layout();
}
+void ScriptEditor::_unhandled_input(const InputEvent& p_event) {
+ if (p_event.key.pressed || !is_visible()) return;
+ if (ED_IS_SHORTCUT("script_editor/next_script", p_event)) {
+ int next_tab = script_list->get_current() + 1;
+ next_tab %= script_list->get_item_count();
+ _go_to_tab(script_list->get_item_metadata(next_tab));
+ _update_script_names();
+ }
+ if (ED_IS_SHORTCUT("script_editor/prev_script", p_event)) {
+ int next_tab = script_list->get_current() - 1;
+ next_tab = next_tab >= 0 ? next_tab : script_list->get_item_count() - 1;
+ _go_to_tab(script_list->get_item_metadata(next_tab));
+ _update_script_names();
+ }
+}
+
void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
if (!bool(EDITOR_DEF("text_editor/restore_scripts_on_load",true))) {
@@ -2335,6 +2411,8 @@ void ScriptEditor::set_window_layout(Ref<ConfigFile> p_layout) {
for(int i=0;i<scripts.size();i++) {
String path = scripts[i];
+ if (!FileAccess::exists(path))
+ continue;
Ref<Script> scr = ResourceLoader::load(path);
if (scr.is_valid()) {
edit(scr);
@@ -2512,7 +2590,7 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
if (bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor")))
return;
- if (open_dominant && p_script.is_valid()) {
+ if (open_dominant && p_script.is_valid() && _can_open_in_editor(p_script.ptr())) {
edit(p_script);
}
}
@@ -2598,6 +2676,7 @@ void ScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward);
ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back);
ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts);
+ ObjectTypeDB::bind_method("_unhandled_input",&ScriptEditor::_unhandled_input);
}
@@ -2631,6 +2710,10 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
tab_container->set_h_size_flags(SIZE_EXPAND_FILL);
+ ED_SHORTCUT("script_editor/next_script", TTR("Next script"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_GREATER);
+ ED_SHORTCUT("script_editor/prev_script", TTR("Previous script"), KEY_MASK_CMD | KEY_LESS);
+ set_process_unhandled_input(true);
+
file_menu = memnew( MenuButton );
menu_hb->add_child(file_menu);
file_menu->set_text(TTR("File"));
@@ -2895,6 +2978,16 @@ void ScriptEditorPlugin::edit(Object *p_object) {
bool ScriptEditorPlugin::handles(Object *p_object) const {
+ if (p_object->cast_to<Script>()) {
+
+ bool valid = _can_open_in_editor(p_object->cast_to<Script>());
+
+ if (!valid) { //user tried to open it by clicking
+ EditorNode::get_singleton()->show_warning(TTR("Built-in scripts can only be edited when the scene they belong to is loaded"));
+ }
+ return valid;
+ }
+
return p_object->is_type("Script");
}
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 0636190a41..2e6e2c035c 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -234,6 +234,8 @@ class ScriptEditor : public VBoxContainer {
bool _test_script_times_on_disk(Ref<Script> p_for_script=Ref<Script>());
+ void _close_tab(int p_idx);
+
void _close_current_tab();
bool grab_focus_block;
@@ -279,6 +281,8 @@ class ScriptEditor : public VBoxContainer {
void _script_split_dragged(float);
+ void _unhandled_input(const InputEvent& p_event);
+
void _history_forward();
void _history_back();
@@ -329,6 +333,8 @@ public:
virtual void edited_scene_changed();
+ void close_builtin_scripts_from_scene(const String& p_scene);
+
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp
index 76042c3028..864df42b6e 100644
--- a/tools/editor/plugins/shader_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_editor_plugin.cpp
@@ -118,9 +118,10 @@ void ShaderTextEditor::_load_theme_settings() {
get_text_edit()->add_color_region("/*","*/",comment_color,false);
get_text_edit()->add_color_region("//","",comment_color,false);
- //colorize strings
+
+ /*//colorize strings
Color string_color = EDITOR_DEF("text_editor/string_color",Color::hex(0x6b6f00ff));
- /*
+
List<String> strings;
shader->get_shader_mode()->get_string_delimiters(&strings);
@@ -499,7 +500,7 @@ ShaderEditor::ShaderEditor() {
edit_menu->set_pos(Point2(5,-1));
edit_menu->set_text(TTR("Edit"));
edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD|KEY_Z), EDIT_UNDO);
- edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_Z), EDIT_REDO);
+ edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD|KEY_Y), EDIT_REDO);
edit_menu->get_popup()->add_separator();
edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/cut", TTR("Cut"), KEY_MASK_CMD|KEY_X), EDIT_CUT);
edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/copy", TTR("Copy"), KEY_MASK_CMD|KEY_C), EDIT_COPY);
@@ -519,7 +520,7 @@ ShaderEditor::ShaderEditor() {
search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/replace", TTR("Replace.."), KEY_MASK_CMD|KEY_R), SEARCH_REPLACE);
search_menu->get_popup()->add_separator();
// search_menu->get_popup()->add_item("Locate Symbol..",SEARCH_LOCATE_SYMBOL,KEY_MASK_CMD|KEY_K);
- search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_G), SEARCH_GOTO_LINE);
+ search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/goto_line", TTR("Goto Line.."), KEY_MASK_CMD|KEY_L), SEARCH_GOTO_LINE);
search_menu->get_popup()->connect("item_pressed", this,"_menu_option");
diff --git a/tools/editor/plugins/shader_graph_editor_plugin.cpp b/tools/editor/plugins/shader_graph_editor_plugin.cpp
index d567c8e9b3..375220051c 100644
--- a/tools/editor/plugins/shader_graph_editor_plugin.cpp
+++ b/tools/editor/plugins/shader_graph_editor_plugin.cpp
@@ -176,7 +176,9 @@ void GraphColorRampEdit::_input_event(const InputEvent& p_event) {
void GraphColorRampEdit::_notification(int p_what){
if (p_what==NOTIFICATION_ENTER_TREE) {
- picker->connect("color_changed",this,"_color_changed");
+ if (!picker->is_connected("color_changed",this,"_color_changed")) {
+ picker->connect("color_changed",this,"_color_changed");
+ }
}
if (p_what==NOTIFICATION_DRAW) {
@@ -184,9 +186,8 @@ void GraphColorRampEdit::_notification(int p_what){
Point prev;
prev.offset=0;
prev.color=Color(0,0,0);
- int w = get_size().x;
- int h = get_size().y;
+ int h = get_size().y;
int total_w = get_size().width-get_size().height-3;
for(int i=-1;i<points.size();i++) {
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 8d72178f23..91a347c69b 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -53,8 +53,6 @@
void SpatialEditorViewport::_update_camera() {
if (orthogonal) {
- Size2 size = get_size();
- Size2 vpsize = Point2(cursor.distance*size.get_aspect(), cursor.distance / size.get_aspect());
//camera->set_orthogonal(size.width*cursor.distance,get_znear(),get_zfar());
camera->set_orthogonal(2 * cursor.distance, 0.1, 8192);
}
@@ -276,10 +274,6 @@ ObjectID SpatialEditorViewport::_select_ray(const Point2& p_pos, bool p_append,b
r_includes_current=false;
List<_RayResult> results;
- Vector3 cn=_get_camera_normal();
- Plane cplane(pos,cn.normalized());
-
- float min_d=1e20;
for (int i=0;i<instances.size();i++) {
@@ -649,21 +643,8 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2& p_screenpos,bool p_hili
Vector3 ray_pos=_get_ray_pos( Vector2( p_screenpos.x, p_screenpos.y ) );
Vector3 ray=_get_ray( Vector2( p_screenpos.x, p_screenpos.y ) );
- Vector3 cn=_get_camera_normal();
- Plane cplane(ray_pos,cn.normalized());
-
Transform gt = spatial_editor->get_gizmo_transform();
float gs=gizmo_scale;
- /*
- if (orthogonal) {
- gs= cursor.distance/surface->get_size().get_aspect();
-
- } else {
- gs = cplane.distance_to(gt.origin);
- }
-
- gs*=GIZMO_SCALE_DEFAULT;
-*/
if (spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_SELECT || spatial_editor->get_tool_mode()==SpatialEditor::TOOL_MODE_MOVE) {
@@ -1268,16 +1249,6 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
if (_edit.gizmo.is_valid()) {
- Plane plane=Plane(_edit.gizmo_initial_pos,_get_camera_normal());
-
-
- Vector3 ray_pos=_get_ray_pos( Vector2( m.x, m.y ) );
- Vector3 ray=_get_ray( Vector2( m.x, m.y ) );
-
- //Vector3 intersection;
- //if (!plane.intersects_ray(ray_pos,ray,&intersection))
- // break;
-
_edit.gizmo->set_handle(_edit.gizmo_handle,camera,Vector2(m.x,m.y));
Variant v = _edit.gizmo->get_handle_value(_edit.gizmo_handle);
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
@@ -1658,136 +1629,89 @@ void SpatialEditorViewport::_sinput(const InputEvent &p_event) {
default: {}
}
} break;
-
case InputEvent::KEY: {
-
const InputEventKey &k = p_event.key;
if (!k.pressed)
break;
- switch(k.scancode) {
-
- case KEY_S: {
-
- if (_edit.mode!=TRANSFORM_NONE) {
-
- _edit.snap=true;
- }
- } break;
- case KEY_7:
- case KEY_KP_7: {
- bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad");
- if (!emulate_numpad && k.scancode==KEY_7)
- return;
- cursor.y_rot=0;
- if (k.mod.shift) {
- cursor.x_rot=-Math_PI/2.0;
- set_message(TTR("Bottom View."),2);
- name=TTR("Bottom");
- _update_name();
-
- } else {
- cursor.x_rot=Math_PI/2.0;
- set_message(TTR("Top View."),2);
- name=TTR("Top");
- _update_name();
- }
- } break;
- case KEY_1:
- case KEY_KP_1: {
- bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad");
- if (!emulate_numpad && k.scancode==KEY_1)
- return;
- cursor.x_rot=0;
- if (k.mod.shift) {
- cursor.y_rot=Math_PI;
- set_message(TTR("Rear View."),2);
- name=TTR("Rear");
- _update_name();
-
- } else {
- cursor.y_rot=0;
- set_message(TTR("Front View."),2);
- name=TTR("Front");
- _update_name();
- }
-
- } break;
- case KEY_3:
- case KEY_KP_3: {
- bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad");
- if (!emulate_numpad && k.scancode==KEY_3)
- return;
- cursor.x_rot=0;
- if (k.mod.shift) {
- cursor.y_rot=Math_PI/2.0;
- set_message(TTR("Left View."),2);
- name=TTR("Left");
- _update_name();
- } else {
- cursor.y_rot=-Math_PI/2.0;
- set_message(TTR("Right View."),2);
- name=TTR("Right");
- _update_name();
- }
-
- } break;
- case KEY_5:
- case KEY_KP_5: {
- bool emulate_numpad = EditorSettings::get_singleton()->get("3d_editor/emulate_numpad");
- if (!emulate_numpad && k.scancode==KEY_5)
- return;
-
- //orthogonal = !orthogonal;
- _menu_option(orthogonal?VIEW_PERSPECTIVE:VIEW_ORTHOGONAL);
- _update_name();
-
-
- } break;
- case KEY_K: {
-
- if (!get_selected_count() || _edit.mode!=TRANSFORM_NONE)
- break;
-
- if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
- set_message(TTR("Keying is disabled (no key inserted)."));
- break;
- }
-
- List<Node*> &selection = editor_selection->get_selected_node_list();
-
- for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
-
- Spatial *sp = E->get()->cast_to<Spatial>();
- if (!sp)
- continue;
-
- emit_signal("transform_key_request",sp,"",sp->get_transform());
- }
-
-
- set_message(TTR("Animation Key Inserted."));
+ if (ED_IS_SHORTCUT("spatial_editor/snap", p_event)) {
+ if (_edit.mode != TRANSFORM_NONE) {
+ _edit.snap=true;
+ }
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/bottom_view", p_event)) {
+ cursor.y_rot = 0;
+ cursor.x_rot = -Math_PI/2.0;
+ set_message(TTR("Bottom View."),2);
+ name = TTR("Bottom");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/top_view", p_event)) {
+ cursor.y_rot = 0;
+ cursor.x_rot = Math_PI/2.0;
+ set_message(TTR("Top View."),2);
+ name = TTR("Top");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/rear_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot = Math_PI;
+ set_message(TTR("Rear View."),2);
+ name = TTR("Rear");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/front_view", p_event)) {
+ cursor.x_rot = 0;
+ cursor.y_rot=0;
+ set_message(TTR("Front View."),2);
+ name=TTR("Front");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/left_view", p_event)) {
+ cursor.x_rot=0;
+ cursor.y_rot = Math_PI/2.0;
+ set_message(TTR("Left View."),2);
+ name = TTR("Left");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/right_view", p_event)) {
+ cursor.x_rot=0;
+ cursor.y_rot = -Math_PI/2.0;
+ set_message(TTR("Right View."),2);
+ name = TTR("Right");
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/switch_perspective_orthogonal", p_event)) {
+ _menu_option(orthogonal?VIEW_PERSPECTIVE:VIEW_ORTHOGONAL);
+ _update_name();
+ }
+ if (ED_IS_SHORTCUT("spatial_editor/insert_anim_key", p_event)) {
+ if (!get_selected_count() || _edit.mode!=TRANSFORM_NONE)
+ break;
+ if (!AnimationPlayerEditor::singleton->get_key_editor()->has_keying()) {
+ set_message(TTR("Keying is disabled (no key inserted)."));
+ break;
+ }
- } break;
+ List<Node*> &selection = editor_selection->get_selected_node_list();
- case KEY_F: {
+ for(List<Node*>::Element *E=selection.front();E;E=E->next()) {
- if (k.pressed && k.mod.shift && k.mod.control) {
- _menu_option(VIEW_ALIGN_SELECTION_WITH_VIEW);
- } else if (k.pressed) {
- _menu_option(VIEW_CENTER_TO_SELECTION);
- }
+ Spatial *sp = E->get()->cast_to<Spatial>();
+ if (!sp)
+ continue;
- } break;
+ emit_signal("transform_key_request",sp,"",sp->get_transform());
+ }
- case KEY_SPACE: {
- if (!k.pressed)
- emit_signal("toggle_maximize_view", this);
- } break;
+ set_message(TTR("Animation Key Inserted."));
}
+ if (k.scancode == KEY_SPACE) {
+ if (!k.pressed) emit_signal("toggle_maximize_view", this);
+ }
} break;
@@ -1855,16 +1779,6 @@ void SpatialEditorViewport::_notification(int p_what) {
continue;
- /*
- ??
- if (!se->poly_instance.is_valid())
- continue;
- if (!ObjectDB::get_instance( E->key() )) {
- VisualServer::get_singleton()->free( se->poly_instance );
- se->poly_instance=RID();
- continue;
- }
- */
VisualInstance *vi=sp->cast_to<VisualInstance>();
@@ -1902,35 +1816,6 @@ void SpatialEditorViewport::_notification(int p_what) {
surface->update();
}
- //grid
- Vector3 grid_cam_axis=_get_camera_normal();
- /*
- for(int i=0;i<3;i++) {
-
-
- Vector3 axis;
- axis[i]=1;
-
- bool should_be_visible= grid_enabled && (grid_enable[i] || (Math::abs(grid_cam_axis.dot(axis))>0.99 && orthogonal));
-
- if (should_be_visible!=grid_visible[i]) {
-
- VisualServer::get_singleton()->instance_geometry_set_flag(grid_instance[i],VS::INSTANCE_FLAG_VISIBLE,should_be_visible);
- grid_visible[i]=should_be_visible;
- }
- }
-
- if (last_grid_snap!=spatial_editor->get_translate_snap()) {
-
-
- last_grid_snap=spatial_editor->get_translate_snap()
- Transform gridt;
- gridt.basis.scale(Vector3(last_grid_snap,last_grid_snap,last_grid_snap));
- for(int i=0;i<3;i++)
- VisualServer::get_singleton()->instance_set_transform(grid_instance[i],gridt);
-
- }*/
-
}
if (p_what==NOTIFICATION_ENTER_TREE) {
@@ -2470,29 +2355,28 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
surface->add_child(view_menu);
view_menu->set_pos( Point2(4,4));
view_menu->set_self_opacity(0.5);
-
- view_menu->get_popup()->add_item(TTR("Top (Num7)"),VIEW_TOP);
- view_menu->get_popup()->add_item(TTR("Bottom (Shift+Num7)"),VIEW_BOTTOM);
- view_menu->get_popup()->add_item(TTR("Left (Num3)"),VIEW_LEFT);
- view_menu->get_popup()->add_item(TTR("Right (Shift+Num3)"),VIEW_RIGHT);
- view_menu->get_popup()->add_item(TTR("Front (Num1)"),VIEW_FRONT);
- view_menu->get_popup()->add_item(TTR("Rear (Shift+Num1)"),VIEW_REAR);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/left_view"), VIEW_LEFT);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/right_view"), VIEW_RIGHT);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/front_view"), VIEW_FRONT);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/rear_view"), VIEW_REAR);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_item(TTR("Perspective (Num5)"),VIEW_PERSPECTIVE);
- view_menu->get_popup()->add_check_item(TTR("Orthogonal (Num5)"),VIEW_ORTHOGONAL);
+ view_menu->get_popup()->add_check_item(TTR("Perspective") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_PERSPECTIVE);
+ view_menu->get_popup()->add_check_item(TTR("Orthogonal") + " (" + ED_GET_SHORTCUT("spatial_editor/switch_perspective_orthogonal")->get_as_text() + ")", VIEW_ORTHOGONAL);
view_menu->get_popup()->set_item_checked(view_menu->get_popup()->get_item_index(VIEW_PERSPECTIVE),true);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_item(TTR("Environment"),VIEW_ENVIRONMENT);
+ view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_environment", TTR("Environment")), VIEW_ENVIRONMENT);
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_ENVIRONMENT),true);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_item(TTR("Audio Listener"),VIEW_AUDIO_LISTENER);
+ view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_audio_listener", TTR("Audio Listener")), VIEW_AUDIO_LISTENER);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_check_item(TTR("Gizmos"),VIEW_GIZMOS);
+ view_menu->get_popup()->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_gizmos", TTR("Gizmos")),VIEW_GIZMOS);
view_menu->get_popup()->set_item_checked( view_menu->get_popup()->get_item_index(VIEW_GIZMOS),true);
view_menu->get_popup()->add_separator();
- view_menu->get_popup()->add_item(TTR("Selection (F)"),VIEW_CENTER_TO_SELECTION);
- view_menu->get_popup()->add_item(TTR("Align with view (Ctrl+Shift+F)"),VIEW_ALIGN_SELECTION_WITH_VIEW);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/focus_selection"), VIEW_CENTER_TO_SELECTION);
+ view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/align_selection_with_view"), VIEW_ALIGN_SELECTION_WITH_VIEW);
view_menu->get_popup()->connect("item_pressed",this,"_menu_option");
preview_camera = memnew( Button );
@@ -2613,16 +2497,9 @@ Object *SpatialEditor::_get_editor_data(Object *p_what) {
si->sbox_instance=VisualServer::get_singleton()->instance_create2(selection_box->get_rid(),sp->get_world()->get_scenario());
VS::get_singleton()->instance_geometry_set_cast_shadows_setting(si->sbox_instance, VS::SHADOW_CASTING_SETTING_OFF);
- RID inst = sp->call("_get_visual_instance_rid");
-
-// if (inst.is_valid())
-// si->aabb = VisualServer::get_singleton()->instance_get_base_aabb(inst);
-
-
if (get_tree()->is_editor_hint())
editor->call("edit_node",sp);
-
return si;
}
@@ -3951,6 +3828,19 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
hbc_menu->add_child(vs);
+ ED_SHORTCUT("spatial_editor/bottom_view", TTR("Bottom View"), KEY_MASK_ALT+KEY_KP_7);
+ ED_SHORTCUT("spatial_editor/top_view", TTR("Top View"), KEY_KP_7);
+ ED_SHORTCUT("spatial_editor/rear_view", TTR("Rear View"), KEY_MASK_ALT+KEY_KP_1);
+ ED_SHORTCUT("spatial_editor/front_view", TTR("Front View"), KEY_KP_1);
+ ED_SHORTCUT("spatial_editor/left_view", TTR("Left View"), KEY_MASK_ALT+KEY_KP_3);
+ ED_SHORTCUT("spatial_editor/right_view", TTR("Right View"), KEY_KP_3);
+ ED_SHORTCUT("spatial_editor/switch_perspective_orthogonal", TTR("Switch Perspective/Orthogonal view"), KEY_KP_5);
+ ED_SHORTCUT("spatial_editor/snap", TTR("Snap"), KEY_S);
+ ED_SHORTCUT("spatial_editor/insert_anim_key", TTR("Insert Animation Key"), KEY_K);
+ ED_SHORTCUT("spatial_editor/focus_selection", TTR("Focus Selection"), KEY_F);
+ ED_SHORTCUT("spatial_editor/align_selection_with_view", TTR("Align Selection With View"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_F);
+
+
PopupMenu *p;
transform_menu = memnew( MenuButton );
@@ -3958,13 +3848,13 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
hbc_menu->add_child( transform_menu );
p = transform_menu->get_popup();
- p->add_check_item(TTR("Use Snap"),MENU_TRANSFORM_USE_SNAP);
- p->add_item(TTR("Configure Snap.."),MENU_TRANSFORM_CONFIGURE_SNAP);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_snap", TTR("Use Snap")), MENU_TRANSFORM_USE_SNAP);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/configure_snap", TTR("Configure Snap..")), MENU_TRANSFORM_CONFIGURE_SNAP);
p->add_separator();
- p->add_check_item(TTR("Local Coords"),MENU_TRANSFORM_LOCAL_COORDS);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTR("Local Coords")), MENU_TRANSFORM_LOCAL_COORDS);
//p->set_item_checked(p->get_item_count()-1,true);
p->add_separator();
- p->add_item(TTR("Transform Dialog.."),MENU_TRANSFORM_DIALOG);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/transform_dialog", TTR("Transform Dialog..")), MENU_TRANSFORM_DIALOG);
p->connect("item_pressed", this,"_menu_item_pressed");
@@ -3975,27 +3865,27 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) {
p = view_menu->get_popup();
- p->add_check_item(TTR("Use Default Light"),MENU_VIEW_USE_DEFAULT_LIGHT);
- p->add_check_item(TTR("Use Default sRGB"),MENU_VIEW_USE_DEFAULT_SRGB);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_default_light", TTR("Use Default Light")), MENU_VIEW_USE_DEFAULT_LIGHT);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/use_default_srgb", TTR("Use Default sRGB")), MENU_VIEW_USE_DEFAULT_SRGB);
p->add_separator();
- p->add_check_item(TTR("1 Viewport"),MENU_VIEW_USE_1_VIEWPORT,KEY_MASK_CMD+KEY_1);
- p->add_check_item(TTR("2 Viewports"),MENU_VIEW_USE_2_VIEWPORTS,KEY_MASK_CMD+KEY_2);
- p->add_check_item(TTR("2 Viewports (Alt)"),MENU_VIEW_USE_2_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_2);
- p->add_check_item(TTR("3 Viewports"),MENU_VIEW_USE_3_VIEWPORTS,KEY_MASK_CMD+KEY_3);
- p->add_check_item(TTR("3 Viewports (Alt)"),MENU_VIEW_USE_3_VIEWPORTS_ALT,KEY_MASK_SHIFT+KEY_MASK_CMD+KEY_3);
- p->add_check_item(TTR("4 Viewports"),MENU_VIEW_USE_4_VIEWPORTS,KEY_MASK_CMD+KEY_4);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/1_viewport", TTR("1 Viewport"), KEY_MASK_CMD+KEY_1), MENU_VIEW_USE_1_VIEWPORT);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports", TTR("2 Viewports"), KEY_MASK_CMD+KEY_2), MENU_VIEW_USE_2_VIEWPORTS);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/2_viewports_alt", TTR("2 Viewports (Alt)"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_2), MENU_VIEW_USE_2_VIEWPORTS_ALT);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports", TTR("3 Viewports"),KEY_MASK_CMD+KEY_3), MENU_VIEW_USE_3_VIEWPORTS);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/3_viewports_alt", TTR("3 Viewports (Alt)"), KEY_MASK_ALT+KEY_MASK_CMD+KEY_3), MENU_VIEW_USE_3_VIEWPORTS_ALT);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/4_viewports", TTR("4 Viewports"), KEY_MASK_CMD+KEY_4), MENU_VIEW_USE_4_VIEWPORTS);
p->add_separator();
- p->add_check_item(TTR("Display Normal"),MENU_VIEW_DISPLAY_NORMAL);
- p->add_check_item(TTR("Display Wireframe"),MENU_VIEW_DISPLAY_WIREFRAME);
- p->add_check_item(TTR("Display Overdraw"),MENU_VIEW_DISPLAY_OVERDRAW);
- p->add_check_item(TTR("Display Shadeless"),MENU_VIEW_DISPLAY_SHADELESS);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_normal", TTR("Display Normal")), MENU_VIEW_DISPLAY_NORMAL);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_wireframe", TTR("Display Wireframe")), MENU_VIEW_DISPLAY_WIREFRAME);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_overdraw", TTR("Display Overdraw")), MENU_VIEW_DISPLAY_OVERDRAW);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/display_shadeless", TTR("Display Shadeless")), MENU_VIEW_DISPLAY_SHADELESS);
p->add_separator();
- p->add_check_item(TTR("View Origin"),MENU_VIEW_ORIGIN);
- p->add_check_item(TTR("View Grid"),MENU_VIEW_GRID);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_origin", TTR("View Origin")), MENU_VIEW_ORIGIN);
+ p->add_check_shortcut(ED_SHORTCUT("spatial_editor/view_grid", TTR("View Grid")), MENU_VIEW_GRID);
p->add_separator();
- p->add_item(TTR("Settings"),MENU_VIEW_CAMERA_SETTINGS);
+ p->add_shortcut(ED_SHORTCUT("spatial_editor/settings", TTR("Settings")), MENU_VIEW_CAMERA_SETTINGS);
p->set_item_checked( p->get_item_index(MENU_VIEW_USE_DEFAULT_LIGHT), true );
diff --git a/tools/editor/plugins/sprite_frames_editor_plugin.cpp b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
index 4f59287994..e29a0c8d52 100644
--- a/tools/editor/plugins/sprite_frames_editor_plugin.cpp
+++ b/tools/editor/plugins/sprite_frames_editor_plugin.cpp
@@ -31,7 +31,7 @@
#include "io/resource_loader.h"
#include "globals.h"
#include "tools/editor/editor_settings.h"
-
+#include "scene/3d/sprite_3d.h"
@@ -355,6 +355,35 @@ void SpriteFramesEditor::_animation_select() {
}
+
+static void _find_anim_sprites(Node* p_node,List<Node*> *r_nodes,Ref<SpriteFrames> p_sfames) {
+
+ Node *edited = EditorNode::get_singleton()->get_edited_scene();
+ if (!edited)
+ return;
+ if (p_node!=edited && p_node->get_owner()!=edited)
+ return;
+
+ {
+ AnimatedSprite *as = p_node->cast_to<AnimatedSprite>();
+ if (as && as->get_sprite_frames()==p_sfames) {
+ r_nodes->push_back(p_node);
+ }
+ }
+
+ {
+ AnimatedSprite3D *as = p_node->cast_to<AnimatedSprite3D>();
+ if (as && as->get_sprite_frames()==p_sfames) {
+ r_nodes->push_back(p_node);
+ }
+ }
+
+ for(int i=0;i<p_node->get_child_count();i++) {
+ _find_anim_sprites(p_node->get_child(i),r_nodes,p_sfames);
+ }
+
+}
+
void SpriteFramesEditor::_animation_name_edited(){
if (updating)
@@ -381,9 +410,24 @@ void SpriteFramesEditor::_animation_name_edited(){
name=new_name+" "+itos(counter);
}
+ List<Node*> nodes;
+ _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames));
+
undo_redo->create_action(TTR("Rename Animation"));
undo_redo->add_do_method(frames,"rename_animation",edited_anim,name);
undo_redo->add_undo_method(frames,"rename_animation",name,edited_anim);
+
+ for(List<Node*>::Element *E=nodes.front();E;E=E->next()) {
+
+ String current = E->get()->call("get_animation");
+ if (current!=edited_anim)
+ continue;
+
+ undo_redo->add_do_method(E->get(),"set_animation",name);
+ undo_redo->add_undo_method(E->get(),"set_animation",edited_anim);
+
+ }
+
undo_redo->add_do_method(this,"_update_library");
undo_redo->add_undo_method(this,"_update_library");
@@ -406,12 +450,28 @@ void SpriteFramesEditor::_animation_add(){
name=new_name+" "+itos(counter);
}
+ List<Node*> nodes;
+ _find_anim_sprites(EditorNode::get_singleton()->get_edited_scene(),&nodes,Ref<SpriteFrames>(frames));
+
+
undo_redo->create_action(TTR("Add Animation"));
undo_redo->add_do_method(frames,"add_animation",name);
undo_redo->add_undo_method(frames,"remove_animation",name);
undo_redo->add_do_method(this,"_update_library");
undo_redo->add_undo_method(this,"_update_library");
+
+ for(List<Node*>::Element *E=nodes.front();E;E=E->next()) {
+
+ String current = E->get()->call("get_animation");
+ if (frames->has_animation(current))
+ continue;
+
+ undo_redo->add_do_method(E->get(),"set_animation",name);
+ undo_redo->add_undo_method(E->get(),"set_animation",current);
+
+ }
+
edited_anim=new_name;
undo_redo->commit_action();
@@ -426,6 +486,7 @@ void SpriteFramesEditor::_animation_remove(){
if (!frames->has_animation(edited_anim))
return;
+
undo_redo->create_action(TTR("Remove Animation"));
undo_redo->add_do_method(frames,"remove_animation",edited_anim);
undo_redo->add_undo_method(frames,"add_animation",edited_anim);
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp
index d5f85d3333..9d27ac8aa3 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_map_editor_plugin.cpp
@@ -223,7 +223,7 @@ void TileMapEditor::_update_palette() {
String name;
if (tileset->tile_get_name(E->get())!="") {
- name = tileset->tile_get_name(E->get());
+ name = itos(E->get())+" - "+tileset->tile_get_name(E->get());
} else {
name = "#"+itos(E->get());
}
diff --git a/tools/editor/project_export.cpp b/tools/editor/project_export.cpp
index 3f82199fc3..103962716b 100644
--- a/tools/editor/project_export.cpp
+++ b/tools/editor/project_export.cpp
@@ -431,7 +431,6 @@ void ProjectExportDialog::_validate_platform() {
void ProjectExportDialog::_export_mode_changed(int p_idx) {
- bool do_all = p_idx==0;
if (EditorImportExport::get_singleton()->get_export_filter()==p_idx)
return;
EditorImportExport::get_singleton()->set_export_filter(EditorImportExport::ExportFilter(p_idx));
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index d8814fd50e..52f6d1dd9c 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -46,7 +46,7 @@
#include "io/resource_saver.h"
#include "editor_themes.h"
-
+#include "editor_initialize_ssl.h"
#include "editor_scale.h"
class NewProjectDialog : public ConfirmationDialog {
@@ -823,13 +823,13 @@ void ProjectManager::_bind_methods() {
ProjectManager::ProjectManager() {
- int margin = get_constant("margin","Dialogs");
- int button_margin = get_constant("button_margin","Dialogs");
-
// load settings
if (!EditorSettings::get_singleton())
EditorSettings::create();
+
+ EditorSettings::get_singleton()->set_optimize_save(false); //just write settings as they came
+
{
int dpi_mode = EditorSettings::get_singleton()->get("global/hidpi_mode");
if (dpi_mode==0) {
@@ -871,9 +871,6 @@ ProjectManager::ProjectManager() {
HBoxContainer *top_hb = memnew( HBoxContainer);
vb->add_child(top_hb);
- TextureFrame *logo = memnew( TextureFrame );
- logo->set_texture(theme->get_icon("LogoSmall","EditorIcons"));
- //top_hb->add_child( logo );
CenterContainer *ccl = memnew( CenterContainer );
Label *l = memnew( Label );
l->set_text(_MKSTR(VERSION_NAME)+String(" - ")+TTR("Project Manager"));
@@ -1103,6 +1100,8 @@ void ProjectListFilter::_bind_methods() {
ProjectListFilter::ProjectListFilter() {
+ editor_initialize_certificates(); //for asset sharing
+
_current_filter = FILTER_NAME;
filter_option = memnew(OptionButton);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 246785932d..7816dd9bc7 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -389,7 +389,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
List<String> names;
names.push_back("value:");
config_value_editors(1,1,50,names);
- Vector3 vec=v;
value_editor[0]->set_text( String::num(v) );
}
@@ -436,7 +435,6 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
List<String> names;
names.push_back("string:");
config_value_editors(1,1,50,names);
- Vector3 vec=v;
value_editor[0]->set_text( v );
}
@@ -612,6 +610,7 @@ bool CustomPropertyEditor::edit(Object* p_owner,const String& p_name,Variant::Ty
color_picker->set_edit_alpha(hint!=PROPERTY_HINT_COLOR_NO_ALPHA);
color_picker->set_color(v);
set_size( Size2(300*EDSCALE, color_picker->get_combined_minimum_size().height+10*EDSCALE));
+ color_picker->set_focus_on_line_edit();
/*
int ofs=80;
int m=10;
@@ -2980,10 +2979,8 @@ void PropertyEditor::update_tree() {
else
item->set_cell_mode( 1, TreeItem::CELL_MODE_RANGE_EXPRESSION );
- if (p.hint==PROPERTY_HINT_SPRITE_FRAME) {
- item->set_range_config(1,0,99999,1);
- } else if (p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
+ if (p.hint==PROPERTY_HINT_SPRITE_FRAME || p.hint==PROPERTY_HINT_RANGE || p.hint==PROPERTY_HINT_EXP_RANGE) {
int c = p.hint_string.get_slice_count(",");
float min=0,max=100,step=1;
@@ -3346,7 +3343,6 @@ void PropertyEditor::update_tree() {
String type;
if (p.hint==PROPERTY_HINT_RESOURCE_TYPE)
type=p.hint_string;
- bool notnil=false;
if (obj->get( p.name ).get_type() == Variant::NIL || obj->get( p.name ).operator RefPtr().is_null()) {
item->set_text(1,"<null>");
@@ -3369,8 +3365,7 @@ void PropertyEditor::update_tree() {
} else {
item->set_text(1,"<"+res->get_type()+">");
- };
- notnil=true;
+ }
if (has_icon(res->get_type(),"EditorIcons")) {
type=res->get_type();
diff --git a/tools/editor/quick_open.cpp b/tools/editor/quick_open.cpp
index fc2a2241ab..e18dc584d5 100644
--- a/tools/editor/quick_open.cpp
+++ b/tools/editor/quick_open.cpp
@@ -109,16 +109,27 @@ void EditorQuickOpen::_sbox_input(const InputEvent& p_ie) {
}
-void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
+float EditorQuickOpen::_path_cmp(String search, String path) const {
+
+ if (search == path) {
+ return 1.2f;
+ }
+ if (path.findn(search) != -1) {
+ return 1.1f;
+ }
+ return path.to_lower().similarity(search.to_lower());
+}
+
+void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd, Vector< Pair< String, Ref<Texture> > > &list) {
if (!add_directories) {
for(int i=0;i<efsd->get_subdir_count();i++) {
- _parse_fs(efsd->get_subdir(i));
+ _parse_fs(efsd->get_subdir(i), list);
}
}
- TreeItem *root = search_options->get_root();
+ String search_text = search_box->get_text();
if (add_directories) {
String path = efsd->get_path();
@@ -126,11 +137,27 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
path+="/";
if (path!="res://") {
path=path.substr(6,path.length());
- if (search_box->get_text().is_subsequence_ofi(path)) {
- TreeItem *ti = search_options->create_item(root);
- ti->set_text(0,path);
- Ref<Texture> icon = get_icon("folder","FileDialog");
- ti->set_icon(0,icon);
+ if (search_text.is_subsequence_ofi(path)) {
+ Pair< String, Ref<Texture> > pair;
+ pair.first = path;
+ pair.second = get_icon("folder", "FileDialog");
+
+ if (search_text != String() && list.size() > 0) {
+
+ float this_sim = _path_cmp(search_text, path);
+ float other_sim = _path_cmp(list[0].first, path);
+ int pos = 1;
+
+ while (pos < list.size() && this_sim <= other_sim) {
+ other_sim = _path_cmp(list[pos++].first, path);
+ }
+
+ pos = this_sim >= other_sim ? pos - 1 : pos;
+ list.insert(pos, pair);
+
+ } else {
+ list.push_back(pair);
+ }
}
}
}
@@ -138,12 +165,29 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
String file = efsd->get_file_path(i);
file=file.substr(6,file.length());
- if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_box->get_text().is_subsequence_ofi(file))) {
- TreeItem *ti = search_options->create_item(root);
- ti->set_text(0,file);
- Ref<Texture> icon = get_icon( (has_icon(efsd->get_file_type(i),ei)?efsd->get_file_type(i):ot),ei);
- ti->set_icon(0,icon);
+ if (ObjectTypeDB::is_type(efsd->get_file_type(i),base_type) && (search_text.is_subsequence_ofi(file))) {
+ Pair< String, Ref<Texture> > pair;
+ pair.first = file;
+ pair.second = get_icon((has_icon(efsd->get_file_type(i), ei) ? efsd->get_file_type(i) : ot), ei);
+
+ if (search_text != String() && list.size() > 0) {
+
+ float this_sim = _path_cmp(search_text, file);
+ float other_sim = _path_cmp(list[0].first, file);
+ int pos = 1;
+
+ while (pos < list.size() && this_sim <= other_sim) {
+ other_sim = _path_cmp(list[pos++].first, file);
+ }
+
+ pos = this_sim >= other_sim ? pos - 1 : pos;
+ list.insert(pos, pair);
+
+ } else {
+
+ list.push_back(pair);
+ }
}
}
@@ -151,7 +195,7 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
if (add_directories) {
for(int i=0;i<efsd->get_subdir_count();i++) {
- _parse_fs(efsd->get_subdir(i));
+ _parse_fs(efsd->get_subdir(i), list);
}
}
@@ -159,10 +203,18 @@ void EditorQuickOpen::_parse_fs(EditorFileSystemDirectory *efsd) {
void EditorQuickOpen::_update_search() {
-
search_options->clear();
TreeItem *root = search_options->create_item();
- _parse_fs(EditorFileSystem::get_singleton()->get_filesystem());
+ EditorFileSystemDirectory *efsd = EditorFileSystem::get_singleton()->get_filesystem();
+ Vector< Pair< String, Ref<Texture> > > list;
+
+ _parse_fs(efsd, list);
+
+ for (int i = 0; i < list.size(); i++) {
+ TreeItem *ti = search_options->create_item(root);
+ ti->set_text(0, list[i].first);
+ ti->set_icon(0, list[i].second);
+ }
if (root->get_children()) {
TreeItem *ti = root->get_children();
diff --git a/tools/editor/quick_open.h b/tools/editor/quick_open.h
index 520f7e569d..c253f7606e 100644
--- a/tools/editor/quick_open.h
+++ b/tools/editor/quick_open.h
@@ -32,6 +32,7 @@
#include "scene/gui/dialogs.h"
#include "scene/gui/tree.h"
#include "editor_file_system.h"
+#include "pair.h"
class EditorQuickOpen : public ConfirmationDialog {
OBJ_TYPE(EditorQuickOpen,ConfirmationDialog )
@@ -47,7 +48,8 @@ class EditorQuickOpen : public ConfirmationDialog {
void _update_search();
void _sbox_input(const InputEvent& p_ie);
- void _parse_fs(EditorFileSystemDirectory *efsd);
+ void _parse_fs(EditorFileSystemDirectory *efsd, Vector< Pair< String,Ref <Texture> > > &list);
+ float _path_cmp(String search, String path) const;
void _confirmed();
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index ab5c6e5044..4526fa26aa 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -382,11 +382,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
ERR_FAIL_COND(!top_node->get_parent());
ERR_FAIL_COND(!bottom_node->get_parent());
- int top_node_pos = top_node->get_index();
int bottom_node_pos = bottom_node->get_index();
-
- int top_node_pos_next = top_node_pos + (MOVING_DOWN ? 1 : -1);
- int bottom_node_pos_next = bottom_node_pos + (MOVING_DOWN ? 1 : -1);
+ int top_node_pos_next = top_node->get_index() + (MOVING_DOWN ? 1 : -1);
editor_data->get_undo_redo().add_do_method(top_node->get_parent(), "move_child", top_node, top_node_pos_next);
editor_data->get_undo_redo().add_undo_method(bottom_node->get_parent(), "move_child", bottom_node, bottom_node_pos);
@@ -1069,6 +1066,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
List<Pair<NodePath,NodePath> > path_renames;
+ int inc=0;
+
for(int ni=0;ni<p_nodes.size();ni++) {
//no undo for now, sorry
@@ -1085,12 +1084,16 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
}
+ if (new_parent==node->get_parent() && node->get_index() < p_position_in_parent+ni) {
+ //if child will generate a gap when moved, adjust
+ inc--;
+ }
editor_data->get_undo_redo().add_do_method(node->get_parent(),"remove_child",node);
editor_data->get_undo_redo().add_do_method(new_parent,"add_child",node);
if (p_position_in_parent>=0)
- editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+ni);
+ editor_data->get_undo_redo().add_do_method(new_parent,"move_child",node,p_position_in_parent+inc);
ScriptEditorDebugger *sed = ScriptEditor::get_singleton()->get_debugger();
String new_name = new_parent->validate_child_name(node->get_name());
@@ -1102,17 +1105,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Node2D>()->get_global_transform());
if (node->cast_to<Spatial>())
editor_data->get_undo_redo().add_do_method(node,"set_global_transform",node->cast_to<Spatial>()->get_global_transform());
- if (node->cast_to<Control>()) {
- bool can_do_it=false;
- Control *c=node->cast_to<Control>();
- if (c->get_parent()->cast_to<Container>())
- can_do_it=false;
- for(int i=0;i<4;i++) {
- if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN)
- can_do_it=false;
- }
+ if (node->cast_to<Control>())
editor_data->get_undo_redo().add_do_method(node,"set_global_pos",node->cast_to<Control>()->get_global_pos());
- }
}
editor_data->get_undo_redo().add_do_method(this,"_set_owners",edited_scene,owners);
@@ -1122,6 +1116,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
editor_data->get_undo_redo().add_undo_method(new_parent,"remove_child",node);
+ inc++;
+
}
//add and move in a second step.. (so old order is preserved)
@@ -1153,17 +1149,8 @@ void SceneTreeDock::_do_reparent(Node* p_new_parent,int p_position_in_parent,Vec
editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Node2D>()->get_transform());
if (node->cast_to<Spatial>())
editor_data->get_undo_redo().add_undo_method(node,"set_transform",node->cast_to<Spatial>()->get_transform());
- if (node->cast_to<Control>()) {
- bool can_do_it=false;
- Control *c=node->cast_to<Control>();
- if (c->get_parent()->cast_to<Container>())
- can_do_it=false;
- for(int i=0;i<4;i++) {
- if (c->get_anchor(Margin(i))!=ANCHOR_BEGIN)
- can_do_it=false;
- }
+ if (node->cast_to<Control>())
editor_data->get_undo_redo().add_undo_method(node,"set_pos",node->cast_to<Control>()->get_pos());
- }
}
@@ -1543,7 +1530,7 @@ static bool _has_visible_children(Node* p_node) {
for(int i=0;i<p_node->get_child_count();i++) {
Node* child = p_node->get_child(i);
- if (!_is_node_visible(p_node))
+ if (!_is_node_visible(child))
continue;
return true;
@@ -1555,9 +1542,9 @@ static bool _has_visible_children(Node* p_node) {
-static Node* _find_last_visible(Node*p_node) {
+static Node* _find_last_visible(Node* p_node) {
- Node*last=NULL;
+ Node* last=NULL;
bool collapsed = p_node->has_meta("_editor_collapsed") ? (bool)p_node->get_meta("_editor_collapsed") : false;
@@ -1583,7 +1570,7 @@ static Node* _find_last_visible(Node*p_node) {
}
-void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) {
+void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos, int p_type) {
to_pos=-1;
@@ -1624,6 +1611,7 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) {
//just insert over this node because nothing is above at the same level
to_pos=to_node->get_index();
to_node=to_node->get_parent();
+
}
} else if (p_type==1) {
@@ -1650,12 +1638,13 @@ void SceneTreeDock::_normalize_drop(Node*& to_node, int &to_pos,int p_type) {
break;
}
}
-
if (lower_sibling) {
to_pos=lower_sibling->get_index();
}
to_node=to_node->get_parent();
+
+
}
#if 0
//quite complicated, look for next visible in tree
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index 60bec9b4f4..51041a235b 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -139,7 +139,7 @@ class SceneTreeDock : public VBoxContainer {
void _fill_path_renames(Vector<StringName> base_path,Vector<StringName> new_base_path,Node * p_node, List<Pair<NodePath,NodePath> > *p_renames);
- void _normalize_drop(Node*& to_node, int &to_pos,int p_type);
+ void _normalize_drop(Node*& to_node, int &to_pos, int p_type);
void _nodes_dragged(Array p_nodes,NodePath p_to,int p_type);
void _files_dropped(Vector<String> p_files,NodePath p_to,int p_type);
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index cbd7df9d18..75c983994e 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -37,6 +37,8 @@
#include "editor_settings.h"
#include "scene/main/viewport.h"
+
+
bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir) {
@@ -57,60 +59,8 @@ bool ScenesDock::_create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_di
item->select(0);
}
-
- //item->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
-
- bool has_items=false;
-
- for(int i=0;i<p_dir->get_subdir_count();i++) {
-
- if (_create_tree(item,p_dir->get_subdir(i)))
- has_items=true;
- }
-#if 0
- for (int i=0;i<p_dir->get_file_count();i++) {
-
- String file_name = p_dir->get_file(i);
- String file_path = p_dir->get_file_path(i);
-
- // ScenesDockFilter::FILTER_PATH
- String search_from = file_path.right(6); // trim "res://"
- if (file_filter == ScenesDockFilter::FILTER_NAME)
- search_from = file_name;
- else if (file_filter == ScenesDockFilter::FILTER_FOLDER)
- search_from = file_path.right(6).get_base_dir();
-
- if (search_term!="" && search_from.findn(search_term)==-1)
- continue;
-
- bool isfave = favorites.has(file_path);
- if (button_favorite->is_pressed() && !isfave)
- continue;
-
- TreeItem *fitem = tree->create_item(item);
- fitem->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
- fitem->set_editable(0,true);
- fitem->set_checked(0,isfave);
- fitem->set_text(0,file_name);
-
- Ref<Texture> icon = get_icon( (has_icon(p_dir->get_file_type(i),"EditorIcons")?p_dir->get_file_type(i):String("Object")),"EditorIcons");
- fitem->set_icon(0, icon );
-
-
- fitem->set_metadata(0,file_path);
- //if (p_dir->files[i]->icon.is_valid()) {
-// fitem->set_icon(0,p_dir->files[i]->icon);
-// }
- has_items=true;
-
- }
-#endif
- /*if (!has_items) {
-
- memdelete(item);
- return false;
-
- }*/
+ for(int i=0;i<p_dir->get_subdir_count();i++)
+ _create_tree(item,p_dir->get_subdir(i));
return true;
}
@@ -164,12 +114,14 @@ void ScenesDock::_notification(int p_what) {
if (split_mode) {
file_list_vb->hide();
+ tree->set_custom_minimum_size(Size2(0,0));
tree->set_v_size_flags(SIZE_EXPAND_FILL);
button_back->show();
} else {
tree->show();
file_list_vb->show();
+ tree->set_custom_minimum_size(Size2(0,200)*EDSCALE);
tree->set_v_size_flags(SIZE_FILL);
button_back->hide();
if (!EditorFileSystem::get_singleton()->is_scanning()) {
@@ -187,6 +139,7 @@ void ScenesDock::_notification(int p_what) {
initialized=true;
EditorFileSystem::get_singleton()->connect("filesystem_changed",this,"_fs_changed");
+ EditorResourcePreview::get_singleton()->connect("preview_invalidated",this,"_preview_invalidated");
button_reload->set_icon( get_icon("Reload","EditorIcons"));
button_favorite->set_icon( get_icon("Favorites","EditorIcons"));
@@ -661,6 +614,27 @@ void ScenesDock::_go_to_dir(const String& p_dir){
}
+
+void ScenesDock::_preview_invalidated(const String& p_path) {
+
+ if (p_path.get_base_dir()==path && search_box->get_text()==String() && file_list_vb->is_visible()) {
+
+
+ for(int i=0;i<files->get_item_count();i++) {
+
+ if (files->get_item_metadata(i)==p_path) {
+ //re-request preview
+ Array udata;
+ udata.resize(2);
+ udata[0]=i;
+ udata[1]=files->get_item_text(i);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(p_path,this,"_thumbnail_done",udata);
+ break;
+ }
+ }
+ }
+}
+
void ScenesDock::_fs_changed() {
button_hist_prev->set_disabled(history_pos==0);
@@ -1618,6 +1592,9 @@ void ScenesDock::_bind_methods() {
ObjectTypeDB::bind_method(_MD("drop_data_fw"), &ScenesDock::drop_data_fw);
ObjectTypeDB::bind_method(_MD("_files_list_rmb_select"),&ScenesDock::_files_list_rmb_select);
+ ObjectTypeDB::bind_method(_MD("_preview_invalidated"),&ScenesDock::_preview_invalidated);
+
+
ADD_SIGNAL(MethodInfo("instance"));
ADD_SIGNAL(MethodInfo("open"));
@@ -1702,7 +1679,6 @@ ScenesDock::ScenesDock(EditorNode *p_editor) {
tree->set_hide_root(true);
split_box->add_child(tree);
- tree->set_custom_minimum_size(Size2(0,200)*EDSCALE);
tree->set_drag_forwarding(this);
diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h
index ed24711abb..0973fce250 100644
--- a/tools/editor/scenes_dock.h
+++ b/tools/editor/scenes_dock.h
@@ -168,6 +168,8 @@ class ScenesDock : public VBoxContainer {
bool can_drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from) const;
void drop_data_fw(const Point2& p_point,const Variant& p_data,Control* p_from);
+ void _preview_invalidated(const String& p_path);
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp
index 6d8f54d88f..fc746bc21d 100644
--- a/tools/editor/script_editor_debugger.cpp
+++ b/tools/editor/script_editor_debugger.cpp
@@ -819,7 +819,6 @@ void ScriptEditorDebugger::_performance_draw() {
if(which.empty())
return;
- Color graph_color=get_color("font_color","TextEdit");
Ref<StyleBox> graph_sb = get_stylebox("normal","TextEdit");
Ref<Font> graph_font = get_font("font","TextEdit");
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index e1a2ea162e..f436e369af 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -97,11 +97,24 @@ void EditorSettingsDialog::_clear_search_box() {
property_editor->get_property_editor()->update_tree();
}
+void EditorSettingsDialog::_clear_shortcut_search_box() {
+ if (shortcut_search_box->get_text()=="")
+ return;
+
+ shortcut_search_box->clear();
+}
+
+void EditorSettingsDialog::_filter_shortcuts(const String& p_filter) {
+ shortcut_filter = p_filter;
+ _update_shortcuts();
+}
+
void EditorSettingsDialog::_notification(int p_what) {
if (p_what==NOTIFICATION_ENTER_TREE) {
clear_button->set_icon(get_icon("Close","EditorIcons"));
+ shortcut_clear_button->set_icon(get_icon("Close","EditorIcons"));
}
}
@@ -137,26 +150,30 @@ void EditorSettingsDialog::_update_shortcuts() {
sections[section_name]=section;
section->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
section->set_custom_bg_color(1,get_color("prop_subsection","Editor"));
-
}
- TreeItem *item = shortcuts->create_item(section);
-
-
- item->set_text(0,sc->get_name());
- item->set_text(1,sc->get_as_text());
- if (!sc->is_shortcut(original) && !(sc->get_shortcut().type==InputEvent::NONE && original.type==InputEvent::NONE)) {
- item->add_button(1,get_icon("Reload","EditorIcons"),2);
+ if (shortcut_filter.is_subsequence_ofi(sc->get_name())) {
+ TreeItem *item = shortcuts->create_item(section);
+
+ item->set_text(0,sc->get_name());
+ item->set_text(1,sc->get_as_text());
+ if (!sc->is_shortcut(original) && !(sc->get_shortcut().type==InputEvent::NONE && original.type==InputEvent::NONE)) {
+ item->add_button(1,get_icon("Reload","EditorIcons"),2);
+ }
+ item->add_button(1,get_icon("Edit","EditorIcons"),0);
+ item->add_button(1,get_icon("Close","EditorIcons"),1);
+ item->set_tooltip(0,E->get());
+ item->set_metadata(0,E->get());
}
- item->add_button(1,get_icon("Edit","EditorIcons"),0);
- item->add_button(1,get_icon("Close","EditorIcons"),1);
- item->set_tooltip(0,E->get());
- item->set_metadata(0,E->get());
}
-
-
-
+ // remove sections with no shortcuts
+ for(Map<String,TreeItem*>::Element *E=sections.front();E;E=E->next()) {
+ TreeItem *section = E->get();
+ if (section->get_children() == NULL) {
+ root->remove_child(section);
+ }
+ }
}
void EditorSettingsDialog::_shortcut_button_pressed(Object* p_item,int p_column,int p_idx) {
@@ -265,7 +282,9 @@ void EditorSettingsDialog::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_settings_save"),&EditorSettingsDialog::_settings_save);
ObjectTypeDB::bind_method(_MD("_settings_changed"),&EditorSettingsDialog::_settings_changed);
ObjectTypeDB::bind_method(_MD("_clear_search_box"),&EditorSettingsDialog::_clear_search_box);
+ ObjectTypeDB::bind_method(_MD("_clear_shortcut_search_box"),&EditorSettingsDialog::_clear_shortcut_search_box);
ObjectTypeDB::bind_method(_MD("_shortcut_button_pressed"),&EditorSettingsDialog::_shortcut_button_pressed);
+ ObjectTypeDB::bind_method(_MD("_filter_shortcuts"),&EditorSettingsDialog::_filter_shortcuts);
ObjectTypeDB::bind_method(_MD("_update_shortcuts"),&EditorSettingsDialog::_update_shortcuts);
ObjectTypeDB::bind_method(_MD("_press_a_key_confirm"),&EditorSettingsDialog::_press_a_key_confirm);
ObjectTypeDB::bind_method(_MD("_wait_for_key"),&EditorSettingsDialog::_wait_for_key);
@@ -311,6 +330,23 @@ EditorSettingsDialog::EditorSettingsDialog() {
tabs->add_child(vbc);
vbc->set_name(TTR("Shortcuts"));
+ hbc = memnew( HBoxContainer );
+ hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ vbc->add_child(hbc);
+
+ l = memnew( Label );
+ l->set_text(TTR("Search:")+" ");
+ hbc->add_child(l);
+
+ shortcut_search_box = memnew( LineEdit );
+ shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ hbc->add_child(shortcut_search_box);
+ shortcut_search_box->connect("text_changed", this, "_filter_shortcuts");
+
+ shortcut_clear_button = memnew( ToolButton );
+ hbc->add_child(shortcut_clear_button);
+ shortcut_clear_button->connect("pressed",this,"_clear_shortcut_search_box");
+
shortcuts = memnew( Tree );
vbc->add_margin_child("Shortcut List:",shortcuts,true);
shortcuts->set_columns(2);
diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h
index c930de6a77..68a2b008f0 100644
--- a/tools/editor/settings_config_dialog.h
+++ b/tools/editor/settings_config_dialog.h
@@ -45,7 +45,9 @@ class EditorSettingsDialog : public AcceptDialog {
TabContainer *tabs;
LineEdit *search_box;
+ LineEdit *shortcut_search_box;
ToolButton *clear_button;
+ ToolButton *shortcut_clear_button;
SectionedPropertyEditor *property_editor;
Timer *timer;
@@ -56,6 +58,7 @@ class EditorSettingsDialog : public AcceptDialog {
Label *press_a_key_label;
InputEvent last_wait_for_key;
String shortcut_configured;
+ String shortcut_filter;
virtual void cancel_pressed();
virtual void ok_pressed();
@@ -69,8 +72,11 @@ class EditorSettingsDialog : public AcceptDialog {
void _press_a_key_confirm();
void _wait_for_key(const InputEvent& p_event);
+ void _clear_shortcut_search_box();
void _clear_search_box();
+ void _filter_shortcuts(const String& p_filter);
+
void _update_shortcuts();
void _shortcut_button_pressed(Object* p_item,int p_column,int p_idx);
diff --git a/tools/editor/spatial_editor_gizmos.cpp b/tools/editor/spatial_editor_gizmos.cpp
index 1ca62d3a63..edc2fc513d 100644
--- a/tools/editor/spatial_editor_gizmos.cpp
+++ b/tools/editor/spatial_editor_gizmos.cpp
@@ -424,16 +424,11 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
}
Transform ti=t.affine_inverse();
- Vector3 ray_from=ti.xform(p_camera->project_ray_origin(p_point));
- Vector3 ray_dir=t.basis.xform_inv(p_camera->project_ray_normal(p_point)).normalized();
- Vector3 ray_to = ray_from+ray_dir*4096;
float min_d=1e20;
int idx=-1;
for(int i=0;i<secondary_handles.size();i++) {
-#if 1
-
Vector3 hpos = t.xform(secondary_handles[i]);
Vector2 p = p_camera->unproject_position(hpos);
@@ -449,31 +444,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
idx=i+handles.size();
}
-
- }
-
-#else
- AABB aabb;
- aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE;
- aabb.size=aabb.pos*-2;
- aabb.pos+=secondary_handles[i];
-
-
- Vector3 rpos,rnorm;
-
- if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) {
-
- real_t dp = ray_dir.dot(rpos);
- if (dp<min_d) {
-
- r_pos=t.xform(rpos);
- r_normal=ti.basis.xform_inv(rnorm).normalized();
- min_d=dp;
- idx=i+handles.size();
-
- }
}
-#endif
}
if (p_sec_first && idx!=-1) {
@@ -486,9 +457,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
for(int i=0;i<handles.size();i++) {
-#if 1
-
-
Vector3 hpos = t.xform(handles[i]);
Vector2 p = p_camera->unproject_position(hpos);
if (p.distance_to(p_point)<SpatialEditorGizmos::singleton->handle_t->get_width()*0.6) {
@@ -503,32 +471,7 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
idx=i;
}
-
- }
-
-#else
-
- AABB aabb;
- aabb.pos=Vector3(-1,-1,-1)*HANDLE_HALF_SIZE;
- aabb.size=aabb.pos*-2;
- aabb.pos+=handles[i];
-
-
- Vector3 rpos,rnorm;
-
- if (aabb.intersects_segment(ray_from,ray_to,&rpos,&rnorm)) {
-
- real_t dp = ray_dir.dot(rpos);
- if (dp<min_d) {
-
- r_pos=t.xform(rpos);
- r_normal=ti.basis.xform_inv(rnorm).normalized();
- min_d=dp;
- idx=i;
-
- }
}
-#endif
}
if (idx>=0) {
@@ -612,9 +555,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
Vector3 ray_dir=ai.basis.xform(p_camera->project_ray_normal(p_point)).normalized();
Vector3 rpos,rnorm;
-#if 1
-
-
if (collision_mesh->intersect_ray(ray_from,ray_dir,rpos,rnorm)) {
@@ -622,16 +562,6 @@ bool EditorSpatialGizmo::intersect_ray(const Camera *p_camera,const Point2& p_po
r_normal=gt.basis.xform(rnorm).normalized();
return true;
}
-#else
-
- if (collision_mesh->intersect_segment(ray_from,ray_from+ray_dir*4906.0,rpos,rnorm)) {
-
- r_pos=gt.xform(rpos);
- r_normal=gt.basis.xform(rnorm).normalized();
- return true;
- }
-
-#endif
}
return false;
@@ -2250,7 +2180,6 @@ void VisibilityNotifierGizmo::set_handle(int p_idx,Camera *p_camera, const Point
if (d<0.001)
d=0.001;
- Vector3 he = aabb.size;
aabb.pos[p_idx]=(aabb.pos[p_idx]+aabb.size[p_idx]*0.5)-d;
aabb.size[p_idx]=d*2;
notifier->set_aabb(aabb);
@@ -2456,8 +2385,6 @@ void HingeJointSpatialGizmo::redraw() {
if (p3d->get_flag(HingeJoint::FLAG_USE_LIMIT) && ll<ul) {
const int points = 32;
- float step = (ul-ll)/points;
-
for(int i=0;i<points;i++) {
@@ -2573,8 +2500,6 @@ void SliderJointSpatialGizmo::redraw() {
if (ll<ul) {
const int points = 32;
- float step = (ul-ll)/points;
-
for(int i=0;i<points;i++) {
@@ -2641,7 +2566,6 @@ SliderJointSpatialGizmo::SliderJointSpatialGizmo(SliderJoint* p_p3d) {
void ConeTwistJointSpatialGizmo::redraw() {
clear();
- float cs = 0.25;
Vector<Vector3> points;
float r = 1.0;
@@ -2837,8 +2761,6 @@ void Generic6DOFJointSpatialGizmo::redraw() {
if (enable_ang && ll<=ul) {
const int points = 32;
- float step = (ul-ll)/points;
-
for(int i=0;i<points;i++) {