mostly working, but some blinking when setting glow

This commit is contained in:
ZappoMan 2014-06-19 10:40:38 -07:00
parent ab95370a62
commit 618f538be5
6 changed files with 18 additions and 22 deletions

View file

@ -182,6 +182,7 @@ bool StoreModelOperator::PreRecursion(OctreeElement* element) {
// Note: updateModel() will only operate on correctly found models and/or add them
// to the element if they SHOULD be stored there.
if (modelTreeElement->updateModel(_newModel)) {
qDebug() << "model was updated!";
_foundNew = true;
// NOTE: don't change the keepSearching here, if it came in here
// false then we stay false, if it came in here true, then it
@ -227,8 +228,11 @@ OctreeElement* StoreModelOperator::PossiblyCreateChildAt(OctreeElement* element,
void ModelTree::storeModel(const ModelItem& model, const SharedNodePointer& senderNode) {
// NOTE: callers must lock the tree before using this method
// First, look for the existing model in the tree..
StoreModelOperator theOperator(this, model);
recurseTreeWithOperator(&theOperator);
_isDirty = true;
@ -498,7 +502,9 @@ int ModelTree::processEditPacketData(PacketType packetType, const unsigned char*
bool isValid;
ModelItem newModel = ModelItem::fromEditPacket(editData, maxLength, processedBytes, this, isValid);
if (isValid) {
lockForWrite();
storeModel(newModel, senderNode);
unlock();
if (newModel.isNewlyCreated()) {
notifyNewlyCreatedModel(newModel, senderNode);
}

View file

@ -363,6 +363,9 @@ bool ModelTreeElement::updateModel(const ModelItem& model) {
for (uint16_t i = 0; i < numberOfModels; i++) {
ModelItem& thisModel = (*_modelItems)[i];
if (thisModel.getID() == model.getID()) {
if (wantDebug) {
qDebug() << "found model with id";
}
int difference = thisModel.getLastUpdated() - model.getLastUpdated();
bool changedOnServer = thisModel.getLastEdited() <= model.getLastEdited();
bool localOlder = thisModel.getLastUpdated() < model.getLastUpdated();
@ -401,6 +404,7 @@ bool ModelTreeElement::updateModel(const ModelItem& model) {
// TODO: can this be optimized to only set the containing element in cases where it could have
// changed or has not been set?
_myTree->setContainingElement(model.getModelItemID(), this);
return true;
}
return false;
@ -640,16 +644,3 @@ bool ModelTreeElement::collapseChildren() {
// nothing to do here yet...
return false;
}
/*
void ModelTreeElement::storeModel(const ModelItem& model) {
_modelItems->push_back(model);
markWithChangedTime();
// TODO: can this be optimized to only set the containing element in cases where it could have
// changed or has not been set?
_myTree->setContainingElement(model.getModelItemID(), this);
}
*/

View file

@ -148,9 +148,6 @@ public:
protected:
virtual void init(unsigned char * octalCode);
void storeModel(const ModelItem& model);
ModelTree* _myTree;
QList<ModelItem>* _modelItems;
};

View file

@ -16,7 +16,7 @@
#include "AABoxCubeTests.h"
void AABoxCubeTests::AABoxCubeTests() {
void AABoxCubeTests::AABoxCubeTests(bool verbose) {
qDebug() << "******************************************************************************************";
qDebug() << "AABoxCubeTests::AABoxCubeTests()";
@ -95,6 +95,6 @@ void AABoxCubeTests::AABoxCubeTests() {
qDebug() << "******************************************************************************************";
}
void AABoxCubeTests::runAllTests() {
AABoxCubeTests();
void AABoxCubeTests::runAllTests(bool verbose) {
AABoxCubeTests(verbose);
}

View file

@ -13,8 +13,8 @@
#define hifi_AABoxCubeTests_h
namespace AABoxCubeTests {
void AABoxCubeTests();
void runAllTests();
void AABoxCubeTests(bool verbose);
void runAllTests(bool verbose);
}
#endif // hifi_AABoxCubeTests_h

View file

@ -9,6 +9,7 @@
//
#include "AABoxCubeTests.h"
#include "ModelTests.h"
#include "OctreeTests.h"
#include "SharedUtil.h"
@ -17,6 +18,7 @@ int main(int argc, const char* argv[]) {
bool verbose = cmdOptionExists(argc, argv, VERBOSE);
qDebug() << "OctreeTests::runAllTests()";
OctreeTests::runAllTests(verbose);
AABoxCubeTests::runAllTests();
AABoxCubeTests::runAllTests(verbose);
ModelTests::runAllTests(verbose);
return 0;
}