mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +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) {
|
||||
if (!url) {
|
||||
url = assetProxyModel.data(treeView.selection.currentIndex, 0x103);
|
||||
}
|
||||
function addToWorld() {
|
||||
var url = assetProxyModel.data(treeView.selection.currentIndex, 0x103);
|
||||
|
||||
if (!url || !canAddToWorld(url)) {
|
||||
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)));
|
||||
Entities.addModelEntity(url, addPosition);
|
||||
Entities.addModelEntity(name, url, addPosition);
|
||||
}
|
||||
|
||||
function copyURLToClipboard(index) {
|
||||
|
|
|
@ -182,9 +182,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
|
|||
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;
|
||||
properties.setType(EntityTypes::Model);
|
||||
properties.setName(name);
|
||||
properties.setModelURL(modelUrl);
|
||||
properties.setPosition(position);
|
||||
return addEntity(properties);
|
||||
|
|
|
@ -84,7 +84,8 @@ public slots:
|
|||
/// adds a model with the specific 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
|
||||
/// this function will not find return results in script engine contexts which don't have access to models
|
||||
|
|
Loading…
Reference in a new issue