summaryrefslogtreecommitdiff
path: root/editor/create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/create_dialog.cpp')
-rw-r--r--editor/create_dialog.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index fb7cf494cd..4adb3844bc 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -33,8 +33,10 @@
#include "core/class_db.h"
#include "core/os/keyboard.h"
#include "core/print_string.h"
+#include "editor_feature_profile.h"
#include "editor_help.h"
#include "editor_node.h"
+#include "editor_scale.h"
#include "editor_settings.h"
#include "scene/gui/box_container.h"
@@ -56,8 +58,7 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const St
while (!f->eof_reached()) {
String l = f->get_line().strip_edges();
String name = l.split(" ")[0];
-
- if (ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) {
+ if ((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name)) {
TreeItem *ti = recent->create_item(root);
ti->set_text(0, l);
ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(l, base_type));
@@ -272,17 +273,7 @@ bool CreateDialog::_is_class_disabled_by_feature_profile(const StringName &p_cla
return false;
}
- StringName class_name = p_class;
-
- while (class_name != StringName()) {
-
- if (profile->is_class_disabled(class_name)) {
- return true;
- }
- class_name = ClassDB::get_parent_class_nocheck(class_name);
- }
-
- return false;
+ return profile->is_class_disabled(p_class);
}
void CreateDialog::select_type(const String &p_type) {
@@ -613,7 +604,7 @@ void CreateDialog::_update_favorite_list() {
for (int i = 0; i < favorite_list.size(); i++) {
String l = favorite_list[i];
String name = l.split(" ")[0];
- if (!(ClassDB::class_exists(name) || ScriptServer::is_global_class(name)))
+ if (!((ClassDB::class_exists(name) || ScriptServer::is_global_class(name)) && !_is_class_disabled_by_feature_profile(name)))
continue;
TreeItem *ti = favorites->create_item(root);
ti->set_text(0, l);