From Sukender, "Lastest change (update to FBX 2012.1) introduced a regression. It didn't take materials' order into consideration. The line
lMaterialLayer->GetDirectArray().SetAt(it->second.getIndex(), lMaterial); has been replaced by _curFbxNode->AddMaterial(lMaterial); because KFbxLayerElementMaterial::GetDirectArray() is now private and we can't access to it. However, pushing back the material at the end of the vector is wrong. We can use the (now) public attribute KFbxLayerElementMaterial::mDirectArray, as in this submission. "
This commit is contained in:
parent
4f7903f732
commit
1f33e65c2a
@ -372,7 +372,7 @@ WriterNodeVisitor::Material::Material(WriterNodeVisitor& writerNodeVisitor,
|
|||||||
// Note there should be no reason KFbxSurfacePhong::Create() would return NULL, but as previous code made this secirity test, here we keep the same way.
|
// Note there should be no reason KFbxSurfacePhong::Create() would return NULL, but as previous code made this secirity test, here we keep the same way.
|
||||||
if (_fbxMaterial)
|
if (_fbxMaterial)
|
||||||
{
|
{
|
||||||
_fbxMaterial->GetDiffuseColor().ConnectSrcObject(_fbxTexture);
|
_fbxMaterial->Diffuse.ConnectSrcObject(_fbxTexture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -435,6 +435,8 @@ WriterNodeVisitor::setLayerTextureAndMaterial(KFbxMesh* mesh)
|
|||||||
lMaterialLayer->SetReferenceMode(KFbxLayerElement::eINDEX_TO_DIRECT);
|
lMaterialLayer->SetReferenceMode(KFbxLayerElement::eINDEX_TO_DIRECT);
|
||||||
|
|
||||||
lTextureDiffuseLayer->GetDirectArray().SetCount(_lastMaterialIndex);
|
lTextureDiffuseLayer->GetDirectArray().SetCount(_lastMaterialIndex);
|
||||||
|
lMaterialLayer->mDirectArray->SetCount(_lastMaterialIndex);
|
||||||
|
|
||||||
for (MaterialMap::iterator it = _materialMap.begin(); it != _materialMap.end(); ++it)
|
for (MaterialMap::iterator it = _materialMap.begin(); it != _materialMap.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->second.getIndex() != -1)
|
if (it->second.getIndex() != -1)
|
||||||
@ -442,7 +444,7 @@ WriterNodeVisitor::setLayerTextureAndMaterial(KFbxMesh* mesh)
|
|||||||
KFbxSurfaceMaterial* lMaterial = it->second.getFbxMaterial();
|
KFbxSurfaceMaterial* lMaterial = it->second.getFbxMaterial();
|
||||||
KFbxFileTexture* lTexture = it->second.getFbxTexture();
|
KFbxFileTexture* lTexture = it->second.getFbxTexture();
|
||||||
lTextureDiffuseLayer->GetDirectArray().SetAt(it->second.getIndex(), lTexture);
|
lTextureDiffuseLayer->GetDirectArray().SetAt(it->second.getIndex(), lTexture);
|
||||||
_curFbxNode->AddMaterial(lMaterial);
|
lMaterialLayer->mDirectArray->SetAt(it->second.getIndex(), lMaterial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mesh->GetLayer(0)->SetMaterials(lMaterialLayer);
|
mesh->GetLayer(0)->SetMaterials(lMaterialLayer);
|
||||||
|
Loading…
Reference in New Issue
Block a user