1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +00:00

Import 3D Scene Improvements

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

-If re-importing from the "dependency changed" dialog, edited scene will keep the local changes.
-Imported scene will keep track of changes in the source asset
-Geometry changes in source geometry or nodes with a different transform will be updated.
-Materials will be kept if changed locally.
-New nodes added will be kept
-If nodes were reparented or renamed, they will still keep track
-Deleted notes will be restored, use the -noimp option to avoid this.
-In general, you can trust that if you do local modifications to the imported scene, they will not be erased after re-import.
-Erasing your changes is done by re-importing from the "Re-Import" menu, re-opening the "Import 3D Scene" dialog. This wil re-import fresh.

Overall, This should allow you to work on a scene and see changes made to 3D assets in real-time.

So Please test!!
This commit is contained in:
Juan Linietsky
2014-06-19 02:23:03 -03:00
parent ddc0e7fd3b
commit e086bccd63
19 changed files with 667 additions and 124 deletions

View File

@@ -42,6 +42,9 @@ void EditorReImportDialog::popup_reimport() {
List<String> ril;
EditorFileSystem::get_singleton()->get_changed_sources(&ril);
scene_must_save=false;
TreeItem *root = tree->create_item();
for(List<String>::Element *E=ril.front();E;E=E->next()) {
@@ -52,11 +55,34 @@ void EditorReImportDialog::popup_reimport() {
item->set_tooltip(0,E->get());
item->set_checked(0,true);
item->set_editable(0,true);
items.push_back(item);
String name = E->get();
if (EditorFileSystem::get_singleton()->get_file_type(name)=="PackedScene" && EditorNode::get_singleton()->is_scene_in_use(name)) {
scene_must_save=true;
}
}
if (scene_must_save) {
if (EditorNode::get_singleton()->get_edited_scene() && EditorNode::get_singleton()->get_edited_scene()->get_filename()=="") {
error->set_text("Current scene must be saved to re-import.");
error->popup_centered(Size2(250,100));
get_ok()->set_text("Re-Import");
get_ok()->set_disabled(true);
return;
}
get_ok()->set_disabled(false);
get_ok()->set_text("Save & Re-Import");
} else {
get_ok()->set_text("Re-Import");
get_ok()->set_disabled(false);
}
popup_centered(Size2(600,400));
@@ -70,7 +96,17 @@ void EditorReImportDialog::ok_pressed() {
error->popup_centered(Size2(250,100));
return;
}
EditorProgress ep("reimport","Re-Importing",items.size());
String reload_fname;
if (scene_must_save && EditorNode::get_singleton()->get_edited_scene()) {
reload_fname = EditorNode::get_singleton()->get_edited_scene()->get_filename();
EditorNode::get_singleton()->save_scene(reload_fname);
EditorNode::get_singleton()->clear_scene();
}
for(int i=0;i<items.size();i++) {
String it = items[i]->get_metadata(0);
@@ -87,6 +123,9 @@ void EditorReImportDialog::ok_pressed() {
}
}
if (reload_fname!="") {
EditorNode::get_singleton()->load_scene(reload_fname);
}
EditorFileSystem::get_singleton()->scan_sources();
}
@@ -100,5 +139,6 @@ EditorReImportDialog::EditorReImportDialog() {
set_title("Re-Import Changed Resources");
error = memnew( AcceptDialog);
add_child(error);
scene_must_save=false;
}