simplifying the change

This commit is contained in:
ZappoMan 2015-02-23 09:23:15 -08:00
parent d32fc645e8
commit e5ef61e27e

View file

@ -718,7 +718,11 @@ QScriptValueList EntityTreeRenderer::createEntityArgs(const EntityItemID& entity
}
void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
if (_tree && !_shuttingDown) {
// If we don't have a tree, or we're in the process of shutting down, then don't
// process these events.
if (!_tree || _shuttingDown) {
return;
}
PerformanceTimer perfTimer("EntityTreeRenderer::mousePressEvent");
PickRay ray = _viewState->computePickRay(event->x(), event->y());
@ -742,11 +746,14 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event, unsigned int device
}
_lastMouseEvent = MouseEvent(*event, deviceID);
_lastMouseEventValid = true;
}
}
void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) {
if (_tree && !_shuttingDown) {
// If we don't have a tree, or we're in the process of shutting down, then don't
// process these events.
if (!_tree || _shuttingDown) {
return;
}
PerformanceTimer perfTimer("EntityTreeRenderer::mouseReleaseEvent");
PickRay ray = _viewState->computePickRay(event->x(), event->y());
bool precisionPicking = !_dontDoPrecisionPicking;
@ -778,11 +785,14 @@ void EntityTreeRenderer::mouseReleaseEvent(QMouseEvent* event, unsigned int devi
_currentClickingOnEntityID = EntityItemID::createInvalidEntityID();
_lastMouseEvent = MouseEvent(*event, deviceID);
_lastMouseEventValid = true;
}
}
void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
if (_tree && !_shuttingDown) {
// If we don't have a tree, or we're in the process of shutting down, then don't
// process these events.
if (!_tree || _shuttingDown) {
return;
}
PerformanceTimer perfTimer("EntityTreeRenderer::mouseMoveEvent");
PickRay ray = _viewState->computePickRay(event->x(), event->y());
@ -870,7 +880,6 @@ void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceI
}
_lastMouseEvent = MouseEvent(*event, deviceID);
_lastMouseEventValid = true;
}
}
void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
@ -919,7 +928,11 @@ void EntityTreeRenderer::changingEntityID(const EntityItemID& oldEntityID, const
void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, const EntityItemID& idB,
const Collision& collision) {
if (_tree && !_shuttingDown) {
// If we don't have a tree, or we're in the process of shutting down, then don't
// process these events.
if (!_tree || _shuttingDown) {
return;
}
QScriptValue entityScriptA = loadEntityScript(idA);
if (entityScriptA.property("collisionWithEntity").isValid()) {
QScriptValueList args;
@ -937,6 +950,5 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
args << collisionToScriptValue(_entitiesScriptEngine, collision);
entityScriptB.property("collisionWithEntity").call(entityScriptA, args);
}
}
}