mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:58:51 +02:00
Merge pull request #111 from huffman/atp-manager-name
Add atp filename to entities added to world
This commit is contained in:
commit
17e5b441cf
3 changed files with 10 additions and 8 deletions
|
@ -136,19 +136,19 @@ Window {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToWorld(url) {
|
function addToWorld() {
|
||||||
if (!url) {
|
var url = assetProxyModel.data(treeView.selection.currentIndex, 0x103);
|
||||||
url = assetProxyModel.data(treeView.selection.currentIndex, 0x103);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!url || !canAddToWorld(url)) {
|
if (!url || !canAddToWorld(url)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Asset browser - adding asset " + url + " to world.");
|
var name = assetProxyModel.data(treeView.selection.currentIndex);
|
||||||
|
|
||||||
|
console.log("Asset browser - adding asset " + url + " (" + name + ") to world.");
|
||||||
|
|
||||||
var addPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(MyAvatar.orientation)));
|
var addPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(2, Quat.getFront(MyAvatar.orientation)));
|
||||||
Entities.addModelEntity(url, addPosition);
|
Entities.addModelEntity(name, url, addPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyURLToClipboard(index) {
|
function copyURLToClipboard(index) {
|
||||||
|
|
|
@ -182,9 +182,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::addModelEntity(const QString& modelUrl, const glm::vec3& position) {
|
QUuid EntityScriptingInterface::addModelEntity(const QString& name, const QString& modelUrl, const glm::vec3& position) {
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
properties.setType(EntityTypes::Model);
|
properties.setType(EntityTypes::Model);
|
||||||
|
properties.setName(name);
|
||||||
properties.setModelURL(modelUrl);
|
properties.setModelURL(modelUrl);
|
||||||
properties.setPosition(position);
|
properties.setPosition(position);
|
||||||
return addEntity(properties);
|
return addEntity(properties);
|
||||||
|
|
|
@ -84,7 +84,8 @@ public slots:
|
||||||
/// adds a model with the specific properties
|
/// adds a model with the specific properties
|
||||||
Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties);
|
Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties);
|
||||||
|
|
||||||
Q_INVOKABLE QUuid addModelEntity(const QString& modelUrl, const glm::vec3& position);
|
/// temporary method until addEntity can be used from QJSEngine
|
||||||
|
Q_INVOKABLE QUuid addModelEntity(const QString& name, const QString& modelUrl, const glm::vec3& position);
|
||||||
|
|
||||||
/// gets the current model properties for a specific model
|
/// gets the current model properties for a specific model
|
||||||
/// this function will not find return results in script engine contexts which don't have access to models
|
/// this function will not find return results in script engine contexts which don't have access to models
|
||||||
|
|
Loading…
Reference in a new issue