Add select all; fix undo.
parent
b8e5d31169
commit
de0075bab4
|
@ -596,6 +596,9 @@ void SkeletonDocument::fromSnapshot(const SkeletonSnapshot &snapshot)
|
||||||
part.subdived = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "subdived"));
|
part.subdived = isTrueValueString(valueOfKeyInMapOrEmpty(partKv.second, "subdived"));
|
||||||
partMap[part.id] = part;
|
partMap[part.id] = part;
|
||||||
}
|
}
|
||||||
|
for (const auto &nodeIt: nodeMap) {
|
||||||
|
partMap[nodeIt.second.partId].nodeIds.push_back(nodeIt.first);
|
||||||
|
}
|
||||||
for (const auto &partIdIt: snapshot.partIdList) {
|
for (const auto &partIdIt: snapshot.partIdList) {
|
||||||
partIds.push_back(QUuid(partIdIt));
|
partIds.push_back(QUuid(partIdIt));
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,11 @@ void SkeletonGraphicsWidget::showContextMenu(const QPoint &pos)
|
||||||
selectAllAction.setEnabled(!nodeItemMap.empty());
|
selectAllAction.setEnabled(!nodeItemMap.empty());
|
||||||
contextMenu.addAction(&selectAllAction);
|
contextMenu.addAction(&selectAllAction);
|
||||||
|
|
||||||
|
QAction selectPartAllAction("Select Part", this);
|
||||||
|
connect(&selectPartAllAction, &QAction::triggered, this, &SkeletonGraphicsWidget::selectPartAll);
|
||||||
|
selectPartAllAction.setEnabled(!nodeItemMap.empty());
|
||||||
|
contextMenu.addAction(&selectPartAllAction);
|
||||||
|
|
||||||
QAction unselectAllAction("Unselect All", this);
|
QAction unselectAllAction("Unselect All", this);
|
||||||
connect(&unselectAllAction, &QAction::triggered, this, &SkeletonGraphicsWidget::unselectAll);
|
connect(&unselectAllAction, &QAction::triggered, this, &SkeletonGraphicsWidget::unselectAll);
|
||||||
unselectAllAction.setEnabled(!m_rangeSelectionSet.empty());
|
unselectAllAction.setEnabled(!m_rangeSelectionSet.empty());
|
||||||
|
@ -903,6 +908,50 @@ void SkeletonGraphicsWidget::readSkeletonNodeAndEdgeIdSetFromRangeSelection(std:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonGraphicsWidget::selectPartAll()
|
||||||
|
{
|
||||||
|
unselectAll();
|
||||||
|
SkeletonProfile choosenProfile = SkeletonProfile::Main;
|
||||||
|
QUuid choosenPartId;
|
||||||
|
if (m_hoveredNodeItem) {
|
||||||
|
choosenProfile = m_hoveredNodeItem->profile();
|
||||||
|
const SkeletonNode *node = m_document->findNode(m_hoveredNodeItem->id());
|
||||||
|
if (node)
|
||||||
|
choosenPartId = node->partId;
|
||||||
|
} else if (m_hoveredEdgeItem) {
|
||||||
|
choosenProfile = m_hoveredEdgeItem->profile();
|
||||||
|
const SkeletonEdge *edge = m_document->findEdge(m_hoveredEdgeItem->id());
|
||||||
|
if (edge)
|
||||||
|
choosenPartId = edge->partId;
|
||||||
|
}
|
||||||
|
for (const auto &it: nodeItemMap) {
|
||||||
|
SkeletonGraphicsNodeItem *item = SkeletonProfile::Main == choosenProfile ? it.second.first : it.second.second;
|
||||||
|
const SkeletonNode *node = m_document->findNode(item->id());
|
||||||
|
if (!node)
|
||||||
|
continue;
|
||||||
|
if (choosenPartId.isNull()) {
|
||||||
|
choosenPartId = node->partId;
|
||||||
|
}
|
||||||
|
if (node->partId != choosenPartId)
|
||||||
|
continue;
|
||||||
|
checkSkeletonItem(item, true);
|
||||||
|
m_rangeSelectionSet.insert(item);
|
||||||
|
}
|
||||||
|
for (const auto &it: edgeItemMap) {
|
||||||
|
SkeletonGraphicsEdgeItem *item = SkeletonProfile::Main == choosenProfile ? it.second.first : it.second.second;
|
||||||
|
const SkeletonEdge *edge = m_document->findEdge(item->id());
|
||||||
|
if (!edge)
|
||||||
|
continue;
|
||||||
|
if (choosenPartId.isNull()) {
|
||||||
|
choosenPartId = edge->partId;
|
||||||
|
}
|
||||||
|
if (edge->partId != choosenPartId)
|
||||||
|
continue;
|
||||||
|
checkSkeletonItem(item, true);
|
||||||
|
m_rangeSelectionSet.insert(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SkeletonGraphicsWidget::selectAll()
|
void SkeletonGraphicsWidget::selectAll()
|
||||||
{
|
{
|
||||||
unselectAll();
|
unselectAll();
|
||||||
|
|
|
@ -300,6 +300,7 @@ public slots:
|
||||||
void deleteSelected();
|
void deleteSelected();
|
||||||
void selectAll();
|
void selectAll();
|
||||||
void unselectAll();
|
void unselectAll();
|
||||||
|
void selectPartAll();
|
||||||
private slots:
|
private slots:
|
||||||
void turnaroundImageReady();
|
void turnaroundImageReady();
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue