diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 174f392bf8..6bac9593ae 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1631,19 +1631,15 @@ void Application::importVoxels() { } bool Application::importEntities(const QString& filename) { -qDebug() << "Application::importEntities()..."; _entityClipboard.eraseAllOctreeElements(); bool success = _entityClipboard.readFromSVOFile(filename.toLocal8Bit().constData()); -qDebug() << " success=" << success; if (success) { -_entityClipboard.dumpTree(); _entityClipboard.reaverageOctreeElements(); } return success; } void Application::pasteEntities(float x, float y, float z) { -qDebug() << "Application::pasteEntities(" << x << ", " << y << ", " << z << ")"; _entityClipboard.sendEntities(&_entityEditSender, _entities.getTree(), x, y, z); } diff --git a/interface/src/entities/EntityTreeRenderer.cpp b/interface/src/entities/EntityTreeRenderer.cpp index 055ec2b490..7d322590db 100644 --- a/interface/src/entities/EntityTreeRenderer.cpp +++ b/interface/src/entities/EntityTreeRenderer.cpp @@ -186,7 +186,6 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args) for (uint16_t i = 0; i < numberOfEntities; i++) { EntityItem* entityItem = entityItems[i]; - bool wantDebug = false; if (wantDebug) { @@ -205,7 +204,6 @@ void EntityTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args) // TODO: some entity types (like lights) might want to be rendered even // when they are outside of the view frustum... if (args->_viewFrustum->cubeInFrustum(entityCube) != ViewFrustum::OUTSIDE) { - Glower* glower = NULL; if (entityItem->getGlowLevel() > 0.0f) { glower = new Glower(entityItem->getGlowLevel()); diff --git a/interface/src/ui/overlays/LocalModelsOverlay.cpp b/interface/src/ui/overlays/LocalModelsOverlay.cpp index 7ce59cd7dd..e4aaa04b20 100644 --- a/interface/src/ui/overlays/LocalModelsOverlay.cpp +++ b/interface/src/ui/overlays/LocalModelsOverlay.cpp @@ -31,9 +31,7 @@ void LocalModelsOverlay::render() { Application* app = Application::getInstance(); glm::vec3 oldTranslation = app->getViewMatrixTranslation(); app->setViewMatrixTranslation(oldTranslation + _position); - _entityTreeRenderer->render(); - Application::getInstance()->setViewMatrixTranslation(oldTranslation); } glPopMatrix(); } diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 0c3dda5f67..9ecf22d72c 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -36,7 +36,6 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemI int sizeOut = 0; if (EntityItemProperties::encodeEntityEditPacket(type, modelID, properties, &bufferOut[0], _maxPacketSize, sizeOut)) { - qDebug() << "EntityItemProperties::encodeEntityEditPacket() returned TRUE.... calling queueOctreeEditMessage()...."; queueOctreeEditMessage(type, bufferOut, sizeOut); } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 384694aa65..cb95e625f5 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -431,9 +431,6 @@ void EntityItemPropertiesFromScriptValue(const QScriptValue &object, EntityItemP bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItemID id, const EntityItemProperties& properties, unsigned char* bufferOut, int sizeIn, int& sizeOut) { - -qDebug() << "EntityItemProperties::encodeEntityEditPacket()...."; - OctreePacketData packetData(false, sizeIn); // create a packetData object to add out packet details too. bool success = true; // assume the best @@ -524,9 +521,6 @@ qDebug() << "EntityItemProperties::encodeEntityEditPacket()...."; if (headerFits) { bool successPropertyFits; - -qDebug() << " HEADER FITS....."; - propertyFlags -= PROP_LAST_ITEM; // clear the last item for now, we may or may not set it as the actual item // These items would go here once supported.... @@ -539,9 +533,6 @@ qDebug() << " HEADER FITS....."; LevelDetails propertyLevel = packetData.startLevel(); successPropertyFits = packetData.appendPosition(properties.getPosition()); if (successPropertyFits) { - -qDebug() << " PROP_POSITION FITS....."; - propertyFlags |= PROP_POSITION; propertiesDidntFit -= PROP_POSITION; propertyCount++; @@ -700,9 +691,6 @@ qDebug() << " PROP_POSITION FITS....."; LevelDetails propertyLevel = packetData.startLevel(); successPropertyFits = packetData.appendValue(properties.getModelURL()); if (successPropertyFits) { - -qDebug() << " PROP_MODEL_URL FITS....."; - propertyFlags |= PROP_MODEL_URL; propertiesDidntFit -= PROP_MODEL_URL; propertyCount++; diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 3f4a4d2064..e4c479b36f 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -117,7 +117,6 @@ public: void setType(EntityTypes::EntityType type) { _type = type; } /// set position in meter units void setPosition(const glm::vec3& value) { _position = value; _positionChanged = true; } - void resetPosition(const glm::vec3& value) { _position = value; } /// changes the position without marking it as changed void setRadius(float value) { _radius = value; _radiusChanged = true; } void setRotation(const glm::quat& rotation) { _rotation = rotation; _rotationChanged = true; } diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 288cfe982c..ddcb5afec4 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -1049,7 +1049,6 @@ void EntityTree::dumpTree() { } void EntityTree::sendEntities(EntityEditPacketSender* packetSender, EntityTree* localTree, float x, float y, float z) { -qDebug() << "EntityTree::sendEntities(" << x << ", " << y << ", " << z << ")"; SendEntitiesOperationArgs args; args.packetSender = packetSender; args.localTree = localTree; @@ -1062,51 +1061,23 @@ bool EntityTree::sendEntitiesOperation(OctreeElement* element, void* extraData) SendEntitiesOperationArgs* args = static_cast(extraData); EntityTreeElement* entityTreeElement = static_cast(element); - qDebug() << "EntityTree::sendEntitiesOperation()"; - qDebug() << " element box:" << entityTreeElement->getAACube(); - const QList& entities = entityTreeElement->getEntities(); for (int i = 0; i < entities.size(); i++) { - qDebug() << " entity[" << i <<"].id" << entities[i]->getEntityItemID(); EntityItemID newID(NEW_ENTITY, EntityItemID::getNextCreatorTokenID(), false); - - qDebug() << " entity[" << i <<"].newID" << newID; - EntityItemProperties properties = entities[i]->getProperties(); - qDebug() << " entity[" << i <<"].properties..."; - properties.debugDump(); + properties.setPosition(properties.getPosition() + args->root); + properties.markAllChanged(); // so the entire property set is considered new, since we're making a new entity - properties.resetPosition(properties.getPosition() + args->root); - qDebug() << " after resetPosition()...."; - properties.debugDump(); - - properties.markAllChanged(); - - // queue the packet - qDebug() << " calling queueEditEntityMessage...."; + // queue the packet to send to the server args->packetSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, newID, properties); - // It would be nice to also update the local tree... - //if (_entityTree) { - // _entityTree->lockForWrite(); - // _entityTree->addEntity(id, properties); - // _entityTree->unlock(); - //} + // also update the local tree instantly (note: this is not our tree, but an alternate tree) + if (args->localTree) { + args->localTree->lockForWrite(); + args->localTree->addEntity(newID, properties); + args->localTree->unlock(); + } } - - - /** --- OLD WAY --- - const QList& modelList = modelTreeElement->getModels(); - - for (int i = 0; i < modelList.size(); i++) { - uint32_t creatorTokenID = ModelItem::getNextCreatorTokenID(); - ModelItemID id(NEW_MODEL, creatorTokenID, false); - ModelItemProperties properties; - properties.copyFromNewModelItem(modelList.at(i)); - properties.setPosition(properties.getPosition() + args->root); - args->packetSender->queueModelEditMessage(PacketTypeModelAddOrEdit, id, properties); - } - **/ return true; } diff --git a/libraries/entities/src/EntityTypes.cpp b/libraries/entities/src/EntityTypes.cpp index 7ad64850ea..a593b14695 100644 --- a/libraries/entities/src/EntityTypes.cpp +++ b/libraries/entities/src/EntityTypes.cpp @@ -104,7 +104,7 @@ EntityItem* EntityTypes::constructEntityItem(const unsigned char* data, int byte EntityItemID tempEntityID; EntityItemProperties tempProperties; - return new ModelEntityItem(tempEntityID, tempProperties); + return constructEntityItem(Model, tempEntityID, tempProperties); } // Header bytes diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 84a325cbf0..c549b6b341 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -18,8 +18,7 @@ EntityItem* ModelEntityItem::factory(const EntityItemID& entityID, const EntityItemProperties& properties) { - //qDebug() << "ModelEntityItem::factory(const EntityItemID& entityItemID, const EntityItemProperties& properties)..."; - return new ModelEntityItem(entityID, properties); + return new ModelEntityItem(entityID, properties); } // our non-pure virtual subclass for now... diff --git a/libraries/entities/src/todo.txt b/libraries/entities/src/todo.txt index 82ada8ca19..29af21064c 100644 --- a/libraries/entities/src/todo.txt +++ b/libraries/entities/src/todo.txt @@ -1,20 +1,17 @@ // REQUIRED: - 1) Import/Export Models - verify it works. /copy/paste?? + 7) Test file save load for case where two siblings have more than MTU amount of data. I wonder if the fact that file save + doesn't include the extra exists bits will break something. - 22b) Local Entities Overlay - from Local Models Overlay - - DONE -- 22d) void ModelTree::findModelsInCube(const AACube& cube, QVector& foundModels)... - DONE -- 22e) void ModelTreeElement::getModelsInside(const AACube& box, QVector& foundModels)... - DONE -- 22f) Application::exportEntities() tested/works - DONE -- 22g) Application::pasteEntities() tested/works - DONE -- 22c) void ModelTree::sendModels(ModelEditPacketSender* packetSender, float x, float y, float z).... - bool EntityTree::sendEntitiesOperation(OctreeElement* element, void* extraData) {... - RESOLVED -- 22a) void ModelItemProperties::copyFromNewModelItem(const ModelItem& modelItem); // Do we need this? NO! + 14) Make sure LOD logic honors the LOD settings for entities in "spanners/parent" cells. + 8) memory leaks??? + + 9) EntityTreeRenderer::clearModelsCache() + 3) Don't allow models to be "edited" to be outside of domain. clamp them to the domain. - 4) if velocity sends a model out of the domain - delete it + 4) if velocity sends a model out of the domain - delete it 3) random crashes on moving (I think things going out of bounds???) @@ -25,19 +22,10 @@ 6) clear all entities when changing domains? - 7) Test file save load for case where two siblings have more than MTU amount of data. I wonder if the fact that file save - doesn't include the extra exists bits will break something. - - 8) memory leaks??? - - 9) EntityTreeRenderer::clearModelsCache() - 11) What happens if the edit properties don't fit in a single message MTU??? 13) EntityItemProperties::decodeEntityEditPacket() doesn't include PROP_SCRIPT - 14) Make sure LOD logic honors the LOD settings for entities in "spanners/parent" cells. - 15) quickly do some edits... then change domains... watch the entities continue to exist in new domain and move around. @@ -226,8 +214,18 @@ // SOLVED -- 2) verify shadows work // SOLVED -- 9) Handle the ID -> UUID swap in old files to new files - verify old files read correctly // SOLVED -- 2) Test models -> attachments logic --- TESTED/WORKS - - +// SOLVED -- 1) Import/Export Models - verify it works. /copy/paste?? +// DONE -- 22d) void ModelTree::findModelsInCube(const AACube& cube, QVector& foundModels)... +// DONE -- 22e) void ModelTreeElement::getModelsInside(const AACube& box, QVector& foundModels)... +// DONE -- 22f) Application::exportEntities() tested/works +// DONE -- 22g) Application::pasteEntities() tested/works +// DONE -- 22c) void ModelTree::sendModels(ModelEditPacketSender* packetSender, float x, float y, float z).... +// bool EntityTree::sendEntitiesOperation(OctreeElement* element, void* extraData) {... +// RESOLVED -- 22a) void ModelItemProperties::copyFromNewModelItem(const ModelItem& modelItem); // Do we need this? NO! +// WORKS AS PRODUCTION -- 22b) Local Entities Overlay - from Local Models Overlay +// Note: there's a bug in production related to the overlay correctly rendering when +// the original (non-translated positions) of the models are out of view. This is a bug +// not introduced byt this PR. diff --git a/libraries/octree/src/OctreeRenderer.cpp b/libraries/octree/src/OctreeRenderer.cpp index 7f398fc1bd..b2fc1241f7 100644 --- a/libraries/octree/src/OctreeRenderer.cpp +++ b/libraries/octree/src/OctreeRenderer.cpp @@ -165,9 +165,7 @@ void OctreeRenderer::render(RenderMode renderMode) { RenderArgs args = { this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust(), renderMode, 0, 0, 0 }; if (_tree) { _tree->lockForRead(); - //qDebug() << "OctreeRenderer::render() tree locked START RENDER RECURSION..."; _tree->recurseTreeWithOperation(renderOperation, &args); - //qDebug() << "OctreeRenderer::render() tree locked ENDED RENDER RECURSION..."; _tree->unlock(); } }