Fixed view toggle, Added new Notifications

- View Toggle now only toggles if no other modifiers are pressed
- More notification, and cases for notification
   - Parenting to existing parent
   - Unparenting when there is no parent
   - Unparenting single entities
This commit is contained in:
Menithal 2017-02-19 20:18:11 +02:00
parent 2a4b493de5
commit d9f86612de
2 changed files with 50 additions and 14 deletions

View file

@ -2886,10 +2886,12 @@ void Application::keyPressEvent(QKeyEvent* event) {
}
break;
case Qt::Key_P: {
bool isFirstPersonChecked = Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson);
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, !isFirstPersonChecked);
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, isFirstPersonChecked);
cameraMenuChanged();
if (!(isShifted || isMeta || isOption)) {
bool isFirstPersonChecked = Menu::getInstance()->isOptionChecked(MenuOption::FirstPerson);
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, !isFirstPersonChecked);
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, isFirstPersonChecked);
cameraMenuChanged();
}
break;
}

View file

@ -1116,30 +1116,64 @@ function recursiveDelete(entities, childrenList) {
}
function unparentSelectedEntities() {
if (SelectionManager.hasSelection()) {
var selectedEntities = selectionManager.selections;
selectedEntities.forEach(function (id, index) {
Entities.editEntity(id, {parentID: null})
return true;
});
Window.notify("Entities Unparented");
var selectedEntities = selectionManager.selections;
var parentCheck = false;
if (selectedEntities.length < 1) {
Window.notifyEditError("You must have an entity selected inorder to unparent it.");
return;
}
selectedEntities.forEach(function (id, index) {
var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID;
if (parentId !== null && parentId.length > 0 && parentId !== "{00000000-0000-0000-0000-000000000000}") {
parentCheck = true;
}
Entities.editEntity(id, {parentID: null})
return true;
});
if (parentCheck) {
if (selectedEntities.length > 1) {
Window.notify("Entities unparented");
} else {
Window.notify("Entity unparented");
}
} else {
if (selectedEntities.length > 1) {
Window.notify("Selected Entities have no parents");
} else {
Window.notify("Selected Entity does not have a parent");
}
}
} else {
Window.notifyEditError("You have nothing selected to unparent");
}
}
function parentSelectedEntities() {
if (SelectionManager.hasSelection()) {
var selectedEntities = selectionManager.selections;
if (selectedEntities.length <= 1) {
Window.notifyEditError("You must have multiple objects selected in order to parent them");
return;
Window.notifyEditError("You must have multiple entities selected in order to parent them");
return;
}
var parentCheck = false;
var lastEntityId = selectedEntities[selectedEntities.length-1];
selectedEntities.forEach(function (id, index) {
if (lastEntityId !== id) {
var parentId = Entities.getEntityProperties(id, ["parentID"]).parentID;
if (parentId !== lastEntityId) {
parentCheck = true;
}
Entities.editEntity(id, {parentID: lastEntityId})
}
});
Window.notify("Entities Parented");
if(parentCheck) {
Window.notify("Entities parented");
}else {
Window.notify("Entities are already parented to last");
}
} else {
Window.notifyEditError("You have nothing selected")
Window.notifyEditError("You have nothing selected to parent");
}
}
function deleteSelectedEntities() {