History

improve terse entity logging. change how action data sending is triggered

Seth Alves committed 11 years ago

Commit 5e4f30b1 parent d0430114 files · +91 −10Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 4 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+10−5
@@ -611,7 +611,8 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 610 unmodified lines
611 const QVariantMap& arguments) {611 const QVariantMap& arguments) {
612 QUuid actionID = QUuid::createUuid();612 QUuid actionID = QUuid::createUuid();
613 auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();613 auto actionFactory = DependencyManager::get<EntityActionFactoryInterface>();
614 bool success = actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {614 bool success = true;
615 actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
615 // create this action even if the entity doesn't have physics info. it will often be the616 // create this action even if the entity doesn't have physics info. it will often be the
616 // case that a script adds an action immediately after an object is created, and the physicsInfo617 // case that a script adds an action immediately after an object is created, and the physicsInfo
617 // is computed asynchronously.618 // is computed asynchronously.
@@ -620,17 +621,18 @@ QUuid EntityScriptingInterface::addAction(const QString& actionTypeString, · 2 unmodified lines
620 // }621 // }
621 EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString);622 EntityActionType actionType = EntityActionInterface::actionTypeFromString(actionTypeString);
622 if (actionType == ACTION_TYPE_NONE) {623 if (actionType == ACTION_TYPE_NONE) {
624 success = false;
623 return false;625 return false;
624 }626 }
625 EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments);627 EntityActionPointer action = actionFactory->factory(actionType, actionID, entity, arguments);
626 if (action) {628 if (action) {
627 entity->addAction(simulation, action);629 success = entity->addAction(simulation, action);
628 auto nodeList = DependencyManager::get<NodeList>();630 auto nodeList = DependencyManager::get<NodeList>();
629 const QUuid myNodeID = nodeList->getSessionUUID();631 const QUuid myNodeID = nodeList->getSessionUUID();
630 if (entity->getSimulatorID() != myNodeID) {632 if (entity->getSimulatorID() != myNodeID) {
631 entity->flagForOwnership();633 entity->flagForOwnership();
632 }634 }
633 return true;635 return false; // Physics will cause a packet to be sent, so don't send from here.
634 }636 }
635 return false;637 return false;
636 });638 });
@@ -656,9 +658,12 @@ bool EntityScriptingInterface::updateAction(const QUuid& entityID, const QUuid& · 19 unmodified lines
656}658}
657 659
658bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) {660bool EntityScriptingInterface::deleteAction(const QUuid& entityID, const QUuid& actionID) {
659 return actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {661 bool success = false;
660 return entity->removeAction(simulation, actionID);662 actionWorker(entityID, [&](EntitySimulation* simulation, EntityItemPointer entity) {
663 success = entity->removeAction(simulation, actionID);
664 return false; // Physics will cause a packet to be sent, so don't send from here.
661 });665 });
666 return success;
662}667}
663 668
664QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) {669QVector<QUuid> EntityScriptingInterface::getActionIDs(const QUuid& entityID) {