@@ -76,6 +76,10 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const St
7676 }
7777}
7878
79+ void CreateDialog::for_inherit () {
80+ allow_abstract_scripts = true ;
81+ }
82+
7983void CreateDialog::_fill_type_list () {
8084 List<StringName> complete_type_list;
8185 ClassDB::get_class_list (&complete_type_list);
@@ -222,7 +226,7 @@ bool CreateDialog::_should_hide_type(const StringName &p_type) const {
222226 // Abstract scripts cannot be instantiated.
223227 String path = ScriptServer::get_global_class_path (p_type);
224228 Ref<Script> scr = ResourceLoader::load (path, " Script" );
225- return scr.is_null () || scr->is_abstract ();
229+ return scr.is_null () || (!allow_abstract_scripts && scr->is_abstract () );
226230 }
227231
228232 return false ;
@@ -363,7 +367,9 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const StringN
363367 type_name = p_type;
364368 text = p_type;
365369
366- is_abstract = ScriptServer::is_global_class_abstract (p_type);
370+ if (!allow_abstract_scripts) {
371+ is_abstract = ScriptServer::is_global_class_abstract (p_type);
372+ }
367373
368374 String tooltip = TTR (" Script path: %s" );
369375 bool is_tool = ScriptServer::is_global_class_tool (p_type);
@@ -392,7 +398,7 @@ void CreateDialog::_configure_search_option_item(TreeItem *r_item, const StringN
392398 r_item->set_metadata (0 , meta);
393399
394400 bool can_instantiate = (p_type_category == TypeCategory::CPP_TYPE && ClassDB::can_instantiate (p_type)) ||
395- (p_type_category == TypeCategory::OTHER_TYPE && !is_abstract);
401+ (p_type_category == TypeCategory::OTHER_TYPE && !(!allow_abstract_scripts && is_abstract) );
396402 bool instantiable = can_instantiate && !(ClassDB::class_exists (p_type) && ClassDB::is_virtual (p_type));
397403
398404 r_item->set_meta (SNAME (" __instantiable" ), instantiable);
0 commit comments