Use the gray color for all abstract classes

This commit is contained in:
MewPurPur 2023-08-01 20:04:28 +03:00 committed by MewPurPur
parent 6758a7f8c0
commit 398ca4e71a
21 changed files with 42 additions and 38 deletions

View file

@ -289,14 +289,12 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const String
bool can_instantiate = (p_type_category == TypeCategory::CPP_TYPE && ClassDB::can_instantiate(p_type)) ||
p_type_category == TypeCategory::OTHER_TYPE;
bool is_virtual = ClassDB::class_exists(p_type) && ClassDB::is_virtual(p_type);
bool instantiable = can_instantiate && !(ClassDB::class_exists(p_type) && ClassDB::is_virtual(p_type));
r_item->set_meta(SNAME("__instantiable"), can_instantiate && !is_virtual);
r_item->set_meta(SNAME("__instantiable"), instantiable);
if (can_instantiate && !is_virtual) {
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, icon_fallback));
} else {
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type, "NodeDisabled"));
r_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_type));
if (!instantiable) {
r_item->set_custom_color(0, search_options->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor")));
}
@ -714,7 +712,7 @@ void CreateDialog::_save_and_update_favorite_list() {
TreeItem *ti = favorites->create_item(root);
ti->set_text(0, l);
ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(name, icon_fallback));
ti->set_icon(0, EditorNode::get_singleton()->get_class_icon(name));
}
}
}
@ -731,7 +729,7 @@ void CreateDialog::_load_favorites_and_history() {
String name = l.get_slicec(' ', 0);
if (EditorNode::get_editor_data().is_type_recognized(name) && !_is_class_disabled_by_feature_profile(name)) {
recent->add_item(l, EditorNode::get_singleton()->get_class_icon(name, icon_fallback));
recent->add_item(l, EditorNode::get_singleton()->get_class_icon(name));
}
}
}

View file

@ -495,7 +495,7 @@ void EditorFeatureProfileManager::_profile_selected(int p_what) {
void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const String &p_class, const String &p_selected) {
TreeItem *class_item = class_list->create_item(p_parent);
class_item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
class_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_class, "Node"));
class_item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_class));
String text = p_class;
bool disabled = edited->is_class_disabled(p_class);
@ -522,11 +522,11 @@ void EditorFeatureProfileManager::_fill_classes_from(TreeItem *p_parent, const S
class_item->select(0);
}
if (disabled) {
//class disabled, do nothing else (do not show further)
// Class disabled, do nothing else (do not show further).
return;
}
class_item->set_checked(0, true); // if its not disabled, its checked
class_item->set_checked(0, true); // If it's not disabled, it's checked.
List<StringName> child_classes;
ClassDB::get_direct_inheriters_from_class(p_class, &child_classes);

View file

@ -367,7 +367,7 @@ void EditorHelp::_add_type_icon(const String &p_type, int p_size, const String &
Ref<Texture2D> icon = EditorNode::get_singleton()->get_class_icon(p_type, p_fallback);
Vector2i size = Vector2i(icon->get_width(), icon->get_height());
if (p_size > 0) {
// Ensures icon scales proportionally on both axis, based on icon height.
// Ensures icon scales proportionally on both axes, based on icon height.
float ratio = p_size / float(size.height);
size.width *= ratio;
size.height *= ratio;

View file

@ -593,16 +593,10 @@ TreeItem *EditorHelpSearch::Runner::_create_class_hierarchy(const ClassMatch &p_
}
TreeItem *EditorHelpSearch::Runner::_create_class_item(TreeItem *p_parent, const DocData::ClassDoc *p_doc, bool p_gray) {
Ref<Texture2D> icon = empty_icon;
if (ui_service->has_theme_icon(p_doc->name, SNAME("EditorIcons"))) {
icon = ui_service->get_theme_icon(p_doc->name, SNAME("EditorIcons"));
} else if (ClassDB::class_exists(p_doc->name) && ClassDB::is_parent_class(p_doc->name, "Object")) {
icon = ui_service->get_theme_icon(SNAME("Object"), SNAME("EditorIcons"));
}
String tooltip = DTR(p_doc->brief_description.strip_edges());
TreeItem *item = results_tree->create_item(p_parent);
item->set_icon(0, icon);
item->set_icon(0, EditorNode::get_singleton()->get_class_icon(p_doc->name));
item->set_text(0, p_doc->name);
item->set_text(1, TTR("Class"));
item->set_tooltip_text(0, tooltip);
@ -706,6 +700,5 @@ EditorHelpSearch::Runner::Runner(Control *p_icon_service, Tree *p_results_tree,
results_tree(p_results_tree),
term((p_search_flags & SEARCH_CASE_SENSITIVE) == 0 ? p_term.strip_edges().to_lower() : p_term.strip_edges()),
search_flags(p_search_flags),
empty_icon(ui_service->get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons"))),
disabled_color(ui_service->get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))) {
}

View file

@ -122,7 +122,6 @@ class EditorHelpSearch::Runner : public RefCounted {
Vector<String> terms;
int search_flags;
Ref<Texture2D> empty_icon;
Color disabled_color;
HashMap<String, DocData::ClassDoc>::Iterator iterator_doc;

View file

@ -2795,7 +2795,7 @@ void EditorInspector::update_tree() {
// Find the icon corresponding to the script.
if (script_name != StringName()) {
category->icon = EditorNode::get_singleton()->get_class_icon(script_name, "Object");
category->icon = EditorNode::get_singleton()->get_class_icon(script_name);
} else {
category->icon = EditorNode::get_singleton()->get_object_icon(scr.ptr(), "Object");
}
@ -2803,7 +2803,7 @@ void EditorInspector::update_tree() {
}
if (category->icon.is_null() && !type.is_empty()) {
category->icon = EditorNode::get_singleton()->get_class_icon(type, "Object");
category->icon = EditorNode::get_singleton()->get_class_icon(type);
}
// Set the category label.

View file

@ -4330,9 +4330,19 @@ Ref<Texture2D> EditorNode::_get_class_or_script_icon(const String &p_class, cons
return gui_base->get_theme_icon(p_class, SNAME("EditorIcons"));
}
if (p_fallback.length() && gui_base->has_theme_icon(p_fallback, SNAME("EditorIcons"))) {
if (!p_fallback.is_empty() && gui_base->has_theme_icon(p_fallback, SNAME("EditorIcons"))) {
return gui_base->get_theme_icon(p_fallback, SNAME("EditorIcons"));
}
// If the fallback is empty or wasn't found, use the default fallback.
if (ClassDB::class_exists(p_class)) {
bool instantiable = !ClassDB::is_virtual(p_class) && ClassDB::can_instantiate(p_class);
if (ClassDB::is_parent_class(p_class, SNAME("Node"))) {
return gui_base->get_theme_icon(instantiable ? "Node" : "NodeDisabled", SNAME("EditorIcons"));
} else {
return gui_base->get_theme_icon(instantiable ? "Object" : "ObjectDisabled", SNAME("EditorIcons"));
}
}
}
return nullptr;

View file

@ -868,7 +868,7 @@ public:
Ref<Script> get_object_custom_type_base(const Object *p_object) const;
StringName get_object_custom_type_name(const Object *p_object) const;
Ref<Texture2D> get_object_icon(const Object *p_object, const String &p_fallback = "Object");
Ref<Texture2D> get_class_icon(const String &p_class, const String &p_fallback = "Object");
Ref<Texture2D> get_class_icon(const String &p_class, const String &p_fallback = "");
bool is_object_of_custom_type(const Object *p_object, const StringName &p_class);

View file

@ -81,10 +81,13 @@ void EditorColorMap::create() {
add_conversion_color_pair("#f9f9f9", "#606060"); // Scrollbar grabber highlight color
add_conversion_color_pair("#c38ef1", "#a85de9"); // Animation
add_conversion_color_pair("#fc7f7f", "#cd3838"); // Spatial
add_conversion_color_pair("#8da5f3", "#3d64dd"); // 2D
add_conversion_color_pair("#4b70ea", "#1a3eac"); // 2D Dark
add_conversion_color_pair("#8eef97", "#2fa139"); // Control
add_conversion_color_pair("#7582a8", "#6d83c8"); // 2D Abstract
add_conversion_color_pair("#fc7f7f", "#cd3838"); // 3D
add_conversion_color_pair("#b56d6d", "#be6a6a"); // 3D Abstract
add_conversion_color_pair("#8eef97", "#2fa139"); // GUI Control
add_conversion_color_pair("#76ad7b", "#64a66a"); // GUI Control Abstract
add_conversion_color_pair("#5fb2ff", "#0079f0"); // Selection (blue)
add_conversion_color_pair("#003e7a", "#2b74bb"); // Selection (darker blue)

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m5.5 9c-.831 0-1.5.669-1.5 1.5v1.5h-2v2h12v-2h-2v-1.5c0-.831-.669-1.5-1.5-1.5z" fill="#8eef97"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 9C4.669 9 4 9.669 4 10.5V12H2v2h12v-2h-2v-1.5c0-.831-.669-1.5-1.5-1.5z" fill="#76ad7b"/></svg>

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 192 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M6 2a3 3 0 0 0-2 5.23V9L1 7v6l3-2v1a1 1 0 0 0 1 1h3a2 2 0 0 1 .73-1.24 1.83 1.83 0 0 1 1.828-3.143 1.8 1.8 0 0 1 3.313-.75 3 3 0 0 0-4.883-3.09A3 3 0 0 0 6 2z" fill="#e0e0e0"/><path d="M12.36 8.598a.533 3.2 0 0 0-.51 2.275 3.2.533 30 0 0-.515.887.533 3.2 60 0 0 .515.887.533 3.2 0 0 0 1.02 0 3.2.533 30 0 0 .515-.887.533 3.2 60 0 0-.515-.887.533 3.2 0 0 0-.51-2.275z" fill="#c38ef1"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M6 2a3 3 0 0 0-2 5.23V9L1 7v6l3-2v1a1 1 0 0 0 1 1h3a2 2 0 0 1 .73-1.24 1.83 1.83 0 0 1 1.828-3.143 1.8 1.8 0 0 1 3.313-.75 3 3 0 0 0-4.883-3.09A3 3 0 0 0 6 2z" fill="#808080"/><path d="M12.36 8.598a.533 3.2 0 0 0-.51 2.275 3.2.533 30 0 0-.515.887.533 3.2 60 0 0 .515.887.533 3.2 0 0 0 1.02 0 3.2.533 30 0 0 .515-.887.533 3.2 60 0 0-.515-.887.533 3.2 0 0 0-.51-2.275z" fill="#c38ef1"/></svg>

Before

Width:  |  Height:  |  Size: 483 B

After

Width:  |  Height:  |  Size: 483 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.92 10c-.263.3-.42.73-.42 1.238 0 1.628-3.138-.178-.337 2.67.884.9 2.654.67 3.538-.228a2.33 2.33 0 0 0 0-3.256c-1.1-1.119-2.2-1.084-2.78-.424zm2.381-1.61 2.4 2.441 6.802-6.917a1.7 1.7 0 0 0-2.4-2.442z" fill="#e0e0e0"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M2.92 10c-.263.3-.42.73-.42 1.238 0 1.628-3.138-.178-.337 2.67.884.9 2.654.67 3.538-.228a2.33 2.33 0 0 0 0-3.256c-1.1-1.119-2.2-1.084-2.78-.424zm2.3-1.64 2.4 2.4 6.8-6.8a1.7 1.7 0 0 0-2.4-2.45z" fill="#808080"/></svg>

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 310 B

View file

@ -1 +1 @@
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M1 1h14v4h-1a2 2 0 0 0-2-2H9v9a2 2 0 0 0 2 2v1H5v-1a2 2 0 0 0 2-2V3H4a2 2 0 0 0-2 2H1z" fill="#e0e0e0"/></svg>
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M1 1h14v4h-1a2 2 0 0 0-2-2H9v9a2 2 0 0 0 2 2v1H5v-1a2 2 0 0 0 2-2V3H4a2 2 0 0 0-2 2H1z" fill="#808080"/></svg>

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M4.729 2A2 2 0 1 0 2 4.73v6.541A2 2 0 1 0 4.73 14h6.541a2 2 0 1 0 2.698-2.75H14V4.729A2 2 0 1 0 11.27 2H4.729zm6.542 2a2 2 0 0 0 .729.729v6.542a2 2 0 0 0-.729.729H4.729A2 2 0 0 0 4 11.271V4.729A2 2 0 0 0 4.729 4z" fill="#fc7f7f"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M4.729 2A2 2 0 1 0 2 4.73v6.541A2 2 0 1 0 4.73 14h6.541a2 2 0 1 0 2.698-2.75H14V4.729A2 2 0 1 0 11.27 2H4.729zm6.542 2a2 2 0 0 0 .729.729v6.542a2 2 0 0 0-.729.729H4.729A2 2 0 0 0 4 11.271V4.729A2 2 0 0 0 4.729 4z" fill="#b56d6d"/></svg>

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 329 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M4.73 2A2 2 0 1 0 2 4.73v6.541A2 2 0 1 0 4.73 14h6.541A2 2 0 1 0 14 11.27V4.729A2 2 0 1 0 11.27 2Zm.683 2h5.857a2 2 0 0 0 .729.73v5.856L5.412 4zM3.999 5.414 10.584 12H4.727a2 2 0 0 0-.729-.73V5.414z" fill="#ffca5f"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M4.73 2A2 2 0 1 0 2 4.73v6.541A2 2 0 1 0 4.73 14h6.541A2 2 0 1 0 14 11.27V4.729A2 2 0 1 0 11.27 2Zm.683 2h5.857a2 2 0 0 0 .729.73v5.856L5.412 4zM3.999 5.414 10.584 12H4.727a2 2 0 0 0-.729-.73V5.414z" fill="#808080"/></svg>

Before

Width:  |  Height:  |  Size: 315 B

After

Width:  |  Height:  |  Size: 315 B

View file

@ -0,0 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M1.553 4.104A1 1 0 0 0 1 5v6a1 1 0 0 0 .553.895l6 3a1 1 0 0 0 .894 0l6-3A1 1 0 0 0 15 11V5a1 1 0 0 0-.553-.894l-6-3a1 1 0 0 0-.894 0zm6.447-1 3.764 1.882L8 6.868 4.236 4.986zm-5 3.5 4 2v3.766l-4-2z" fill="#808080"/></svg>

After

Width:  |  Height:  |  Size: 314 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m13 1a2 2 0 0 0 -1.730469 1h-3.0273435a4.5 4.5 0 0 1 .7285156 2h2.3007809a2 2 0 0 0 .728516.7304688v5.8554692l-3.6933594-3.6933599a4.5 4.5 0 0 1 -1.4140625 1.4140625l3.6933599 3.6933594h-5.8574224a2 2 0 0 0 -.7285156-.730469v-2.3046872a4.5 4.5 0 0 1 -2-.7285157v3.0351559a2 2 0 0 0 -1 1.728516 2 2 0 0 0 2 2 2 2 0 0 0 1.7304688-1h6.5410152a2 2 0 0 0 1.728516 1 2 2 0 0 0 2-2 2 2 0 0 0 -1.03125-1.75h.03125v-6.5214844a2 2 0 0 0 1-1.7285156 2 2 0 0 0 -2-2z" fill="#ffca5f"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M8.242 2a4.5 4.5 0 0 1 .729 2h2.3a2 2 0 0 0 .729.73v5.856L8.307 6.893a4.5 4.5 0 0 1-1.414 1.414L10.586 12H4.729A2 2 0 0 0 4 11.27V8.965a4.5 4.5 0 0 1-2-.729v3.035A2 2 0 1 0 4.73 14h6.541a2 2 0 1 0 2.698-2.75H14V4.729A2 2 0 1 0 11.27 2z" fill="#808080"/></svg>

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 352 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3.75 8 0.75 3.5 3.5 0.75 M8 3.75 l3.5 0.75 0.75 3.5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="#8eef97" fill="none"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m3 8 1 4 4 1M8 3l4 1 1 4" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" stroke="#76ad7b" fill="none"/></svg>

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 221 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><linearGradient id="a" x2="0" y1="2" y2="14" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ff8dbc"/><stop offset=".4" stop-color="#7260ff"/><stop offset=".6" stop-color="#7260ff"/><stop offset="1" stop-color="#74c9ff"/></linearGradient><path d="m12 2 a-1 1 0 0 1 0 2a 8 8 0 0 0-8 8a-1 1 0 0 1-2 0a10 10 0 0 1 10-10zm0 4A-1 1 0 0 1 12 8a4 4 0 0 0-4 4A-1 1 0 0 1 6 12a6 6 0 0 1 6-6zm-2 4.5 a.667.667 0 0 1 1-0.566l2.667 1.674a.667.667 0 0 1 0 1.149l-2.667 1.674a.667 0.667 0 0 1-1-.566z" fill="url(#a)"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><path d="m12 2 a-1 1 0 0 1 0 2a 8 8 0 0 0-8 8a-1 1 0 0 1-2 0a10 10 0 0 1 10-10zm0 4A-1 1 0 0 1 12 8a4 4 0 0 0-4 4A-1 1 0 0 1 6 12a6 6 0 0 1 6-6zm-2 4.5 a.667.667 0 0 1 1-0.566l2.667 1.674a.667.667 0 0 1 0 1.149l-2.667 1.674a.667 0.667 0 0 1-1-.566z" fill="#808080"/></svg>

Before

Width:  |  Height:  |  Size: 607 B

After

Width:  |  Height:  |  Size: 356 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect x="1.5" y="2.5" height="11" width="13" rx="1.5" stroke="#e0e0e0" fill="none"/></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><rect x="1.75" y="2.75" height="10.5" width="12.5" rx="1.5" stroke="#808080" stroke-width="1.5" fill="none"/></svg>

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 199 B

View file

@ -1 +1 @@
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#fc7f7f"><circle cx="3" cy="3" r="2"/><circle cx="13" cy="3" r="2"/><circle cx="13" cy="13" r="2"/><circle cx="3" cy="13" r="2"/></g></svg>
<svg height="16" viewBox="0 0 16 16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#b56d6d"><circle cx="3" cy="3" r="2"/><circle cx="13" cy="3" r="2"/><circle cx="13" cy="13" r="2"/><circle cx="3" cy="13" r="2"/></g></svg>

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B