Merge branch 'master' of https://github.com/highfidelity/hifi into hdr

This commit is contained in:
samcake 2016-01-20 10:14:02 -08:00
commit 320c799379
13 changed files with 116 additions and 49 deletions

View file

@ -28,6 +28,6 @@
};
if (!isScriptRunning(SCRIPT_NAME)) {
Script.load(SCRIPT_NAME);
ScriptDiscoveryService.loadOneScript(SCRIPT_NAME);
}
})

View file

@ -33,7 +33,7 @@ var toggleStreamPlayButton = Overlays.addOverlay("text", {
visible: false,
text: " Play"
});
// Set up toggleStreamStopButton overlay.
var toggleStreamStopButton = Overlays.addOverlay("text", {
x: 166,
@ -47,7 +47,7 @@ var toggleStreamStopButton = Overlays.addOverlay("text", {
visible: false,
text: " Stop"
});
// Set up increaseVolumeButton overlay.
var toggleIncreaseVolumeButton = Overlays.addOverlay("text", {
x: 211,
@ -61,7 +61,7 @@ var toggleIncreaseVolumeButton = Overlays.addOverlay("text", {
visible: false,
text: " +"
});
// Set up decreaseVolumeButton overlay.
var toggleDecreaseVolumeButton = Overlays.addOverlay("text", {
x: 234,
@ -93,7 +93,7 @@ function changeVolume(volume) {
}
streamWindow.eventBridge.emitScriptEvent(JSON.stringify(volumeJSON));
}
// Function that adds mousePressEvent functionality to connect UI to enter stream URL, play and stop stream.
function mousePressEvent(event) {
if (Overlays.getOverlayAtPoint({x: event.x, y: event.y}) == toggleStreamPlayButton) {
@ -116,7 +116,7 @@ function mousePressEvent(event) {
// Function checking bool if in proper zone.
function isOurZone(properties) {
return stream != "" && properties.type == "Zone";
return stream != "" && stream != undefined && properties.type == "Zone";
}
// Function to toggle visibile the overlay.
@ -129,7 +129,21 @@ function toggleVisible(newVisibility) {
Overlays.editOverlay(toggleDecreaseVolumeButton, {visible: visible});
}
}
// Procedure to check to see if you within a zone with a given stream.
var entities = Entities.findEntities(MyAvatar.position, 0.1);
for (var i in entities) {
var properties = Entities.getEntityProperties(entities[i]);
if (properties.type == "Zone") {
print("Entered zone: " + JSON.stringify(entities[i]));
stream = JSON.parse(properties.userData).stream;
if (isOurZone(properties)) {
print("Entered zone " + JSON.stringify(entities[i]) + " with stream: " + stream);
lastZone = properties.name;
toggleVisible(true);
}
}
}
// Function to check if avatar is in proper domain.
Window.domainChanged.connect(function() {
Script.stop();
@ -139,7 +153,7 @@ Window.domainChanged.connect(function() {
Entities.enterEntity.connect(function(entityID) {
print("Entered..." + JSON.stringify(entityID));
var properties = Entities.getEntityProperties(entityID);
stream = properties.userData;
stream = JSON.parse(properties.userData).stream;
if(isOurZone(properties))
{
lastZone = properties.name;
@ -173,4 +187,4 @@ Controller.mousePressEvent.connect(mousePressEvent);
streamWindow.setVisible(false);
// Call function upon ending script.
Script.scriptEnding.connect(onScriptEnding);
Script.scriptEnding.connect(onScriptEnding);

View file

@ -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"

View file

@ -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();

View file

@ -510,6 +510,8 @@ private:
bool _reticleClickPressed { false };
int _avatarAttachmentRequest = 0;
bool _settingsLoaded { false };
};
#endif // hifi_Application_h

View file

@ -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());
}
}

View file

@ -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;
}

View file

@ -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);

View file

@ -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

View file

@ -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;
}

View file

@ -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);

View file

@ -1358,7 +1358,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 +1365,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();
}

View file

@ -236,6 +236,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);