History

add a way to get a SpatiallyNestable's name without knowing what its type is

Seth Alves committed 9 years ago

Commit 69944cc1 parent ed09dcb6 files · +30 −2Browse files

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

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+13−1
@@ -469,7 +469,19 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& · 468 unmodified lines
469 if (entityFound) {469 if (entityFound) {
470 queueEntityMessage(PacketType::EntityEdit, entityID, properties);470 queueEntityMessage(PacketType::EntityEdit, entityID, properties);
471 } else {471 } else {
472 qCWarning(entities) << "attempted edit on unknown entity: " << id;472 QString name = "unknown";
473 QSharedPointer<SpatialParentFinder> parentFinder = DependencyManager::get<SpatialParentFinder>();
474 if (parentFinder) {
475 bool success;
476 auto nestableWP = parentFinder->find(id, success, static_cast<SpatialParentTree*>(_entityTree.get()));
477 if (success) {
478 auto nestable = nestableWP.lock();
479 if (nestable) {
480 name = nestable->getName();
481 }
482 }
483 }
484 qCWarning(entities) << "attempted edit on unknown entity: " << id << name;
473 }485 }
474 return id;486 return id;
475}487}