MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / get_object_icon

Method get_object_icon

editor/editor_node.cpp:5285–5318  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5283}
5284
5285Ref<Texture2D> EditorNode::get_object_icon(const Object *p_object, const String &p_fallback) {
5286 ERR_FAIL_NULL_V_MSG(p_object, nullptr, "Object cannot be null.");
5287
5288 Ref<Script> scr = p_object->get_script();
5289
5290 const EditorDebuggerRemoteObjects *robjs = Object::cast_to<EditorDebuggerRemoteObjects>(p_object);
5291 if (robjs) {
5292 String class_name;
5293 if (scr.is_valid()) {
5294 class_name = scr->get_global_name();
5295
5296 if (class_name.is_empty()) {
5297 // If there is no class_name in this script we just take the script path.
5298 class_name = scr->get_path();
5299 }
5300 }
5301
5302 if (class_name.is_empty()) {
5303 return get_class_icon(robjs->type_name, p_fallback);
5304 }
5305
5306 return get_class_icon(class_name, p_fallback);
5307 }
5308
5309 if (scr.is_null() && p_object->is_class("Script")) {
5310 scr = p_object;
5311 }
5312
5313 if (Object::cast_to<MultiNodeEdit>(p_object)) {
5314 return get_class_icon(Object::cast_to<MultiNodeEdit>(p_object)->get_edited_class_name(), p_fallback);
5315 } else {
5316 return _get_class_or_script_icon(p_object->get_class(), scr.is_valid() ? scr->get_path() : String(), p_fallback);
5317 }
5318}
5319
5320Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p_fallback) {
5321 ERR_FAIL_COND_V_MSG(p_class.is_empty(), nullptr, "Class name cannot be empty.");

Callers 15

_update_tab_titlesMethod · 0.80
_gui_input_selectMethod · 0.80
_gui_input_hoverMethod · 0.80
_update_nodeMethod · 0.80
set_valid_typesMethod · 0.80
_node_assignMethod · 0.80
_list_selectMethod · 0.80
get_theme_iconMethod · 0.80
popup_connectionsMethod · 0.80
_update_iconMethod · 0.80
update_propertyMethod · 0.80
_update_resourceMethod · 0.80

Calls 10

get_edited_class_nameMethod · 0.80
StringClass · 0.50
get_scriptMethod · 0.45
is_validMethod · 0.45
get_global_nameMethod · 0.45
is_emptyMethod · 0.45
get_pathMethod · 0.45
is_nullMethod · 0.45
is_classMethod · 0.45
get_classMethod · 0.45

Tested by 2

_update_iconMethod · 0.64
_prepare_historyMethod · 0.64