diff --git a/languages/dust3d_zh_CN.ts b/languages/dust3d_zh_CN.ts
index 95f912c3..e3f083c6 100644
--- a/languages/dust3d_zh_CN.ts
+++ b/languages/dust3d_zh_CN.ts
@@ -342,10 +342,6 @@ Tips:
自动着色
-
-
- 创建包裹部件
-
马克笔
@@ -1279,10 +1275,6 @@ Tips:
着色
-
-
- 创建包裹部件
-
UpdatesCheckWidget
diff --git a/src/document.cpp b/src/document.cpp
index 338c404d..51f7f0b6 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -660,6 +660,8 @@ void Document::addEdge(QUuid fromNodeId, QUuid toNodeId)
void Document::checkPartGrid(QUuid partId)
{
+ return;
+ /*
SkeletonPart *part = (SkeletonPart *)findPart(partId);
if (nullptr == part)
return;
@@ -678,6 +680,7 @@ void Document::checkPartGrid(QUuid partId)
part->gridded = isGrid;
part->dirty = true;
emit partGridStateChanged(partId);
+ */
}
void Document::updateLinkedPart(QUuid oldPartId, QUuid newPartId)
@@ -1144,8 +1147,8 @@ void Document::toSnapshot(Snapshot *snapshot, const std::set &limitNodeId
part["materialId"] = partIt.second.materialId.toString();
if (partIt.second.countershaded)
part["countershaded"] = "true";
- if (partIt.second.gridded)
- part["gridded"] = "true";
+ //if (partIt.second.gridded)
+ // part["gridded"] = "true";
snapshot->parts[part["id"]] = part;
}
for (const auto &nodeIt: nodeMap) {
@@ -1620,7 +1623,7 @@ void Document::addFromSnapshot(const Snapshot &snapshot, bool fromPaste)
if (materialIdIt != partKv.second.end())
part.materialId = oldNewIdMap[QUuid(materialIdIt->second)];
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);
}
for (const auto &it: cutFaceLinkedIdModifyMap) {
diff --git a/src/documentwindow.cpp b/src/documentwindow.cpp
index fc7ca43a..e0ad5310 100644
--- a/src/documentwindow.cpp
+++ b/src/documentwindow.cpp
@@ -599,11 +599,11 @@ DocumentWindow::DocumentWindow() :
});
m_editMenu->addAction(m_clearCutFaceAction);
- m_createWrapPartsAction = new QAction(tr("Create Wrap Parts"), this);
- connect(m_createWrapPartsAction, &QAction::triggered, [=] {
- m_graphicsWidget->createWrapParts();
- });
- m_editMenu->addAction(m_createWrapPartsAction);
+ //m_createWrapPartsAction = new QAction(tr("Create Wrap Parts"), this);
+ //connect(m_createWrapPartsAction, &QAction::triggered, [=] {
+ // m_graphicsWidget->createWrapParts();
+ //});
+ //m_editMenu->addAction(m_createWrapPartsAction);
m_alignToMenu = new QMenu(tr("Align To"));
@@ -698,7 +698,7 @@ DocumentWindow::DocumentWindow() :
m_switchXzAction->setEnabled(m_graphicsWidget->hasSelection());
m_setCutFaceAction->setEnabled(m_graphicsWidget->hasSelection());
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_colorizeAsAutoAction->setEnabled(m_graphicsWidget->hasSelection());
m_alignToGlobalCenterAction->setEnabled(m_graphicsWidget->hasSelection() && m_document->originSettled());
diff --git a/src/meshgenerator.cpp b/src/meshgenerator.cpp
index 797c8ee0..5fcb00cf 100644
--- a/src/meshgenerator.cpp
+++ b/src/meshgenerator.cpp
@@ -14,7 +14,6 @@
#include "theme.h"
#include "partbase.h"
#include "imageforever.h"
-#include "gridmeshbuilder.h"
#include "triangulatefaces.h"
#include "remesher.h"
#include "polycount.h"
@@ -350,7 +349,7 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
float hollowThickness = 0.0;
auto target = PartTargetFromString(valueOfKeyInMapOrEmpty(part, "target").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");
std::vector cutTemplate;
@@ -500,7 +499,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
std::map nodeIndexToIdStringMap;
StrokeModifier *nodeMeshModifier = nullptr;
StrokeMeshBuilder *nodeMeshBuilder = nullptr;
- GridMeshBuilder *gridMeshBuilder = nullptr;
QString mirroredPartIdString;
QUuid mirroredPartId;
@@ -544,166 +542,115 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
}
};
- if (gridded) {
- gridMeshBuilder = new GridMeshBuilder;
+ nodeMeshModifier = new StrokeModifier;
+
+ if (addIntermediateNodes)
+ nodeMeshModifier->enableIntermediateAddition();
+
+ for (const auto &nodeIt: nodeInfos) {
+ const auto &nodeIdString = nodeIt.first;
+ const auto &nodeInfo = nodeIt.second;
+ size_t nodeIndex = 0;
+ if (nodeInfo.hasCutFaceSettings) {
+ std::vector nodeCutTemplate;
+ cutFaceStringToCutTemplate(nodeInfo.cutFace, nodeCutTemplate);
+ if (chamfered)
+ chamferFace2D(&nodeCutTemplate);
+ nodeIndex = nodeMeshModifier->addNode(nodeInfo.position, nodeInfo.radius, nodeCutTemplate, nodeInfo.cutRotation);
+ } else {
+ nodeIndex = nodeMeshModifier->addNode(nodeInfo.position, nodeInfo.radius, cutTemplate, cutRotation);
+ }
+ nodeIdStringToIndexMap[nodeIdString] = nodeIndex;
+ nodeIndexToIdStringMap[nodeIndex] = nodeIdString;
- 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);
+ 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;
}
- 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);
+ auto findToNodeIndex = nodeIdStringToIndexMap.find(toNodeIdString);
+ if (findToNodeIndex == nodeIdStringToIndexMap.end()) {
+ qDebug() << "Find to-node failed:" << toNodeIdString;
+ continue;
}
- if (subdived)
- gridMeshBuilder->setSubdived(true);
- buildSucceed = gridMeshBuilder->build();
+ nodeMeshModifier->addEdge(findFromNodeIndex->second, findToNodeIndex->second);
+ addEdge(fromNodeIdString, toNodeIdString);
+ }
+
+ if (subdived)
+ nodeMeshModifier->subdivide();
+
+ if (rounded)
+ nodeMeshModifier->roundEnd();
+
+ nodeMeshModifier->finalize();
+
+ nodeMeshBuilder = new StrokeMeshBuilder;
+ nodeMeshBuilder->setDeformThickness(deformThickness);
+ nodeMeshBuilder->setDeformWidth(deformWidth);
+ nodeMeshBuilder->setDeformMapScale(deformMapScale);
+ nodeMeshBuilder->setHollowThickness(hollowThickness);
+ if (nullptr != deformImage)
+ nodeMeshBuilder->setDeformMapImage(deformImage);
+ if (PartBase::YZ == base) {
+ nodeMeshBuilder->enableBaseNormalOnX(false);
+ } else if (PartBase::Average == base) {
+ nodeMeshBuilder->enableBaseNormalAverage(true);
+ } else if (PartBase::XY == base) {
+ nodeMeshBuilder->enableBaseNormalOnZ(false);
+ } else if (PartBase::ZX == base) {
+ nodeMeshBuilder->enableBaseNormalOnY(false);
+ }
+
+ std::vector builderNodeIndices;
+ for (const auto &node: nodeMeshModifier->nodes()) {
+ auto nodeIndex = nodeMeshBuilder->addNode(node.position, node.radius, node.cutTemplate, node.cutRotation);
+ nodeMeshBuilder->setNodeOriginInfo(nodeIndex, node.nearOriginNodeIndex, node.farOriginNodeIndex);
+ builderNodeIndices.push_back(nodeIndex);
- partCache.vertices = gridMeshBuilder->getGeneratedPositions();
- partCache.faces = gridMeshBuilder->getGeneratedFaces();
+ const auto &originNodeIdString = nodeIndexToIdStringMap[node.originNodeIndex];
- 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;
+ OutcomePaintNode paintNode;
+ paintNode.originNodeIndex = node.originNodeIndex;
+ paintNode.originNodeId = QUuid(originNodeIdString);
+ paintNode.radius = node.radius;
+ paintNode.origin = node.position;
- if (addIntermediateNodes)
- nodeMeshModifier->enableIntermediateAddition();
+ partCache.outcomePaintMap.paintNodes.push_back(paintNode);
+ }
+ for (const auto &edge: nodeMeshModifier->edges())
+ nodeMeshBuilder->addEdge(edge.firstNodeIndex, edge.secondNodeIndex);
+ buildSucceed = nodeMeshBuilder->build();
+
+ partCache.vertices = nodeMeshBuilder->generatedVertices();
+ partCache.faces = nodeMeshBuilder->generatedFaces();
+ for (size_t i = 0; i < partCache.vertices.size(); ++i) {
+ const auto &position = partCache.vertices[i];
+ const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
+ size_t nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
+ const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
+ partCache.outcomeNodeVertices.push_back({position, {partIdString, nodeIdString}});
- for (const auto &nodeIt: nodeInfos) {
- const auto &nodeIdString = nodeIt.first;
- const auto &nodeInfo = nodeIt.second;
- size_t nodeIndex = 0;
- if (nodeInfo.hasCutFaceSettings) {
- std::vector nodeCutTemplate;
- cutFaceStringToCutTemplate(nodeInfo.cutFace, nodeCutTemplate);
- if (chamfered)
- chamferFace2D(&nodeCutTemplate);
- nodeIndex = nodeMeshModifier->addNode(nodeInfo.position, nodeInfo.radius, nodeCutTemplate, nodeInfo.cutRotation);
- } else {
- nodeIndex = nodeMeshModifier->addNode(nodeInfo.position, nodeInfo.radius, cutTemplate, cutRotation);
- }
- nodeIdStringToIndexMap[nodeIdString] = nodeIndex;
- nodeIndexToIdStringMap[nodeIndex] = nodeIdString;
-
- addNode(nodeIdString, nodeInfo);
- }
+ auto &paintNode = partCache.outcomePaintMap.paintNodes[source];
+ paintNode.vertices.push_back(position);
+ }
+
+ for (size_t i = 0; i < partCache.outcomePaintMap.paintNodes.size(); ++i) {
+ auto &paintNode = partCache.outcomePaintMap.paintNodes[i];
+ paintNode.baseNormal = nodeMeshBuilder->nodeBaseNormal(i);
+ paintNode.direction = nodeMeshBuilder->nodeTraverseDirection(i);
+ paintNode.order = nodeMeshBuilder->nodeTraverseOrder(i);
- 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;
- }
-
- nodeMeshModifier->addEdge(findFromNodeIndex->second, findToNodeIndex->second);
- addEdge(fromNodeIdString, toNodeIdString);
- }
-
- if (subdived)
- nodeMeshModifier->subdivide();
-
- if (rounded)
- nodeMeshModifier->roundEnd();
-
- nodeMeshModifier->finalize();
-
- nodeMeshBuilder = new StrokeMeshBuilder;
- nodeMeshBuilder->setDeformThickness(deformThickness);
- nodeMeshBuilder->setDeformWidth(deformWidth);
- nodeMeshBuilder->setDeformMapScale(deformMapScale);
- nodeMeshBuilder->setHollowThickness(hollowThickness);
- if (nullptr != deformImage)
- nodeMeshBuilder->setDeformMapImage(deformImage);
- if (PartBase::YZ == base) {
- nodeMeshBuilder->enableBaseNormalOnX(false);
- } else if (PartBase::Average == base) {
- nodeMeshBuilder->enableBaseNormalAverage(true);
- } else if (PartBase::XY == base) {
- nodeMeshBuilder->enableBaseNormalOnZ(false);
- } else if (PartBase::ZX == base) {
- nodeMeshBuilder->enableBaseNormalOnY(false);
- }
-
- std::vector builderNodeIndices;
- for (const auto &node: nodeMeshModifier->nodes()) {
- auto nodeIndex = nodeMeshBuilder->addNode(node.position, node.radius, node.cutTemplate, node.cutRotation);
- nodeMeshBuilder->setNodeOriginInfo(nodeIndex, node.nearOriginNodeIndex, node.farOriginNodeIndex);
- builderNodeIndices.push_back(nodeIndex);
-
- const auto &originNodeIdString = nodeIndexToIdStringMap[node.originNodeIndex];
-
- OutcomePaintNode paintNode;
- paintNode.originNodeIndex = node.originNodeIndex;
- paintNode.originNodeId = QUuid(originNodeIdString);
- paintNode.radius = node.radius;
- paintNode.origin = node.position;
-
- partCache.outcomePaintMap.paintNodes.push_back(paintNode);
- }
- for (const auto &edge: nodeMeshModifier->edges())
- nodeMeshBuilder->addEdge(edge.firstNodeIndex, edge.secondNodeIndex);
- buildSucceed = nodeMeshBuilder->build();
-
- partCache.vertices = nodeMeshBuilder->generatedVertices();
- partCache.faces = nodeMeshBuilder->generatedFaces();
- for (size_t i = 0; i < partCache.vertices.size(); ++i) {
- const auto &position = partCache.vertices[i];
- const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
- size_t nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
- const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
- partCache.outcomeNodeVertices.push_back({position, {partIdString, nodeIdString}});
-
- auto &paintNode = partCache.outcomePaintMap.paintNodes[source];
- paintNode.vertices.push_back(position);
- }
-
- for (size_t i = 0; i < partCache.outcomePaintMap.paintNodes.size(); ++i) {
- auto &paintNode = partCache.outcomePaintMap.paintNodes[i];
- paintNode.baseNormal = nodeMeshBuilder->nodeBaseNormal(i);
- paintNode.direction = nodeMeshBuilder->nodeTraverseDirection(i);
- paintNode.order = nodeMeshBuilder->nodeTraverseOrder(i);
-
- partCache.outcomeNodes[paintNode.originNodeIndex].direction = paintNode.direction;
- }
+ partCache.outcomeNodes[paintNode.originNodeIndex].direction = paintNode.direction;
}
bool hasMeshError = false;
@@ -719,12 +666,8 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
for (size_t i = 0; i < xMirroredVertices.size(); ++i) {
const auto &position = xMirroredVertices[i];
size_t nodeIndex = 0;
- if (gridded) {
- nodeIndex = gridMeshBuilder->getGeneratedSources()[i];
- } else {
- const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
- nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
- }
+ const auto &source = nodeMeshBuilder->generatedVerticesSourceNodeIndices()[i];
+ nodeIndex = nodeMeshModifier->nodes()[source].originNodeIndex;
const auto &nodeIdString = nodeIndexToIdStringMap[nodeIndex];
partCache.outcomeNodeVertices.push_back({position, {mirroredPartIdString, nodeIdString}});
}
@@ -811,8 +754,6 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
delete nodeMeshBuilder;
delete nodeMeshModifier;
- delete gridMeshBuilder;
-
if (mesh && mesh->isNull()) {
delete mesh;
mesh = nullptr;
diff --git a/src/skeletongraphicswidget.cpp b/src/skeletongraphicswidget.cpp
index 68fdc428..215b92d7 100644
--- a/src/skeletongraphicswidget.cpp
+++ b/src/skeletongraphicswidget.cpp
@@ -267,13 +267,13 @@ void SkeletonGraphicsWidget::showContextMenu(const QPoint &pos)
contextMenu.addAction(&clearCutFaceAction);
}
- QAction createWrapPartsAction(tr("Create Wrap Parts"), this);
- if (!m_nodePositionModifyOnly && hasSelection()) {
- connect(&createWrapPartsAction, &QAction::triggered, this, [&]() {
- createWrapParts();
- });
- contextMenu.addAction(&createWrapPartsAction);
- }
+ //QAction createWrapPartsAction(tr("Create Wrap Parts"), this);
+ //if (!m_nodePositionModifyOnly && hasSelection()) {
+ // connect(&createWrapPartsAction, &QAction::triggered, this, [&]() {
+ // createWrapParts();
+ // });
+ // contextMenu.addAction(&createWrapPartsAction);
+ //}
QAction alignToLocalCenterAction(tr("Local 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())) {
emit addEdge(m_addFromNodeItem->id(), m_hoveredNodeItem->id());
emit groupOperationAdded();
+ emit setEditMode(SkeletonDocumentEditMode::Select);
return true;
}
}