mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 14:09:01 +02:00
also guard deleteEntity and getEntityProperties with canEdit. make canEdit available to javascript
This commit is contained in:
parent
d19ab4c36f
commit
bad44c540a
2 changed files with 29 additions and 20 deletions
|
@ -73,6 +73,8 @@ EntityItemID EntityScriptingInterface::identifyEntity(EntityItemID entityID) {
|
|||
|
||||
EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID entityID) {
|
||||
EntityItemProperties results;
|
||||
|
||||
if (canEdit()) {
|
||||
EntityItemID identity = identifyEntity(entityID);
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForRead();
|
||||
|
@ -98,6 +100,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID
|
|||
}
|
||||
_entityTree->unlock();
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
@ -148,6 +151,9 @@ EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const E
|
|||
|
||||
void EntityScriptingInterface::deleteEntity(EntityItemID entityID) {
|
||||
|
||||
if (! canEdit())
|
||||
return;
|
||||
|
||||
EntityItemID actualID = entityID;
|
||||
|
||||
// if the entity is unknown, attempt to look it up
|
||||
|
|
|
@ -60,9 +60,12 @@ public:
|
|||
void setEntityTree(EntityTree* modelTree) { _entityTree = modelTree; }
|
||||
EntityTree* getEntityTree(EntityTree*) { return _entityTree; }
|
||||
|
||||
bool canEdit();
|
||||
|
||||
public slots:
|
||||
|
||||
// returns true if the DomainServer will allow this Node/Avatar to make changes
|
||||
Q_INVOKABLE bool canEdit();
|
||||
|
||||
/// adds a model with the specific properties
|
||||
Q_INVOKABLE EntityItemID addEntity(const EntityItemProperties& properties);
|
||||
|
||||
|
|
Loading…
Reference in a new issue