Fix material widget
parent
438c488f5a
commit
62632dc168
|
@ -8,6 +8,7 @@ MaterialWidget::MaterialWidget(const Document *document, QUuid materialId) :
|
|||
setObjectName("MaterialFrame");
|
||||
|
||||
m_previewWidget = new ModelWidget(this);
|
||||
m_previewWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_previewWidget->setFixedSize(Theme::materialPreviewImageSize, Theme::materialPreviewImageSize);
|
||||
m_previewWidget->enableMove(false);
|
||||
m_previewWidget->enableZoom(false);
|
||||
|
|
|
@ -670,11 +670,11 @@ void MeshGenerator::generate()
|
|||
}
|
||||
|
||||
for (const auto &verticesSourcesIt: m_cacheContext->componentVerticesSources[QUuid().toString()].map()) {
|
||||
m_outcome->bmeshVertices.push_back(verticesSourcesIt.second);
|
||||
m_outcome->nodeVertices.push_back(verticesSourcesIt.second);
|
||||
}
|
||||
|
||||
for (const auto &bmeshNodes: m_cacheContext->partBmeshNodes) {
|
||||
m_outcome->bmeshNodes.insert(m_outcome->bmeshNodes.end(),
|
||||
m_outcome->nodes.insert(m_outcome->nodes.end(),
|
||||
bmeshNodes.second.begin(), bmeshNodes.second.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ Outcome *MeshResultPostProcessor::takePostProcessedResultContext()
|
|||
|
||||
void MeshResultPostProcessor::process()
|
||||
{
|
||||
if (!m_outcome->bmeshNodes.empty()) {
|
||||
if (!m_outcome->nodes.empty()) {
|
||||
(void)m_outcome->triangleTangents();
|
||||
(void)m_outcome->parts();
|
||||
}
|
||||
|
|
|
@ -26,18 +26,6 @@ struct CandidateEdge
|
|||
float length;
|
||||
};
|
||||
|
||||
Outcome::Outcome() :
|
||||
m_triangleSourceResolved(false),
|
||||
m_triangleMaterialResolved(false),
|
||||
m_triangleEdgeSourceMapResolved(false),
|
||||
m_bmeshNodeMapResolved(false),
|
||||
m_resultPartsResolved(false),
|
||||
m_resultTriangleUvsResolved(false),
|
||||
m_triangleVertexNormalsInterpolated(false),
|
||||
m_triangleTangentsResolved(false)
|
||||
{
|
||||
}
|
||||
|
||||
const std::vector<std::pair<QUuid, QUuid>> &Outcome::triangleSourceNodes()
|
||||
{
|
||||
if (!m_triangleSourceResolved) {
|
||||
|
@ -90,7 +78,7 @@ void Outcome::calculateTriangleSourceNodes(std::vector<std::pair<QUuid, QUuid>>
|
|||
PositionMap<std::pair<QUuid, QUuid>> positionMap;
|
||||
std::map<std::pair<int, int>, HalfColorEdge> halfColorEdgeMap;
|
||||
std::set<int> brokenTriangleSet;
|
||||
for (const auto &it: bmeshVertices) {
|
||||
for (const auto &it: nodeVertices) {
|
||||
positionMap.addPosition(it.position.x(), it.position.y(), it.position.z(),
|
||||
std::make_pair(it.partId, it.nodeId));
|
||||
}
|
||||
|
@ -262,7 +250,7 @@ void Outcome::calculateRemainingVertexSourceNodesAfterTriangleSourceNodesSolved(
|
|||
void Outcome::calculateTriangleMaterials(std::vector<OutcomeMaterial> &triangleMaterials)
|
||||
{
|
||||
std::map<std::pair<QUuid, QUuid>, OutcomeMaterial> nodeMaterialMap;
|
||||
for (const auto &it: bmeshNodes) {
|
||||
for (const auto &it: nodes) {
|
||||
nodeMaterialMap[std::make_pair(it.partId, it.nodeId)] = it.material;
|
||||
}
|
||||
const auto sourceNodes = triangleSourceNodes();
|
||||
|
@ -285,8 +273,8 @@ void Outcome::calculateTriangleEdgeSourceMap(std::map<std::pair<int, int>, std::
|
|||
}
|
||||
|
||||
void Outcome::calculateBmeshNodeMap(std::map<std::pair<QUuid, QUuid>, OutcomeNode *> &bmeshNodeMap) {
|
||||
for (auto i = 0u; i < bmeshNodes.size(); i++) {
|
||||
OutcomeNode *bmeshNode = &bmeshNodes[i];
|
||||
for (auto i = 0u; i < nodes.size(); i++) {
|
||||
OutcomeNode *bmeshNode = &nodes[i];
|
||||
bmeshNodeMap[std::make_pair(bmeshNode->partId, bmeshNode->nodeId)] = bmeshNode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,10 @@ struct ResultPart
|
|||
class Outcome
|
||||
{
|
||||
public:
|
||||
std::vector<OutcomeNode> bmeshNodes;
|
||||
std::vector<OutcomeNodeVertex> bmeshVertices;
|
||||
std::vector<OutcomeNode> nodes;
|
||||
std::vector<OutcomeNodeVertex> nodeVertices;
|
||||
std::vector<OutcomeVertex> vertices;
|
||||
std::vector<OutcomeTriangle> triangles;
|
||||
Outcome();
|
||||
public:
|
||||
const std::vector<std::pair<QUuid, QUuid>> &triangleSourceNodes();
|
||||
const std::vector<OutcomeMaterial> &triangleMaterials();
|
||||
|
@ -89,14 +88,14 @@ public:
|
|||
const std::vector<QVector3D> &interpolatedTriangleVertexNormals();
|
||||
const std::vector<QVector3D> &triangleTangents();
|
||||
private:
|
||||
bool m_triangleSourceResolved;
|
||||
bool m_triangleMaterialResolved;
|
||||
bool m_triangleEdgeSourceMapResolved;
|
||||
bool m_bmeshNodeMapResolved;
|
||||
bool m_resultPartsResolved;
|
||||
bool m_resultTriangleUvsResolved;
|
||||
bool m_triangleVertexNormalsInterpolated;
|
||||
bool m_triangleTangentsResolved;
|
||||
bool m_triangleSourceResolved = false;
|
||||
bool m_triangleMaterialResolved = false;
|
||||
bool m_triangleEdgeSourceMapResolved = false;
|
||||
bool m_bmeshNodeMapResolved = false;
|
||||
bool m_resultPartsResolved = false;
|
||||
bool m_resultTriangleUvsResolved = false;
|
||||
bool m_triangleVertexNormalsInterpolated = false;
|
||||
bool m_triangleTangentsResolved = false;
|
||||
private:
|
||||
std::vector<std::pair<QUuid, QUuid>> m_triangleSourceNodes;
|
||||
std::vector<OutcomeMaterial> m_triangleMaterials;
|
||||
|
|
|
@ -148,7 +148,7 @@ void TextureGenerator::prepare()
|
|||
QUuid partId = QUuid(partIt.first);
|
||||
updatedMaterialIdMap.insert({partId, materialId});
|
||||
}
|
||||
for (const auto &bmeshNode: m_outcome->bmeshNodes) {
|
||||
for (const auto &bmeshNode: m_outcome->nodes) {
|
||||
for (size_t i = 0; i < (int)TextureType::Count - 1; ++i) {
|
||||
TextureType forWhat = (TextureType)(i + 1);
|
||||
MaterialTextures materialTextures;
|
||||
|
|
Loading…
Reference in New Issue