Remove grided mesh builder
This feature was been designed to make cloth mesh, however, it's not work as planned and is been replaced by the cloth simulation.master
parent
9ca0102b52
commit
6c01c0d07b
|
@ -342,10 +342,6 @@ Tips:
|
||||||
<source>Auto Color</source>
|
<source>Auto Color</source>
|
||||||
<translation>自动着色</translation>
|
<translation>自动着色</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Create Wrap Parts</source>
|
|
||||||
<translation>创建包裹部件</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>Marker pen</source>
|
<source>Marker pen</source>
|
||||||
<translation>马克笔</translation>
|
<translation>马克笔</translation>
|
||||||
|
@ -1279,10 +1275,6 @@ Tips:
|
||||||
<source>Colorize</source>
|
<source>Colorize</source>
|
||||||
<translation>着色</translation>
|
<translation>着色</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source>Create Wrap Parts</source>
|
|
||||||
<translation>创建包裹部件</translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>UpdatesCheckWidget</name>
|
<name>UpdatesCheckWidget</name>
|
||||||
|
|
|
@ -660,6 +660,8 @@ void Document::addEdge(QUuid fromNodeId, QUuid toNodeId)
|
||||||
|
|
||||||
void Document::checkPartGrid(QUuid partId)
|
void Document::checkPartGrid(QUuid partId)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
/*
|
||||||
SkeletonPart *part = (SkeletonPart *)findPart(partId);
|
SkeletonPart *part = (SkeletonPart *)findPart(partId);
|
||||||
if (nullptr == part)
|
if (nullptr == part)
|
||||||
return;
|
return;
|
||||||
|
@ -678,6 +680,7 @@ void Document::checkPartGrid(QUuid partId)
|
||||||
part->gridded = isGrid;
|
part->gridded = isGrid;
|
||||||
part->dirty = true;
|
part->dirty = true;
|
||||||
emit partGridStateChanged(partId);
|
emit partGridStateChanged(partId);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::updateLinkedPart(QUuid oldPartId, QUuid newPartId)
|
void Document::updateLinkedPart(QUuid oldPartId, QUuid newPartId)
|
||||||
|
@ -1144,8 +1147,8 @@ void Document::toSnapshot(Snapshot *snapshot, const std::set<QUuid> &limitNodeId
|
||||||
part["materialId"] = partIt.second.materialId.toString();
|
part["materialId"] = partIt.second.materialId.toString();
|
||||||
if (partIt.second.countershaded)
|
if (partIt.second.countershaded)
|
||||||
part["countershaded"] = "true";
|
part["countershaded"] = "true";
|
||||||
if (partIt.second.gridded)
|
//if (partIt.second.gridded)
|
||||||
part["gridded"] = "true";
|
// part["gridded"] = "true";
|
||||||
snapshot->parts[part["id"]] = part;
|
snapshot->parts[part["id"]] = part;
|
||||||
}
|
}
|
||||||
for (const auto &nodeIt: nodeMap) {
|
for (const auto &nodeIt: nodeMap) {
|
||||||
|
@ -1620,7 +1623,7 @@ void Document::addFromSnapshot(const Snapshot &snapshot, bool fromPaste)
|
||||||
if (materialIdIt != partKv.second.end())
|
if (materialIdIt != partKv.second.end())
|
||||||
part.materialId = oldNewIdMap[QUuid(materialIdIt->second)];
|
part.materialId = oldNewIdMap[QUuid(materialIdIt->second)];
|
||||||
part.countershaded = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "countershaded"));
|
part.countershaded = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "countershaded"));
|
||||||
part.gridded = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "gridded"));;
|
//part.gridded = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "gridded"));;
|
||||||
newAddedPartIds.insert(part.id);
|
newAddedPartIds.insert(part.id);
|
||||||
}
|
}
|
||||||
for (const auto &it: cutFaceLinkedIdModifyMap) {
|
for (const auto &it: cutFaceLinkedIdModifyMap) {
|
||||||
|
|
|
@ -599,11 +599,11 @@ DocumentWindow::DocumentWindow() :
|
||||||
});
|
});
|
||||||
m_editMenu->addAction(m_clearCutFaceAction);
|
m_editMenu->addAction(m_clearCutFaceAction);
|
||||||
|
|
||||||
m_createWrapPartsAction = new QAction(tr("Create Wrap Parts"), this);
|
//m_createWrapPartsAction = new QAction(tr("Create Wrap Parts"), this);
|
||||||
connect(m_createWrapPartsAction, &QAction::triggered, [=] {
|
//connect(m_createWrapPartsAction, &QAction::triggered, [=] {
|
||||||
m_graphicsWidget->createWrapParts();
|
// m_graphicsWidget->createWrapParts();
|
||||||
});
|
//});
|
||||||
m_editMenu->addAction(m_createWrapPartsAction);
|
//m_editMenu->addAction(m_createWrapPartsAction);
|
||||||
|
|
||||||
m_alignToMenu = new QMenu(tr("Align To"));
|
m_alignToMenu = new QMenu(tr("Align To"));
|
||||||
|
|
||||||
|
@ -698,7 +698,7 @@ DocumentWindow::DocumentWindow() :
|
||||||
m_switchXzAction->setEnabled(m_graphicsWidget->hasSelection());
|
m_switchXzAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
m_setCutFaceAction->setEnabled(m_graphicsWidget->hasSelection());
|
m_setCutFaceAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
m_clearCutFaceAction->setEnabled(m_graphicsWidget->hasCutFaceAdjustedNodesSelection());
|
m_clearCutFaceAction->setEnabled(m_graphicsWidget->hasCutFaceAdjustedNodesSelection());
|
||||||
m_createWrapPartsAction->setEnabled(m_graphicsWidget->hasSelection());
|
//m_createWrapPartsAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
m_colorizeAsBlankAction->setEnabled(m_graphicsWidget->hasSelection());
|
m_colorizeAsBlankAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
m_colorizeAsAutoAction->setEnabled(m_graphicsWidget->hasSelection());
|
m_colorizeAsAutoAction->setEnabled(m_graphicsWidget->hasSelection());
|
||||||
m_alignToGlobalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
|
m_alignToGlobalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "partbase.h"
|
#include "partbase.h"
|
||||||
#include "imageforever.h"
|
#include "imageforever.h"
|
||||||
#include "gridmeshbuilder.h"
|
|
||||||
#include "triangulatefaces.h"
|
#include "triangulatefaces.h"
|
||||||
#include "remesher.h"
|
#include "remesher.h"
|
||||||
#include "polycount.h"
|
#include "polycount.h"
|
||||||
|
@ -350,7 +349,7 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
float hollowThickness = 0.0;
|
float hollowThickness = 0.0;
|
||||||
auto target = PartTargetFromString(valueOfKeyInMapOrEmpty(part, "target").toUtf8().constData());
|
auto target = PartTargetFromString(valueOfKeyInMapOrEmpty(part, "target").toUtf8().constData());
|
||||||
auto base = PartBaseFromString(valueOfKeyInMapOrEmpty(part, "base").toUtf8().constData());
|
auto base = PartBaseFromString(valueOfKeyInMapOrEmpty(part, "base").toUtf8().constData());
|
||||||
bool gridded = isTrueValueString(valueOfKeyInMapOrEmpty(part, "gridded"));
|
//bool gridded = isTrueValueString(valueOfKeyInMapOrEmpty(part, "gridded"));
|
||||||
|
|
||||||
QString cutFaceString = valueOfKeyInMapOrEmpty(part, "cutFace");
|
QString cutFaceString = valueOfKeyInMapOrEmpty(part, "cutFace");
|
||||||
std::vector<QVector2D> cutTemplate;
|
std::vector<QVector2D> cutTemplate;
|
||||||
|
@ -500,7 +499,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
std::map<int, QString> nodeIndexToIdStringMap;
|
std::map<int, QString> nodeIndexToIdStringMap;
|
||||||
StrokeModifier *nodeMeshModifier = nullptr;
|
StrokeModifier *nodeMeshModifier = nullptr;
|
||||||
StrokeMeshBuilder *nodeMeshBuilder = nullptr;
|
StrokeMeshBuilder *nodeMeshBuilder = nullptr;
|
||||||
GridMeshBuilder *gridMeshBuilder = nullptr;
|
|
||||||
|
|
||||||
QString mirroredPartIdString;
|
QString mirroredPartIdString;
|
||||||
QUuid mirroredPartId;
|
QUuid mirroredPartId;
|
||||||
|
@ -544,56 +542,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (gridded) {
|
|
||||||
gridMeshBuilder = new GridMeshBuilder;
|
|
||||||
|
|
||||||
for (const auto &nodeIt: nodeInfos) {
|
|
||||||
const auto &nodeIdString = nodeIt.first;
|
|
||||||
const auto &nodeInfo = nodeIt.second;
|
|
||||||
size_t nodeIndex = 0;
|
|
||||||
|
|
||||||
nodeIndex = gridMeshBuilder->addNode(nodeInfo.position, nodeInfo.radius);
|
|
||||||
|
|
||||||
nodeIdStringToIndexMap[nodeIdString] = nodeIndex;
|
|
||||||
nodeIndexToIdStringMap[nodeIndex] = nodeIdString;
|
|
||||||
|
|
||||||
addNode(nodeIdString, nodeInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto &edgeIt: edges) {
|
|
||||||
const QString &fromNodeIdString = edgeIt.first;
|
|
||||||
const QString &toNodeIdString = edgeIt.second;
|
|
||||||
|
|
||||||
auto findFromNodeIndex = nodeIdStringToIndexMap.find(fromNodeIdString);
|
|
||||||
if (findFromNodeIndex == nodeIdStringToIndexMap.end()) {
|
|
||||||
qDebug() << "Find from-node failed:" << fromNodeIdString;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto findToNodeIndex = nodeIdStringToIndexMap.find(toNodeIdString);
|
|
||||||
if (findToNodeIndex == nodeIdStringToIndexMap.end()) {
|
|
||||||
qDebug() << "Find to-node failed:" << toNodeIdString;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
gridMeshBuilder->addEdge(findFromNodeIndex->second, findToNodeIndex->second);
|
|
||||||
addEdge(fromNodeIdString, toNodeIdString);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (subdived)
|
|
||||||
gridMeshBuilder->setSubdived(true);
|
|
||||||
buildSucceed = gridMeshBuilder->build();
|
|
||||||
|
|
||||||
partCache.vertices = gridMeshBuilder->getGeneratedPositions();
|
|
||||||
partCache.faces = gridMeshBuilder->getGeneratedFaces();
|
|
||||||
|
|
||||||
for (size_t i = 0; i < partCache.vertices.size(); ++i) {
|
|
||||||
const auto &position = partCache.vertices[i];
|
|
||||||
const auto &nodeIndex = gridMeshBuilder->getGeneratedSources()[i];
|
|
||||||
const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
|
|
||||||
partCache.outcomeNodeVertices.push_back({position, {partIdString, nodeIdString}});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
nodeMeshModifier = new StrokeModifier;
|
nodeMeshModifier = new StrokeModifier;
|
||||||
|
|
||||||
if (addIntermediateNodes)
|
if (addIntermediateNodes)
|
||||||
|
@ -704,7 +652,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
|
|
||||||
partCache.outcomeNodes[paintNode.originNodeIndex].direction = paintNode.direction;
|
partCache.outcomeNodes[paintNode.originNodeIndex].direction = paintNode.direction;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool hasMeshError = false;
|
bool hasMeshError = false;
|
||||||
MeshCombiner::Mesh *mesh = nullptr;
|
MeshCombiner::Mesh *mesh = nullptr;
|
||||||
|
@ -719,12 +666,8 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
for (size_t i = 0; i < xMirroredVertices.size(); ++i) {
|
for (size_t i = 0; i < xMirroredVertices.size(); ++i) {
|
||||||
const auto &position = xMirroredVertices[i];
|
const auto &position = xMirroredVertices[i];
|
||||||
size_t nodeIndex = 0;
|
size_t nodeIndex = 0;
|
||||||
if (gridded) {
|
|
||||||
nodeIndex = gridMeshBuilder->getGeneratedSources()[i];
|
|
||||||
} else {
|
|
||||||
const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
|
const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
|
||||||
nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
|
nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
|
||||||
}
|
|
||||||
const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
|
const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
|
||||||
partCache.outcomeNodeVertices.push_back({position, {mirroredPartIdString, nodeIdString}});
|
partCache.outcomeNodeVertices.push_back({position, {mirroredPartIdString, nodeIdString}});
|
||||||
}
|
}
|
||||||
|
@ -811,8 +754,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
|
||||||
delete nodeMeshBuilder;
|
delete nodeMeshBuilder;
|
||||||
delete nodeMeshModifier;
|
delete nodeMeshModifier;
|
||||||
|
|
||||||
delete gridMeshBuilder;
|
|
||||||
|
|
||||||
if (mesh && mesh->isNull()) {
|
if (mesh && mesh->isNull()) {
|
||||||
delete mesh;
|
delete mesh;
|
||||||
mesh = nullptr;
|
mesh = nullptr;
|
||||||
|
|
|
@ -267,13 +267,13 @@ void SkeletonGraphicsWidget::showContextMenu(const QPoint &pos)
|
||||||
contextMenu.addAction(&clearCutFaceAction);
|
contextMenu.addAction(&clearCutFaceAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction createWrapPartsAction(tr("Create Wrap Parts"), this);
|
//QAction createWrapPartsAction(tr("Create Wrap Parts"), this);
|
||||||
if (!m_nodePositionModifyOnly && hasSelection()) {
|
//if (!m_nodePositionModifyOnly && hasSelection()) {
|
||||||
connect(&createWrapPartsAction, &QAction::triggered, this, [&]() {
|
// connect(&createWrapPartsAction, &QAction::triggered, this, [&]() {
|
||||||
createWrapParts();
|
// createWrapParts();
|
||||||
});
|
// });
|
||||||
contextMenu.addAction(&createWrapPartsAction);
|
// contextMenu.addAction(&createWrapPartsAction);
|
||||||
}
|
//}
|
||||||
|
|
||||||
QAction alignToLocalCenterAction(tr("Local Center"), this);
|
QAction alignToLocalCenterAction(tr("Local Center"), this);
|
||||||
QAction alignToLocalVerticalCenterAction(tr("Local Vertical Center"), this);
|
QAction alignToLocalVerticalCenterAction(tr("Local Vertical Center"), this);
|
||||||
|
@ -1522,6 +1522,7 @@ bool SkeletonGraphicsWidget::mousePress(QMouseEvent *event)
|
||||||
if (m_document->isNodeConnectable(m_hoveredNodeItem->id())) {
|
if (m_document->isNodeConnectable(m_hoveredNodeItem->id())) {
|
||||||
emit addEdge(m_addFromNodeItem->id(), m_hoveredNodeItem->id());
|
emit addEdge(m_addFromNodeItem->id(), m_hoveredNodeItem->id());
|
||||||
emit groupOperationAdded();
|
emit groupOperationAdded();
|
||||||
|
emit setEditMode(SkeletonDocumentEditMode::Select);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue