mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
fix bugs in unloading scripts when changing domains
This commit is contained in:
parent
e9207ab74d
commit
93755e6506
2 changed files with 6 additions and 13 deletions
|
@ -127,9 +127,7 @@
|
|||
}
|
||||
|
||||
var globalMouseClick = function(event) {
|
||||
print("globalMouseClick");
|
||||
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||
|
||||
if (clickedOverlay == externalThis.standUpButton) {
|
||||
seat.model = null;
|
||||
externalThis.standUp();
|
||||
|
@ -166,6 +164,7 @@
|
|||
} catch (e){}
|
||||
Script.update.connect(standingUpAnimation);
|
||||
Overlays.editOverlay(this.standUpButton, { visible: false });
|
||||
Controller.mousePressEvent.disconnect(globalMouseClick);
|
||||
}
|
||||
|
||||
function SeatIndicator(modelProperties, seatIndex) {
|
||||
|
@ -226,20 +225,11 @@
|
|||
print("Was seated: " + sitting);
|
||||
storeStartPoseAndTransition();
|
||||
updateJoints(1.0);
|
||||
Overlays.editOverlay(this.standUpButton, { visible: true });
|
||||
}
|
||||
}
|
||||
frame++;
|
||||
}
|
||||
|
||||
var locationChanged = false;
|
||||
if (location.hostname != oldHost || !location.isConnected) {
|
||||
this.removeIndicators();
|
||||
oldHost = location.hostname;
|
||||
locationChanged = true;
|
||||
}
|
||||
}
|
||||
var oldHost = location.hostname;
|
||||
|
||||
this.addIndicators = function() {
|
||||
if (!this.indicatorsAdded) {
|
||||
|
@ -351,12 +341,13 @@
|
|||
|
||||
this.unload = function(entityID) {
|
||||
this.cleanup();
|
||||
Script.update.disconnect(update);
|
||||
};
|
||||
|
||||
this.preload = function(entityID) {
|
||||
this.updateProperties(entityID); // All callbacks start by updating the properties
|
||||
this.createStandupButton();
|
||||
Script.update.connect(update); // do we want to do this??? how expensive will this be?
|
||||
Script.update.connect(update);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -64,6 +64,9 @@ EntityTreeRenderer::~EntityTreeRenderer() {
|
|||
}
|
||||
|
||||
void EntityTreeRenderer::clear() {
|
||||
foreach (const EntityItemID& entityID, _entityScripts.keys()) {
|
||||
checkAndCallUnload(entityID);
|
||||
}
|
||||
OctreeRenderer::clear();
|
||||
_entityScripts.clear();
|
||||
}
|
||||
|
@ -858,7 +861,6 @@ void EntityTreeRenderer::mouseMoveEvent(QMouseEvent* event, unsigned int deviceI
|
|||
}
|
||||
|
||||
void EntityTreeRenderer::deletingEntity(const EntityItemID& entityID) {
|
||||
|
||||
checkAndCallUnload(entityID);
|
||||
_entityScripts.remove(entityID);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue