Skip to content

Commit 06c0985

Browse files
committed
Merge pull request godotengine#105450 from raulsntos/MissingNode/default_properties
Make `MissingNode`/`MissingResource` non-virtual and hide from dialogs
2 parents 076445b + 6faa4e3 commit 06c0985

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

core/register_core_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void register_core_types() {
176176
GDREGISTER_VIRTUAL_CLASS(ScriptExtension);
177177
GDREGISTER_VIRTUAL_CLASS(ScriptLanguageExtension);
178178

179-
GDREGISTER_VIRTUAL_CLASS(MissingResource);
179+
GDREGISTER_CLASS(MissingResource);
180180
GDREGISTER_CLASS(Image);
181181

182182
GDREGISTER_CLASS(Shortcut);

editor/gui/create_dialog.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,8 @@ CreateDialog::CreateDialog() {
856856

857857
type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here.
858858
type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix.
859+
type_blacklist.insert("MissingNode");
860+
type_blacklist.insert("MissingResource");
859861

860862
HSplitContainer *hsc = memnew(HSplitContainer);
861863
add_child(hsc);

editor/inspector/editor_resource_picker.cpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,16 +671,28 @@ String EditorResourcePicker::_get_resource_type(const Ref<Resource> &p_resource)
671671
return res_type;
672672
}
673673

674+
static bool _should_hide_type(const StringName &p_type) {
675+
if (ClassDB::is_virtual(p_type)) {
676+
return true;
677+
}
678+
679+
if (p_type == SNAME("MissingResource")) {
680+
return true;
681+
}
682+
683+
return false;
684+
}
685+
674686
static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vector) {
675687
if (p_vector->find(p_type)) {
676688
// Already added.
677689
return;
678690
}
679691

680692
if (ClassDB::class_exists(p_type)) {
681-
// Engine class,
693+
// Engine class.
682694

683-
if (!ClassDB::is_virtual(p_type)) {
695+
if (!_should_hide_type(p_type)) {
684696
p_vector->push_back(p_type);
685697
}
686698

scene/register_scene_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void register_scene_types() {
411411
OS::get_singleton()->yield(); // may take time to init
412412

413413
GDREGISTER_CLASS(Node);
414-
GDREGISTER_VIRTUAL_CLASS(MissingNode);
414+
GDREGISTER_CLASS(MissingNode);
415415
GDREGISTER_ABSTRACT_CLASS(InstancePlaceholder);
416416

417417
GDREGISTER_ABSTRACT_CLASS(CanvasItem);

0 commit comments

Comments
 (0)