mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Make possible to create inherited scenes via the RMB menu in the FileSystem dock
This commit is contained in:
parent
89c37dae49
commit
dcf27c71b7
@ -3250,6 +3250,12 @@ InspectorDock *EditorNode::get_inspector_dock() {
|
||||
return inspector_dock;
|
||||
}
|
||||
|
||||
void EditorNode::_inherit_request(String p_file) {
|
||||
|
||||
current_option = FILE_NEW_INHERITED_SCENE;
|
||||
_dialog_action(p_file);
|
||||
}
|
||||
|
||||
void EditorNode::_instance_request(const Vector<String> &p_files) {
|
||||
|
||||
request_instance_scenes(p_files);
|
||||
@ -5023,6 +5029,7 @@ void EditorNode::_bind_methods() {
|
||||
ClassDB::bind_method("_get_scene_metadata", &EditorNode::_get_scene_metadata);
|
||||
ClassDB::bind_method("set_edited_scene", &EditorNode::set_edited_scene);
|
||||
ClassDB::bind_method("open_request", &EditorNode::open_request);
|
||||
ClassDB::bind_method("_inherit_request", &EditorNode::_inherit_request);
|
||||
ClassDB::bind_method("_instance_request", &EditorNode::_instance_request);
|
||||
ClassDB::bind_method("_close_messages", &EditorNode::_close_messages);
|
||||
ClassDB::bind_method("_show_messages", &EditorNode::_show_messages);
|
||||
@ -5991,6 +5998,7 @@ EditorNode::EditorNode() {
|
||||
|
||||
filesystem_dock = memnew(FileSystemDock(this));
|
||||
filesystem_dock->connect("open", this, "open_request");
|
||||
filesystem_dock->connect("inherit", this, "_inherit_request");
|
||||
filesystem_dock->connect("instance", this, "_instance_request");
|
||||
filesystem_dock->connect("display_mode_changed", this, "_save_docks");
|
||||
|
||||
|
@ -474,6 +474,7 @@ private:
|
||||
int _next_unsaved_scene(bool p_valid_filename, int p_start = 0);
|
||||
void _discard_changes(const String &p_str = String());
|
||||
|
||||
void _inherit_request(String p_file);
|
||||
void _instance_request(const Vector<String> &p_files);
|
||||
|
||||
void _display_top_editors(bool p_display);
|
||||
|
@ -1505,6 +1505,13 @@ void FileSystemDock::_file_option(int p_option, const Vector<String> p_selected)
|
||||
}
|
||||
} break;
|
||||
|
||||
case FILE_INHERIT: {
|
||||
// Create a new scene inherited from the selected one
|
||||
if (p_selected.size() == 1) {
|
||||
emit_signal("inherit", p_selected[0]);
|
||||
}
|
||||
} break;
|
||||
|
||||
case FILE_INSTANCE: {
|
||||
// Instance all selected scenes
|
||||
Vector<String> paths;
|
||||
@ -2071,13 +2078,16 @@ void FileSystemDock::_file_and_folders_fill_popup(PopupMenu *p_popup, Vector<Str
|
||||
|
||||
if (all_files) {
|
||||
|
||||
if (all_files_scenes && filenames.size() >= 1) {
|
||||
p_popup->add_item(TTR("Open Scene(s)"), FILE_OPEN);
|
||||
if (all_files_scenes) {
|
||||
if (filenames.size() == 1) {
|
||||
p_popup->add_item(TTR("Open Scene"), FILE_OPEN);
|
||||
p_popup->add_item(TTR("New Inherited Scene"), FILE_INHERIT);
|
||||
} else {
|
||||
p_popup->add_item(TTR("Open Scenes"), FILE_OPEN);
|
||||
}
|
||||
p_popup->add_item(TTR("Instance"), FILE_INSTANCE);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
|
||||
if (!all_files_scenes && filenames.size() == 1) {
|
||||
} else if (filenames.size() == 1) {
|
||||
p_popup->add_item(TTR("Open"), FILE_OPEN);
|
||||
p_popup->add_separator();
|
||||
}
|
||||
@ -2378,8 +2388,8 @@ void FileSystemDock::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_feature_profile_changed"), &FileSystemDock::_feature_profile_changed);
|
||||
|
||||
ADD_SIGNAL(MethodInfo("inherit", PropertyInfo(Variant::STRING, "file")));
|
||||
ADD_SIGNAL(MethodInfo("instance", PropertyInfo(Variant::POOL_STRING_ARRAY, "files")));
|
||||
ADD_SIGNAL(MethodInfo("open"));
|
||||
|
||||
ADD_SIGNAL(MethodInfo("file_removed", PropertyInfo(Variant::STRING, "file")));
|
||||
ADD_SIGNAL(MethodInfo("folder_removed", PropertyInfo(Variant::STRING, "folder")));
|
||||
|
@ -73,6 +73,7 @@ public:
|
||||
private:
|
||||
enum FileMenu {
|
||||
FILE_OPEN,
|
||||
FILE_INHERIT,
|
||||
FILE_INSTANCE,
|
||||
FILE_ADD_FAVORITE,
|
||||
FILE_REMOVE_FAVORITE,
|
||||
|
Loading…
Reference in New Issue
Block a user