mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Modified the condition checking if the parent had changed so an object without parent isn't placed in a storey.
This commit is contained in:
@@ -370,7 +370,6 @@ void ColladaSerializer::ColladaExporter::endDocument() {
|
|||||||
// only at this point all objects are written to the stream.
|
// only at this point all objects are written to the stream.
|
||||||
materials.write();
|
materials.write();
|
||||||
|
|
||||||
|
|
||||||
std::set<std::string> geometries_written;
|
std::set<std::string> geometries_written;
|
||||||
|
|
||||||
//if the setting USE_ELEMENT_HIERARCHY is in use, we sort the deferreds objects by their parents.
|
//if the setting USE_ELEMENT_HIERARCHY is in use, we sort the deferreds objects by their parents.
|
||||||
@@ -391,16 +390,19 @@ void ColladaSerializer::ColladaExporter::endDocument() {
|
|||||||
for (std::vector<DeferredObject>::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it){
|
for (std::vector<DeferredObject>::const_iterator it = deferreds.begin(); it != deferreds.end(); ++it){
|
||||||
const std::string object_name = it->unique_id;
|
const std::string object_name = it->unique_id;
|
||||||
|
|
||||||
//if the setting USE_ELEMENT_HIERARCHY is in use, we check if the parent changed
|
//if the setting USE_ELEMENT_HIERARCHY is in use, we check if the parent has changed
|
||||||
if (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) && it->parent != NULL && parent_id != it->parent->id()){
|
if (serializer->settings().get(SerializerSettings::USE_ELEMENT_HIERARCHY) && ((it->parent == NULL && parent_id != -1) || (it->parent != NULL && parent_id != it->parent->id()))){
|
||||||
|
|
||||||
//close the parent tag, if one is already open.
|
//close the parent tag, if one is already open.
|
||||||
if (!is_parent_empty){
|
if (!is_parent_empty){
|
||||||
scene.closeParent();
|
scene.closeParent();
|
||||||
}
|
}
|
||||||
parent_id = it->parent->id();
|
|
||||||
scene.addParent(*it->parent);
|
if (it->parent != NULL){
|
||||||
is_parent_empty = false;
|
parent_id = it->parent->id();
|
||||||
|
scene.addParent(*it->parent);
|
||||||
|
is_parent_empty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name
|
/// @todo redundant information using ID as both ID and Name, maybe omit Name or allow specifying what would be used as the name
|
||||||
|
|||||||
Reference in New Issue
Block a user