Keep part attributes while been splitted

master
Jeremy Hu 2018-04-11 17:48:43 +08:00
parent c9efa79ddb
commit 5ac8968cee
2 changed files with 9 additions and 0 deletions

View File

@ -54,6 +54,7 @@ void SkeletonDocument::removeEdge(QUuid edgeId)
splitPartByEdge(&groups, edgeId);
for (auto groupIt = groups.begin(); groupIt != groups.end(); groupIt++) {
SkeletonPart part;
part.copyAttributes(*oldPart);
part.name = nextPartName;
for (auto nodeIdIt = (*groupIt).begin(); nodeIdIt != (*groupIt).end(); nodeIdIt++) {
auto nodeIt = nodeMap.find(*nodeIdIt);
@ -115,6 +116,7 @@ void SkeletonDocument::removeNode(QUuid nodeId)
splitPartByNode(&groups, nodeId);
for (auto groupIt = groups.begin(); groupIt != groups.end(); groupIt++) {
SkeletonPart part;
part.copyAttributes(*oldPart);
part.name = nextPartName;
for (auto nodeIdIt = (*groupIt).begin(); nodeIdIt != (*groupIt).end(); nodeIdIt++) {
auto nodeIt = nodeMap.find(*nodeIdIt);

View File

@ -78,6 +78,13 @@ public:
{
id = withId.isNull() ? QUuid::createUuid() : withId;
}
void copyAttributes(const SkeletonPart &other)
{
visible = other.visible;
locked = other.locked;
subdived = other.subdived;
disabled = other.disabled;
}
};
enum class SkeletonProfile