summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-12-14 10:25:19 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-12-14 10:25:19 -0300
commit4713bcccf3de5f8e0f577f29a67f38bfb8a99b57 (patch)
treefa79263ca3cd17786086f3c9a93f40270abb73a5
parent83e0e97214a4fad635e5992bbbbd413642d76436 (diff)
parentc262becd7bb87fc17e5a4d3b737c13682855da1a (diff)
Merge branch 'master' of https://github.com/godotengine/godot
-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_sub_scene.cpp12
-rw-r--r--tools/editor/property_editor.cpp18
-rw-r--r--tools/editor/reparent_dialog.cpp16
-rw-r--r--tools/editor/scene_tree_editor.cpp5
7 files changed, 53 insertions, 26 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_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/property_editor.cpp b/tools/editor/property_editor.cpp
index 9fb623022b..c44cfa3d6e 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;
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");
}