make _parentID and _parentJointIndex private to avoid accidental direct access

This commit is contained in:
Seth Alves 2017-02-12 11:37:29 -08:00
parent 0c2abc9883
commit bc5f563f57
4 changed files with 9 additions and 9 deletions

View file

@ -38,7 +38,7 @@ Line3DOverlay::~Line3DOverlay() {
glm::vec3 Line3DOverlay::getStart() const { glm::vec3 Line3DOverlay::getStart() const {
bool success; bool success;
glm::vec3 worldStart = localToWorld(_start, _parentID, _parentJointIndex, success); glm::vec3 worldStart = localToWorld(_start, getParentID(), getParentJointIndex(), success);
if (!success) { if (!success) {
qDebug() << "Line3DOverlay::getStart failed"; qDebug() << "Line3DOverlay::getStart failed";
} }
@ -47,7 +47,7 @@ glm::vec3 Line3DOverlay::getStart() const {
glm::vec3 Line3DOverlay::getEnd() const { glm::vec3 Line3DOverlay::getEnd() const {
bool success; bool success;
glm::vec3 worldEnd = localToWorld(_end, _parentID, _parentJointIndex, success); glm::vec3 worldEnd = localToWorld(_end, getParentID(), getParentJointIndex(), success);
if (!success) { if (!success) {
qDebug() << "Line3DOverlay::getEnd failed"; qDebug() << "Line3DOverlay::getEnd failed";
} }
@ -56,7 +56,7 @@ glm::vec3 Line3DOverlay::getEnd() const {
void Line3DOverlay::setStart(const glm::vec3& start) { void Line3DOverlay::setStart(const glm::vec3& start) {
bool success; bool success;
_start = worldToLocal(start, _parentID, _parentJointIndex, success); _start = worldToLocal(start, getParentID(), getParentJointIndex(), success);
if (!success) { if (!success) {
qDebug() << "Line3DOverlay::setStart failed"; qDebug() << "Line3DOverlay::setStart failed";
} }
@ -64,7 +64,7 @@ void Line3DOverlay::setStart(const glm::vec3& start) {
void Line3DOverlay::setEnd(const glm::vec3& end) { void Line3DOverlay::setEnd(const glm::vec3& end) {
bool success; bool success;
_end = worldToLocal(end, _parentID, _parentJointIndex, success); _end = worldToLocal(end, getParentID(), getParentJointIndex(), success);
if (!success) { if (!success) {
qDebug() << "Line3DOverlay::setEnd failed"; qDebug() << "Line3DOverlay::setEnd failed";
} }

View file

@ -410,7 +410,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent
auto parentInfo = reinterpret_cast<AvatarDataPacket::ParentInfo*>(destinationBuffer); auto parentInfo = reinterpret_cast<AvatarDataPacket::ParentInfo*>(destinationBuffer);
QByteArray referentialAsBytes = parentID.toRfc4122(); QByteArray referentialAsBytes = parentID.toRfc4122();
memcpy(parentInfo->parentUUID, referentialAsBytes.data(), referentialAsBytes.size()); memcpy(parentInfo->parentUUID, referentialAsBytes.data(), referentialAsBytes.size());
parentInfo->parentJointIndex = _parentJointIndex; parentInfo->parentJointIndex = getParentJointIndex();
destinationBuffer += sizeof(AvatarDataPacket::ParentInfo); destinationBuffer += sizeof(AvatarDataPacket::ParentInfo);
int numBytes = destinationBuffer - startSection; int numBytes = destinationBuffer - startSection;

View file

@ -1595,7 +1595,7 @@ void EntityItem::updatePosition(const glm::vec3& value) {
} }
void EntityItem::updateParentID(const QUuid& value) { void EntityItem::updateParentID(const QUuid& value) {
if (_parentID != value) { if (getParentID() != value) {
setParentID(value); setParentID(value);
_dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; // children are forced to be kinematic _dirtyFlags |= Simulation::DIRTY_MOTION_TYPE; // children are forced to be kinematic
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar _dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar

View file

@ -186,9 +186,6 @@ public:
protected: protected:
const NestableType _nestableType; // EntityItem or an AvatarData const NestableType _nestableType; // EntityItem or an AvatarData
QUuid _id; QUuid _id;
QUuid _parentID; // what is this thing's transform relative to?
quint16 _parentJointIndex { INVALID_JOINT_INDEX }; // which joint of the parent is this relative to?
mutable SpatiallyNestableWeakPointer _parent; mutable SpatiallyNestableWeakPointer _parent;
virtual void beParentOfChild(SpatiallyNestablePointer newChild) const; virtual void beParentOfChild(SpatiallyNestablePointer newChild) const;
@ -211,6 +208,9 @@ protected:
quint64 _rotationChanged { 0 }; quint64 _rotationChanged { 0 };
private: private:
QUuid _parentID; // what is this thing's transform relative to?
quint16 _parentJointIndex { INVALID_JOINT_INDEX }; // which joint of the parent is this relative to?
mutable ReadWriteLockable _transformLock; mutable ReadWriteLockable _transformLock;
mutable ReadWriteLockable _idLock; mutable ReadWriteLockable _idLock;
mutable ReadWriteLockable _velocityLock; mutable ReadWriteLockable _velocityLock;