You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Make MissingNode/MissingResource non-virtual and hide from dialogs
This allows ClassDB to get the default values for inherited properties. The `MissingNode` and `MissingResource` types are excluded from the create dialog and the inspector's Resource selector.
This commit is contained in:
@@ -176,7 +176,7 @@ void register_core_types() {
|
|||||||
GDREGISTER_VIRTUAL_CLASS(ScriptExtension);
|
GDREGISTER_VIRTUAL_CLASS(ScriptExtension);
|
||||||
GDREGISTER_VIRTUAL_CLASS(ScriptLanguageExtension);
|
GDREGISTER_VIRTUAL_CLASS(ScriptLanguageExtension);
|
||||||
|
|
||||||
GDREGISTER_VIRTUAL_CLASS(MissingResource);
|
GDREGISTER_CLASS(MissingResource);
|
||||||
GDREGISTER_CLASS(Image);
|
GDREGISTER_CLASS(Image);
|
||||||
|
|
||||||
GDREGISTER_CLASS(Shortcut);
|
GDREGISTER_CLASS(Shortcut);
|
||||||
|
|||||||
@@ -856,6 +856,8 @@ CreateDialog::CreateDialog() {
|
|||||||
|
|
||||||
type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here.
|
type_blacklist.insert("PluginScript"); // PluginScript must be initialized before use, which is not possible here.
|
||||||
type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix.
|
type_blacklist.insert("ScriptCreateDialog"); // This is an exposed editor Node that doesn't have an Editor prefix.
|
||||||
|
type_blacklist.insert("MissingNode");
|
||||||
|
type_blacklist.insert("MissingResource");
|
||||||
|
|
||||||
HSplitContainer *hsc = memnew(HSplitContainer);
|
HSplitContainer *hsc = memnew(HSplitContainer);
|
||||||
add_child(hsc);
|
add_child(hsc);
|
||||||
|
|||||||
@@ -653,6 +653,18 @@ String EditorResourcePicker::_get_resource_type(const Ref<Resource> &p_resource)
|
|||||||
return res_type;
|
return res_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool _should_hide_type(const StringName &p_type) {
|
||||||
|
if (ClassDB::is_virtual(p_type)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_type == SNAME("MissingResource")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vector) {
|
static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vector) {
|
||||||
if (p_vector->find(p_type)) {
|
if (p_vector->find(p_type)) {
|
||||||
// Already added.
|
// Already added.
|
||||||
@@ -660,9 +672,9 @@ static void _add_allowed_type(const StringName &p_type, List<StringName> *p_vect
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ClassDB::class_exists(p_type)) {
|
if (ClassDB::class_exists(p_type)) {
|
||||||
// Engine class,
|
// Engine class.
|
||||||
|
|
||||||
if (!ClassDB::is_virtual(p_type)) {
|
if (!_should_hide_type(p_type)) {
|
||||||
p_vector->push_back(p_type);
|
p_vector->push_back(p_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ void register_scene_types() {
|
|||||||
OS::get_singleton()->yield(); // may take time to init
|
OS::get_singleton()->yield(); // may take time to init
|
||||||
|
|
||||||
GDREGISTER_CLASS(Node);
|
GDREGISTER_CLASS(Node);
|
||||||
GDREGISTER_VIRTUAL_CLASS(MissingNode);
|
GDREGISTER_CLASS(MissingNode);
|
||||||
GDREGISTER_ABSTRACT_CLASS(InstancePlaceholder);
|
GDREGISTER_ABSTRACT_CLASS(InstancePlaceholder);
|
||||||
|
|
||||||
GDREGISTER_ABSTRACT_CLASS(CanvasItem);
|
GDREGISTER_ABSTRACT_CLASS(CanvasItem);
|
||||||
|
|||||||
Reference in New Issue
Block a user