diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 25 | ||||
-rw-r--r-- | editor/project_manager.cpp | 26 |
2 files changed, 20 insertions, 31 deletions
diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 0a8cfa3815..51086d47b7 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4048,7 +4048,23 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po if (mesh != nullptr) { MeshInstance3D *mesh_instance = memnew(MeshInstance3D); mesh_instance->set_mesh(mesh); - mesh_instance->set_name(path.get_file().get_basename()); + + // Adjust casing according to project setting. The file name is expected to be in snake_case, but will work for others. + String name = path.get_file().get_basename(); + switch (ProjectSettings::get_singleton()->get("editor/node_naming/name_casing").operator int()) { + case NAME_CASING_PASCAL_CASE: + name = name.capitalize().replace(" ", ""); + break; + case NAME_CASING_CAMEL_CASE: + name = name.capitalize().replace(" ", ""); + name[0] = name.to_lower()[0]; + break; + case NAME_CASING_SNAKE_CASE: + name = name.capitalize().replace(" ", "_").to_lower(); + break; + } + mesh_instance->set_name(name); + instantiated_scene = mesh_instance; } else { if (!scene.is_valid()) { // invalid scene @@ -4221,10 +4237,9 @@ void Node3DEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p_ if (root_node) { target_node = root_node; } else { - accept->set_text(TTR("Cannot drag and drop into scene with no root node.")); - accept->popup_centered(); - _remove_preview(); - return; + // Create a root node so we can add child nodes to it. + EditorNode::get_singleton()->get_scene_tree_dock()->add_root_node(memnew(Node3D)); + target_node = get_tree()->get_edited_scene_root(); } } else { accept->set_text(TTR("Cannot drag and drop into multiple selected nodes.")); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 9f8a42eccc..7ae03b3072 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -102,7 +102,6 @@ private: FileDialog *fdialog; FileDialog *fdialog_install; OptionButton *vcs_metadata_selection; - CheckBox *create_default_environment; String zip_path; String zip_title; AcceptDialog *dialog_error; @@ -495,31 +494,10 @@ private: initial_settings["application/config/name"] = project_name->get_text().strip_edges(); initial_settings["application/config/icon"] = "res://icon.png"; - if (create_default_environment->is_pressed()) { - initial_settings["rendering/environment/defaults/default_environment"] = "res://default_env.tres"; - } - if (ProjectSettings::get_singleton()->save_custom(dir.plus_file("project.godot"), initial_settings, Vector<String>(), false) != OK) { set_message(TTR("Couldn't create project.godot in project path."), MESSAGE_ERROR); } else { ResourceSaver::save(dir.plus_file("icon.png"), create_unscaled_default_project_icon()); - FileAccess *f; - if (create_default_environment->is_pressed()) { - f = FileAccess::open(dir.plus_file("default_env.tres"), FileAccess::WRITE); - if (!f) { - set_message(TTR("Couldn't create default_env.tres in project path."), MESSAGE_ERROR); - } else { - f->store_line("[gd_resource type=\"Environment\" load_steps=2 format=2]"); - f->store_line(""); - f->store_line("[sub_resource type=\"Sky\" id=\"1\"]"); - f->store_line(""); - f->store_line("[resource]"); - f->store_line("background_mode = 2"); - f->store_line("sky = SubResource( \"1\" )"); - memdelete(f); - } - } - EditorVCSInterface::create_vcs_metadata_files(EditorVCSInterface::VCSMetadata(vcs_metadata_selection->get_selected()), dir); } } else if (mode == MODE_INSTALL) { @@ -945,10 +923,6 @@ public: Control *spacer = memnew(Control); spacer->set_h_size_flags(Control::SIZE_EXPAND_FILL); default_files_container->add_child(spacer); - create_default_environment = memnew(CheckBox); - create_default_environment->set_text("Create Default Environment"); - create_default_environment->set_pressed(true); - default_files_container->add_child(create_default_environment); fdialog = memnew(FileDialog); fdialog->set_access(FileDialog::ACCESS_FILESYSTEM); |