summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-08-24 09:35:07 +0200
committerRémi Verschelde <rverschelde@gmail.com>2018-08-24 14:59:01 +0200
commit52466d57e9c2897c40698a09482e5e7de230368f (patch)
tree54ff3bb78961ca5d8120cc7e6abe91f5c99d92b7 /editor/import
parentd442f3d0aa4185f154bee396efaf24ceb73c9d84 (diff)
Make some debug prints verbose-only, remove others
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/editor_import_collada.cpp42
-rw-r--r--editor/import/editor_scene_importer_gltf.cpp36
-rw-r--r--editor/import/resource_importer_obj.cpp10
-rw-r--r--editor/import/resource_importer_scene.cpp15
-rw-r--r--editor/import/resource_importer_wav.cpp11
5 files changed, 39 insertions, 75 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index 22ea5883e8..d4bd4f85e6 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -119,7 +119,6 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n
Collada::NodeJoint *joint = static_cast<Collada::NodeJoint *>(p_node);
- print_line("populating joint " + joint->name);
p_skeleton->add_bone(p_node->name);
if (p_parent >= 0)
p_skeleton->set_bone_parent(r_bone, p_parent);
@@ -137,8 +136,7 @@ Error ColladaImport::_populate_skeleton(Skeleton *p_skeleton, Collada::Node *p_n
p_skeleton->set_bone_rest(r_bone, collada.fix_transform(collada.state.bone_rest_map[joint->sid]));
//should map this bone to something for animation?
} else {
- print_line("no rest: " + joint->sid);
- WARN_PRINT("Joint has no rest...");
+ WARN_PRINT("Collada: Joint has no rest.");
}
int id = r_bone++;
@@ -585,9 +583,6 @@ static void _generate_tangents_and_binormals(const PoolVector<int> &p_indices, c
binormals.write[index_arrayr[idx * 3 + 1]] += binormal;
tangents.write[index_arrayr[idx * 3 + 2]] += tangent;
binormals.write[index_arrayr[idx * 3 + 2]] += binormal;
-
- //print_line(itos(idx)+" tangent: "+tangent);
- //print_line(itos(idx)+" binormal: "+binormal);
}
r_tangents.resize(vlen * 4);
@@ -1028,7 +1023,7 @@ Error ColladaImport::_create_mesh_surfaces(bool p_optimize, Ref<ArrayMesh> &p_me
material = material_cache[target];
} else if (p.material != "") {
- print_line("Warning, unreferenced material in geometry instance: " + p.material);
+ WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + p.material);
}
}
@@ -1352,7 +1347,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mesh_cache[meshid] = mesh;
} else {
- print_line("Warning, will not import geometry: " + meshid);
+ WARN_PRINTS("Collada: Will not import geometry: " + meshid);
}
}
@@ -1379,7 +1374,7 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres
mi->set_surface_material(i, material);
} else if (matname != "") {
- print_line("Warning, unreferenced material in geometry instance: " + matname);
+ WARN_PRINTS("Collada: Unreferenced material in geometry instance: " + matname);
}
}
}
@@ -1541,7 +1536,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
for (int i = 0; i < collada.state.animation_tracks.size(); i++) {
const Collada::AnimationTrack &at = collada.state.animation_tracks[i];
- //print_line("CHANNEL: "+at.target+" PARAM: "+at.param);
String node;
@@ -1551,7 +1545,7 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
node = node_name_map[at.target];
} else {
- print_line("Couldn't find node: " + at.target);
+ WARN_PRINTS("Collada: Couldn't find node: " + at.target);
continue;
}
} else {
@@ -1570,7 +1564,6 @@ void ColladaImport::create_animations(bool p_make_tracks_in_all_bones, bool p_im
}
create_animation(-1, p_make_tracks_in_all_bones, p_import_value_tracks);
- //print_line("clipcount: "+itos(collada.state.animation_clips.size()));
for (int i = 0; i < collada.state.animation_clips.size(); i++)
create_animation(i, p_make_tracks_in_all_bones, p_import_value_tracks);
}
@@ -1580,11 +1573,8 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Ref<Animation> animation = Ref<Animation>(memnew(Animation));
if (p_clip == -1) {
-
- //print_line("default");
animation->set_name("default");
} else {
- //print_line("clip name: "+collada.state.animation_clips[p_clip].name);
animation->set_name(collada.state.animation_clips[p_clip].name);
}
@@ -1658,7 +1648,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
}
- //print_line("anim len: "+rtos(anim_length));
animation->set_length(anim_length);
bool tracks_found = false;
@@ -1736,7 +1725,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
}
if (xform_idx == -1) {
- print_line("couldn't find matching node " + at.target + " xform for track " + at.param);
+ WARN_PRINTS("Collada: Couldn't find matching node " + at.target + " xform for track " + at.param);
continue;
}
@@ -1758,14 +1747,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
ERR_CONTINUE(data.size() > 1);
xf.data.write[cn] = data[0];
} else if (data.size() == xf.data.size()) {
-
xf.data = data;
} else {
-
- if (data.size() != xf.data.size()) {
- print_line("component " + at.component + " datasize " + itos(data.size()) + " xfdatasize " + itos(xf.data.size()));
- }
-
+ ERR_EXPLAIN("Component " + at.component + " has datasize " + itos(data.size()) + ", xfdatasize " + itos(xf.data.size()));
ERR_CONTINUE(data.size() != xf.data.size());
}
}
@@ -1781,7 +1765,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
xform = sk->get_bone_rest(nm.bone).affine_inverse() * xform;
} else {
- ERR_PRINT("INVALID SKELETON!!!!");
+ ERR_PRINT("Collada: Invalid skeleton");
}
}
@@ -1812,8 +1796,6 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
if (E->get())
continue;
- //print_line("BONE LACKS ANIM: "+E->key());
-
NodeMap &nm = node_map[E->key()];
String path = scene->get_path_to(nm.node);
ERR_CONTINUE(nm.bone < 0);
@@ -1823,7 +1805,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Collada::Node *cn = collada.state.scene_map[E->key()];
if (cn->ignore_anim) {
- print_line("warning, ignoring animation on node: " + path);
+ WARN_PRINTS("Collada: Ignoring animation on node: " + path);
continue;
}
@@ -1889,10 +1871,9 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
} else if (data.size() == 16) {
//matrix
- print_line("value keys for matrices not supported");
+ WARN_PRINT("Collada: Value keys for matrices not supported.");
} else {
-
- print_line("don't know what to do with this amount of value keys: " + itos(data.size()));
+ WARN_PRINTS("Collada: Unexpected amount of value keys: " + itos(data.size()));
}
animation->track_insert_key(track, time, value);
@@ -1994,7 +1975,6 @@ Ref<Animation> EditorSceneImporterCollada::import_animation(const String &p_path
if (state.animations.size() == 0)
return Ref<Animation>();
Ref<Animation> anim = state.animations[0];
- print_line("Anim Load OK");
String base = p_path.get_basename().to_lower();
if (p_flags & IMPORT_ANIMATION_DETECT_LOOP) {
diff --git a/editor/import/editor_scene_importer_gltf.cpp b/editor/import/editor_scene_importer_gltf.cpp
index 906d902b4a..4d5c292847 100644
--- a/editor/import/editor_scene_importer_gltf.cpp
+++ b/editor/import/editor_scene_importer_gltf.cpp
@@ -323,7 +323,7 @@ Error EditorSceneImporterGLTF::_parse_buffers(GLTFState &state, const String &p_
}
}
- print_line("total buffers: " + itos(state.buffers.size()));
+ print_verbose("glTF: Total buffers: " + itos(state.buffers.size()));
return OK;
}
@@ -359,7 +359,7 @@ Error EditorSceneImporterGLTF::_parse_buffer_views(GLTFState &state) {
state.buffer_views.push_back(buffer_view);
}
- print_line("total buffer views: " + itos(state.buffer_views.size()));
+ print_verbose("glTF: Total buffer views: " + itos(state.buffer_views.size()));
return OK;
}
@@ -451,7 +451,7 @@ Error EditorSceneImporterGLTF::_parse_accessors(GLTFState &state) {
state.accessors.push_back(accessor);
}
- print_line("total accessors: " + itos(state.accessors.size()));
+ print_verbose("glTF: Total accessors: " + itos(state.accessors.size()));
return OK;
}
@@ -501,8 +501,8 @@ Error EditorSceneImporterGLTF::_decode_buffer_view(GLTFState &state, int p_buffe
const uint8_t *bufptr = buffer.ptr();
//use to debug
- //print_line("type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
- print_line("accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length));
+ print_verbose("glTF: type " + _get_type_name(type) + " component type: " + _get_component_type_name(component_type) + " stride: " + itos(stride) + " amount " + itos(count));
+ print_verbose("glTF: accessor offset" + itos(byte_offset) + " view offset: " + itos(bv.byte_offset) + " total buffer len: " + itos(buffer.size()) + " view len " + itos(bv.byte_length));
int buffer_end = (stride * (count - 1)) + element_size;
ERR_FAIL_COND_V(buffer_end > bv.byte_length, ERR_PARSE_ERROR);
@@ -853,7 +853,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array meshes = state.json["meshes"];
for (int i = 0; i < meshes.size(); i++) {
- print_line("on mesh: " + itos(i));
+ print_verbose("glTF: Parsing mesh: " + itos(i));
Dictionary d = meshes[i];
GLTFMesh mesh;
@@ -935,7 +935,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
w[j + 3] /= total;
}
- //print_line(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3]));
+ //print_verbose(itos(j / 4) + ": " + itos(r[j + 0]) + ":" + rtos(w[j + 0]) + ", " + itos(r[j + 1]) + ":" + rtos(w[j + 1]) + ", " + itos(r[j + 2]) + ":" + rtos(w[j + 2]) + ", " + itos(r[j + 3]) + ":" + rtos(w[j + 3]));
}
}
array[Mesh::ARRAY_WEIGHTS] = weights;
@@ -996,7 +996,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
Array morphs;
//blend shapes
if (p.has("targets")) {
- print_line("has targets!");
+ print_verbose("glTF: Mesh has targets");
Array targets = p["targets"];
if (j == 0) {
@@ -1091,7 +1091,7 @@ Error EditorSceneImporterGLTF::_parse_meshes(GLTFState &state) {
state.meshes.push_back(mesh);
}
- print_line("total meshes: " + itos(state.meshes.size()));
+ print_verbose("glTF: Total meshes: " + itos(state.meshes.size()));
return OK;
}
@@ -1183,7 +1183,7 @@ Error EditorSceneImporterGLTF::_parse_images(GLTFState &state, const String &p_b
ERR_FAIL_V(ERR_FILE_CORRUPT);
}
- print_line("total images: " + itos(state.images.size()));
+ print_verbose("Total images: " + itos(state.images.size()));
return OK;
}
@@ -1338,7 +1338,7 @@ Error EditorSceneImporterGLTF::_parse_materials(GLTFState &state) {
state.materials.push_back(material);
}
- print_line("total materials: " + itos(state.materials.size()));
+ print_verbose("Total materials: " + itos(state.materials.size()));
return OK;
}
@@ -1381,12 +1381,11 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) {
skin.bones.push_back(bone);
}
- print_line("skin has skeleton? " + itos(d.has("skeleton")));
+ print_verbose("glTF: Skin has skeleton? " + itos(d.has("skeleton")));
if (d.has("skeleton")) {
int skeleton = d["skeleton"];
ERR_FAIL_INDEX_V(skeleton, state.nodes.size(), ERR_PARSE_ERROR);
- //state.nodes[skeleton]->skeleton_skin = state.skins.size();
- print_line("setting skeleton skin to" + itos(skeleton));
+ print_verbose("glTF: Setting skeleton skin to" + itos(skeleton));
skin.skeleton = skeleton;
if (!state.skeleton_nodes.has(skeleton)) {
state.skeleton_nodes[skeleton] = Vector<int>();
@@ -1443,7 +1442,7 @@ Error EditorSceneImporterGLTF::_parse_skins(GLTFState &state) {
*/
state.skins.push_back(skin);
}
- print_line("total skins: " + itos(state.skins.size()));
+ print_verbose("glTF: Total skins: " + itos(state.skins.size()));
//now
@@ -1496,7 +1495,7 @@ Error EditorSceneImporterGLTF::_parse_cameras(GLTFState &state) {
state.cameras.push_back(camera);
}
- print_line("total cameras: " + itos(state.cameras.size()));
+ print_verbose("glTF: Total cameras: " + itos(state.cameras.size()));
return OK;
}
@@ -1574,7 +1573,6 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
}
}
- print_line("path: " + path);
PoolVector<float> times = _decode_accessor_as_floats(state, input, false);
if (path == "translation") {
PoolVector<Vector3> translations = _decode_accessor_as_vec3(state, output, false);
@@ -1624,7 +1622,7 @@ Error EditorSceneImporterGLTF::_parse_animations(GLTFState &state) {
state.animations.push_back(animation);
}
- print_line("total animations: " + itos(state.animations.size()));
+ print_verbose("glTF: Total animations: " + itos(state.animations.size()));
return OK;
}
@@ -1656,7 +1654,7 @@ void EditorSceneImporterGLTF::_generate_node(GLTFState &state, int p_node, Node
if (n->mesh >= 0) {
ERR_FAIL_INDEX(n->mesh, state.meshes.size());
MeshInstance *mi = memnew(MeshInstance);
- print_line("**creating mesh for: " + n->name);
+ print_verbose("glTF: Creating mesh for: " + n->name);
GLTFMesh &mesh = state.meshes.write[n->mesh];
mi->set_mesh(mesh.mesh);
if (mesh.mesh->get_name() == "") {
diff --git a/editor/import/resource_importer_obj.cpp b/editor/import/resource_importer_obj.cpp
index 5babf6419c..3f101cd04d 100644
--- a/editor/import/resource_importer_obj.cpp
+++ b/editor/import/resource_importer_obj.cpp
@@ -63,7 +63,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
material_map[current_name] = current;
} else if (l.begins_with("Ka ")) {
//uv
- print_line("Warning: Ambient light for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINTS("OBJ: Ambient light for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("Kd ")) {
//normal
@@ -119,7 +119,7 @@ static Error _parse_material_library(const String &p_path, Map<String, Ref<Spati
} else if (l.begins_with("map_Ka ")) {
//uv
- print_line("Warning: Ambient light texture for material '" + current_name + "' is ignored in PBR");
+ WARN_PRINTS("OBJ: Ambient light texture for material '" + current_name + "' is ignored in PBR");
} else if (l.begins_with("map_Kd ")) {
//normal
@@ -335,8 +335,8 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
surf_tool->index();
- print_line("current material library " + current_material_library + " has " + itos(material_map.has(current_material_library)));
- print_line("current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
+ print_verbose("OBJ: Current material library " + current_material_library + " has " + itos(material_map.has(current_material_library)));
+ print_verbose("OBJ: Current material " + current_material + " has " + itos(material_map.has(current_material_library) && material_map[current_material_library].has(current_material)));
if (material_map.has(current_material_library) && material_map[current_material_library].has(current_material)) {
surf_tool->set_material(material_map[current_material_library][current_material]);
@@ -350,7 +350,7 @@ static Error _parse_obj(const String &p_path, List<Ref<Mesh> > &r_meshes, bool p
mesh->surface_set_name(mesh->get_surface_count() - 1, current_group);
}
- print_line("Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1));
+ print_verbose("OBJ: Added surface :" + mesh->surface_get_name(mesh->get_surface_count() - 1));
surf_tool->clear();
surf_tool->begin(Mesh::PRIMITIVE_TRIANGLES);
}
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index b5e3466b12..f544811eb0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -281,12 +281,11 @@ static String _fixstr(const String &p_what, const String &p_str) {
Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<ArrayMesh>, Ref<Shape> > &collision_map, LightBakeMode p_light_bake_mode) {
- // children first..
+ // children first
for (int i = 0; i < p_node->get_child_count(); i++) {
Node *r = _fix_node(p_node->get_child(i), p_root, collision_map, p_light_bake_mode);
if (!r) {
- print_line("was erased...");
i--; //was erased
}
}
@@ -391,7 +390,6 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Array
colshape->set_owner(p_node->get_owner());
} else if (p_node->has_meta("empty_draw_type")) {
String empty_draw_type = String(p_node->get_meta("empty_draw_type"));
- print_line(empty_draw_type);
StaticBody *sb = memnew(StaticBody);
sb->set_name(_fixstr(name, "colonly"));
Object::cast_to<Spatial>(sb)->set_transform(Object::cast_to<Spatial>(p_node)->get_transform());
@@ -723,15 +721,11 @@ void ResourceImporterScene::_filter_anim_tracks(Ref<Animation> anim, Set<String>
Ref<Animation> a = anim;
ERR_FAIL_COND(!a.is_valid());
- print_line("From Anim " + anim->get_name() + ":");
-
for (int j = 0; j < a->get_track_count(); j++) {
String path = a->track_get_path(j);
if (!keep.has(path)) {
-
- print_line("Remove: " + path);
a->remove_track(j);
j--;
}
@@ -899,8 +893,6 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans
}
meshes[mesh] = transform;
-
- print_line("mesh transform: " + meshes[mesh]);
}
}
for (int i = 0; i < p_node->get_child_count(); i++) {
@@ -913,8 +905,6 @@ void ResourceImporterScene::_make_external_resources(Node *p_node, const String
List<PropertyInfo> pi;
- print_line("node: " + String(p_node->get_name()));
-
if (p_make_animations) {
if (Object::cast_to<AnimationPlayer>(p_node)) {
AnimationPlayer *ap = Object::cast_to<AnimationPlayer>(p_node);
@@ -1316,7 +1306,6 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
if (bool(p_options["external_files/store_in_subdir"])) {
String subdir_name = p_source_file.get_file().get_basename();
DirAccess *da = DirAccess::open(base_path);
- print_line("at path " + da->get_current_dir() + " making " + subdir_name);
Error err = da->make_dir(subdir_name);
memdelete(da);
ERR_FAIL_COND_V(err != OK && err != ERR_ALREADY_EXISTS, err);
@@ -1421,7 +1410,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
Ref<PackedScene> packer = memnew(PackedScene);
packer->pack(scene);
- print_line("SAVING TO: " + p_save_path + ".scn");
+ print_verbose("Saving scene to: " + p_save_path + ".scn");
err = ResourceSaver::save(p_save_path + ".scn", packer); //do not take over, let the changed files reload themselves
ERR_FAIL_COND_V(err != OK, err);
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index 9e99dcc5c8..d04f29ea5e 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -205,7 +205,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
/*print_line("chunksize: "+itos(chunksize));
print_line("channels: "+itos(format_channels));
print_line("bits: "+itos(format_bits));
-*/
+ */
int len = frames;
if (format_channels == 2)
@@ -293,6 +293,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
bool is16 = format_bits != 8;
int rate = format_freq;
+ /*
print_line("Input Sample: ");
print_line("\tframes: " + itos(frames));
print_line("\tformat_channels: " + itos(format_channels));
@@ -301,18 +302,16 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
print_line("\tloop: " + itos(loop));
print_line("\tloop begin: " + itos(loop_begin));
print_line("\tloop end: " + itos(loop_end));
+ */
//apply frequency limit
bool limit_rate = p_options["force/max_rate"];
int limit_rate_hz = p_options["force/max_rate_hz"];
if (limit_rate && rate > limit_rate_hz && rate > 0 && frames > 0) {
- //resampleeee!!!
+ // resample!
int new_data_frames = (int)(frames * (float)limit_rate_hz / (float)rate);
- print_line("\tresampling ratio: " + rtos((float)limit_rate_hz / (float)rate));
- print_line("\tnew frames: " + itos(new_data_frames));
-
Vector<float> new_data;
new_data.resize(new_data_frames * format_channels);
for (int c = 0; c < format_channels; c++) {
@@ -492,8 +491,6 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
- //print_line("compressing ima-adpcm, resulting buffersize is "+itos(dst_data.size())+" from "+itos(data.size()));
-
} else {
dst_format = is16 ? AudioStreamSample::FORMAT_16_BITS : AudioStreamSample::FORMAT_8_BITS;