MCPcopy Create free account
hub / github.com/assimp/assimp / readMaterialDef

Method readMaterialDef

code/AssetLib/3MF/XmlSerializer.cpp:649–673  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

647}
648
649aiMaterial *XmlSerializer::readMaterialDef(XmlNode &node, unsigned int basematerialsId) {
650 aiMaterial *material = new aiMaterial();
651 material->mNumProperties = 0;
652 std::string name;
653 bool hasName = getNodeAttribute(node, D3MF::XmlTag::basematerials_name, name);
654
655 std::string stdMaterialName;
656 const std::string strId(ai_to_string(basematerialsId));
657 stdMaterialName += "id";
658 stdMaterialName += strId;
659 stdMaterialName += "_";
660 if (hasName) {
661 stdMaterialName += name;
662 } else {
663 stdMaterialName += "basemat_";
664 stdMaterialName += ai_to_string(mMaterials.size());
665 }
666
667 aiString assimpMaterialName(stdMaterialName);
668 material->AddProperty(&assimpMaterialName, AI_MATKEY_NAME);
669
670 assignDiffuseColor(node, material);
671
672 return material;
673}
674
675void XmlSerializer::ReadColor(XmlNode &node, ColorGroup *colorGroup) {
676 if (node.empty() || nullptr == colorGroup) {

Callers

nothing calls this directly

Calls 4

getNodeAttributeFunction · 0.85
assignDiffuseColorFunction · 0.85
sizeMethod · 0.45
AddPropertyMethod · 0.45

Tested by

no test coverage detected