summaryrefslogtreecommitdiff
path: root/tools/editor/io_plugins
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/io_plugins')
-rw-r--r--tools/editor/io_plugins/editor_atlas.cpp2
-rw-r--r--tools/editor/io_plugins/editor_atlas.h2
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.cpp5
-rw-r--r--tools/editor/io_plugins/editor_font_import_plugin.h2
-rw-r--r--tools/editor/io_plugins/editor_import_collada.cpp82
-rw-r--r--tools/editor/io_plugins/editor_import_collada.h2
-rw-r--r--tools/editor/io_plugins/editor_sample_import_plugin.cpp24
-rw-r--r--tools/editor/io_plugins/editor_sample_import_plugin.h2
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.cpp74
-rw-r--r--tools/editor/io_plugins/editor_scene_import_plugin.h4
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.cpp19
-rw-r--r--tools/editor/io_plugins/editor_texture_import_plugin.h2
-rw-r--r--tools/editor/io_plugins/editor_translation_import_plugin.cpp2
-rw-r--r--tools/editor/io_plugins/editor_translation_import_plugin.h2
14 files changed, 176 insertions, 48 deletions
diff --git a/tools/editor/io_plugins/editor_atlas.cpp b/tools/editor/io_plugins/editor_atlas.cpp
index 4c716874ba..4a260a9a6f 100644
--- a/tools/editor/io_plugins/editor_atlas.cpp
+++ b/tools/editor/io_plugins/editor_atlas.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_atlas.h b/tools/editor/io_plugins/editor_atlas.h
index 685cf60c9d..716faff0c6 100644
--- a/tools/editor/io_plugins/editor_atlas.h
+++ b/tools/editor/io_plugins/editor_atlas.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.cpp b/tools/editor/io_plugins/editor_font_import_plugin.cpp
index 0562153199..b0ff6f6e74 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_font_import_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -650,6 +650,7 @@ public:
vbl->add_spacer();
vbl->add_margin_child("Test: ",testhb);
+ /*
HBoxContainer *upd_hb = memnew( HBoxContainer );
// vbl->add_child(upd_hb);
upd_hb->add_spacer();
@@ -657,7 +658,7 @@ public:
upd_hb->add_child(update);
update->set_text("Update");
update->connect("pressed",this,"_update");
-
+*/
options = memnew( _EditorFontImportOptions );
prop_edit = memnew( PropertyEditor() );
vbr->add_margin_child("Options:",prop_edit,true);
diff --git a/tools/editor/io_plugins/editor_font_import_plugin.h b/tools/editor/io_plugins/editor_font_import_plugin.h
index ac3b4eb0fe..451f01080e 100644
--- a/tools/editor/io_plugins/editor_font_import_plugin.h
+++ b/tools/editor/io_plugins/editor_font_import_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_import_collada.cpp b/tools/editor/io_plugins/editor_import_collada.cpp
index 990e52be46..d510333a32 100644
--- a/tools/editor/io_plugins/editor_import_collada.cpp
+++ b/tools/editor/io_plugins/editor_import_collada.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -84,7 +84,7 @@ struct ColladaImport {
Error _create_scene(Collada::Node *p_node, Spatial *p_parent);
Error _create_resources(Collada::Node *p_node);
Error _create_material(const String& p_material);
- Error _create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data);
+ Error _create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *p_skin_data, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes=Vector<Ref<Mesh> >());
Error load(const String& p_path, int p_flags, bool p_force_make_tangents=false);
void _fix_param_animation_tracks();
void create_animation(int p_clip,bool p_make_tracks_in_all_bones);
@@ -589,7 +589,7 @@ static void _generate_tangents_and_binormals(const DVector<int>& p_indices,const
}
}
-Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data) {
+Error ColladaImport::_create_mesh_surfaces(bool p_optimize,Ref<Mesh>& p_mesh,const Map<String,Collada::NodeGeometry::Material>& p_material_map,const Collada::MeshData &meshdata,const Transform& p_local_xform,const Vector<int> &bone_remap, const Collada::SkinControllerData *skin_controller, const Collada::MorphControllerData *p_morph_data,Vector<Ref<Mesh> > p_morph_meshes) {
bool local_xform_mirror=p_local_xform.basis.determinant() < 0;
@@ -750,7 +750,7 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
ERR_FAIL_INDEX_V(src,p.indices.size(),ERR_INVALID_DATA);
Collada::Vertex vertex;
- if (p_morph_data)
+ if (!p_optimize)
vertex.uid=vertidx++;
int vertex_index=p.indices[src+vertex_ofs]; //used for index field (later used by controllers)
@@ -1276,7 +1276,7 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
////////////////////////////
// THEN THE MORPH TARGETS //
////////////////////////////
-
+#if 0
if (p_morph_data) {
//add morphie target
@@ -1358,6 +1358,7 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
vertw = DVector<Vector3>::Write();
DVector<Vector3> normals;
DVector<float> tangents;
+ print_line("vertex source id: "+vertex_src_id);
if(md.vertices[vertex_src_id].sources.has("NORMAL")){
//has normals
normals.resize(vlen);
@@ -1409,7 +1410,9 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
}
}
+ print_line("using built-in normals");
}else{
+ print_line("generating normals");
_generate_normals(index_array,vertices,normals);//no normals
}
if (final_tangent_array.size() && final_uv_array.size()) {
@@ -1436,6 +1439,17 @@ Error ColladaImport::_create_mesh_surfaces(Ref<Mesh>& p_mesh,const Map<String,Co
}
+#endif
+ for(int mi=0;mi<p_morph_meshes.size();mi++) {
+
+ // print_line("want surface "+itos(mi)+" has "+itos(p_morph_meshes[mi]->get_surface_count()));
+ Array a = p_morph_meshes[mi]->surface_get_arrays(surface);
+ a[Mesh::ARRAY_BONES]=Variant();
+ a[Mesh::ARRAY_WEIGHTS]=Variant();
+ a[Mesh::ARRAY_INDEX]=Variant();
+ //a.resize(Mesh::ARRAY_MAX); //no need for index
+ mr.push_back(a);
+ }
p_mesh->add_surface(Mesh::PRIMITIVE_TRIANGLES,d,mr);
@@ -1566,17 +1580,21 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
String meshid;
Transform apply_xform;
Vector<int> bone_remap;
+ Vector<Ref<Mesh> > morphs;
print_line("mesh: "+String(mi->get_name()));
if (ng->controller) {
print_line("has controller");
- if (collada.state.skin_controller_data_map.has(ng->source)) {
+
+ String ngsource = ng->source;
+
+ if (collada.state.skin_controller_data_map.has(ngsource)) {
- ERR_FAIL_COND_V(!collada.state.skin_controller_data_map.has(ng->source),ERR_INVALID_DATA);
- skin=&collada.state.skin_controller_data_map[ng->source];
+ ERR_FAIL_COND_V(!collada.state.skin_controller_data_map.has(ngsource),ERR_INVALID_DATA);
+ skin=&collada.state.skin_controller_data_map[ngsource];
Vector<String> skeletons = ng->skeletons;
@@ -1599,7 +1617,10 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
if (collada.state.morph_controller_data_map.has(meshid)) {
//it's a morph!!
morph = &collada.state.morph_controller_data_map[meshid];
+ ngsource=meshid;
meshid=morph->mesh;
+ } else {
+ ngsource="";
}
if (apply_mesh_xform_to_vertices) {
@@ -1630,15 +1651,48 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
ERR_FAIL_COND_V( !bone_remap_map.has(str), ERR_INVALID_DATA );
bone_remap[i]=bone_remap_map[str];
}
- } else if (collada.state.morph_controller_data_map.has(ng->source)) {
- print_line("is morph "+ng->source);
+ }
+
+ if (collada.state.morph_controller_data_map.has(ngsource)) {
+ print_line("is morph "+ngsource);
//it's a morph!!
- morph = &collada.state.morph_controller_data_map[ng->source];
+ morph = &collada.state.morph_controller_data_map[ngsource];
meshid=morph->mesh;
printf("KKmorph: %p\n",morph);
print_line("morph mshid: "+meshid);
- } else {
- ERR_EXPLAIN("Controller Instance Source '"+ng->source+"' is neither skin or morph!");
+
+ Vector<String> targets;
+
+ morph->targets.has("MORPH_TARGET");
+ String target = morph->targets["MORPH_TARGET"];
+ bool valid=false;
+ if (morph->sources.has(target)) {
+ valid=true;
+ Vector<String> names = morph->sources[target].sarray;
+ for(int i=0;i<names.size();i++) {
+
+ String meshid=names[i];
+ if (collada.state.mesh_data_map.has(meshid)) {
+ Ref<Mesh> mesh=Ref<Mesh>(memnew( Mesh ));
+ const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
+ Error err = _create_mesh_surfaces(false,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,NULL);
+ ERR_FAIL_COND_V(err,err);
+
+ morphs.push_back(mesh);
+ } else {
+ valid=false;
+ }
+ }
+ }
+
+ if (!valid)
+ morphs.clear();
+
+ ngsource="";
+ }
+
+ if (ngsource!=""){
+ ERR_EXPLAIN("Controller Instance Source '"+ngsource+"' is neither skin or morph!");
ERR_FAIL_V( ERR_INVALID_DATA );
}
@@ -1659,7 +1713,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node) {
mesh=Ref<Mesh>(memnew( Mesh ));
const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid];
mesh->set_name( meshdata.name );
- Error err = _create_mesh_surfaces(mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,morph);
+ Error err = _create_mesh_surfaces(morphs.size()==0,mesh,ng->material_map,meshdata,apply_xform,bone_remap,skin,morph,morphs);
ERR_FAIL_COND_V(err,err);
mesh_cache[meshid]=mesh;
diff --git a/tools/editor/io_plugins/editor_import_collada.h b/tools/editor/io_plugins/editor_import_collada.h
index ae4cedeff6..243cd043a0 100644
--- a/tools/editor/io_plugins/editor_import_collada.h
+++ b/tools/editor/io_plugins/editor_import_collada.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.cpp b/tools/editor/io_plugins/editor_sample_import_plugin.cpp
index 377af8f179..d1fe10df03 100644
--- a/tools/editor/io_plugins/editor_sample_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_sample_import_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -254,6 +254,24 @@ public:
error_dialog->popup_centered(Size2(200,100));
}
+ if (save_path->get_text().strip_edges()=="") {
+ error_dialog->set_text("Target path is empty.");
+ error_dialog->popup_centered_minsize();
+ return;
+ }
+
+ if (!save_path->get_text().begins_with("res://")) {
+ error_dialog->set_text("Target path must be full resource path.");
+ error_dialog->popup_centered_minsize();
+ return;
+ }
+
+ if (!DirAccess::exists(save_path->get_text())) {
+ error_dialog->set_text("Target path must exist.");
+ error_dialog->popup_centered_minsize();
+ return;
+ }
+
for(int i=0;i<samples.size();i++) {
Ref<ResourceImportMetadata> imd = memnew( ResourceImportMetadata );
@@ -701,8 +719,8 @@ void EditorSampleImportPlugin::_compress_ima_adpcm(const Vector<float>& p_data,D
xm_sample=CLAMP(in[i]*32767.0,-32768,32767);
- if (xm_sample==32767 || xm_sample==-32768)
- printf("clippy!\n",xm_sample);
+ //if (xm_sample==32767 || xm_sample==-32768)
+ // printf("clippy!\n",xm_sample);
}
// xm_sample=xm_sample+xm_prev;
diff --git a/tools/editor/io_plugins/editor_sample_import_plugin.h b/tools/editor/io_plugins/editor_sample_import_plugin.h
index 176dece0d5..03a4d38ab3 100644
--- a/tools/editor/io_plugins/editor_sample_import_plugin.h
+++ b/tools/editor/io_plugins/editor_sample_import_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
index 06780e4d8a..3fb4b06f3c 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -671,15 +671,28 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
wip_open=p_and_open;
//' ImportMonitorBlock imb;
- if (import_path->get_text()=="") {
+
+ if (import_path->get_text().strip_edges()=="") {
error_dialog->set_text("Source path is empty.");
- error_dialog->popup_centered(Size2(200,100));
+ error_dialog->popup_centered_minsize();
return;
}
- if (save_path->get_text()=="") {
+ if (save_path->get_text().strip_edges()=="") {
error_dialog->set_text("Target path is empty.");
- error_dialog->popup_centered(Size2(200,100));
+ error_dialog->popup_centered_minsize();
+ return;
+ }
+
+ if (!save_path->get_text().begins_with("res://")) {
+ error_dialog->set_text("Target path must be full resource path.");
+ error_dialog->popup_centered_minsize();
+ return;
+ }
+
+ if (!DirAccess::exists(save_path->get_text())) {
+ error_dialog->set_text("Target path must exist.");
+ error_dialog->popup_centered_minsize();
return;
}
@@ -701,7 +714,8 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
}
- Ref<EditorScenePostImport> pi;
+
+
if (script_path->get_text()!="") {
Ref<Script> scr = ResourceLoader::load(script_path->get_text());
@@ -711,7 +725,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
return;
}
- pi = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
+ Ref<EditorScenePostImport> pi = Ref<EditorScenePostImport>( memnew( EditorScenePostImport ) );
pi->set_script(scr.get_ref_ptr());
if (!pi->get_script_instance()) {
@@ -719,6 +733,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
error_dialog->popup_centered(Size2(200,100));
return;
}
+
}
@@ -747,7 +762,7 @@ void EditorSceneImportDialog::_import(bool p_and_open) {
rim->set_option("animation_optimizer_max_angle",animation_options->get_optimize_max_angle());
rim->set_option("animation_filters",animation_options->get_filter());
rim->set_option("animation_clips",animation_options->get_clips());
- rim->set_option("post_import_script",script_path->get_text()!=String()?EditorImportPlugin::validate_source_path(script_path->get_text()):String());
+ rim->set_option("post_import_script",script_path->get_text());
rim->set_option("import_this_time",this_import->get_selected());
rim->set_option("import_next_time",next_import->get_selected());
rim->set_option("reimport",true);
@@ -893,6 +908,7 @@ void EditorSceneImportDialog::popup_import(const String &p_from) {
if (rimd->has_option("animation_optimizer_max_angle"))
animation_options->set_optimize_max_angle(rimd->get_option("animation_optimizer_max_angle"));
+
script_path->set_text(rimd->get_option("post_import_script"));
if (rimd->has_option("import_this_time"))
this_import->select(rimd->get_option("import_this_time"));
@@ -2121,7 +2137,7 @@ void EditorSceneImportPlugin::_merge_existing_node(Node *p_node,Node *p_imported
}
-void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node *p_imported_scene,Set<Node*> &checked_nodes) {
+void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node *p_imported_scene,Node *p_existing_scene,Set<Node*> &checked_nodes) {
for(int i=0;i<p_imported->get_child_count();i++) {
@@ -2129,12 +2145,15 @@ 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)
+ if (imported_node->get_owner()!=p_imported_scene) {
+ // 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));
if (!p_node->has_node(imported_path) && !checked_nodes.has(imported_node)) {
//not there, re-add it
@@ -2144,8 +2163,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..");
+
if (n) {
+ //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()) {
@@ -2155,8 +2177,11 @@ void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node
}
p_node->add_child(n);
+ n->set_owner(p_existing_scene);
}
+ } else {
+ //print_line("already exists");
}
@@ -2164,7 +2189,7 @@ void EditorSceneImportPlugin::_add_new_nodes(Node *p_node,Node *p_imported,Node
Node *other_node = p_node->get_node(imported_path);
- _add_new_nodes(other_node,imported_node,p_imported_scene,checked_nodes);
+ _add_new_nodes(other_node,imported_node,p_imported_scene,p_existing_scene,checked_nodes);
}
@@ -2177,7 +2202,7 @@ void EditorSceneImportPlugin::_merge_scenes(Node *p_node,Node *p_imported) {
Set<Ref<Resource> > checked_resources;
Set<Node*> checked_nodes;
_merge_existing_node(p_node,p_imported,checked_resources,checked_nodes);
- _add_new_nodes(p_node,p_imported,p_imported,checked_nodes);
+ _add_new_nodes(p_node,p_imported,p_imported,p_node,checked_nodes);
//add existing.. ?
}
@@ -2214,27 +2239,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!");
}
}
}
@@ -2251,9 +2282,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
@@ -2687,7 +2728,7 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
Ref<EditorScenePostImport> post_import_script;
if (post_import_script_path!="") {
- post_import_script_path = EditorImportPlugin::expand_source_path(post_import_script_path);
+ post_import_script_path = post_import_script_path;
Ref<Script> scr = ResourceLoader::load(post_import_script_path);
if (!scr.is_valid()) {
EditorNode::add_io_error("Couldn't load post-import script: '"+post_import_script_path);
@@ -2709,8 +2750,11 @@ Error EditorSceneImportPlugin::import2(Node *scene, const String& p_dest_path, c
EditorNode::add_io_error("Error running Post-Import script: '"+post_import_script_path);
return err;
}
+
+
}
+
/// IMPORT IMAGES
diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.h b/tools/editor/io_plugins/editor_scene_import_plugin.h
index fa4730f7ee..71efab9503 100644
--- a/tools/editor/io_plugins/editor_scene_import_plugin.h
+++ b/tools/editor/io_plugins/editor_scene_import_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -113,7 +113,7 @@ class EditorSceneImportPlugin : public EditorImportPlugin {
void _filter_tracks(Node *scene, const String& p_text);
void _merge_existing_node(Node *p_node,Node *p_imported_scene,Set<Ref<Resource> >& checked_resources,Set<Node*> &checked_nodes);
- void _add_new_nodes(Node *p_node,Node *p_imported,Node *p_imported_scene,Set<Node*> &checked_nodes);
+ void _add_new_nodes(Node *p_node,Node *p_imported,Node *p_imported_scene,Node *p_existing_scene,Set<Node*> &checked_nodes);
void _optimize_animations(Node *scene, float p_max_lin_error,float p_max_ang_error,float p_max_angle);
void _merge_scenes(Node *p_node, Node *p_imported);
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
index ce376f2e7b..64b5d5b337 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -321,12 +321,23 @@ void EditorTextureImportDialog::_import() {
String dst_path=save_path->get_text();
- if (dst_path.empty()) {
+ if (save_path->get_text().strip_edges()=="") {
+ error_dialog->set_text("Target path is empty.");
+ error_dialog->popup_centered_minsize();
+ return;
+ }
- error_dialog->set_text("Please specify a valid target import path!");
- error_dialog->popup_centered(Size2(200,100));
+ if (!save_path->get_text().begins_with("res://")) {
+ error_dialog->set_text("Target path must be full resource path.");
+ error_dialog->popup_centered_minsize();
return;
+ }
+
+ if (!atlas && !DirAccess::exists(save_path->get_text())) {
+ error_dialog->set_text("Target path must exist.");
+ error_dialog->popup_centered_minsize();
+ return;
}
if (atlas) { //atlas
diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.h b/tools/editor/io_plugins/editor_texture_import_plugin.h
index e733a3ddf9..5cd36e838e 100644
--- a/tools/editor/io_plugins/editor_texture_import_plugin.h
+++ b/tools/editor/io_plugins/editor_texture_import_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.cpp b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
index 9540869789..6d59b52fb5 100644
--- a/tools/editor/io_plugins/editor_translation_import_plugin.cpp
+++ b/tools/editor/io_plugins/editor_translation_import_plugin.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/tools/editor/io_plugins/editor_translation_import_plugin.h b/tools/editor/io_plugins/editor_translation_import_plugin.h
index 8ea422c244..f3c2884534 100644
--- a/tools/editor/io_plugins/editor_translation_import_plugin.h
+++ b/tools/editor/io_plugins/editor_translation_import_plugin.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */