diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 06c9a12eb31..d01c2af9075 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -2130,14 +2130,14 @@ void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node Node *imported_node = p_imported->get_child(i); if (imported_node->get_owner()!=p_imported_scene) { - print_line("skipping because not imported at "+String(imported_node->get_name())); + // print_line("skipping because not imported at "+String(imported_node->get_name())); continue; //end of the road } Vector nn; nn.push_back(imported_node->get_name()); NodePath imported_path(nn,false); - print_line("check for: "+String(imported_path)); + //print_line("check for: "+String(imported_path)); if (!p_node->has_node(imported_path) && !checked_nodes.has(imported_node)) { //not there, re-add it @@ -2147,11 +2147,11 @@ void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node if (o) n=o->cast_to(); - print_line("creating node of same type.."); + //print_line("creating node of same type.."); if (n) { - print_line("copy props and add"); + //print_line("copy props and add"); List pl; imported_node->get_property_list(&pl); for(List::Element *E=pl.front();E;E=E->next()) { @@ -2165,7 +2165,7 @@ void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node } } else { - print_line("already exists"); + //print_line("already exists"); } @@ -2223,27 +2223,33 @@ void EditorSceneImportPlugin::_scan_materials(Node*p_base,Node *p_node,Map > &mesh_materials,Map >& override_materials,Set >& meshes_processed) { - if (!p_base && p_node->get_owner()!=p_base) + if (p_node!=p_base && p_node->get_owner()!=p_base) return; MeshInstance *mi=p_node->cast_to(); if (mi) { + print_line("is mesh "+String(p_node->get_name())); String path = p_base->get_path_to(p_node); - if (override_materials.has(path)) + if (override_materials.has(path)) { + print_line("is in material overrides"); mi->set_material_override(override_materials[path]); + } Ref mesh = mi->get_mesh(); if (mesh.is_valid() && !meshes_processed.has(mesh)) { + print_line("mesh was not processed"); meshes_processed.insert(mesh); for(int i=0;iget_surface_count();i++) { String name = mesh->get_name()+":"+mesh->surface_get_name(i); + print_line("name for surface "+itos(i)+": "+name); if (mesh_materials.has(name)) { Ref mat = mesh_materials[name]; mesh->surface_set_material(i,mat); + print_line("overriding!"); } } } @@ -2260,9 +2266,19 @@ void EditorSceneImportPlugin::_merge_materials(Node *p_node,Node *p_imported) { Map > override_materials; _scan_materials(p_node,p_node,mesh_materials,override_materials); + + for (Map >::Element *E=mesh_materials.front();E;E=E->next()) { + print_line("Mats: "+String(E->key())); + } + + for (Map >::Element *E=override_materials.front();E;E=E->next()) { + print_line("Overrides: "+String(E->key())); + } + Set > mp; _apply_materials(p_imported,p_imported,mesh_materials,override_materials,mp); + } #if 0 diff --git a/tools/export/blender25/io_scene_dae/export_dae.py b/tools/export/blender25/io_scene_dae/export_dae.py index 020ab6ca080..14db93c8741 100644 --- a/tools/export/blender25/io_scene_dae/export_dae.py +++ b/tools/export/blender25/io_scene_dae/export_dae.py @@ -482,6 +482,11 @@ class DaeExporter: apply_modifiers = len(node.modifiers) and self.config["use_mesh_modifiers"] + name_to_use = mesh.name + #print("name to use: "+mesh.name) + if (custom_name!=None and custom_name!=""): + name_to_use=custom_name + mesh=node.to_mesh(self.scene,apply_modifiers,"RENDER") #is this allright? triangulate=self.config["use_triangles"] @@ -635,10 +640,7 @@ class DaeExporter: meshid = self.new_id("mesh") - if (custom_name!=None): - self.writel(S_GEOM,1,'') - else: - self.writel(S_GEOM,1,'') + self.writel(S_GEOM,1,'') self.writel(S_GEOM,2,'')