From 5ac8968cee557480dafc9699bd2f363dfbc1d212 Mon Sep 17 00:00:00 2001 From: Jeremy Hu Date: Wed, 11 Apr 2018 17:48:43 +0800 Subject: [PATCH] Keep part attributes while been splitted --- src/skeletondocument.cpp | 2 ++ src/skeletondocument.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/skeletondocument.cpp b/src/skeletondocument.cpp index eb274780..1e08f821 100644 --- a/src/skeletondocument.cpp +++ b/src/skeletondocument.cpp @@ -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); diff --git a/src/skeletondocument.h b/src/skeletondocument.h index aff26568..e6a2edc4 100644 --- a/src/skeletondocument.h +++ b/src/skeletondocument.h @@ -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