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

Function _get_hierarchy

editor/script/script_create_dialog.cpp:85–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85static Vector<String> _get_hierarchy(const String &p_class_name) {
86 Vector<String> hierarchy;
87
88 String class_name = p_class_name;
89 while (true) {
90 // A registered class.
91 if (ClassDB::class_exists(class_name)) {
92 hierarchy.push_back(class_name);
93
94 class_name = ClassDB::get_parent_class(class_name);
95 continue;
96 }
97
98 // A class defined in script with class_name.
99 if (ScriptServer::is_global_class(class_name)) {
100 hierarchy.push_back(class_name);
101
102 Ref<Script> script = EditorNode::get_editor_data().script_class_load_script(class_name);
103 ERR_BREAK(script.is_null());
104 class_name = _get_parent_class_of_script(script->get_path());
105 continue;
106 }
107
108 break;
109 }
110
111 if (hierarchy.is_empty()) {
112 if (p_class_name.is_valid_ascii_identifier()) {
113 hierarchy.push_back(p_class_name);
114 }
115 hierarchy.push_back("Object");
116 }
117
118 return hierarchy;
119}
120
121void ScriptCreateDialog::_notification(int p_what) {
122 switch (p_what) {

Callers 1

_update_template_menuMethod · 0.85

Calls 7

push_backMethod · 0.45
is_nullMethod · 0.45
get_pathMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected