The right way to restrict private user data:

This commit is contained in:
Zach Fox 2019-05-13 16:07:29 -07:00
parent e87381f431
commit 2ce9e9ee10
3 changed files with 11 additions and 6 deletions

View file

@ -372,7 +372,7 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream
// Record explicitly filtered-in entity so that extra entities can be flagged.
entityNodeData->insertSentFilteredEntity(entityID);
}
OctreeElement::AppendState appendEntityState = entity->appendEntityData(&_packetData, params, _extraEncodeData);
OctreeElement::AppendState appendEntityState = entity->appendEntityData(&_packetData, params, _extraEncodeData, entityNode->getCanGetAndSetPrivateUserData());
if (appendEntityState != OctreeElement::COMPLETED) {
if (appendEntityState == OctreeElement::PARTIAL) {

View file

@ -155,7 +155,8 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
}
OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packetData, EncodeBitstreamParams& params,
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData) const {
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
const bool destinationNodeCanGetAndSetPrivateUserData) const {
// ALL this fits...
// object ID [16 bytes]
@ -199,6 +200,11 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
requestedProperties = entityTreeElementExtraEncodeData->entities.value(getEntityItemID());
}
QString privateUserData = "";
if (destinationNodeCanGetAndSetPrivateUserData) {
privateUserData = getPrivateUserData();
}
EntityPropertyFlags propertiesDidntFit = requestedProperties;
LevelDetails entityLevel = packetData->startLevel();
@ -277,9 +283,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
APPEND_ENTITY_PROPERTY(PROP_NAME, getName());
APPEND_ENTITY_PROPERTY(PROP_LOCKED, getLocked());
APPEND_ENTITY_PROPERTY(PROP_USER_DATA, getUserData());
if (nodeList->getThisNodeCanGetAndSetPrivateUserData()) {
APPEND_ENTITY_PROPERTY(PROP_PRIVATE_USER_DATA, getPrivateUserData());
}
APPEND_ENTITY_PROPERTY(PROP_PRIVATE_USER_DATA, privateUserData);
APPEND_ENTITY_PROPERTY(PROP_HREF, getHref());
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription());
APPEND_ENTITY_PROPERTY(PROP_POSITION, getLocalPosition());

View file

@ -134,7 +134,8 @@ public:
virtual EntityPropertyFlags getEntityProperties(EncodeBitstreamParams& params) const;
virtual OctreeElement::AppendState appendEntityData(OctreePacketData* packetData, EncodeBitstreamParams& params,
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData) const;
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,
const bool destinationNodeCanGetAndSetPrivateUserData = false) const;
virtual void appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
EntityTreeElementExtraEncodeDataPointer entityTreeElementExtraEncodeData,