summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp30
-rw-r--r--tools/export/blender25/io_scene_dae/export_dae.py10
2 files changed, 29 insertions, 11 deletions
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index 06c9a12eb3..d01c2af907 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<StringName> 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<Node>();
- 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<PropertyInfo> pl;
imported_node->get_property_list(&pl);
for(List<PropertyInfo>::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<Strin
void EditorSceneImportPlugin::_apply_materials(Node*p_base,Node *p_node,Map<String,Ref<Material> > &mesh_materials,Map<String,Ref<Material> >& override_materials,Set<Ref<Mesh> >& 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<MeshInstance>();
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> 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;i<mesh->get_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<Material> 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<String,Ref<Material> > override_materials;
_scan_materials(p_node,p_node,mesh_materials,override_materials);
+
+ for (Map<String,Ref<Material> >::Element *E=mesh_materials.front();E;E=E->next()) {
+ print_line("Mats: "+String(E->key()));
+ }
+
+ for (Map<String,Ref<Material> >::Element *E=override_materials.front();E;E=E->next()) {
+ print_line("Overrides: "+String(E->key()));
+ }
+
Set<Ref<Mesh> > 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 020ab6ca08..14db93c874 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,'<geometry id="'+meshid+'" name="'+custom_name+'">')
- else:
- self.writel(S_GEOM,1,'<geometry id="'+meshid+'" name="'+mesh.name+'">')
+ self.writel(S_GEOM,1,'<geometry id="'+meshid+'" name="'+name_to_use+'">')
self.writel(S_GEOM,2,'<mesh>')