Fix unnecessary mesh regeneration while locked

master
Jeremy Hu 2018-10-11 10:49:44 +08:00
parent 4c6dc1594f
commit 4ea497caf8
1 changed files with 15 additions and 5 deletions

View File

@ -619,7 +619,8 @@ void SkeletonDocument::scaleNodeByAddRadius(QUuid nodeId, float amount)
} }
if (isPartReadonly(it->second.partId)) if (isPartReadonly(it->second.partId))
return; return;
if (!radiusLocked) if (radiusLocked)
return;
it->second.setRadius(it->second.radius + amount); it->second.setRadius(it->second.radius + amount);
auto part = partMap.find(it->second.partId); auto part = partMap.find(it->second.partId);
if (part != partMap.end()) if (part != partMap.end())
@ -647,12 +648,21 @@ void SkeletonDocument::moveNodeBy(QUuid nodeId, float x, float y, float z)
} }
if (m_allPositionRelatedLocksEnabled && isPartReadonly(it->second.partId)) if (m_allPositionRelatedLocksEnabled && isPartReadonly(it->second.partId))
return; return;
if (!(m_allPositionRelatedLocksEnabled && xlocked)) bool changed = false;
if (!(m_allPositionRelatedLocksEnabled && xlocked)) {
it->second.x += x; it->second.x += x;
if (!(m_allPositionRelatedLocksEnabled && ylocked)) changed = true;
}
if (!(m_allPositionRelatedLocksEnabled && ylocked)) {
it->second.y += y; it->second.y += y;
if (!(m_allPositionRelatedLocksEnabled && zlocked)) changed = true;
}
if (!(m_allPositionRelatedLocksEnabled && zlocked)) {
it->second.z += z; it->second.z += z;
changed = true;
}
if (!changed)
return;
auto part = partMap.find(it->second.partId); auto part = partMap.find(it->second.partId);
if (part != partMap.end()) if (part != partMap.end())
part->second.dirty = true; part->second.dirty = true;