mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
add developer menu item to disable sending physics updates
This commit is contained in:
parent
73b9c06ec0
commit
a1ec44b8e0
7 changed files with 52 additions and 6 deletions
|
@ -18,6 +18,7 @@ function setupMenus() {
|
||||||
}
|
}
|
||||||
if (!Menu.menuExists("Developer > Entities")) {
|
if (!Menu.menuExists("Developer > Entities")) {
|
||||||
Menu.addMenu("Developer > Entities");
|
Menu.addMenu("Developer > Entities");
|
||||||
|
/*
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Bounds", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Bounds", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Triangles", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Triangles", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Bounds", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Display Model Element Bounds", isCheckable: true, isChecked: false });
|
||||||
|
@ -26,9 +27,28 @@ function setupMenus() {
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Attempt Render Entities as Scene", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Attempt Render Entities as Scene", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't Do Precision Picking", isCheckable: true, isChecked: false });
|
||||||
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false });
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Disable Light Entities", isCheckable: true, isChecked: false });
|
||||||
|
*/
|
||||||
|
Menu.addMenuItem({ menuName: "Developer > Entities", menuItemName: "Don't send collision updates to server", isCheckable: true, isChecked: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Menu.menuItemEvent.connect(function (menuItem) {
|
||||||
|
print("menuItemEvent() in JS... menuItem=" + menuItem);
|
||||||
|
|
||||||
|
if (menuItem == "Don't send collision updates to server") {
|
||||||
|
var dontSendUpdates = Menu.isOptionChecked("Don't send collision updates to server");
|
||||||
|
print(" dontSendUpdates... checked=" + dontSendUpdates);
|
||||||
|
Entities.setSendPhysicsUpdates(!dontSendUpdates);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setupMenus();
|
||||||
|
|
||||||
|
// register our scriptEnding callback
|
||||||
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
Menu.removeMenu("Developer > Entities");
|
Menu.removeMenu("Developer > Entities");
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include "EntityTree.h"
|
#include "EntityTree.h"
|
||||||
|
|
||||||
quint64 EntityItem::lastCollisionTime = 0;
|
quint64 EntityItem::lastCollisionTime = 0;
|
||||||
|
bool EntityItem::_sendPhysicsUpdates = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void EntityItem::initFromEntityItemID(const EntityItemID& entityItemID) {
|
void EntityItem::initFromEntityItemID(const EntityItemID& entityItemID) {
|
||||||
|
|
|
@ -289,8 +289,15 @@ public:
|
||||||
void setPhysicsInfo(void* data) { _physicsInfo = data; }
|
void setPhysicsInfo(void* data) { _physicsInfo = data; }
|
||||||
|
|
||||||
EntityTreeElement* getElement() const { return _element; }
|
EntityTreeElement* getElement() const { return _element; }
|
||||||
|
|
||||||
|
static void setSendPhysicsUpdates(bool value) { _sendPhysicsUpdates = value; }
|
||||||
|
static bool getSendPhysicsUpdates() { return _sendPhysicsUpdates; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
static bool _sendPhysicsUpdates;
|
||||||
|
|
||||||
virtual void initFromEntityItemID(const EntityItemID& entityItemID); // maybe useful to allow subclasses to init
|
virtual void initFromEntityItemID(const EntityItemID& entityItemID); // maybe useful to allow subclasses to init
|
||||||
virtual void recalculateCollisionShape();
|
virtual void recalculateCollisionShape();
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "LightEntityItem.h"
|
#include "LightEntityItem.h"
|
||||||
#include "ModelEntityItem.h"
|
#include "ModelEntityItem.h"
|
||||||
|
|
||||||
|
|
||||||
EntityScriptingInterface::EntityScriptingInterface() :
|
EntityScriptingInterface::EntityScriptingInterface() :
|
||||||
_nextCreatorTokenID(0),
|
_nextCreatorTokenID(0),
|
||||||
_entityTree(NULL)
|
_entityTree(NULL)
|
||||||
|
@ -234,6 +235,14 @@ bool EntityScriptingInterface::getLightsArePickable() const {
|
||||||
return LightEntityItem::getLightsArePickable();
|
return LightEntityItem::getLightsArePickable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EntityScriptingInterface::setSendPhysicsUpdates(bool value) {
|
||||||
|
EntityItem::setSendPhysicsUpdates(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EntityScriptingInterface::getSendPhysicsUpdates() const {
|
||||||
|
return EntityItem::getSendPhysicsUpdates();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
|
RayToEntityIntersectionResult::RayToEntityIntersectionResult() :
|
||||||
intersects(false),
|
intersects(false),
|
||||||
|
|
|
@ -99,6 +99,9 @@ public slots:
|
||||||
Q_INVOKABLE void setLightsArePickable(bool value);
|
Q_INVOKABLE void setLightsArePickable(bool value);
|
||||||
Q_INVOKABLE bool getLightsArePickable() const;
|
Q_INVOKABLE bool getLightsArePickable() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void setSendPhysicsUpdates(bool value);
|
||||||
|
Q_INVOKABLE bool getSendPhysicsUpdates() const;
|
||||||
|
|
||||||
Q_INVOKABLE void dumpTree() const;
|
Q_INVOKABLE void dumpTree() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -232,12 +232,16 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
|
||||||
properties.setLastEdited(_entity->getLastEdited());
|
properties.setLastEdited(_entity->getLastEdited());
|
||||||
}
|
}
|
||||||
|
|
||||||
EntityItemID id(_entity->getID());
|
if (EntityItem::getSendPhysicsUpdates()) {
|
||||||
EntityEditPacketSender* entityPacketSender = static_cast<EntityEditPacketSender*>(packetSender);
|
EntityItemID id(_entity->getID());
|
||||||
#ifdef WANT_DEBUG
|
EntityEditPacketSender* entityPacketSender = static_cast<EntityEditPacketSender*>(packetSender);
|
||||||
qDebug() << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
|
#ifdef WANT_DEBUG
|
||||||
#endif
|
qDebug() << "EntityMotionState::sendUpdate()... calling queueEditEntityMessage()...";
|
||||||
entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
|
#endif
|
||||||
|
entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
|
||||||
|
} else {
|
||||||
|
qDebug() << "EntityMotionState::sendUpdate()... NOT sending update as requested.";
|
||||||
|
}
|
||||||
|
|
||||||
// The outgoing flags only itemized WHAT to send, not WHETHER to send, hence we always set them
|
// The outgoing flags only itemized WHAT to send, not WHETHER to send, hence we always set them
|
||||||
// to the full set. These flags may be momentarily cleared by incoming external changes.
|
// to the full set. These flags may be momentarily cleared by incoming external changes.
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EntityItem* _entity;
|
EntityItem* _entity;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_EntityMotionState_h
|
#endif // hifi_EntityMotionState_h
|
||||||
|
|
Loading…
Reference in a new issue