feat(editor): multi-select objects in view
This commit is contained in:
parent
9602aa96c0
commit
d972f98ea4
1 changed files with 16 additions and 1 deletions
|
@ -1,8 +1,10 @@
|
|||
#include <GL/glew.h>
|
||||
#include <qnamespace.h>
|
||||
#include <qsoundeffect.h>
|
||||
#include "mainglwidget.h"
|
||||
#include "common.h"
|
||||
#include "math_helper.h"
|
||||
#include "objects/base/instance.h"
|
||||
#include "physics/util.h"
|
||||
#include "rendering/renderer.h"
|
||||
#include "rendering/shader.h"
|
||||
|
@ -368,6 +370,19 @@ void MainGLWidget::mousePressEvent(QMouseEvent* evt) {
|
|||
//part.selected = true;
|
||||
isMouseDragging = true;
|
||||
draggingObject = part;
|
||||
if (evt->modifiers() & Qt::ControlModifier) {
|
||||
std::vector<InstanceRefWeak> currentSelection = getSelection();
|
||||
for (int i = 0; i < currentSelection.size(); i++) {
|
||||
InstanceRefWeak inst = currentSelection[i];
|
||||
if (!inst.expired() && inst.lock() == part) {
|
||||
currentSelection.erase(currentSelection.begin() + i);
|
||||
goto skipAddPart;
|
||||
}
|
||||
}
|
||||
currentSelection.push_back(part);
|
||||
skipAddPart:
|
||||
setSelection(currentSelection);
|
||||
}else
|
||||
setSelection(std::vector<InstanceRefWeak> { part });
|
||||
// Disable bit so that we can ignore the part while raycasting
|
||||
// part->rigidBody->getCollider(0)->setCollisionCategoryBits(0b10);
|
||||
|
|
Loading…
Add table
Reference in a new issue