debugging model editing

This commit is contained in:
ZappoMan 2014-05-02 09:10:30 -07:00
parent f6875b5028
commit 715e6b8e60
28 changed files with 141 additions and 33 deletions

View file

@ -35,6 +35,7 @@ Agent::Agent(const QByteArray& packet) :
ThreadedAssignment(packet),
_voxelEditSender(),
_particleEditSender(),
_modelEditSender(),
_receivedAudioBuffer(NETWORK_BUFFER_LENGTH_SAMPLES_STEREO),
_avatarHashMap()
{
@ -43,6 +44,7 @@ Agent::Agent(const QByteArray& packet) :
_scriptEngine.getVoxelsScriptingInterface()->setPacketSender(&_voxelEditSender);
_scriptEngine.getParticlesScriptingInterface()->setPacketSender(&_particleEditSender);
_scriptEngine.getModelsScriptingInterface()->setPacketSender(&_modelEditSender);
}
void Agent::readPendingDatagrams() {
@ -88,6 +90,17 @@ void Agent::readPendingDatagrams() {
SharedNodePointer sourceNode = nodeList->sendingNodeForPacket(receivedPacket);
sourceNode->setLastHeardMicrostamp(usecTimestampNow());
} else if (datagramPacketType == PacketTypeModelAddResponse) {
// this will keep creatorTokenIDs to IDs mapped correctly
ModelItem::handleAddModelResponse(receivedPacket);
// also give our local particle tree a chance to remap any internal locally created particles
_modelViewer.getTree()->handleAddModelResponse(receivedPacket);
// Make sure our Node and NodeList knows we've heard from this node.
SharedNodePointer sourceNode = nodeList->sendingNodeForPacket(receivedPacket);
sourceNode->setLastHeardMicrostamp(usecTimestampNow());
} else if (datagramPacketType == PacketTypeParticleData
|| datagramPacketType == PacketTypeParticleErase
|| datagramPacketType == PacketTypeOctreeStats

View file

@ -64,6 +64,7 @@ private:
ScriptEngine _scriptEngine;
VoxelEditPacketSender _voxelEditSender;
ParticleEditPacketSender _particleEditSender;
ModelEditPacketSender _modelEditSender;
ParticleTreeHeadlessViewer _particleViewer;
VoxelTreeHeadlessViewer _voxelViewer;

View file

@ -28,7 +28,7 @@ public:
// Subclasses must implement these methods
virtual OctreeQueryNode* createOctreeQueryNode();
virtual Octree* createTree();
virtual unsigned char getMyNodeType() const { return NodeType::ModelServer; }
virtual char getMyNodeType() const { return NodeType::ModelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
virtual const char* getMyServerName() const { return MODEL_SERVER_NAME; }
virtual const char* getMyLoggingServerTargetName() const { return MODEL_SERVER_LOGGING_TARGET_NAME; }

View file

@ -63,7 +63,7 @@ public:
// Subclasses must implement these methods
virtual OctreeQueryNode* createOctreeQueryNode() = 0;
virtual Octree* createTree() = 0;
virtual unsigned char getMyNodeType() const = 0;
virtual char getMyNodeType() const = 0;
virtual PacketType getMyQueryMessageType() const = 0;
virtual const char* getMyServerName() const = 0;
virtual const char* getMyLoggingServerTargetName() const = 0;

View file

@ -28,7 +28,7 @@ public:
// Subclasses must implement these methods
virtual OctreeQueryNode* createOctreeQueryNode();
virtual Octree* createTree();
virtual unsigned char getMyNodeType() const { return NodeType::ParticleServer; }
virtual char getMyNodeType() const { return NodeType::ParticleServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeParticleQuery; }
virtual const char* getMyServerName() const { return PARTICLE_SERVER_NAME; }
virtual const char* getMyLoggingServerTargetName() const { return PARTICLE_SERVER_LOGGING_TARGET_NAME; }

View file

@ -37,7 +37,7 @@ public:
// Subclasses must implement these methods
virtual OctreeQueryNode* createOctreeQueryNode();
virtual Octree* createTree();
virtual unsigned char getMyNodeType() const { return NodeType::VoxelServer; }
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeVoxelQuery; }
virtual const char* getMyServerName() const { return VOXEL_SERVER_NAME; }
virtual const char* getMyLoggingServerTargetName() const { return VOXEL_SERVER_LOGGING_TARGET_NAME; }

View file

@ -35,7 +35,8 @@ var originalProperties = {
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/birarda/birarda_head.fbx",
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/pug.fbx",
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/newInvader16x16-large-purple.svo",
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/minotaur/mino_full.fbx",
//modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/minotaur/mino_full.fbx",
modelURL: "http://highfidelity-public.s3-us-west-1.amazonaws.com/meshes/Combat_tank_V01.FBX",
modelRotation: rotation
};
@ -64,10 +65,10 @@ function moveModel(deltaTime) {
return; // break early
}
print("count =" + count);
//print("count =" + count);
count++;
print("modelID.creatorTokenID = " + modelID.creatorTokenID);
//print("modelID.creatorTokenID = " + modelID.creatorTokenID);
var newProperties = {
position: {
@ -81,7 +82,7 @@ function moveModel(deltaTime) {
//print("modelID = " + modelID);
print("newProperties.position = " + newProperties.position.x + "," + newProperties.position.y+ "," + newProperties.position.z);
//print("newProperties.position = " + newProperties.position.x + "," + newProperties.position.y+ "," + newProperties.position.z);
Models.editModel(modelID, newProperties);
}

View file

@ -273,6 +273,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// connect to the packet sent signal of the _voxelEditSender and the _particleEditSender
connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);
connect(&_particleEditSender, &ParticleEditPacketSender::packetSent, this, &Application::packetSent);
connect(&_modelEditSender, &ModelEditPacketSender::packetSent, this, &Application::packetSent);
// move the silentNodeTimer to the _nodeThread
QTimer* silentNodeTimer = new QTimer();
@ -316,6 +317,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// Tell our voxel edit sender about our known jurisdictions
_voxelEditSender.setVoxelServerJurisdictions(&_voxelServerJurisdictions);
_particleEditSender.setServerJurisdictions(&_particleServerJurisdictions);
_modelEditSender.setServerJurisdictions(&_modelServerJurisdictions);
Particle::setVoxelEditPacketSender(&_voxelEditSender);
Particle::setParticleEditPacketSender(&_particleEditSender);
@ -327,6 +329,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
// probably not the right long term solution. But for now, we're going to do this to
// allow you to move a particle around in your hand
_particleEditSender.setPacketsPerSecond(3000); // super high!!
_modelEditSender.setPacketsPerSecond(3000); // super high!!
// Set the sixense filtering
_sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
@ -397,6 +400,7 @@ Application::~Application() {
_voxelHideShowThread.terminate();
_voxelEditSender.terminate();
_particleEditSender.terminate();
_modelEditSender.terminate();
storeSizeAndPosition();
saveScripts();
@ -497,6 +501,8 @@ void Application::initializeGL() {
_voxelEditSender.initialize(_enableProcessVoxelsThread);
_voxelHideShowThread.initialize(_enableProcessVoxelsThread);
_particleEditSender.initialize(_enableProcessVoxelsThread);
_modelEditSender.initialize(_enableProcessVoxelsThread);
if (_enableProcessVoxelsThread) {
qDebug("Voxel parsing thread created.");
}
@ -1883,6 +1889,7 @@ void Application::updateThreads(float deltaTime) {
_voxelHideShowThread.threadRoutine();
_voxelEditSender.threadRoutine();
_particleEditSender.threadRoutine();
_modelEditSender.threadRoutine();
}
}
@ -3202,6 +3209,9 @@ void Application::nodeKilled(SharedNodePointer node) {
_octreeSceneStatsLock.unlock();
} else if (node->getType() == NodeType::ModelServer) {
qDebug()<< "nodeKilled... NodeType::ModelServer";
QUuid nodeUUID = node->getUUID();
// see if this is the first we've heard of this node...
if (_modelServerJurisdictions.find(nodeUUID) != _modelServerJurisdictions.end()) {
@ -3255,7 +3265,6 @@ void Application::trackIncomingVoxelPacket(const QByteArray& packet, const Share
}
int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePointer& sendingNode) {
// But, also identify the sender, and keep track of the contained jurisdiction root for this server
// parse the incoming stats datas stick it in a temporary object for now, while we
@ -3282,18 +3291,21 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin
// see if this is the first we've heard of this node...
NodeToJurisdictionMap* jurisdiction = NULL;
QString serverType;
if (sendingNode->getType() == NodeType::VoxelServer) {
jurisdiction = &_voxelServerJurisdictions;
serverType = "Voxel";
} else if (sendingNode->getType() == NodeType::ParticleServer) {
jurisdiction = &_particleServerJurisdictions;
serverType = "Particle";
} else {
jurisdiction = &_modelServerJurisdictions;
serverType = "Model";
}
if (jurisdiction->find(nodeUUID) == jurisdiction->end()) {
qDebug("stats from new server... v[%f, %f, %f, %f]",
rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
qDebug("stats from new %s server... [%f, %f, %f, %f]",
qPrintable(serverType), rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s);
// Add the jurisditionDetails object to the list of "fade outs"
if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) {

View file

@ -179,6 +179,7 @@ public:
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
ParticleTreeRenderer* getParticles() { return &_particles; }
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
ModelTreeRenderer* getModels() { return &_models; }
bool getImportSucceded() { return _importSucceded; }
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
VoxelTree* getClipboard() { return &_clipboard; }

View file

@ -56,9 +56,18 @@ void DatagramProcessor::processDatagrams() {
Particle::handleAddParticleResponse(incomingPacket);
application->getParticles()->getTree()->handleAddParticleResponse(incomingPacket);
break;
case PacketTypeModelAddResponse:
qDebug() << ">>>>>>>>> got PacketTypeModelAddResponse...";
// this will keep creatorTokenIDs to IDs mapped correctly
ModelItem::handleAddModelResponse(incomingPacket);
application->getModels()->getTree()->handleAddModelResponse(incomingPacket);
break;
case PacketTypeParticleData:
case PacketTypeParticleErase:
case PacketTypeModelData:
case PacketTypeModelErase:
case PacketTypeVoxelData:
case PacketTypeVoxelErase:
case PacketTypeOctreeStats:

View file

@ -32,7 +32,7 @@ public:
virtual ~ModelTreeRenderer();
virtual Octree* createTree() { return new ModelTree(true); }
virtual NodeType_t getMyNodeType() const { return NodeType::ModelServer; }
virtual char getMyNodeType() const { return NodeType::ModelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeModelData; }
virtual void renderElement(OctreeElement* element, RenderArgs* args);

View file

@ -31,7 +31,7 @@ public:
virtual ~ParticleTreeRenderer();
virtual Octree* createTree() { return new ParticleTree(true); }
virtual NodeType_t getMyNodeType() const { return NodeType::ParticleServer; }
virtual char getMyNodeType() const { return NodeType::ParticleServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeParticleQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeParticleData; }
virtual void renderElement(OctreeElement* element, RenderArgs* args);

View file

@ -44,7 +44,6 @@ void VoxelPacketProcessor::processPacket(const SharedNodePointer& sendingNode, c
// immediately following them inside the same packet. So, we process the PacketType_OCTREE_STATS first
// then process any remaining bytes as if it was another packet
if (voxelPacketType == PacketTypeOctreeStats) {
int statsMessageLength = app->parseOctreeStats(mutablePacket, sendingNode);
wasStatsPacket = true;
if (messageLength > statsMessageLength) {
@ -77,6 +76,14 @@ void VoxelPacketProcessor::processPacket(const SharedNodePointer& sendingNode, c
app->_particles.processDatagram(mutablePacket, sendingNode);
} break;
case PacketTypeModelErase: {
app->_models.processEraseMessage(mutablePacket, sendingNode);
} break;
case PacketTypeModelData: {
app->_models.processDatagram(mutablePacket, sendingNode);
} break;
case PacketTypeEnvironmentData: {
app->_environment.parseData(*sendingNode->getActiveSocket(), mutablePacket);
} break;

View file

@ -31,7 +31,7 @@ public:
void queueModelEditMessage(PacketType type, ModelItemID modelID, const ModelItemProperties& properties);
// My server type is the model server
virtual unsigned char getMyNodeType() const { return NodeType::ModelServer; }
virtual char getMyNodeType() const { return NodeType::ModelServer; }
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew);
};
#endif // hifi_ModelEditPacketSender_h

View file

@ -211,7 +211,7 @@ void ModelTree::handleAddModelResponse(const QByteArray& packet) {
getIsViewing()
};
const bool wantDebug = false;
const bool wantDebug = true;
if (wantDebug) {
qDebug() << "looking for creatorTokenID=" << creatorTokenID << " modelID=" << modelID
<< " getIsViewing()=" << getIsViewing();

View file

@ -29,7 +29,7 @@ public:
virtual ~ModelTreeHeadlessViewer();
virtual Octree* createTree() { return new ModelTree(true); }
virtual NodeType_t getMyNodeType() const { return NodeType::ModelServer; }
virtual char getMyNodeType() const { return NodeType::ModelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeModelData; }

View file

@ -42,6 +42,7 @@ PacketSender::PacketSender(int packetsPerSecond) :
_totalPacketsQueued(0),
_totalBytesQueued(0)
{
qDebug() << "PacketSender::PacketSender() this=" << this;
}
PacketSender::~PacketSender() {
@ -49,6 +50,7 @@ PacketSender::~PacketSender() {
void PacketSender::queuePacketForSending(const SharedNodePointer& destinationNode, const QByteArray& packet) {
qDebug() << "PacketSender::queuePacketForSending() this=" << this << "packet.size()=" << packet.size();
NetworkPacket networkPacket(destinationNode, packet);
lock();
_packets.push_back(networkPacket);
@ -77,6 +79,8 @@ void PacketSender::terminating() {
}
bool PacketSender::threadedProcess() {
qDebug() << "PacketSender::threadedProcess() this=" << this;
bool hasSlept = false;
if (_lastSendTime == 0) {
@ -104,6 +108,7 @@ bool PacketSender::threadedProcess() {
if (usecToSleep > MAX_SLEEP_INTERVAL) {
usecToSleep = MAX_SLEEP_INTERVAL;
}
qDebug() << "PacketSender::threadedProcess() this=" << this << "calling usleep() usecToSleep=" << usecToSleep;
usleep(usecToSleep);
hasSlept = true;
}
@ -140,6 +145,7 @@ bool PacketSender::threadedProcess() {
// We also keep a running total of packets sent over multiple calls to process() so that we can adjust up or down for
// possible rounding error that would occur if we only considered whole integer packet counts per call to process
bool PacketSender::nonThreadedProcess() {
qDebug() << "PacketSender::nonThreadedProcess() this=" << this;
quint64 now = usecTimestampNow();
if (_lastProcessCallTime == 0) {
@ -246,6 +252,8 @@ bool PacketSender::nonThreadedProcess() {
packetsToSendThisCall -= adjust;
}
qDebug() << "PacketSender::nonThreadedProcess() this=" << this << "packetsToSendThisCall=" << packetsToSendThisCall;
// now, do we want to reset the check interval? don't want to completely reset, because we would still have
// a rounding error. instead, we check to see that we've passed the reset interval (which is much larger than
// the check interval), and on those reset intervals we take the second half average and keep that for the next
@ -261,6 +269,8 @@ bool PacketSender::nonThreadedProcess() {
int packetsLeft = _packets.size();
qDebug() << "PacketSender::nonThreadedProcess() this=" << this << "packetsLeft=" << packetsLeft;
// Now that we know how many packets to send this call to process, just send them.
while ((packetsSentThisCall < packetsToSendThisCall) && (packetsLeft > 0)) {
lock();
@ -271,6 +281,7 @@ bool PacketSender::nonThreadedProcess() {
unlock();
// send the packet through the NodeList...
qDebug() << "PacketSender::nonThreadedProcess() this=" << this << "calling writeDatagram()...";
NodeList::getInstance()->writeDatagram(temporary.getByteArray(), temporary.getDestinationNode());
packetsSentThisCall++;
_packetsOverCheckInterval++;

View file

@ -37,7 +37,7 @@ OctreeEditPacketSender::OctreeEditPacketSender() :
_serverJurisdictions(NULL),
_sequenceNumber(0),
_maxPacketSize(MAX_PACKET_SIZE) {
//qDebug("OctreeEditPacketSender::OctreeEditPacketSender() [%p] created... ", this);
qDebug() << "OctreeEditPacketSender::OctreeEditPacketSender() this=" << this;
}
OctreeEditPacketSender::~OctreeEditPacketSender() {
@ -59,45 +59,59 @@ OctreeEditPacketSender::~OctreeEditPacketSender() {
bool OctreeEditPacketSender::serversExist() const {
bool hasServers = false;
bool atLeastOnJurisdictionMissing = false; // assume the best
bool atLeastOneJurisdictionMissing = false; // assume the best
NodeList* nodeList = NodeList::getInstance();
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
// only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType() && node->getActiveSocket()) {
if (node->getType() == getMyNodeType() && node->getActiveSocket()) {
QUuid nodeUUID = node->getUUID();
// If we've got Jurisdictions set, then check to see if we know the jurisdiction for this server
if (_serverJurisdictions) {
// lookup our nodeUUID in the jurisdiction map, if it's missing then we're
// missing at least one jurisdiction
if ((*_serverJurisdictions).find(nodeUUID) == (*_serverJurisdictions).end()) {
atLeastOnJurisdictionMissing = true;
atLeastOneJurisdictionMissing = true;
}
}
hasServers = true;
}
if (atLeastOnJurisdictionMissing) {
if (atLeastOneJurisdictionMissing) {
break; // no point in looking further...
}
}
return (hasServers && !atLeastOnJurisdictionMissing);
return (hasServers && !atLeastOneJurisdictionMissing);
}
// This method is called when the edit packet layer has determined that it has a fully formed packet destined for
// a known nodeID.
void OctreeEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned char* buffer, ssize_t length) {
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this;
NodeList* nodeList = NodeList::getInstance();
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "node->getType()=" << node->getType();
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "getMyNodeType()=" << getMyNodeType();
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "node->getUUID()=" << node->getUUID();
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << " nodeUUID=" << nodeUUID;
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "nodeUUID.isNull=" << nodeUUID.isNull();
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "node->getActiveSocket()=" << node->getActiveSocket();
// only send to the NodeTypes that are getMyNodeType()
if (node->getType() == getMyNodeType() &&
((node->getUUID() == nodeUUID) || (nodeUUID.isNull()))) {
if (node->getActiveSocket()) {
qDebug() << "OctreeEditPacketSender::queuePacketToNode() this=" << this << "calling queuePacketForSending()...";
queuePacketForSending(node, QByteArray(reinterpret_cast<char*>(buffer), length));
// debugging output...
bool wantDebugging = false;
bool wantDebugging = true;
if (wantDebugging) {
int numBytesPacketHeader = numBytesForPacketHeader(reinterpret_cast<char*>(buffer));
unsigned short int sequence = (*((unsigned short int*)(buffer + numBytesPacketHeader)));
@ -164,6 +178,7 @@ void OctreeEditPacketSender::queuePendingPacketToNodes(PacketType type, unsigned
void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, ssize_t length) {
if (!_shouldSend) {
qDebug() << "OctreeEditPacketSender::queuePacketToNodes()... this=" << this << "bail early!";
return; // bail early
}
@ -197,13 +212,17 @@ void OctreeEditPacketSender::queuePacketToNodes(unsigned char* buffer, ssize_t l
// NOTE: codeColorBuffer - is JUST the octcode/color and does not contain the packet header!
void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned char* codeColorBuffer, ssize_t length) {
//qDebug() << "OctreeEditPacketSender::queueOctreeEditMessage()... this=" << this;
if (!_shouldSend) {
//qDebug() << "OctreeEditPacketSender::queueOctreeEditMessage()... this=" << this << "bail early! _shouldSend=" << _shouldSend;
return; // bail early
}
// If we don't have jurisdictions, then we will simply queue up all of these packets and wait till we have
// jurisdictions for processing
if (!serversExist()) {
//qDebug() << "OctreeEditPacketSender::queueOctreeEditMessage()... !serversExist()";
if (_maxPendingMessages > 0) {
EditPacketBuffer* packet = new EditPacketBuffer(type, codeColorBuffer, length);
_pendingPacketsLock.lock();
@ -217,7 +236,8 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
_preServerPackets.erase(_preServerPackets.begin());
}
_pendingPacketsLock.unlock();
}
}
//qDebug() << "OctreeEditPacketSender::queueOctreeEditMessage()... this=" << this << "bail early!... !serversExist()";
return; // bail early
}
@ -274,6 +294,7 @@ void OctreeEditPacketSender::queueOctreeEditMessage(PacketType type, unsigned ch
}
void OctreeEditPacketSender::releaseQueuedMessages() {
qDebug() << "OctreeEditPacketSender::releaseQueuedMessages() this=" << this;
// if we don't yet have jurisdictions then we can't actually release messages yet because we don't
// know where to send them to. Instead, just remember this request and when we eventually get jurisdictions
// call release again at that time.
@ -281,6 +302,7 @@ void OctreeEditPacketSender::releaseQueuedMessages() {
_releaseQueuedMessagesPending = true;
} else {
for (std::map<QUuid, EditPacketBuffer>::iterator i = _pendingEditPackets.begin(); i != _pendingEditPackets.end(); i++) {
qDebug() << "OctreeEditPacketSender::releaseQueuedMessages()... releaseQueuedPacket()... this=" << this;
releaseQueuedPacket(i->second);
}
}
@ -313,12 +335,15 @@ void OctreeEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, Pa
}
bool OctreeEditPacketSender::process() {
qDebug() << "OctreeEditPacketSender::process() this=" << this;
// if we have server jurisdiction details, and we have pending pre-jurisdiction packets, then process those
// before doing our normal process step. This processPreJurisdictionPackets()
if (serversExist() && (!_preServerPackets.empty() || !_preServerSingleMessagePackets.empty() )) {
qDebug() << "OctreeEditPacketSender::process() this=" << this << "calling processPreServerExistsPackets()";
processPreServerExistsPackets();
}
// base class does most of the work.
qDebug() << "OctreeEditPacketSender::process() this=" << this << "calling PacketSender::process()";
return PacketSender::process();
}

View file

@ -87,7 +87,7 @@ public:
int getMaxPacketSize() const { return _maxPacketSize; }
// you must override these...
virtual unsigned char getMyNodeType() const = 0;
virtual char getMyNodeType() const = 0;
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew) { };
protected:

View file

@ -34,7 +34,7 @@ void OctreeHeadlessViewer::init() {
}
void OctreeHeadlessViewer::queryOctree() {
NodeType_t serverType = getMyNodeType();
char serverType = getMyNodeType();
PacketType packetType = getMyQueryMessageType();
NodeToJurisdictionMap& jurisdictions = *_jurisdictionListener->getJurisdictions();

View file

@ -158,6 +158,7 @@ void OctreeRenderer::render() {
_tree->recurseTreeWithOperation(renderOperation, &args);
_tree->unlock();
}
//qDebug() << "rendered items:" << args._renderedItems;
}
void OctreeRenderer::clear() {

View file

@ -42,7 +42,7 @@ public:
virtual ~OctreeRenderer();
virtual Octree* createTree() = 0;
virtual NodeType_t getMyNodeType() const = 0;
virtual char getMyNodeType() const = 0;
virtual PacketType getMyQueryMessageType() const = 0;
virtual PacketType getExpectedPacketType() const = 0;
virtual void renderElement(OctreeElement* element, RenderArgs* args) = 0;

View file

@ -30,7 +30,7 @@ public:
void queueParticleEditMessage(PacketType type, ParticleID particleID, const ParticleProperties& properties);
// My server type is the particle server
virtual unsigned char getMyNodeType() const { return NodeType::ParticleServer; }
virtual char getMyNodeType() const { return NodeType::ParticleServer; }
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew);
};
#endif // hifi_ParticleEditPacketSender_h

View file

@ -28,7 +28,7 @@ public:
virtual ~ParticleTreeHeadlessViewer();
virtual Octree* createTree() { return new ParticleTree(true); }
virtual NodeType_t getMyNodeType() const { return NodeType::ParticleServer; }
virtual char getMyNodeType() const { return NodeType::ParticleServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeParticleQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeParticleData; }

View file

@ -89,6 +89,7 @@ ParticleID ParticlesScriptingInterface::editParticle(ParticleID particleID, cons
// if the particle is unknown, attempt to look it up
if (!particleID.isKnownID) {
actualID = Particle::getIDfromCreatorTokenID(particleID.creatorTokenID);
qDebug() << "ParticlesScriptingInterface::editModel()... actualID=" << actualID;
}
// if at this point, we know the id, send the update to the particle server

View file

@ -364,6 +364,16 @@ void ScriptEngine::run() {
}
}
if (_modelsScriptingInterface.getModelPacketSender()->serversExist()) {
// release the queue of edit voxel messages.
_modelsScriptingInterface.getModelPacketSender()->releaseQueuedMessages();
// since we're in non-threaded mode, call process so that the packets are sent
if (!_modelsScriptingInterface.getModelPacketSender()->isThreaded()) {
_modelsScriptingInterface.getModelPacketSender()->process();
}
}
if (_isAvatar && _avatarData) {
const int SCRIPT_AUDIO_BUFFER_SAMPLES = floor(((SCRIPT_DATA_CALLBACK_USECS * SAMPLE_RATE) / (1000 * 1000)) + 0.5);
@ -475,6 +485,22 @@ void ScriptEngine::run() {
}
}
qDebug() << "ScriptEngine::run()... checking for model server... _modelsScriptingInterface.getModelPacketSender()=" << _modelsScriptingInterface.getModelPacketSender();
qDebug() << "ScriptEngine::run()... checking for model server... _modelsScriptingInterface.getModelPacketSender()->serversExist()=" << _modelsScriptingInterface.getModelPacketSender()->serversExist();
if (_modelsScriptingInterface.getModelPacketSender()->serversExist()) {
qDebug() << "ScriptEngine::run()... calling _modelsScriptingInterface.getModelPacketSender()->releaseQueuedMessages();";
// release the queue of edit voxel messages.
_modelsScriptingInterface.getModelPacketSender()->releaseQueuedMessages();
// since we're in non-threaded mode, call process so that the packets are sent
if (!_modelsScriptingInterface.getModelPacketSender()->isThreaded()) {
_modelsScriptingInterface.getModelPacketSender()->process();
}
}
// If we were on a thread, then wait till it's done
if (thread()) {
thread()->quit();

View file

@ -48,6 +48,6 @@ public:
bool voxelServersExist() const { return serversExist(); }
// My server type is the voxel server
virtual unsigned char getMyNodeType() const { return NodeType::VoxelServer; }
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
};
#endif // hifi_VoxelEditPacketSender_h

View file

@ -28,7 +28,7 @@ public:
virtual ~VoxelTreeHeadlessViewer();
virtual Octree* createTree() { return new VoxelTree(true); }
virtual NodeType_t getMyNodeType() const { return NodeType::VoxelServer; }
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeVoxelQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeVoxelData; }