From 01ff3f14b6fd3d7ece2fe6d440a8e6a4d9ac9f15 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Mon, 9 Jan 2017 15:28:05 -0800 Subject: [PATCH] re-evaluate an entities in-bullet status when parentID changes --- libraries/entities/src/EntityItem.cpp | 9 ++++++++- libraries/entities/src/EntityItem.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 00c9ab2dde..d6792d3871 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1308,7 +1308,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) { SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref); SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription); SET_ENTITY_PROPERTY_FROM_PROPERTIES(actionData, setActionData); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentID, setParentID); + SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentID, updateParentID); SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex); SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube); @@ -1565,6 +1565,13 @@ void EntityItem::updatePosition(const glm::vec3& value) { } } +void EntityItem::updateParentID(const QUuid& value) { + if (_parentID != value) { + setParentID(value); + _dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; // children are forced to be kinematic + } +} + void EntityItem::updatePositionFromNetwork(const glm::vec3& value) { if (shouldSuppressLocationEdits()) { return; diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index bd5fb44fc8..7be81391f3 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -339,6 +339,7 @@ public: // updateFoo() methods to be used when changes need to be accumulated in the _dirtyFlags virtual void updateRegistrationPoint(const glm::vec3& value); void updatePosition(const glm::vec3& value); + void updateParentID(const QUuid& value); void updatePositionFromNetwork(const glm::vec3& value); void updateDimensions(const glm::vec3& value); void updateRotation(const glm::quat& rotation);