summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/array_property_edit.cpp9
-rw-r--r--tools/editor/array_property_edit.h2
-rw-r--r--tools/editor/editor_dir_dialog.cpp17
-rw-r--r--tools/editor/editor_file_dialog.cpp19
-rw-r--r--tools/editor/editor_file_dialog.h2
-rw-r--r--tools/editor/editor_import_export.cpp9
-rw-r--r--tools/editor/editor_name_dialog.cpp (renamed from tools/editor/editor_layout_dialog.cpp)64
-rw-r--r--tools/editor/editor_name_dialog.h (renamed from tools/editor/editor_layout_dialog.h)22
-rw-r--r--tools/editor/editor_node.cpp16
-rw-r--r--tools/editor/editor_node.h8
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/editor_sub_scene.cpp12
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp43
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp6
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.cpp47
-rw-r--r--tools/editor/plugins/tile_set_editor_plugin.h7
-rw-r--r--tools/editor/progress_dialog.cpp12
-rw-r--r--tools/editor/progress_dialog.h3
-rw-r--r--tools/editor/project_manager.cpp7
-rw-r--r--tools/editor/project_manager.h1
-rw-r--r--tools/editor/project_settings.cpp105
-rw-r--r--tools/editor/project_settings.h6
-rw-r--r--tools/editor/property_editor.cpp212
-rw-r--r--tools/editor/property_editor.h26
-rw-r--r--tools/editor/reparent_dialog.cpp16
-rw-r--r--tools/editor/scene_tree_editor.cpp5
-rw-r--r--tools/editor/scenes_dock.cpp10
-rw-r--r--tools/editor/scenes_dock.h1
-rw-r--r--tools/editor/settings_config_dialog.cpp12
-rw-r--r--tools/editor/settings_config_dialog.h2
30 files changed, 569 insertions, 134 deletions
diff --git a/tools/editor/array_property_edit.cpp b/tools/editor/array_property_edit.cpp
index 9cd443270b..64a2762095 100644
--- a/tools/editor/array_property_edit.cpp
+++ b/tools/editor/array_property_edit.cpp
@@ -209,6 +209,15 @@ void ArrayPropertyEdit::edit(Object* p_obj,const StringName& p_prop,Variant::Typ
}
+Node *ArrayPropertyEdit::get_node() {
+
+ Object *o = ObjectDB::get_instance(obj);
+ if (!o)
+ return NULL;
+
+ return o->cast_to<Node>();
+}
+
void ArrayPropertyEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_set_size"),&ArrayPropertyEdit::_set_size);
diff --git a/tools/editor/array_property_edit.h b/tools/editor/array_property_edit.h
index acfb8e68ed..948b2a71a3 100644
--- a/tools/editor/array_property_edit.h
+++ b/tools/editor/array_property_edit.h
@@ -30,6 +30,8 @@ public:
void edit(Object* p_obj, const StringName& p_prop, Variant::Type p_deftype);
+ Node *get_node();
+
ArrayPropertyEdit();
};
diff --git a/tools/editor/editor_dir_dialog.cpp b/tools/editor/editor_dir_dialog.cpp
index a8421acff8..1f3b5eed65 100644
--- a/tools/editor/editor_dir_dialog.cpp
+++ b/tools/editor/editor_dir_dialog.cpp
@@ -205,31 +205,36 @@ void EditorDirDialog::_bind_methods() {
EditorDirDialog::EditorDirDialog() {
+ updating=false;
+
set_title("Choose a Directory");
+ set_hide_on_ok(false);
+
tree = memnew( Tree );
add_child(tree);
set_child_rect(tree);
- updating=false;
- get_ok()->set_text("Choose");
- set_hide_on_ok(false);
-
-
+ tree->connect("item_activated",this,"_ok");
makedir = add_button("Create Folder",OS::get_singleton()->get_swap_ok_cancel()?true:false,"makedir");
makedir->connect("pressed",this,"_make_dir");
makedialog = memnew( ConfirmationDialog );
makedialog->set_title("Create Folder");
+ add_child(makedialog);
+
VBoxContainer *makevb= memnew( VBoxContainer );
makedialog->add_child(makevb);
makedialog->set_child_rect(makevb);
+
makedirname = memnew( LineEdit );
makevb->add_margin_child("Name:",makedirname);
- add_child(makedialog);
makedialog->register_text_enter(makedirname);
makedialog->connect("confirmed",this,"_make_dir_confirm");
+
mkdirerr = memnew( AcceptDialog );
mkdirerr->set_text("Could not create folder.");
add_child(mkdirerr);
+ get_ok()->set_text("Choose");
+
}
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp
index 61ad7b6cbb..fc7ee2bde7 100644
--- a/tools/editor/editor_file_dialog.cpp
+++ b/tools/editor/editor_file_dialog.cpp
@@ -55,11 +55,8 @@ void EditorFileDialog::_notification(int p_what) {
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
} else if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- bool show_hidden = EditorSettings::get_singleton()->get("file_dialog/show_hidden_files");
-
- if (show_hidden != show_hidden_files) {
- set_show_hidden_files(show_hidden);
- }
+ set_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
+ set_display_mode((DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int());
}
}
@@ -1026,6 +1023,8 @@ void EditorFileDialog::_go_forward(){
bool EditorFileDialog::default_show_hidden_files=false;
+EditorFileDialog::DisplayMode EditorFileDialog::default_display_mode=DISPLAY_THUMBNAILS;
+
void EditorFileDialog::set_display_mode(DisplayMode p_mode) {
if (display_mode==p_mode)
@@ -1125,6 +1124,10 @@ void EditorFileDialog::set_default_show_hidden_files(bool p_show) {
default_show_hidden_files=p_show;
}
+void EditorFileDialog::set_default_display_mode(DisplayMode p_mode) {
+ default_display_mode=p_mode;
+}
+
void EditorFileDialog::_save_to_recent() {
String dir = get_current_dir();
@@ -1154,7 +1157,7 @@ void EditorFileDialog::_save_to_recent() {
EditorFileDialog::EditorFileDialog() {
show_hidden_files=default_show_hidden_files;
- display_mode=DISPLAY_THUMBNAILS;
+ display_mode=default_display_mode;
local_history_pos=0;
VBoxContainer *vbc = memnew( VBoxContainer );
@@ -1194,11 +1197,13 @@ EditorFileDialog::EditorFileDialog() {
mode_thumbnails = memnew( ToolButton );
mode_thumbnails->connect("pressed",this,"set_display_mode",varray(DISPLAY_THUMBNAILS));
mode_thumbnails->set_toggle_mode(true);
- mode_thumbnails->set_pressed(true);
+ mode_thumbnails->set_pressed(display_mode==DISPLAY_THUMBNAILS);
pathhb->add_child(mode_thumbnails);
+
mode_list = memnew( ToolButton );
mode_list->connect("pressed",this,"set_display_mode",varray(DISPLAY_LIST));
mode_list->set_toggle_mode(true);
+ mode_list->set_pressed(display_mode==DISPLAY_LIST);
pathhb->add_child(mode_list);
drives = memnew( OptionButton );
diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h
index eb38c3c02f..b72b1fa4ef 100644
--- a/tools/editor/editor_file_dialog.h
+++ b/tools/editor/editor_file_dialog.h
@@ -128,6 +128,7 @@ private:
int preview_wheel_index;
float preview_wheel_timeout;
static bool default_show_hidden_files;
+ static DisplayMode default_display_mode;
bool show_hidden_files;
DisplayMode display_mode;
@@ -211,6 +212,7 @@ public:
bool is_showing_hidden_files() const;
static void set_default_show_hidden_files(bool p_show);
+ static void set_default_display_mode(DisplayMode p_mode);
void invalidate();
diff --git a/tools/editor/editor_import_export.cpp b/tools/editor/editor_import_export.cpp
index b6c68d05be..c50a95a93d 100644
--- a/tools/editor/editor_import_export.cpp
+++ b/tools/editor/editor_import_export.cpp
@@ -1064,7 +1064,7 @@ Error EditorExportPlatform::save_pack_file(void *p_userdata,const String& p_path
MD5Final(&ctx);
pd->f->store_buffer(ctx.digest,16);
}
- pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total);
+ pd->ep->step("Storing File: "+p_path,2+p_file*100/p_total,false);
pd->count++;
pd->ftmp->store_buffer(p_data.ptr(),p_data.size());
if (pd->alignment > 1) {
@@ -1102,7 +1102,7 @@ Error EditorExportPlatform::save_zip_file(void *p_userdata,const String& p_path,
zipWriteInFileInZip(zip,p_data.ptr(),p_data.size());
zipCloseFileInZip(zip);
- zd->ep->step("Storing File: "+p_path,2+p_file*100/p_total);
+ zd->ep->step("Storing File: "+p_path,2+p_file*100/p_total,false);
zd->count++;
return OK;
@@ -1128,10 +1128,7 @@ Error EditorExportPlatform::save_zip(const String& p_path, bool p_make_bundles)
zipClose(zip,NULL);
- if (err)
- return err;
-
-
+ return err;
}
Error EditorExportPlatform::save_pack(FileAccess *dst,bool p_make_bundles, int p_alignment) {
diff --git a/tools/editor/editor_layout_dialog.cpp b/tools/editor/editor_name_dialog.cpp
index e37f263c0c..82050e0a56 100644
--- a/tools/editor/editor_layout_dialog.cpp
+++ b/tools/editor/editor_name_dialog.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_node.cpp */
+/* editor_name_dialog.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,33 +27,63 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "editor_layout_dialog.h"
+#include "editor_name_dialog.h"
#include "object_type_db.h"
+#include "os/keyboard.h"
-void EditorLayoutDialog::clear_layout_name() {
+void EditorNameDialog::_line_input_event(const InputEvent& p_event) {
- layout_name->clear();
+ if (p_event.type == InputEvent::KEY) {
+
+ if (!p_event.key.pressed)
+ return;
+
+ switch (p_event.key.scancode) {
+ case KEY_ENTER:
+ case KEY_RETURN: {
+
+ if (get_hide_on_ok())
+ hide();
+ ok_pressed();
+ accept_event();
+ } break;
+ case KEY_ESCAPE: {
+
+ hide();
+ accept_event();
+ } break;
+ }
+ }
}
-void EditorLayoutDialog::ok_pressed() {
+void EditorNameDialog::_post_popup() {
- if (layout_name->get_text()!="") {
- emit_signal("layout_selected", layout_name->get_text());
+ ConfirmationDialog::_post_popup();
+ name->clear();
+ name->grab_focus();
+}
+
+void EditorNameDialog::ok_pressed() {
+
+ if (name->get_text()!="") {
+ emit_signal("name_confirmed", name->get_text());
}
}
-void EditorLayoutDialog::_bind_methods() {
+void EditorNameDialog::_bind_methods() {
- ADD_SIGNAL(MethodInfo("layout_selected",PropertyInfo( Variant::STRING,"layout_name")));
+ ObjectTypeDB::bind_method("_line_input_event",&EditorNameDialog::_line_input_event);
+
+ ADD_SIGNAL(MethodInfo("name_confirmed",PropertyInfo( Variant::STRING,"name")));
}
-EditorLayoutDialog::EditorLayoutDialog()
+EditorNameDialog::EditorNameDialog()
{
-
- layout_name = memnew( LineEdit );
- layout_name->set_margin(MARGIN_TOP,5);
- layout_name->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
- layout_name->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
- add_child(layout_name);
- move_child(layout_name, get_label()->get_index()+1);
+ name = memnew( LineEdit );
+ add_child(name);
+ move_child(name, get_label()->get_index()+1);
+ name->set_margin(MARGIN_TOP,5);
+ name->set_anchor_and_margin(MARGIN_LEFT,ANCHOR_BEGIN,5);
+ name->set_anchor_and_margin(MARGIN_RIGHT,ANCHOR_END,5);
+ name->connect("input_event", this, "_line_input_event");
}
diff --git a/tools/editor/editor_layout_dialog.h b/tools/editor/editor_name_dialog.h
index 7e3b9e3d8a..85f4f772e6 100644
--- a/tools/editor/editor_layout_dialog.h
+++ b/tools/editor/editor_name_dialog.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* editor_layout_dialog.h */
+/* editor_name_dialog.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -27,27 +27,31 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef EDITOR_LAYOUT_DIALOG_H
-#define EDITOR_LAYOUT_DIALOG_H
+#ifndef EDITOR_NAME_DIALOG_H
+#define EDITOR_NAME_DIALOG_H
#include "scene/gui/dialogs.h"
#include "scene/gui/line_edit.h"
-class EditorLayoutDialog : public ConfirmationDialog {
+class EditorNameDialog : public ConfirmationDialog {
- OBJ_TYPE( EditorLayoutDialog, ConfirmationDialog );
+ OBJ_TYPE( EditorNameDialog, ConfirmationDialog );
- LineEdit *layout_name;
+ LineEdit *name;
+
+ void _line_input_event(const InputEvent& p_event);
protected:
static void _bind_methods();
virtual void ok_pressed();
+ virtual void _post_popup();
public:
- void clear_layout_name();
- EditorLayoutDialog();
+ LineEdit* get_line_edit() { return name; }
+
+ EditorNameDialog();
};
-#endif // EDITOR_LAYOUT_DIALOG_H
+#endif // EDITOR_NAME_DIALOG_H
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 05df0a3e48..b30c875866 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -4040,9 +4040,9 @@ void EditorNode::progress_add_task(const String& p_task,const String& p_label, i
singleton->progress_dialog->add_task(p_task,p_label,p_steps);
}
-void EditorNode::progress_task_step(const String& p_task, const String& p_state, int p_step) {
+void EditorNode::progress_task_step(const String& p_task, const String& p_state, int p_step,bool p_force_redraw) {
- singleton->progress_dialog->task_step(p_task,p_state,p_step);
+ singleton->progress_dialog->task_step(p_task,p_state,p_step,p_force_redraw);
}
@@ -4124,7 +4124,6 @@ void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("_dock_move_right",&EditorNode::_dock_move_right);
ObjectTypeDB::bind_method("_layout_menu_option",&EditorNode::_layout_menu_option);
- ObjectTypeDB::bind_method("_layout_dialog_action",&EditorNode::_dialog_action);
ObjectTypeDB::bind_method("set_current_scene",&EditorNode::set_current_scene);
ObjectTypeDB::bind_method("set_current_version",&EditorNode::set_current_version);
@@ -4624,7 +4623,6 @@ void EditorNode::_layout_menu_option(int p_id) {
case SETTINGS_LAYOUT_SAVE: {
current_option=p_id;
- layout_dialog->clear_layout_name();
layout_dialog->set_title("Save Layout");
layout_dialog->get_ok()->set_text("Save");
layout_dialog->popup_centered();
@@ -4632,7 +4630,6 @@ void EditorNode::_layout_menu_option(int p_id) {
case SETTINGS_LAYOUT_DELETE: {
current_option=p_id;
- layout_dialog->clear_layout_name();
layout_dialog->set_title("Delete Layout");
layout_dialog->get_ok()->set_text("Delete");
layout_dialog->popup_centered();
@@ -4651,8 +4648,7 @@ void EditorNode::_layout_menu_option(int p_id) {
return; //no config
}
- int idx=editor_layouts->get_item_index(p_id);
- _load_docks_from_config(config, editor_layouts->get_item_text(idx));
+ _load_docks_from_config(config, editor_layouts->get_item_text(p_id));
_save_docks();
}
@@ -4770,6 +4766,7 @@ EditorNode::EditorNode() {
ResourceLoader::set_abort_on_missing_resources(false);
FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
EditorFileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("file_dialog/show_hidden_files"));
+ EditorFileDialog::set_default_display_mode((EditorFileDialog::DisplayMode)EditorSettings::get_singleton()->get("file_dialog/display_mode").operator int());
ResourceLoader::set_error_notify_func(this,_load_error_notify);
ResourceLoader::set_dependency_error_notify_func(this,_dependency_error_report);
@@ -5428,13 +5425,13 @@ EditorNode::EditorNode() {
p->add_separator();
p->add_item("About",SETTINGS_ABOUT);
- layout_dialog = memnew( EditorLayoutDialog );
+ layout_dialog = memnew( EditorNameDialog );
gui_base->add_child(layout_dialog);
layout_dialog->set_hide_on_ok(false);
layout_dialog->set_size(Size2(175, 70));
confirm_error = memnew( AcceptDialog );
layout_dialog->add_child(confirm_error);
- layout_dialog->connect("layout_selected", this,"_layout_dialog_action");
+ layout_dialog->connect("name_confirmed", this,"_dialog_action");
sources_button = memnew( ToolButton );
right_menu_hb->add_child(sources_button);
@@ -5616,6 +5613,7 @@ EditorNode::EditorNode() {
scenes_dock = memnew( ScenesDock(this) );
scenes_dock->set_name("FileSystem");
+ scenes_dock->set_use_thumbnails(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_THUMBNAILS);
dock_slot[DOCK_SLOT_LEFT_BR]->add_child(scenes_dock);
//prop_pallete->add_child(scenes_dock);
scenes_dock->connect("open",this,"open_request");
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index c4429f943b..0a087eb1ed 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -76,7 +76,7 @@
#include "editor_reimport_dialog.h"
#include "import_settings.h"
#include "tools/editor/editor_plugin.h"
-#include "tools/editor/editor_layout_dialog.h"
+#include "tools/editor/editor_name_dialog.h"
#include "fileserver/editor_file_server.h"
#include "editor_resource_preview.h"
@@ -290,7 +290,7 @@ class EditorNode : public Node {
Ref<ConfigFile> default_theme;
PopupMenu *editor_layouts;
- EditorLayoutDialog *layout_dialog;
+ EditorNameDialog *layout_dialog;
AcceptDialog *confirm_error;
//OptimizedPresetsDialog *optimized_presets;
@@ -647,7 +647,7 @@ public:
static void add_io_error(const String& p_error);
static void progress_add_task(const String& p_task,const String& p_label, int p_steps);
- static void progress_task_step(const String& p_task,const String& p_state, int p_step=-1);
+ static void progress_task_step(const String& p_task,const String& p_state, int p_step=-1,bool p_force_refresh=true);
static void progress_end_task(const String& p_task);
static void progress_add_task_bg(const String& p_task,const String& p_label, int p_steps);
@@ -674,7 +674,7 @@ public:
struct EditorProgress {
String task;
- void step(const String& p_state, int p_step=-1) { EditorNode::progress_task_step(task,p_state,p_step); }
+ void step(const String& p_state, int p_step=-1,bool p_force_refresh=true) { EditorNode::progress_task_step(task,p_state,p_step,p_force_refresh); }
EditorProgress(const String& p_task,const String& p_label,int p_amount) { EditorNode::progress_add_task(p_task,p_label,p_amount); task=p_task; }
~EditorProgress() { EditorNode::progress_end_task(task); }
};
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index 15de6e7266..5c36b842c7 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -515,6 +515,8 @@ void EditorSettings::_load_defaults() {
set("text_editor/create_signal_callbacks",true);
set("file_dialog/show_hidden_files", false);
+ set("file_dialog/display_mode", 0);
+ hints["file_dialog/display_mode"]=PropertyInfo(Variant::INT,"file_dialog/display_mode",PROPERTY_HINT_ENUM,"Thumbnails,List");
set("file_dialog/thumbnail_size", 64);
hints["file_dialog/thumbnail_size"]=PropertyInfo(Variant::INT,"file_dialog/thumbnail_size",PROPERTY_HINT_RANGE,"32,128,16");
diff --git a/tools/editor/editor_sub_scene.cpp b/tools/editor/editor_sub_scene.cpp
index 2a6eba2554..d7d79e5cc7 100644
--- a/tools/editor/editor_sub_scene.cpp
+++ b/tools/editor/editor_sub_scene.cpp
@@ -196,7 +196,11 @@ void EditorSubScene::_bind_methods() {
EditorSubScene::EditorSubScene() {
+ scene=NULL;
+
set_title("Select Sub-Scene..");
+ set_hide_on_ok(false);
+
VBoxContainer *vb = memnew( VBoxContainer );
add_child(vb);
set_child_rect(vb);
@@ -211,9 +215,11 @@ EditorSubScene::EditorSubScene() {
hb->add_child(b);
b->connect("pressed",this,"_path_browse");
vb->add_margin_child("Scene Path:",hb);
+
tree = memnew( Tree );
tree->set_v_size_flags(SIZE_EXPAND_FILL);
- vb->add_margin_child("Import From Node:",tree)->set_v_size_flags(SIZE_EXPAND_FILL);
+ vb->add_margin_child("Import From Node:",tree,true);
+ tree->connect("item_activated",this,"_ok");
file_dialog = memnew( EditorFileDialog );
List<String> extensions;
@@ -228,8 +234,4 @@ EditorSubScene::EditorSubScene() {
add_child(file_dialog);
file_dialog->connect("file_selected",this,"_path_selected");
- scene=NULL;
-
- set_hide_on_ok(false);
-
}
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index d57cff850e..ffc2d057e3 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -68,6 +68,7 @@ struct ColladaImport {
Map<String,NodeMap> node_map; //map from collada node to engine node
+ Map<String,String> node_name_map; //map from collada node to engine node
Map<String, Ref<Mesh> > mesh_cache;
Map<String, Ref<Curve3D> > curve_cache;
Map<String, Ref<Material> > material_cache;
@@ -124,6 +125,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton,Collada::Node *p_no
nm.node=p_skeleton;
nm.bone = r_bone;
node_map[p_node->id]=nm;
+ node_name_map[p_node->name]=p_node->id;
skeleton_bone_map[p_skeleton][joint->sid]=r_bone;
@@ -345,6 +347,7 @@ Error ColladaImport::_create_scene(Collada::Node *p_node, Spatial *p_parent) {
NodeMap nm;
nm.node=node;
node_map[p_node->id]=nm;
+ node_name_map[p_node->name]=p_node->id;
Transform xf = p_node->default_transform;
xf = collada.fix_transform( xf ) * p_node->post_transform;
@@ -1906,9 +1909,20 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) {
Collada::AnimationTrack &at = collada.state.animation_tracks[i];
//print_line("CHANNEL: "+at.target+" PARAM: "+at.param);
+
+ String node;
+
if (!node_map.has(at.target)) {
- print_line("Coudlnt find node: "+at.target);
- continue;
+
+ if (node_name_map.has(at.target)) {
+
+ node=node_name_map[at.target];
+ } else {
+ print_line("Coudlnt find node: "+at.target);
+ continue;
+ }
+ } else {
+ node=at.target;
}
@@ -1917,8 +1931,9 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones) {
valid_animated_properties.push_back(i);
} else {
- node_map[at.target].anim_tracks.push_back(i);
- valid_animated_nodes.insert(at.target);
+
+ node_map[node].anim_tracks.push_back(i);
+ valid_animated_nodes.insert(node);
}
}
@@ -1934,6 +1949,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Ref<Animation> animation = Ref<Animation>( memnew( Animation ));
+
if (p_clip==-1) {
//print_line("default");
@@ -2007,10 +2023,12 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
while(f<anim_length) {
base_snapshots.push_back(f);
+
f+=snapshot_interval;
if (f>=anim_length) {
base_snapshots.push_back(anim_length);
+
}
}
@@ -2019,11 +2037,17 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
bool tracks_found=false;
+
+
for(Set<String>::Element* E=valid_animated_nodes.front();E;E=E->next()) {
// take snapshots
- if (!collada.state.scene_map.has(E->get()))
+
+
+ if (!collada.state.scene_map.has(E->get())) {
+
continue;
+ }
NodeMap &nm = node_map[E->get()];
String path = scene->get_path_to(nm.node);
@@ -2039,7 +2063,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Collada::Node *cn = collada.state.scene_map[E->get()];
if (cn->ignore_anim) {
- //print_line("warning, ignoring animation on node: "+path);
+
continue;
}
@@ -2058,20 +2082,23 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
for(int i=0;i<at.keys.size();i++)
snapshots.push_back(at.keys[i].time);
- print_line("using anim snapshots");
}
for(int i=0;i<snapshots.size();i++) {
+
for(List<int>::Element *ET=nm.anim_tracks.front();ET;ET=ET->next()) {
//apply tracks
+
if (p_clip==-1) {
- if (track_filter.has(ET->get()))
+ if (track_filter.has(ET->get())) {
+
continue;
+ }
} else {
if (!track_filter.has(ET->get()))
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index df6397ed1d..f22bd3d956 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -1773,7 +1773,7 @@ void ScriptEditor::_update_script_colors() {
if (h>hist_size) {
continue;
}
- float v = Math::ease((edit_pass-pass)/float_t(hist_size),0.4);
+ float v = Math::ease((edit_pass-pass)/float(hist_size),0.4);
script_list->set_item_custom_bg_color(i,hot_color.linear_interpolate(cold_color,v));
@@ -2256,6 +2256,10 @@ void ScriptEditor::_history_back(){
void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/open_dominant_script_on_scene_change");
+
+ if (bool(EditorSettings::get_singleton()->get("external_editor/use_external_editor")))
+ return;
+
if (open_dominant && p_script.is_valid()) {
edit(p_script);
}
diff --git a/tools/editor/plugins/tile_set_editor_plugin.cpp b/tools/editor/plugins/tile_set_editor_plugin.cpp
index 09115472a8..b61fe6806b 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.cpp
+++ b/tools/editor/plugins/tile_set_editor_plugin.cpp
@@ -145,10 +145,6 @@ void TileSetEditor::_menu_confirm() {
switch(option) {
- case MENU_OPTION_REMOVE_ITEM: {
-
- tileset->remove_tile(to_erase);
- } break;
case MENU_OPTION_MERGE_FROM_SCENE:
case MENU_OPTION_CREATE_FROM_SCENE: {
@@ -165,6 +161,27 @@ void TileSetEditor::_menu_confirm() {
}
}
+void TileSetEditor::_name_dialog_confirm(const String& name) {
+
+ switch (option) {
+
+ case MENU_OPTION_REMOVE_ITEM: {
+
+ int id=tileset->find_tile_by_name(name);
+
+ if (id<0 && name.is_valid_integer())
+ id=name.to_int();
+
+ if (tileset->has_tile(id)) {
+ tileset->remove_tile(id);
+ } else {
+ err_dialog->set_text("Could not find tile: " + name);
+ err_dialog->popup_centered(Size2(300, 60));
+ }
+ } break;
+ }
+}
+
void TileSetEditor::_menu_cbk(int p_option) {
option=p_option;
@@ -176,13 +193,9 @@ void TileSetEditor::_menu_cbk(int p_option) {
} break;
case MENU_OPTION_REMOVE_ITEM: {
- String p = editor->get_property_editor()->get_selected_path();
- if (p.begins_with("/TileSet") && p.get_slice_count("/")>=2) {
-
- to_erase = p.get_slice("/",2).to_int();
- cd->set_text("Remove Item "+itos(to_erase)+"?");
- cd->popup_centered(Size2(300,60));
- }
+ nd->set_title("Remove Item");
+ nd->set_text("Item name or ID:");
+ nd->popup_centered(Size2(300, 95));
} break;
case MENU_OPTION_CREATE_FROM_SCENE: {
@@ -210,6 +223,7 @@ void TileSetEditor::_bind_methods() {
ObjectTypeDB::bind_method("_menu_cbk",&TileSetEditor::_menu_cbk);
ObjectTypeDB::bind_method("_menu_confirm",&TileSetEditor::_menu_confirm);
+ ObjectTypeDB::bind_method("_name_dialog_confirm",&TileSetEditor::_name_dialog_confirm);
}
TileSetEditor::TileSetEditor(EditorNode *p_editor) {
@@ -222,7 +236,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
options->set_pos(Point2(1,1));
options->set_text("Theme");
options->get_popup()->add_item("Add Item",MENU_OPTION_ADD_ITEM);
- options->get_popup()->add_item("Remove Selected Item",MENU_OPTION_REMOVE_ITEM);
+ options->get_popup()->add_item("Remove Item",MENU_OPTION_REMOVE_ITEM);
options->get_popup()->add_separator();
options->get_popup()->add_item("Create from Scene",MENU_OPTION_CREATE_FROM_SCENE);
options->get_popup()->add_item("Merge from Scene",MENU_OPTION_MERGE_FROM_SCENE);
@@ -232,6 +246,15 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) {
add_child(cd);
cd->get_ok()->connect("pressed", this,"_menu_confirm");
+ nd = memnew(EditorNameDialog);
+ add_child(nd);
+ nd->set_hide_on_ok(true);
+ nd->get_line_edit()->set_margin(MARGIN_TOP,28);
+ nd->connect("name_confirmed", this,"_name_dialog_confirm");
+
+ err_dialog = memnew(AcceptDialog);
+ add_child(err_dialog);
+ err_dialog->set_title("Error");
}
void TileSetEditorPlugin::edit(Object *p_node) {
diff --git a/tools/editor/plugins/tile_set_editor_plugin.h b/tools/editor/plugins/tile_set_editor_plugin.h
index df82df6993..0a646001ab 100644
--- a/tools/editor/plugins/tile_set_editor_plugin.h
+++ b/tools/editor/plugins/tile_set_editor_plugin.h
@@ -33,6 +33,7 @@
#include "scene/resources/tile_set.h"
#include "tools/editor/editor_node.h"
+#include "tools/editor/editor_name_dialog.h"
class TileSetEditor : public Control {
@@ -44,7 +45,8 @@ class TileSetEditor : public Control {
EditorNode *editor;
MenuButton *menu;
ConfirmationDialog *cd;
- int to_erase;
+ EditorNameDialog *nd;
+ AcceptDialog *err_dialog;
enum {
@@ -56,7 +58,8 @@ class TileSetEditor : public Control {
int option;
void _menu_cbk(int p_option);
- void _menu_confirm();
+ void _menu_confirm();
+ void _name_dialog_confirm(const String& name);
static void _import_scene(Node *p_scene, Ref<TileSet> p_library, bool p_merge);
diff --git a/tools/editor/progress_dialog.cpp b/tools/editor/progress_dialog.cpp
index c8b87486c0..90398767ea 100644
--- a/tools/editor/progress_dialog.cpp
+++ b/tools/editor/progress_dialog.cpp
@@ -29,7 +29,7 @@
#include "progress_dialog.h"
#include "main/main.h"
#include "message_queue.h"
-
+#include "os/os.h"
void BackgroundProgress::_add_task(const String& p_task,const String& p_label, int p_steps) {
@@ -191,10 +191,16 @@ void ProgressDialog::add_task(const String& p_task,const String& p_label,int p_s
}
-void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step){
+void ProgressDialog::task_step(const String& p_task, const String& p_state, int p_step,bool p_force_redraw){
ERR_FAIL_COND(!tasks.has(p_task));
+ if (!p_force_redraw) {
+ uint64_t tus = OS::get_singleton()->get_ticks_usec();
+ if (tus-last_progress_tick < 50000) //50ms
+ return;
+ }
+
Task &t=tasks[p_task];
if (p_step<0)
t.progress->set_val(t.progress->get_val()+1);
@@ -202,6 +208,7 @@ void ProgressDialog::task_step(const String& p_task, const String& p_state, int
t.progress->set_val(p_step);
t.state->set_text(p_state);
+ last_progress_tick=OS::get_singleton()->get_ticks_usec();
Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor
}
@@ -229,4 +236,5 @@ ProgressDialog::ProgressDialog() {
add_child(main);
main->set_area_as_parent_rect();
set_exclusive(true);
+ last_progress_tick=0;
}
diff --git a/tools/editor/progress_dialog.h b/tools/editor/progress_dialog.h
index 7f1cc4cb2d..8c75948fda 100644
--- a/tools/editor/progress_dialog.h
+++ b/tools/editor/progress_dialog.h
@@ -84,6 +84,7 @@ class ProgressDialog : public Popup {
Map<String,Task> tasks;
VBoxContainer *main;
+ uint64_t last_progress_tick;
void _popup();
protected:
@@ -92,7 +93,7 @@ protected:
public:
void add_task(const String& p_task,const String& p_label, int p_steps);
- void task_step(const String& p_task,const String& p_state, int p_step=-1);
+ void task_step(const String& p_task, const String& p_state, int p_step=-1, bool p_force_redraw=true);
void end_task(const String& p_task);
diff --git a/tools/editor/project_manager.cpp b/tools/editor/project_manager.cpp
index 4db56ea2f9..880df85c19 100644
--- a/tools/editor/project_manager.cpp
+++ b/tools/editor/project_manager.cpp
@@ -348,6 +348,13 @@ struct ProjectItem {
_FORCE_INLINE_ bool operator ==(const ProjectItem& l) const { return project==l.project; }
};
+void ProjectManager::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+
+ get_tree()->set_editor_hint(true);
+ }
+}
void ProjectManager::_panel_draw(Node *p_hb) {
diff --git a/tools/editor/project_manager.h b/tools/editor/project_manager.h
index 1e6ea9c1c9..f8edb6dc10 100644
--- a/tools/editor/project_manager.h
+++ b/tools/editor/project_manager.h
@@ -85,6 +85,7 @@ class ProjectManager : public Control {
protected:
+ void _notification(int p_what);
static void _bind_methods();
public:
ProjectManager();
diff --git a/tools/editor/project_settings.cpp b/tools/editor/project_settings.cpp
index a2419895eb..dd3c7552de 100644
--- a/tools/editor/project_settings.cpp
+++ b/tools/editor/project_settings.cpp
@@ -338,6 +338,15 @@ void ProjectSettings::_action_button_pressed(Object* p_obj, int p_column,int p_i
add_at="input/"+ti->get_text(0);
} else if (p_id==2) {
+ //rename
+
+ add_at="input/"+ti->get_text(0);
+ rename_action->popup_centered();
+ rename_action->get_line_edit()->set_text(ti->get_text(0));
+ rename_action->get_line_edit()->set_cursor_pos(ti->get_text(0).length());
+ rename_action->get_line_edit()->select_all();
+
+ } else if (p_id==3) {
//remove
if (ti->get_parent()==input_editor->get_root()) {
@@ -418,7 +427,10 @@ void ProjectSettings::_update_actions() {
item->set_cell_mode(0,TreeItem::CELL_MODE_CHECK);
item->set_text(0,name);
item->add_button(0,get_icon("Add","EditorIcons"),1);
- item->add_button(0,get_icon("Remove","EditorIcons"),2);
+ if (!Globals::get_singleton()->get_input_presets().find(pi.name)) {
+ item->add_button(0,get_icon("Rename","EditorIcons"),2);
+ item->add_button(0,get_icon("Remove","EditorIcons"),3);
+ }
item->set_custom_bg_color(0,get_color("prop_subsection","Editor"));
item->set_editable(0,true);
item->set_checked(0,pi.usage&PROPERTY_USAGE_CHECKED);
@@ -486,7 +498,7 @@ void ProjectSettings::_update_actions() {
action->set_icon(0,get_icon("JoyAxis","EditorIcons"));
} break;
}
- action->add_button(0,get_icon("Remove","EditorIcons"),2);
+ action->add_button(0,get_icon("Remove","EditorIcons"),3);
action->set_metadata(0,i);
}
}
@@ -507,7 +519,7 @@ void ProjectSettings::popup_project_settings() {
void ProjectSettings::_item_selected() {
- TreeItem *ti = globals_editor->get_scene_tree()->get_selected();
+ TreeItem *ti = globals_editor->get_property_editor()->get_scene_tree()->get_selected();
if (!ti)
return;
if (!ti->get_parent())
@@ -551,7 +563,7 @@ void ProjectSettings::_item_add() {
String name = catname+"/"+propname;
Globals::get_singleton()->set(name,value);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
void ProjectSettings::_item_del() {
@@ -563,7 +575,7 @@ void ProjectSettings::_item_del() {
String name = catname+"/"+propname;
Globals::get_singleton()->set(name,Variant());
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
@@ -616,14 +628,57 @@ void ProjectSettings::_action_add() {
}
+void ProjectSettings::_action_rename(const String &p_name) {
+
+
+ if (p_name.find("/")!=-1 || p_name.find(":")!=-1 || p_name=="") {
+ message->set_text("Invalid Action (Anything goes but / or :).");
+ message->popup_centered(Size2(300,100));
+ return;
+ }
+
+ String new_name = "input/"+p_name;
+
+ if (Globals::get_singleton()->has(new_name)) {
+ message->set_text("Action '"+p_name+"' already exists!.");
+ message->popup_centered(Size2(300,100));
+ return;
+ }
+
+ int order = Globals::get_singleton()->get_order(add_at);
+ Array va = Globals::get_singleton()->get(add_at);
+ bool persisting = Globals::get_singleton()->is_persisting(add_at);
+
+ undo_redo->create_action("Rename Input Action Event");
+ undo_redo->add_do_method(Globals::get_singleton(),"clear",add_at);
+ undo_redo->add_do_method(Globals::get_singleton(),"set",new_name,va);
+ undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",new_name,persisting);
+ undo_redo->add_do_method(Globals::get_singleton(),"set_order",new_name,order);
+ undo_redo->add_undo_method(Globals::get_singleton(),"clear",new_name);
+ undo_redo->add_undo_method(Globals::get_singleton(),"set",add_at,va);
+ undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",add_at,persisting);
+ undo_redo->add_undo_method(Globals::get_singleton(),"set_order",add_at,order);
+ undo_redo->add_do_method(this,"_update_actions");
+ undo_redo->add_undo_method(this,"_update_actions");
+ undo_redo->add_do_method(this,"_settings_changed");
+ undo_redo->add_undo_method(this,"_settings_changed");
+ undo_redo->commit_action();
+
+ rename_action->hide();
+}
+
void ProjectSettings::_item_checked(const String& p_item, bool p_check) {
undo_redo->create_action("Toggle Persisting");
- undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",p_item,p_check);
- undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",p_item,!p_check);
+ String full_item = globals_editor->get_full_item_path(p_item);
+
+ undo_redo->add_do_method(Globals::get_singleton(),"set_persisting",full_item,p_check);
+ undo_redo->add_undo_method(Globals::get_singleton(),"set_persisting",full_item,!p_check);
undo_redo->add_do_method(this,"_settings_changed");
undo_redo->add_undo_method(this,"_settings_changed");
+ undo_redo->add_do_method(globals_editor->get_property_editor(),"update_tree");
+ undo_redo->add_undo_method(globals_editor->get_property_editor(),"update_tree");
undo_redo->commit_action();
}
@@ -641,10 +696,10 @@ void ProjectSettings::_save() {
void ProjectSettings::_settings_prop_edited(const String& p_name) {
if (!Globals::get_singleton()->is_persisting(p_name)) {
-
- Globals::get_singleton()->set_persisting(p_name,true);
+ String full_item = globals_editor->get_full_item_path(p_name);
+ Globals::get_singleton()->set_persisting(full_item,true);
// globals_editor->update_property(p_name);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
_settings_changed();
}
@@ -679,7 +734,7 @@ void ProjectSettings::_copy_to_platform(int p_which) {
name = catname+"/"+propname;
Globals::get_singleton()->set(name,value);
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
@@ -1183,7 +1238,7 @@ void ProjectSettings::_update_autoload() {
void ProjectSettings::_toggle_search_bar(bool p_pressed) {
- globals_editor->set_use_filter(p_pressed);
+ globals_editor->get_property_editor()->set_use_filter(p_pressed);
if (p_pressed) {
@@ -1204,7 +1259,7 @@ void ProjectSettings::_clear_search_box() {
return;
search_box->clear();
- globals_editor->update_tree();
+ globals_editor->get_property_editor()->update_tree();
}
void ProjectSettings::_bind_methods() {
@@ -1219,6 +1274,7 @@ void ProjectSettings::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_action_adds"),&ProjectSettings::_action_adds);
ObjectTypeDB::bind_method(_MD("_action_persist_toggle"),&ProjectSettings::_action_persist_toggle);
ObjectTypeDB::bind_method(_MD("_action_button_pressed"),&ProjectSettings::_action_button_pressed);
+ ObjectTypeDB::bind_method(_MD("_action_rename"),&ProjectSettings::_action_rename);
ObjectTypeDB::bind_method(_MD("_update_actions"),&ProjectSettings::_update_actions);
ObjectTypeDB::bind_method(_MD("_wait_for_key"),&ProjectSettings::_wait_for_key);
ObjectTypeDB::bind_method(_MD("_add_item"),&ProjectSettings::_add_item);
@@ -1346,15 +1402,15 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
search_bar->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
- globals_editor = memnew( PropertyEditor );
+ globals_editor = memnew( SectionedPropertyEditor );
props_base->add_child(globals_editor);
- globals_editor->hide_top_label();
+ //globals_editor->hide_top_label();
globals_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
- globals_editor->register_text_enter(search_box);
- globals_editor->set_capitalize_paths(false);
- globals_editor->get_scene_tree()->connect("cell_selected",this,"_item_selected");
- globals_editor->connect("property_toggled",this,"_item_checked");
- globals_editor->connect("property_edited",this,"_settings_prop_edited");
+ globals_editor->get_property_editor()->register_text_enter(search_box);
+ globals_editor->get_property_editor()->set_capitalize_paths(false);
+ globals_editor->get_property_editor()->get_scene_tree()->connect("cell_selected",this,"_item_selected");
+ globals_editor->get_property_editor()->connect("property_toggled",this,"_item_checked",varray(),CONNECT_DEFERRED);
+ globals_editor->get_property_editor()->connect("property_edited",this,"_settings_prop_edited");
/*
Button *save = memnew( Button );
@@ -1438,12 +1494,17 @@ ProjectSettings::ProjectSettings(EditorData *p_data) {
add_child(popup_add);
popup_add->connect("item_pressed",this,"_add_item");
+ rename_action = memnew( EditorNameDialog );
+ add_child(rename_action);
+ rename_action->set_hide_on_ok(false);
+ rename_action->set_size(Size2(200, 70));
+ rename_action->set_title("Rename Input Action");
+ rename_action->connect("name_confirmed", this,"_action_rename");
+
press_a_key = memnew( ConfirmationDialog );
press_a_key->set_focus_mode(FOCUS_ALL);
add_child(press_a_key);
-
-
l = memnew( Label );
l->set_text("Press a Key..");
l->set_area_as_parent_rect();
diff --git a/tools/editor/project_settings.h b/tools/editor/project_settings.h
index b122609e52..f201f5c48f 100644
--- a/tools/editor/project_settings.h
+++ b/tools/editor/project_settings.h
@@ -34,6 +34,7 @@
#include "optimized_save_dialog.h"
#include "undo_redo.h"
#include "editor_data.h"
+#include "editor_name_dialog.h"
//#include "project_export_settings.h"
class ProjectSettings : public AcceptDialog {
@@ -45,7 +46,7 @@ class ProjectSettings : public AcceptDialog {
EditorData *data;
UndoRedo *undo_redo;
- PropertyEditor *globals_editor;
+ SectionedPropertyEditor *globals_editor;
HBoxContainer *search_bar;
ToolButton *search_button;
@@ -66,6 +67,8 @@ class ProjectSettings : public AcceptDialog {
Label *device_index_label;
MenuButton *popup_platform;
+ EditorNameDialog *rename_action;
+
LineEdit *action_name;
Tree *input_editor;
bool setting;
@@ -106,6 +109,7 @@ class ProjectSettings : public AcceptDialog {
void _action_adds(String);
void _action_add();
+ void _action_rename(const String& p_name);
void _device_input_add();
void _item_checked(const String& p_item, bool p_check);
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 9fb623022b..141f0c2943 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -915,15 +915,25 @@ void CustomPropertyEditor::_color_changed(const Color& p_color) {
void CustomPropertyEditor::_node_path_selected(NodePath p_path) {
- if (owner && owner->is_type("Node")) {
+ if (owner) {
+
+ Node *node=NULL;
+
+ if (owner->is_type("Node"))
+ node = owner->cast_to<Node>();
+ else if (owner->is_type("ArrayPropertyEdit"))
+ node = owner->cast_to<ArrayPropertyEdit>()->get_node();
+
+ if (!node) {
+ v=p_path;
+ emit_signal("variant_changed");
+ return;
+ }
- Node *node = owner->cast_to<Node>();
Node *tonode=node->get_node(p_path);
if (tonode) {
-
p_path=node->get_path_to(tonode);
}
-
}
v=p_path;
@@ -3476,6 +3486,7 @@ void PropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method( "_draw_flags",&PropertyEditor::_draw_flags);
ObjectTypeDB::bind_method( "_set_range_def",&PropertyEditor::_set_range_def);
ObjectTypeDB::bind_method( "_filter_changed",&PropertyEditor::_filter_changed);
+ ObjectTypeDB::bind_method( "update_tree",&PropertyEditor::update_tree);
ADD_SIGNAL( MethodInfo("property_toggled",PropertyInfo( Variant::STRING, "property"),PropertyInfo( Variant::BOOL, "value")));
ADD_SIGNAL( MethodInfo("resource_selected", PropertyInfo( Variant::OBJECT, "res"),PropertyInfo( Variant::STRING, "prop") ) );
@@ -3628,3 +3639,196 @@ PropertyEditor::~PropertyEditor()
}
+/////////////////////////////
+
+
+
+
+
+class SectionedPropertyEditorFilter : public Object {
+
+ OBJ_TYPE( SectionedPropertyEditorFilter, Object );
+
+ Object *edited;
+ String section;
+
+ bool _set(const StringName& p_name, const Variant& p_value) {
+
+ if (!edited)
+ return false;
+
+ String name=p_name;
+ if (section!="") {
+ name=section+"/"+name;
+ }
+
+ bool valid;
+ edited->set(name,p_value,&valid);
+ return valid;
+ }
+
+ bool _get(const StringName& p_name,Variant &r_ret) const{
+
+ if (!edited)
+ return false;
+
+ String name=p_name;
+ if (section!="") {
+ name=section+"/"+name;
+ }
+
+ bool valid=false;
+
+ r_ret=edited->get(name,&valid);
+ return valid;
+
+
+ }
+ void _get_property_list(List<PropertyInfo> *p_list) const{
+
+ if (!edited)
+ return;
+
+ List<PropertyInfo> pinfo;
+ edited->get_property_list(&pinfo);
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ PropertyInfo pi=E->get();
+ int sp = pi.name.find("/");
+ if (sp!=-1) {
+ String ss = pi.name.substr(0,sp);
+
+ if (ss==section) {
+ pi.name=pi.name.substr(sp+1,pi.name.length());
+ p_list->push_back(pi);
+ }
+ } else {
+ if (section=="")
+ p_list->push_back(pi);
+ }
+ }
+
+ }
+public:
+
+ void set_section(const String& p_section) {
+
+ section=p_section;
+ _change_notify();
+ }
+
+ void set_edited(Object* p_edited) {
+ edited=p_edited;
+ _change_notify();
+ }
+
+ SectionedPropertyEditorFilter() {
+ edited=NULL;
+ }
+
+};
+
+
+void SectionedPropertyEditor::_bind_methods() {
+
+ ObjectTypeDB::bind_method("_section_selected",&SectionedPropertyEditor::_section_selected);
+}
+
+void SectionedPropertyEditor::_section_selected(int p_which) {
+
+ filter->set_section( sections->get_item_metadata(p_which) );
+}
+
+String SectionedPropertyEditor::get_full_item_path(const String& p_item) {
+
+ String base = sections->get_item_metadata( sections->get_current() );
+ if (base!="")
+ return base+"/"+p_item;
+ else
+ return p_item;
+}
+
+void SectionedPropertyEditor::edit(Object* p_object) {
+
+ List<PropertyInfo> pinfo;
+ if (p_object)
+ p_object->get_property_list(&pinfo);
+ sections->clear();
+
+ Set<String> existing_sections;
+ for (List<PropertyInfo>::Element *E=pinfo.front();E;E=E->next()) {
+
+ PropertyInfo pi=E->get();
+ if (pi.usage&PROPERTY_USAGE_CATEGORY)
+ continue;
+ if (pi.name.find(":")!=-1 || pi.name=="script/script")
+ continue;
+ int sp = pi.name.find("/");
+ if (sp!=-1) {
+ String sname=pi.name.substr(0,sp);
+ if (!existing_sections.has(sname)) {
+ existing_sections.insert(sname);
+ sections->add_item(sname.capitalize());
+ sections->set_item_metadata(sections->get_item_count()-1,sname);
+ }
+
+ } else {
+ if (!existing_sections.has("")) {
+ existing_sections.insert("");
+ sections->add_item("Global");
+ sections->set_item_metadata(sections->get_item_count()-1,"");
+ }
+ }
+
+
+ }
+
+ //sections->sort_items_by_text();
+
+
+ filter->set_edited(p_object);
+ editor->edit(filter);
+
+ sections->select(0);
+ _section_selected(0);
+
+}
+
+PropertyEditor *SectionedPropertyEditor::get_property_editor() {
+
+ return editor;
+}
+
+SectionedPropertyEditor::SectionedPropertyEditor() {
+
+ VBoxContainer *left_vb = memnew( VBoxContainer);
+ left_vb->set_custom_minimum_size(Size2(160,0));
+ add_child(left_vb);
+
+ sections = memnew( ItemList );
+ sections->set_v_size_flags(SIZE_EXPAND_FILL);
+
+ left_vb->add_margin_child("Sections:",sections,true);
+
+ VBoxContainer *right_vb = memnew( VBoxContainer);
+ right_vb->set_h_size_flags(SIZE_EXPAND_FILL);
+ add_child(right_vb);
+
+ filter = memnew( SectionedPropertyEditorFilter );
+ editor = memnew( PropertyEditor );
+ editor->set_v_size_flags(SIZE_EXPAND_FILL);
+ right_vb->add_margin_child("Properties:",editor,true);
+
+ editor->get_scene_tree()->set_column_titles_visible(false);
+ add_child(editor);
+
+ editor->hide_top_label();
+
+ sections->connect("item_selected",this,"_section_selected");
+
+}
+
+SectionedPropertyEditor::~SectionedPropertyEditor() {
+
+ memdelete(filter);
+}
diff --git a/tools/editor/property_editor.h b/tools/editor/property_editor.h
index e933d7ab3b..81fb078a11 100644
--- a/tools/editor/property_editor.h
+++ b/tools/editor/property_editor.h
@@ -39,6 +39,7 @@
#include "scene/gui/texture_frame.h"
#include "scene/gui/text_edit.h"
#include "scene/gui/check_button.h"
+#include "scene/gui/split_container.h"
#include "scene_tree_editor.h"
/**
@@ -247,4 +248,29 @@ public:
};
+
+class SectionedPropertyEditorFilter;
+
+class SectionedPropertyEditor : public HBoxContainer {
+
+
+ OBJ_TYPE(SectionedPropertyEditor,HBoxContainer);
+ ItemList *sections;
+ SectionedPropertyEditorFilter *filter;
+ PropertyEditor *editor;
+
+
+ static void _bind_methods();
+ void _section_selected(int p_which);
+
+public:
+
+ PropertyEditor *get_property_editor();
+ void edit(Object* p_object);
+ String get_full_item_path(const String& p_item);
+
+ SectionedPropertyEditor();
+ ~SectionedPropertyEditor();
+};
+
#endif
diff --git a/tools/editor/reparent_dialog.cpp b/tools/editor/reparent_dialog.cpp
index 78ba47d54b..f024844731 100644
--- a/tools/editor/reparent_dialog.cpp
+++ b/tools/editor/reparent_dialog.cpp
@@ -36,12 +36,12 @@
void ReparentDialog::_notification(int p_what) {
- if (p_what==NOTIFICATION_ENTER_TREE) {
+ if (p_what==NOTIFICATION_ENTER_TREE) {
connect("confirmed", this,"_reparent");
}
- if (p_what==NOTIFICATION_EXIT_TREE) {
+ if (p_what==NOTIFICATION_EXIT_TREE) {
disconnect("confirmed", this,"_reparent");
}
@@ -83,29 +83,29 @@ void ReparentDialog::_bind_methods() {
ReparentDialog::ReparentDialog() {
-
set_title("Reparent Node");
+
VBoxContainer *vbc = memnew( VBoxContainer );
add_child(vbc);
set_child_rect(vbc);
tree = memnew( SceneTreeEditor(false) );
-
+ tree->set_show_enabled_subscene(true);
vbc->add_margin_child("Reparent Location (Select new Parent):",tree,true);
-
+
+ tree->get_scene_tree()->connect("item_activated",this,"_reparent");
+
//Label *label = memnew( Label );
//label->set_pos( Point2( 15,8) );
//label->set_text("Reparent Location (Select new Parent):");
-
+
node_only = memnew( CheckButton );
add_child(node_only);
node_only->hide();
- tree->set_show_enabled_subscene(true);
//vbc->add_margin_child("Options:",node_only);;
-
//cancel->connect("pressed", this,"_cancel");
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 6575603073..a164703e31 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -928,7 +928,7 @@ void SceneTreeDialog::_cancel() {
void SceneTreeDialog::_select() {
if (tree->get_selected()) {
- emit_signal("selected",tree->get_selected()->get_path());
+ emit_signal("selected",tree->get_selected()->get_path());
hide();
}
}
@@ -939,7 +939,6 @@ void SceneTreeDialog::_bind_methods() {
ObjectTypeDB::bind_method("_cancel",&SceneTreeDialog::_cancel);
ADD_SIGNAL( MethodInfo("selected",PropertyInfo(Variant::NODE_PATH,"path")));
-
}
@@ -951,7 +950,7 @@ SceneTreeDialog::SceneTreeDialog() {
add_child(tree);
set_child_rect(tree);
-
+ tree->get_scene_tree()->connect("item_activated",this,"_select");
}
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp
index c9b376ebec..5880a6eef6 100644
--- a/tools/editor/scenes_dock.cpp
+++ b/tools/editor/scenes_dock.cpp
@@ -195,7 +195,12 @@ void ScenesDock::_notification(int p_what) {
case NOTIFICATION_EXIT_TREE: {
} break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ display_mode->set_pressed(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_LIST);
+
+ _change_file_display();
+ } break;
}
}
@@ -1063,6 +1068,11 @@ void ScenesDock::open(const String& p_path) {
}
+void ScenesDock::set_use_thumbnails(bool p_use) {
+
+ display_mode->set_pressed(!p_use);
+}
+
void ScenesDock::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_update_tree"),&ScenesDock::_update_tree);
diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h
index d045124bf7..e5e0eafc24 100644
--- a/tools/editor/scenes_dock.h
+++ b/tools/editor/scenes_dock.h
@@ -153,6 +153,7 @@ public:
void fix_dependencies(const String& p_for_file);
+ void set_use_thumbnails(bool p_use);
ScenesDock(EditorNode *p_editor);
~ScenesDock();
diff --git a/tools/editor/settings_config_dialog.cpp b/tools/editor/settings_config_dialog.cpp
index 6d8f849427..d3c9e39cbb 100644
--- a/tools/editor/settings_config_dialog.cpp
+++ b/tools/editor/settings_config_dialog.cpp
@@ -71,7 +71,7 @@ void EditorSettingsDialog::popup_edit_settings() {
return;
property_editor->edit(EditorSettings::get_singleton());
- property_editor->update_tree();
+ property_editor->get_property_editor()->update_tree();
search_box->select_all();
search_box->grab_focus();
@@ -254,7 +254,7 @@ void EditorSettingsDialog::_clear_search_box() {
return;
search_box->clear();
- property_editor->update_tree();
+ property_editor->get_property_editor()->update_tree();
}
void EditorSettingsDialog::_notification(int p_what) {
@@ -306,10 +306,10 @@ EditorSettingsDialog::EditorSettingsDialog() {
hbc->add_child(clear_button);
clear_button->connect("pressed",this,"_clear_search_box");
- property_editor = memnew( PropertyEditor );
- property_editor->hide_top_label();
- property_editor->set_use_filter(true);
- property_editor->register_text_enter(search_box);
+ property_editor = memnew( SectionedPropertyEditor );
+ //property_editor->hide_top_label();
+ property_editor->get_property_editor()->set_use_filter(true);
+ property_editor->get_property_editor()->register_text_enter(search_box);
property_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL);
vbc->add_child(property_editor);
diff --git a/tools/editor/settings_config_dialog.h b/tools/editor/settings_config_dialog.h
index 50159cf488..4934c8c97b 100644
--- a/tools/editor/settings_config_dialog.h
+++ b/tools/editor/settings_config_dialog.h
@@ -53,7 +53,7 @@ class EditorSettingsDialog : public AcceptDialog {
Tree *plugins;
LineEdit *search_box;
ToolButton *clear_button;
- PropertyEditor *property_editor;
+ SectionedPropertyEditor *property_editor;
Timer *timer;