mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:44:02 +02:00
Merge branch 'master' into droplets
This commit is contained in:
commit
e3608534cd
16 changed files with 114 additions and 48 deletions
|
@ -111,8 +111,7 @@ Window {
|
|||
Button { text: "Stop all"; onClicked: stopAll() }
|
||||
}
|
||||
|
||||
ListView {
|
||||
clip: true
|
||||
ScrollView {
|
||||
anchors {
|
||||
top: allButtons.bottom;
|
||||
left: parent.left;
|
||||
|
@ -122,45 +121,49 @@ Window {
|
|||
bottomMargin: 8
|
||||
}
|
||||
|
||||
model: runningScriptsModel
|
||||
ListView {
|
||||
clip: true
|
||||
anchors { fill: parent; margins: 0 }
|
||||
|
||||
delegate: Rectangle {
|
||||
radius: 3
|
||||
anchors { left: parent.left; right: parent.right }
|
||||
model: runningScriptsModel
|
||||
|
||||
height: scriptName.height + 12
|
||||
color: index % 2 ? "#ddd" : "#eee"
|
||||
delegate: Rectangle {
|
||||
radius: 3
|
||||
anchors { left: parent.left; right: parent.right }
|
||||
|
||||
Text {
|
||||
anchors { left: parent.left; leftMargin: 4; verticalCenter: parent.verticalCenter }
|
||||
id: scriptName
|
||||
text: name
|
||||
}
|
||||
height: scriptName.height + 12
|
||||
color: index % 2 ? "#ddd" : "#eee"
|
||||
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
spacing: 4
|
||||
HifiControls.FontAwesome {
|
||||
text: "\uf021"; size: scriptName.height;
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: reloadScript(model.url)
|
||||
}
|
||||
Text {
|
||||
anchors { left: parent.left; leftMargin: 4; verticalCenter: parent.verticalCenter }
|
||||
id: scriptName
|
||||
text: name
|
||||
}
|
||||
HifiControls.FontAwesome {
|
||||
size: scriptName.height; text: "\uf00d"
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: stopScript(model.url)
|
||||
|
||||
Row {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
spacing: 4
|
||||
HifiControls.FontAwesome {
|
||||
text: "\uf021"; size: scriptName.height;
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: reloadScript(model.url)
|
||||
}
|
||||
}
|
||||
HifiControls.FontAwesome {
|
||||
size: scriptName.height; text: "\uf00d"
|
||||
MouseArea {
|
||||
anchors { fill: parent; margins: -2; }
|
||||
onClicked: stopScript(model.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Text {
|
||||
id: loadLabel
|
||||
text: "Load Scripts"
|
||||
|
|
|
@ -2653,6 +2653,8 @@ void Application::loadSettings() {
|
|||
|
||||
Menu::getInstance()->loadSettings();
|
||||
getMyAvatar()->loadData();
|
||||
|
||||
_settingsLoaded = true;
|
||||
}
|
||||
|
||||
void Application::saveSettings() {
|
||||
|
@ -3276,6 +3278,10 @@ int Application::sendNackPackets() {
|
|||
|
||||
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
|
||||
if (!_settingsLoaded) {
|
||||
return; // bail early if settings are not loaded
|
||||
}
|
||||
|
||||
//qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
|
||||
bool wantExtraDebugging = getLogger()->extraDebugging();
|
||||
|
||||
|
|
|
@ -510,6 +510,8 @@ private:
|
|||
bool _reticleClickPressed { false };
|
||||
|
||||
int _avatarAttachmentRequest = 0;
|
||||
|
||||
bool _settingsLoaded { false };
|
||||
};
|
||||
|
||||
#endif // hifi_Application_h
|
||||
|
|
|
@ -51,10 +51,10 @@ void UpdateDialog::closeDialog() {
|
|||
}
|
||||
|
||||
void UpdateDialog::hide() {
|
||||
((QQuickItem*)parent())->setEnabled(false);
|
||||
((QQuickItem*)parent())->setVisible(false);
|
||||
}
|
||||
|
||||
void UpdateDialog::triggerUpgrade() {
|
||||
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
|
||||
applicationUpdater.data()->performAutoUpdate(applicationUpdater.data()->getBuildData().lastKey());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -772,8 +772,14 @@ int RenderableModelEntityItem::getJointIndex(const QString& name) const {
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
// TODO -- expose a way to list joint names
|
||||
// RenderableModelEntityItem::QStringList getJointNames() const {
|
||||
// rig->nameOfJoint(i);
|
||||
// }
|
||||
QStringList RenderableModelEntityItem::getJointNames() const {
|
||||
QStringList result;
|
||||
if (_model && _model->isActive()) {
|
||||
RigPointer rig = _model->getRig();
|
||||
int jointCount = rig->getJointStateCount();
|
||||
for (int jointIndex = 0; jointIndex < jointCount; jointIndex++) {
|
||||
result << rig->nameOfJoint(jointIndex);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
virtual void resizeJointArrays(int newSize = -1) override;
|
||||
|
||||
virtual int getJointIndex(const QString& name) const override;
|
||||
virtual QStringList getJointNames() const override;
|
||||
|
||||
private:
|
||||
QVariantMap parseTexturesToMap(QString textures);
|
||||
|
|
|
@ -396,6 +396,7 @@ public:
|
|||
virtual bool setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) override { return false; }
|
||||
|
||||
virtual int getJointIndex(const QString& name) const { return -1; }
|
||||
virtual QStringList getJointNames() const { return QStringList(); }
|
||||
|
||||
virtual void loader() {} // called indirectly when urls for geometry are updated
|
||||
|
||||
|
|
|
@ -977,6 +977,18 @@ int EntityScriptingInterface::getJointIndex(const QUuid& entityID, const QString
|
|||
if (!_entityTree) {
|
||||
return -1;
|
||||
}
|
||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
return entity->getJointIndex(name);
|
||||
int result;
|
||||
QMetaObject::invokeMethod(_entityTree.get(), "getJointIndex", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(int, result), Q_ARG(QUuid, entityID), Q_ARG(QString, name));
|
||||
return result;
|
||||
}
|
||||
|
||||
QStringList EntityScriptingInterface::getJointNames(const QUuid& entityID) {
|
||||
if (!_entityTree) {
|
||||
return QStringList();
|
||||
}
|
||||
QStringList result;
|
||||
QMetaObject::invokeMethod(_entityTree.get(), "getJointNames", Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(QStringList, result), Q_ARG(QUuid, entityID));
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ public slots:
|
|||
const QVector<glm::vec3>& translations);
|
||||
|
||||
Q_INVOKABLE int getJointIndex(const QUuid& entityID, const QString& name);
|
||||
Q_INVOKABLE QStringList getJointNames(const QUuid& entityID);
|
||||
|
||||
signals:
|
||||
void collisionWithEntity(const EntityItemID& idA, const EntityItemID& idB, const Collision& collision);
|
||||
|
|
|
@ -1291,12 +1291,13 @@ void EntityTree::remapIDs() {
|
|||
recurseTreeWithOperator(&theOperator);
|
||||
}
|
||||
|
||||
bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues) {
|
||||
bool EntityTree::writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents) {
|
||||
if (! entityDescription.contains("Entities")) {
|
||||
entityDescription["Entities"] = QVariantList();
|
||||
}
|
||||
QScriptEngine scriptEngine;
|
||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues);
|
||||
RecurseOctreeToMapOperator theOperator(entityDescription, element, &scriptEngine, skipDefaultValues, skipThoseWithBadParents);
|
||||
recurseTreeWithOperator(&theOperator);
|
||||
return true;
|
||||
}
|
||||
|
@ -1358,7 +1359,6 @@ void EntityTree::trackIncomingEntityLastEdited(quint64 lastEditedTime, int bytes
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void EntityTree::callLoader(EntityItemID entityID) {
|
||||
// this is used to bounce from the networking thread to the main thread
|
||||
EntityItemPointer entity = findEntityByEntityItemID(entityID);
|
||||
|
@ -1366,3 +1366,21 @@ void EntityTree::callLoader(EntityItemID entityID) {
|
|||
entity->loader();
|
||||
}
|
||||
}
|
||||
|
||||
int EntityTree::getJointIndex(const QUuid& entityID, const QString& name) const {
|
||||
EntityTree* nonConstThis = const_cast<EntityTree*>(this);
|
||||
EntityItemPointer entity = nonConstThis->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return -1;
|
||||
}
|
||||
return entity->getJointIndex(name);
|
||||
}
|
||||
|
||||
QStringList EntityTree::getJointNames(const QUuid& entityID) const {
|
||||
EntityTree* nonConstThis = const_cast<EntityTree*>(this);
|
||||
EntityItemPointer entity = nonConstThis->findEntityByEntityItemID(entityID);
|
||||
if (!entity) {
|
||||
return QStringList();
|
||||
}
|
||||
return entity->getJointNames();
|
||||
}
|
||||
|
|
|
@ -199,7 +199,8 @@ public:
|
|||
|
||||
void remapIDs();
|
||||
|
||||
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues) override;
|
||||
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents) override;
|
||||
virtual bool readFromMap(QVariantMap& entityDescription) override;
|
||||
|
||||
float getContentsLargestDimension();
|
||||
|
@ -236,6 +237,10 @@ public:
|
|||
return _deletedEntityItemIDs.contains(id);
|
||||
}
|
||||
|
||||
// these are used to call through to EntityItems
|
||||
Q_INVOKABLE int getJointIndex(const QUuid& entityID, const QString& name) const;
|
||||
Q_INVOKABLE QStringList getJointNames(const QUuid& entityID) const;
|
||||
|
||||
public slots:
|
||||
void callLoader(EntityItemID entityID);
|
||||
|
||||
|
|
|
@ -16,12 +16,14 @@
|
|||
RecurseOctreeToMapOperator::RecurseOctreeToMapOperator(QVariantMap& map,
|
||||
OctreeElementPointer top,
|
||||
QScriptEngine* engine,
|
||||
bool skipDefaultValues) :
|
||||
bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents) :
|
||||
RecurseOctreeOperator(),
|
||||
_map(map),
|
||||
_top(top),
|
||||
_engine(engine),
|
||||
_skipDefaultValues(skipDefaultValues)
|
||||
_skipDefaultValues(skipDefaultValues),
|
||||
_skipThoseWithBadParents(skipThoseWithBadParents)
|
||||
{
|
||||
// if some element "top" was given, only save information for that element and its children.
|
||||
if (_top) {
|
||||
|
@ -47,6 +49,10 @@ bool RecurseOctreeToMapOperator::postRecursion(OctreeElementPointer element) {
|
|||
QVariantList entitiesQList = qvariant_cast<QVariantList>(_map["Entities"]);
|
||||
|
||||
entityTreeElement->forEachEntity([&](EntityItemPointer entityItem) {
|
||||
if (_skipThoseWithBadParents && !entityItem->isParentIDValid()) {
|
||||
return; // we weren't able to resolve a parent from _parentID, so don't save this entity.
|
||||
}
|
||||
|
||||
EntityItemProperties properties = entityItem->getProperties();
|
||||
QScriptValue qScriptValues;
|
||||
if (_skipDefaultValues) {
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
class RecurseOctreeToMapOperator : public RecurseOctreeOperator {
|
||||
public:
|
||||
RecurseOctreeToMapOperator(QVariantMap& map, OctreeElementPointer top, QScriptEngine* engine, bool skipDefaultValues);
|
||||
RecurseOctreeToMapOperator(QVariantMap& map, OctreeElementPointer top, QScriptEngine* engine, bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents);
|
||||
bool preRecursion(OctreeElementPointer element);
|
||||
bool postRecursion(OctreeElementPointer element);
|
||||
private:
|
||||
|
@ -22,4 +23,5 @@ public:
|
|||
QScriptEngine* _engine;
|
||||
bool _withinTop;
|
||||
bool _skipDefaultValues;
|
||||
bool _skipThoseWithBadParents;
|
||||
};
|
||||
|
|
|
@ -1919,7 +1919,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element,
|
|||
entityDescription["Version"] = (int) expectedVersion;
|
||||
|
||||
// store the entity data
|
||||
bool entityDescriptionSuccess = writeToMap(entityDescription, top, true);
|
||||
bool entityDescriptionSuccess = writeToMap(entityDescription, top, true, true);
|
||||
if (!entityDescriptionSuccess) {
|
||||
qCritical("Failed to convert Entities to QVariantMap while saving to json.");
|
||||
return;
|
||||
|
|
|
@ -304,7 +304,8 @@ public:
|
|||
void writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo");
|
||||
void writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false);
|
||||
void writeToSVOFile(const char* filename, OctreeElementPointer element = NULL);
|
||||
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues) = 0;
|
||||
virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues,
|
||||
bool skipThoseWithBadParents) = 0;
|
||||
|
||||
// Octree importers
|
||||
bool readFromFile(const char* filename);
|
||||
|
|
|
@ -118,6 +118,8 @@ public:
|
|||
void die() { _isDead = true; }
|
||||
bool isDead() const { return _isDead; }
|
||||
|
||||
bool isParentIDValid() const { bool success = false; getParentPointer(success); return success; }
|
||||
|
||||
protected:
|
||||
const NestableType _nestableType; // EntityItem or an AvatarData
|
||||
QUuid _id;
|
||||
|
|
Loading…
Reference in a new issue