You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Allow opening scenes with missing scene dependency
This commit is contained in:
@@ -66,6 +66,14 @@ String MissingNode::get_original_class() const {
|
||||
return original_class;
|
||||
}
|
||||
|
||||
void MissingNode::set_original_scene(const String &p_scene) {
|
||||
original_scene = p_scene;
|
||||
}
|
||||
|
||||
String MissingNode::get_original_scene() const {
|
||||
return original_scene;
|
||||
}
|
||||
|
||||
void MissingNode::set_recording_properties(bool p_enable) {
|
||||
recording_properties = p_enable;
|
||||
}
|
||||
@@ -77,8 +85,15 @@ bool MissingNode::is_recording_properties() const {
|
||||
Array MissingNode::get_configuration_warnings() const {
|
||||
// The mere existence of this node is warning.
|
||||
Array ret;
|
||||
ret.push_back(vformat(RTR("This node was saved as class type '%s', which was no longer available when this scene was loaded."), original_class));
|
||||
ret.push_back(RTR("Data from the original node is kept as a placeholder until this type of node is available again. It can hence be safely re-saved without risk of data loss."));
|
||||
if (!original_scene.is_empty()) {
|
||||
ret.push_back(vformat(RTR("This node was an instance of scene '%s', which was no longer available when this scene was loaded."), original_scene));
|
||||
ret.push_back(vformat(RTR("Saving current scene will discard instance and all its properties, including editable children edits (if existing).")));
|
||||
} else if (!original_class.is_empty()) {
|
||||
ret.push_back(vformat(RTR("This node was saved as class type '%s', which was no longer available when this scene was loaded."), original_class));
|
||||
ret.push_back(RTR("Data from the original node is kept as a placeholder until this type of node is available again. It can hence be safely re-saved without risk of data loss."));
|
||||
} else {
|
||||
ret.push_back(RTR("Unrecognized missing node. Check scene dependency errors for details."));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -86,11 +101,15 @@ void MissingNode::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_original_class", "name"), &MissingNode::set_original_class);
|
||||
ClassDB::bind_method(D_METHOD("get_original_class"), &MissingNode::get_original_class);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_original_scene", "name"), &MissingNode::set_original_class);
|
||||
ClassDB::bind_method(D_METHOD("get_original_scene"), &MissingNode::get_original_class);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_recording_properties", "enable"), &MissingNode::set_recording_properties);
|
||||
ClassDB::bind_method(D_METHOD("is_recording_properties"), &MissingNode::is_recording_properties);
|
||||
|
||||
// Expose, but not save.
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "original_class", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_original_class", "get_original_class");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "original_scene", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_original_scene", "get_original_scene");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "recording_properties", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_recording_properties", "is_recording_properties");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user