- manually merged C4D importer code from acgessler branch

- manually merged IFC bugfixes and improvements from schrompf branch
This commit is contained in:
ulf
2015-02-23 14:23:28 +01:00
parent 7c38a33225
commit b71ded1ad0
12 changed files with 1532 additions and 424 deletions

View File

@@ -428,7 +428,7 @@ void GetAbsTransform(aiMatrix4x4& out, const aiNode* nd, ConversionData& conv)
}
// ------------------------------------------------------------------------------------------------
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, ConversionData& conv)
bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector< aiNode* >& subnodes_src, unsigned int matid, ConversionData& conv)
{
// insert a custom node here, the cartesian transform operator is simply a conventional transformation matrix
std::auto_ptr<aiNode> nd(new aiNode());
@@ -453,11 +453,12 @@ bool ProcessMappedItem(const IfcMappedItem& mapped, aiNode* nd_src, std::vector<
}
}
unsigned int localmatid = ProcessMaterials(mapped.GetID(),matid,conv,false);
const IfcRepresentation& repr = mapped.MappingSource->MappedRepresentation;
bool got = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr.Items) {
if(!ProcessRepresentationItem(item,meshes,conv)) {
if(!ProcessRepresentationItem(item,localmatid,meshes,conv)) {
IFCImporter::LogWarn("skipping mapped entity of type " + item.GetClassName() + ", no representations could be generated");
}
else got = true;
@@ -557,7 +558,11 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
if(!el.Representation) {
return;
}
// extract Color from metadata, if present
unsigned int matid = ProcessMaterials( el.GetID(), UINT32_MAX, conv, false);
std::vector<unsigned int> meshes;
// we want only one representation type, so bring them in a suitable order (i.e try those
// that look as if we could read them quickly at first). This way of reading
// representation is relatively generic and allows the concrete implementations
@@ -571,10 +576,10 @@ void ProcessProductRepresentation(const IfcProduct& el, aiNode* nd, std::vector<
bool res = false;
BOOST_FOREACH(const IfcRepresentationItem& item, repr->Items) {
if(const IfcMappedItem* const geo = item.ToPtr<IfcMappedItem>()) {
res = ProcessMappedItem(*geo,nd,subnodes,conv) || res;
res = ProcessMappedItem(*geo,nd,subnodes,matid,conv) || res;
}
else {
res = ProcessRepresentationItem(item,meshes,conv) || res;
res = ProcessRepresentationItem(item,matid,meshes,conv) || res;
}
}
// if we got something meaningful at this point, skip any further representations