clean : Remove the debug print

debug : don't display the name of the element in unity anymore
This commit is contained in:
Balleux Benjamin
2017-04-19 16:38:35 +02:00
parent 195979d4f0
commit 8e4febecc0
3 changed files with 6 additions and 27 deletions
+4 -20
View File
@@ -251,7 +251,7 @@ void ColladaSerializer::ColladaExporter::ColladaScene::addParent(const IfcGeom::
}
void ColladaSerializer::ColladaExporter::ColladaScene::closeParent(){
if (current_node != NULL) { std::cout << "current node is not null\n"; current_node->end(); }
if (current_node != NULL) { current_node->end(); }
}
void ColladaSerializer::ColladaExporter::ColladaScene::write() {
@@ -340,7 +340,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
const std::string name = serializer->settings().get(SerializerSettings::USE_ELEMENT_GUIDS) ?
o->guid() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_NAMES) ?
o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() + "_" + o->name() : o->unique_id()));
o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() : o->unique_id()));
const std::string representation_id = "representation-" + boost::lexical_cast<std::string>(o->geometry().id());
std::vector<std::string> material_references;
foreach(const IfcGeom::Material& material, mesh.materials()) {
@@ -364,7 +364,7 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
const IfcGeom::Representation::Triangulation<real_t>& mesh = o->geometry();
const std::string name = serializer->settings().get(SerializerSettings::USE_ELEMENT_GUIDS) ?
o->guid() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_NAMES) ?
o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() + "_" + o->name() : o->unique_id()));
o->name() : (serializer->settings().get(SerializerSettings::USE_ELEMENT_TYPES) ? o->type() : o->unique_id()));
const std::string representation_id = "representation-" + boost::lexical_cast<std::string>(o->geometry().id());
std::vector<std::string> material_references;
foreach(const IfcGeom::Material& material, mesh.materials()) {
@@ -389,12 +389,9 @@ void ColladaSerializer::ColladaExporter::write(const IfcGeom::TriangulationEleme
void ColladaSerializer::ColladaExporter::endDocument() {
// In fact due the XML based nature of Collada and its dependency on library nodes,
// only at this point all objects are written to the stream.
std::cout << "starting end document\n";
materials.write();
std::set<std::string> geometries_written;
std::cout << "sorting defered list...\n";
std::sort(deferreds.begin(), deferreds.end());
std::cout << "done\n";
for (std::vector<DeferredObject>::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it) {
if (geometries_written.find(it->representation_id) != geometries_written.end()) {
continue;
@@ -408,34 +405,21 @@ void ColladaSerializer::ColladaExporter::endDocument() {
for (std::vector<DeferredObject>::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it)
{
const std::string object_name = it->unique_id;
//std::cout << "working on " << it->unique_id;
//std::cout << (it->parent == NULL ? " parent is null\n" : "parent is not null\n");
if (it->parent != NULL && parent_id != it->parent->id())
{
std::cout << "parent description : \n --- Type : " << it->parent->type() << " \n --- Name : " << it->parent->name() << "\n";
//std::cout << "parent is not null. Id : " << it->parent->id() << '\n';
//std::cout << "test if parent is empty ... \n";
if (!is_parent_empty)
{
//std::cout << "close parent1 ... \n";
scene.closeParent();
//std::cout << "done\n";
}
//std::cout << "get parent id .. \n";
parent_id = it->parent->id();
//std::cout << "add parent to scene .. \n";
scene.addParent(*it->parent);
//std::cout << "done \n";
is_parent_empty = false;
}
//std::cout << "add node to scene ... \n";
/// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name
scene.add(object_name, object_name, it->representation_id, it->material_references, it->matrix);
//std::cout << "done \n";
}
std::cout << "close parent2 : \n";
if (!is_parent_empty) scene.closeParent();
std::cout << "write : \n";
scene.write();
stream.endDocument();
}
+1 -1
View File
@@ -43,7 +43,7 @@ public:
/// Use material names instead of unique IDs for naming materials.
/// Applicable for OBJ and DAE output.
USE_MATERIAL_NAMES = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 3),
/// Use element types and names instead of unique IDs for naming elements.
/// Use element types instead of unique IDs for naming elements.
/// Applicable for DAE output.
USE_ELEMENT_TYPES = 1 << (IfcGeom::IteratorSettings::NUM_SETTINGS + 4),
/// Order the elements using their IfcBuildingStorey parent
+1 -6
View File
@@ -268,7 +268,7 @@ int main(int argc, char** argv)
"Use material names instead of unique IDs for naming materials upon serialization. "
"Applicable for OBJ and DAE output.")
("use-element-types",
"Use element types and names instead of unique IDs for naming elements upon serialization. "
"Use element types instead of unique IDs for naming elements upon serialization. "
"Applicable for DAE output.")
("use-element-hierarchy",
"Order the elements using their IfcBuildingStorey parent. "
@@ -596,7 +596,6 @@ int main(int argc, char** argv)
try { parent_object = context_iterator.getObject(geom_object->parent_id()); }
catch (std::exception e)
{
std::cout << e.what() << '\n';
hasParent = false;
}
@@ -605,15 +604,11 @@ int main(int argc, char** argv)
try { parent_object = context_iterator.getObject(parent_object->parent_id()); }
catch (std::exception e)
{
std::cout << e.what() << '\n';
hasParent = false;
}
hasParent = hasParent && parent_object->parent_id() != 1;
}
//Debug
//if (parent_object != NULL) std::cout << '\n' << "obj " << geom_object->unique_id() << " parent = " << parent_object->name() << " of type " << parent_object->type() << '\n';
//else std::cout << "No parent found : " << geom_object->unique_id() << " of type : " << geom_object->type();
if (parent_object != NULL) serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object), parent_object);
else serializer->write(static_cast<const IfcGeom::TriangulationElement<real_t>*>(geom_object));