diff options
Diffstat (limited to 'tools/editor/create_dialog.cpp')
-rw-r--r-- | tools/editor/create_dialog.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tools/editor/create_dialog.cpp b/tools/editor/create_dialog.cpp index 3ab2e35242..5aac8bff09 100644 --- a/tools/editor/create_dialog.cpp +++ b/tools/editor/create_dialog.cpp @@ -140,7 +140,7 @@ void CreateDialog::_update_search() { search_options->clear(); - + help_bit->set_text(""); /* TreeItem *root = search_options->create_item(); _parse_fs(EditorFileSystem::get_singleton()->get_filesystem()); @@ -292,9 +292,12 @@ String CreateDialog::get_selected_type() { Object *CreateDialog::instance_selected() { TreeItem *selected = search_options->get_selected(); + if (selected) { String custom = selected->get_metadata(0); + + if (custom!=String()) { if (EditorNode::get_editor_data().get_custom_types().has(custom)) { @@ -323,6 +326,7 @@ Object *CreateDialog::instance_selected() { } } + return NULL; } @@ -332,11 +336,27 @@ String CreateDialog::get_base_type() const { return base_type; } +void CreateDialog::_item_selected() { + + TreeItem *item = search_options->get_selected(); + if (!item) + return; + + String name = item->get_text(0); + + if (!EditorHelp::get_doc_data()->class_list.has(name)) + return; + + help_bit->set_text(EditorHelp::get_doc_data()->class_list[name].brief_description); + +} + void CreateDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("_text_changed"),&CreateDialog::_text_changed); ObjectTypeDB::bind_method(_MD("_confirmed"),&CreateDialog::_confirmed); ObjectTypeDB::bind_method(_MD("_sbox_input"),&CreateDialog::_sbox_input); + ObjectTypeDB::bind_method(_MD("_item_selected"),&CreateDialog::_item_selected); ADD_SIGNAL(MethodInfo("create")); @@ -360,9 +380,14 @@ CreateDialog::CreateDialog() { register_text_enter(search_box); set_hide_on_ok(false); search_options->connect("item_activated",this,"_confirmed"); + search_options->connect("cell_selected",this,"_item_selected"); // search_options->set_hide_root(true); base_type="Object"; + help_bit = memnew( EditorHelpBit ); + vbc->add_margin_child(TTR("Description:"),help_bit); + help_bit->connect("request_hide",this,"_closed"); + } |