mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 20:53:33 +02:00
Merge pull request #15124 from SamGondelman/shapes
Case 21605: Fix shapes app and debugAvatarMixer
This commit is contained in:
commit
abb61b7e90
13 changed files with 72 additions and 41 deletions
interface/src
libraries
entities-renderer/src
entities/src
shared/src
scripts/developer/debugging
|
@ -910,7 +910,7 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
|||
recorder->recordFrame(FRAME_TYPE, toFrame(*this));
|
||||
}
|
||||
|
||||
locationChanged();
|
||||
locationChanged(true, false);
|
||||
// if a entity-child of this avatar has moved outside of its queryAACube, update the cube and tell the entity server.
|
||||
auto entityTreeRenderer = qApp->getEntities();
|
||||
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
||||
|
@ -920,6 +920,7 @@ void MyAvatar::simulate(float deltaTime, bool inView) {
|
|||
zoneInteractionProperties = entityTreeRenderer->getZoneInteractionProperties();
|
||||
EntityEditPacketSender* packetSender = qApp->getEntityEditPacketSender();
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
locationChanged(true, false);
|
||||
// we need to update attached queryAACubes in our own local tree so point-select always works
|
||||
// however we don't want to flood the update pipeline with AvatarEntity updates, so we assume
|
||||
// others have all info required to properly update queryAACube of AvatarEntities on their end
|
||||
|
|
|
@ -204,7 +204,8 @@ QString Overlays::overlayToEntityType(const QString& type) {
|
|||
#define RENAME_PROP(o, e) \
|
||||
{ \
|
||||
auto iter = overlayProps.find(#o); \
|
||||
if (iter != overlayProps.end()) { \
|
||||
if (iter != overlayProps.end() && \
|
||||
!overlayProps.contains(#e)) { \
|
||||
overlayProps[#e] = iter.value(); \
|
||||
} \
|
||||
}
|
||||
|
@ -493,15 +494,34 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
|
|||
RENAME_PROP_CONVERT(p1, p1, [](const QVariant& v) { return vec3toVariant(glm::vec3(0.0f)); });
|
||||
RENAME_PROP_CONVERT(p2, p2, [=](const QVariant& v) {
|
||||
glm::vec3 position;
|
||||
bool hasPosition = false;
|
||||
glm::quat rotation;
|
||||
bool hasRotation = false;
|
||||
|
||||
auto iter2 = overlayProps.find("position");
|
||||
if (iter2 != overlayProps.end()) {
|
||||
position = vec3FromVariant(iter2.value());
|
||||
} else if (!add) {
|
||||
EntityPropertyFlags desiredProperties;
|
||||
desiredProperties += PROP_POSITION;
|
||||
position = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(id, desiredProperties).getPosition();
|
||||
hasPosition = true;
|
||||
}
|
||||
return vec3toVariant(vec3FromVariant(v) - position);
|
||||
iter2 = overlayProps.find("rotation");
|
||||
if (iter2 != overlayProps.end()) {
|
||||
rotation = quatFromVariant(iter2.value());
|
||||
hasRotation = true;
|
||||
}
|
||||
|
||||
if (!add && !(hasPosition && hasRotation)) {
|
||||
auto entity = DependencyManager::get<EntityTreeRenderer>()->getEntity(id);
|
||||
if (entity) {
|
||||
if (!hasPosition) {
|
||||
position = entity->getWorldPosition();
|
||||
}
|
||||
if (!hasRotation) {
|
||||
rotation = entity->getWorldOrientation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vec3toVariant(glm::inverse(rotation) * (vec3FromVariant(v) - position));
|
||||
});
|
||||
|
||||
RENAME_PROP(localStart, p1);
|
||||
|
|
|
@ -928,9 +928,9 @@ void RenderableModelEntityItem::setJointTranslationsSet(const QVector<bool>& tra
|
|||
_needsJointSimulation = true;
|
||||
}
|
||||
|
||||
void RenderableModelEntityItem::locationChanged(bool tellPhysics) {
|
||||
void RenderableModelEntityItem::locationChanged(bool tellPhysics, bool tellChildren) {
|
||||
DETAILED_PERFORMANCE_TIMER("locationChanged");
|
||||
EntityItem::locationChanged(tellPhysics);
|
||||
EntityItem::locationChanged(tellPhysics, tellChildren);
|
||||
auto model = getModel();
|
||||
if (model && model->isLoaded()) {
|
||||
model->updateRenderItems();
|
||||
|
@ -1032,9 +1032,7 @@ void RenderableModelEntityItem::copyAnimationJointDataToModel() {
|
|||
});
|
||||
|
||||
if (changed) {
|
||||
forEachChild([&](SpatiallyNestablePointer object) {
|
||||
object->locationChanged(false);
|
||||
});
|
||||
locationChanged(false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public:
|
|||
virtual void setJointTranslations(const QVector<glm::vec3>& translations) override;
|
||||
virtual void setJointTranslationsSet(const QVector<bool>& translationsSet) override;
|
||||
|
||||
virtual void locationChanged(bool tellPhysics = true) override;
|
||||
virtual void locationChanged(bool tellPhysics = true, bool tellChildren = true) override;
|
||||
|
||||
virtual int getJointIndex(const QString& name) const override;
|
||||
virtual QStringList getJointNames() const override;
|
||||
|
|
|
@ -150,7 +150,7 @@ public:
|
|||
virtual bool addToScene(const EntityItemPointer& self, const render::ScenePointer& scene, render::Transaction& transaction) override;
|
||||
virtual void removeFromScene(const EntityItemPointer& self, const render::ScenePointer& scene, render::Transaction& transaction) override;
|
||||
private:
|
||||
virtual void locationChanged(bool tellPhysics = true) override { EntityItem::locationChanged(tellPhysics); notifyBoundChanged(); }
|
||||
virtual void locationChanged(bool tellPhysics = true, bool tellChildren = true) override { EntityItem::locationChanged(tellPhysics, tellChildren); notifyBoundChanged(); }
|
||||
virtual void dimensionsChanged() override { EntityItem::dimensionsChanged(); notifyBoundChanged(); }
|
||||
void notifyBoundChanged();
|
||||
void notifyChangedRenderItem();
|
||||
|
|
|
@ -2593,7 +2593,7 @@ QList<EntityDynamicPointer> EntityItem::getActionsOfType(EntityDynamicType typeT
|
|||
return result;
|
||||
}
|
||||
|
||||
void EntityItem::locationChanged(bool tellPhysics) {
|
||||
void EntityItem::locationChanged(bool tellPhysics, bool tellChildren) {
|
||||
requiresRecalcBoxes();
|
||||
if (tellPhysics) {
|
||||
_flags |= Simulation::DIRTY_TRANSFORM;
|
||||
|
@ -2602,7 +2602,7 @@ void EntityItem::locationChanged(bool tellPhysics) {
|
|||
tree->entityChanged(getThisPointer());
|
||||
}
|
||||
}
|
||||
SpatiallyNestable::locationChanged(tellPhysics); // tell all the children, also
|
||||
SpatiallyNestable::locationChanged(tellPhysics, tellChildren);
|
||||
std::pair<int32_t, glm::vec4> data(_spaceIndex, glm::vec4(getWorldPosition(), _boundingRadius));
|
||||
emit spaceUpdate(data);
|
||||
somethingChangedNotification();
|
||||
|
|
|
@ -518,7 +518,7 @@ public:
|
|||
|
||||
virtual bool getMeshes(MeshProxyList& result) { return true; }
|
||||
|
||||
virtual void locationChanged(bool tellPhysics = true) override;
|
||||
virtual void locationChanged(bool tellPhysics = true, bool tellChildren = true) override;
|
||||
|
||||
virtual bool getScalesWithParent() const override;
|
||||
|
||||
|
|
|
@ -2039,6 +2039,8 @@ void EntityTree::fixupNeedsParentFixups() {
|
|||
Simulation::DIRTY_COLLISION_GROUP |
|
||||
Simulation::DIRTY_TRANSFORM);
|
||||
entityChanged(entity);
|
||||
entity->locationChanged(true, false);
|
||||
|
||||
entity->forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer descendantEntity = std::static_pointer_cast<EntityItem>(object);
|
||||
|
@ -2047,8 +2049,8 @@ void EntityTree::fixupNeedsParentFixups() {
|
|||
Simulation::DIRTY_TRANSFORM);
|
||||
entityChanged(descendantEntity);
|
||||
}
|
||||
object->locationChanged(true, false);
|
||||
});
|
||||
entity->locationChanged(true);
|
||||
|
||||
// Update our parent's bounding box
|
||||
bool success = false;
|
||||
|
@ -3002,8 +3004,19 @@ void EntityTree::updateEntityQueryAACubeWorker(SpatiallyNestablePointer object,
|
|||
// if the queryBox has changed, tell the entity-server
|
||||
EntityItemPointer entity = std::dynamic_pointer_cast<EntityItem>(object);
|
||||
if (entity) {
|
||||
// NOTE: we rely on side-effects of the entity->updateQueryAACube() call in the following if() conditional:
|
||||
if (entity->updateQueryAACube() || force) {
|
||||
bool queryAACubeChanged = false;
|
||||
if (!entity->hasChildren()) {
|
||||
// updateQueryAACube will also update all ancestors' AACubes, so we only need to call this for leaf nodes
|
||||
queryAACubeChanged = entity->updateQueryAACube();
|
||||
} else {
|
||||
AACube oldCube = entity->getQueryAACube();
|
||||
object->forEachChild([&](SpatiallyNestablePointer descendant) {
|
||||
updateEntityQueryAACubeWorker(descendant, packetSender, moveOperator, force, tellServer);
|
||||
});
|
||||
queryAACubeChanged = oldCube != entity->getQueryAACube();
|
||||
}
|
||||
|
||||
if (queryAACubeChanged || force) {
|
||||
bool success;
|
||||
AACube newCube = entity->getQueryAACube(success);
|
||||
if (success) {
|
||||
|
@ -3027,10 +3040,6 @@ void EntityTree::updateEntityQueryAACubeWorker(SpatiallyNestablePointer object,
|
|||
entityChanged(entity);
|
||||
}
|
||||
}
|
||||
|
||||
object->forEachDescendant([&](SpatiallyNestablePointer descendant) {
|
||||
updateEntityQueryAACubeWorker(descendant, packetSender, moveOperator, force, tellServer);
|
||||
});
|
||||
}
|
||||
|
||||
void EntityTree::updateEntityQueryAACube(SpatiallyNestablePointer object, EntityEditPacketSender* packetSender,
|
||||
|
|
|
@ -55,8 +55,8 @@ void LightEntityItem::setUnscaledDimensions(const glm::vec3& value) {
|
|||
}
|
||||
}
|
||||
|
||||
void LightEntityItem::locationChanged(bool tellPhysics) {
|
||||
EntityItem::locationChanged(tellPhysics);
|
||||
void LightEntityItem::locationChanged(bool tellPhysics, bool tellChildren) {
|
||||
EntityItem::locationChanged(tellPhysics, tellChildren);
|
||||
withWriteLock([&] {
|
||||
_lightPropertiesChanged = true;
|
||||
});
|
||||
|
|
|
@ -74,7 +74,7 @@ public:
|
|||
static bool getLightsArePickable() { return _lightsArePickable; }
|
||||
static void setLightsArePickable(bool value) { _lightsArePickable = value; }
|
||||
|
||||
virtual void locationChanged(bool tellPhysics) override;
|
||||
virtual void locationChanged(bool tellPhysics, bool tellChildren) override;
|
||||
virtual void dimensionsChanged() override;
|
||||
|
||||
bool lightPropertiesChanged() const { return _lightPropertiesChanged; }
|
||||
|
|
|
@ -1100,10 +1100,12 @@ void SpatiallyNestable::forEachDescendantTest(const ChildLambdaTest& actor) cons
|
|||
}
|
||||
}
|
||||
|
||||
void SpatiallyNestable::locationChanged(bool tellPhysics) {
|
||||
forEachChild([&](SpatiallyNestablePointer object) {
|
||||
object->locationChanged(tellPhysics);
|
||||
});
|
||||
void SpatiallyNestable::locationChanged(bool tellPhysics, bool tellChildren) {
|
||||
if (tellChildren) {
|
||||
forEachChild([&](SpatiallyNestablePointer object) {
|
||||
object->locationChanged(tellPhysics, tellChildren);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AACube SpatiallyNestable::getMaximumAACube(bool& success) const {
|
||||
|
|
|
@ -211,7 +211,7 @@ public:
|
|||
|
||||
void dump(const QString& prefix = "") const;
|
||||
|
||||
virtual void locationChanged(bool tellPhysics = true); // called when a this object's location has changed
|
||||
virtual void locationChanged(bool tellPhysics = true, bool tellChildren = true); // called when a this object's location has changed
|
||||
virtual void dimensionsChanged() { _queryAACubeSet = false; } // called when a this object's dimensions have changed
|
||||
virtual void parentDeleted() { } // called on children of a deleted parent
|
||||
|
||||
|
|
|
@ -19,6 +19,11 @@ Script.include("/~/system/libraries/controllers.js");
|
|||
|
||||
var isShowingOverlays = true;
|
||||
var debugOverlays = {};
|
||||
var textSizeOverlay = Overlays.addOverlay("text3d", {
|
||||
position: MyAvatar.position,
|
||||
lineHeight: 0.1,
|
||||
visible: false
|
||||
});
|
||||
|
||||
function removeOverlays() {
|
||||
// enumerate the overlays and remove them
|
||||
|
@ -31,6 +36,8 @@ function removeOverlays() {
|
|||
}
|
||||
}
|
||||
|
||||
Overlays.deleteOverlay(textSizeOverlay);
|
||||
|
||||
debugOverlays = {};
|
||||
}
|
||||
|
||||
|
@ -60,8 +67,6 @@ function updateOverlays() {
|
|||
var overlayPosition = avatar.getJointPosition("Head");
|
||||
overlayPosition.y += 1.15;
|
||||
|
||||
var rows = 8;
|
||||
|
||||
var text = avatarID + "\n"
|
||||
+"--- Data from Mixer ---\n"
|
||||
+"All: " + AvatarManager.getAvatarDataRate(avatarID).toFixed(2) + "kbps (" + AvatarManager.getAvatarUpdateRate(avatarID).toFixed(2) + "hz)" + "\n"
|
||||
|
@ -85,9 +90,11 @@ function updateOverlays() {
|
|||
//+" SM: " + AvatarManager.getAvatarSimulationRate(avatarID,"skeletonModel").toFixed(2) + "hz \n"
|
||||
+" JD: " + AvatarManager.getAvatarSimulationRate(avatarID,"jointData").toFixed(2) + "hz \n"
|
||||
|
||||
var dimensions = Overlays.textSize(textSizeOverlay, text);
|
||||
if (avatarID in debugOverlays) {
|
||||
// keep the overlay above the current position of this avatar
|
||||
Overlays.editOverlay(debugOverlays[avatarID][0], {
|
||||
dimensions: { x: 1.1 * dimensions.width, y: 0.6 * dimensions.height },
|
||||
position: overlayPosition,
|
||||
text: text
|
||||
});
|
||||
|
@ -95,15 +102,9 @@ function updateOverlays() {
|
|||
// add the overlay above this avatar
|
||||
var newOverlay = Overlays.addOverlay("text3d", {
|
||||
position: overlayPosition,
|
||||
dimensions: {
|
||||
x: 1.25,
|
||||
y: rows * 0.13
|
||||
},
|
||||
dimensions: { x: 1.1 * dimensions.width, y: 0.6 * dimensions.height },
|
||||
lineHeight: 0.1,
|
||||
font:{size:0.1},
|
||||
text: text,
|
||||
size: 1,
|
||||
scale: 0.4,
|
||||
color: { red: 255, green: 255, blue: 255},
|
||||
alpha: 1,
|
||||
solid: true,
|
||||
|
|
Loading…
Reference in a new issue