| 83 | } |
| 84 | |
| 85 | static 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 | |
| 121 | void ScriptCreateDialog::_notification(int p_what) { |
| 122 | switch (p_what) { |
no test coverage detected