summaryrefslogtreecommitdiff
path: root/modules/gdnative/gdnative_library_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/gdnative_library_editor_plugin.cpp')
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp22
1 files changed, 0 insertions, 22 deletions
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index 10ddd79d3a..278bc7217d 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -40,7 +40,6 @@ void GDNativeLibraryEditor::edit(Ref<GDNativeLibrary> p_library) {
for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
for (List<String>::Element *it = E->value().entries.front(); it; it = it->next()) {
-
String target = E->key() + "." + it->get();
TargetConfig ecfg;
ecfg.library = config->get_value("entry", target, "");
@@ -56,14 +55,12 @@ void GDNativeLibraryEditor::_bind_methods() {
}
void GDNativeLibraryEditor::_update_tree() {
-
tree->clear();
TreeItem *root = tree->create_item();
PopupMenu *filter_list = filter->get_popup();
String text = "";
for (int i = 0; i < filter_list->get_item_count(); i++) {
-
if (!filter_list->is_item_checked(i)) {
continue;
}
@@ -84,7 +81,6 @@ void GDNativeLibraryEditor::_update_tree() {
platform->set_expand_right(0, true);
for (List<String>::Element *it = E->value().entries.front(); it; it = it->next()) {
-
String target = E->key() + "." + it->get();
TreeItem *bit = tree->create_item(platform);
@@ -125,14 +121,12 @@ void GDNativeLibraryEditor::_update_tree() {
}
void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) {
-
String target = Object::cast_to<TreeItem>(item)->get_metadata(0);
String platform = target.substr(0, target.find("."));
String entry = target.substr(platform.length() + 1, target.length());
String section = (id == BUTTON_SELECT_DEPENDENCES || id == BUTTON_CLEAR_DEPENDENCES) ? "dependencies" : "entry";
if (id == BUTTON_SELECT_LIBRARY || id == BUTTON_SELECT_DEPENDENCES) {
-
EditorFileDialog::FileMode mode = EditorFileDialog::FILE_MODE_OPEN_FILE;
if (id == BUTTON_SELECT_DEPENDENCES)
mode = EditorFileDialog::FILE_MODE_OPEN_FILES;
@@ -156,24 +150,20 @@ void GDNativeLibraryEditor::_on_item_button(Object *item, int column, int id) {
}
void GDNativeLibraryEditor::_on_library_selected(const String &file) {
-
_set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), file);
}
void GDNativeLibraryEditor::_on_dependencies_selected(const PackedStringArray &files) {
-
_set_target_value(file_dialog->get_meta("section"), file_dialog->get_meta("target"), files);
}
void GDNativeLibraryEditor::_on_filter_selected(int index) {
-
PopupMenu *filter_list = filter->get_popup();
filter_list->set_item_checked(index, !filter_list->is_item_checked(index));
_update_tree();
}
void GDNativeLibraryEditor::_on_item_collapsed(Object *p_item) {
-
TreeItem *item = Object::cast_to<TreeItem>(p_item);
String name = item->get_text(0);
@@ -185,7 +175,6 @@ void GDNativeLibraryEditor::_on_item_collapsed(Object *p_item) {
}
void GDNativeLibraryEditor::_on_item_activated() {
-
TreeItem *item = tree->get_selected();
if (item && tree->get_selected_column() == 0 && item->get_metadata(0).get_type() == Variant::NIL) {
new_architecture_dialog->set_meta("platform", item->get_metadata(1));
@@ -194,7 +183,6 @@ void GDNativeLibraryEditor::_on_item_activated() {
}
void GDNativeLibraryEditor::_on_create_new_entry() {
-
String platform = new_architecture_dialog->get_meta("platform");
String entry = new_architecture_input->get_text().strip_edges();
if (!entry.empty()) {
@@ -213,10 +201,8 @@ void GDNativeLibraryEditor::_set_target_value(const String &section, const Strin
}
void GDNativeLibraryEditor::_erase_entry(const String &platform, const String &entry) {
-
if (platforms.has(platform)) {
if (List<String>::Element *E = platforms[platform].entries.find(entry)) {
-
String target = platform + "." + entry;
platforms[platform].entries.erase(E);
@@ -243,16 +229,13 @@ void GDNativeLibraryEditor::_move_entry(const String &platform, const String &en
}
void GDNativeLibraryEditor::_translate_to_config_file() {
-
if (!library.is_null()) {
-
Ref<ConfigFile> config = library->get_config_file();
config->erase_section("entry");
config->erase_section("dependencies");
for (Map<String, NativePlatformConfig>::Element *E = platforms.front(); E; E = E->next()) {
for (List<String>::Element *it = E->value().entries.front(); it; it = it->next()) {
-
String target = E->key() + "." + it->get();
if (entry_configs[target].library.empty() && entry_configs[target].dependencies.empty())
continue;
@@ -267,7 +250,6 @@ void GDNativeLibraryEditor::_translate_to_config_file() {
}
GDNativeLibraryEditor::GDNativeLibraryEditor() {
-
{ // Define platforms
NativePlatformConfig platform_windows;
platform_windows.name = "Windows";
@@ -388,19 +370,16 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
}
void GDNativeLibraryEditorPlugin::edit(Object *p_node) {
-
Ref<GDNativeLibrary> new_library = Object::cast_to<GDNativeLibrary>(p_node);
if (new_library.is_valid())
library_editor->edit(new_library);
}
bool GDNativeLibraryEditorPlugin::handles(Object *p_node) const {
-
return p_node->is_class("GDNativeLibrary");
}
void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) {
-
if (p_visible) {
button->show();
EditorNode::get_singleton()->make_bottom_panel_item_visible(library_editor);
@@ -413,7 +392,6 @@ void GDNativeLibraryEditorPlugin::make_visible(bool p_visible) {
}
GDNativeLibraryEditorPlugin::GDNativeLibraryEditorPlugin(EditorNode *p_node) {
-
library_editor = memnew(GDNativeLibraryEditor);
library_editor->set_custom_minimum_size(Size2(0, 250 * EDSCALE));
button = p_node->add_bottom_panel_item(TTR("GDNativeLibrary"), library_editor);