Absolute delete

This commit is contained in:
Riku Avelar 2016-12-06 20:02:36 -05:00
parent 9957a0bae0
commit dbc433dbf7

View File

@ -1229,16 +1229,18 @@ void Viewer::deleteSelected() {
// Remove Shape from its parent // Remove Shape from its parent
if(selectedObj.shape == nullptr) return; if(selectedObj.shape == nullptr) return;
// selectedObj.shape->getParent()->getChildren()->erase( selectedObj.shape->getParent()->getChildren()->erase(
// std::remove(selectedObj.shape->getParent()->getChildren()->begin(), std::remove(selectedObj.shape->getParent()->getChildren()->begin(),
// selectedObj.shape->getParent()->getChildren()->end(), selectedObj.shape->getParent()->getChildren()->end(),
// selection), selection),
// selectedObj.shape->getParent()->getChildren()->end()); selectedObj.shape->getParent()->getChildren()->end());
// Get Children if available, and attach to parent // Get Children if available, and attach to parent
if(selectedObj.shape->getParent()->getChildren()->size() > 1) { if(selectedObj.shape->getParent()->getChildren()->size() > 1) {
QMatrix4x4 parentMatrix = QMatrix4x4(selectedObj.shape->getParent()->transform);
for(int i = 0; i < selectedObj.shape->getParent()->getChildren()->size(); i++) { for(int i = 0; i < selectedObj.shape->getParent()->getChildren()->size(); i++) {
if(selectedObj.shape != selectedObj.shape->getParent()->getChildren()->at(i)) { if(selectedObj.shape != selectedObj.shape->getParent()->getChildren()->at(i)) {
selectedObj.shape->getParent()->getChildren()->at(i)->transform = parentMatrix * selectedObj.shape->getParent()->getChildren()->at(i)->transform;
selectedObj.shape->getParent()->getParent()->addChild(selectedObj.shape->getParent()->getChildren()->at(i)); selectedObj.shape->getParent()->getParent()->addChild(selectedObj.shape->getParent()->getChildren()->at(i));
} }
} }