Merge commit 'refs/pull/13165/head' of https://github.com/highfidelity/hifi into gravprep-redo

This commit is contained in:
milad 2018-05-12 23:42:21 -07:00
commit 4fb479c382
29 changed files with 1881 additions and 37 deletions

View file

@ -33,6 +33,19 @@
#include "entities/EntityTreeHeadlessViewer.h"
#include "avatars/ScriptableAvatar.h"
/**jsdoc
* @namespace Agent
*
* @hifi-assignment-client
*
* @property {boolean} isAvatar
* @property {boolean} isPlayingAvatarSound <em>Read-only.</em>
* @property {boolean} isListeningToAudioStream
* @property {boolean} isNoiseGateEnabled
* @property {number} lastReceivedAudioLoudness <em>Read-only.</em>
* @property {Uuid} sessionUUID <em>Read-only.</em>
*/
class Agent : public ThreadedAssignment {
Q_OBJECT
@ -60,10 +73,27 @@ public:
virtual void aboutToFinish() override;
public slots:
/**jsdoc
* @function Agent.run
*/
void run() override;
/**jsdoc
* @function Agent.playAvatarSound
* @param {object} avatarSound
*/
void playAvatarSound(SharedSoundPointer avatarSound);
/**jsdoc
* @function Agent.setIsAvatar
* @param {boolean} isAvatar
*/
void setIsAvatar(bool isAvatar);
/**jsdoc
* @function Agent.isAvatar
* @returns {boolean}
*/
bool isAvatar() const { return _isAvatar; }
private slots:

View file

@ -23,6 +23,13 @@
class EntitySimulation;
/**jsdoc
* @namespace EntityViewer
*
* @hifi-assignment-client
*/
// API functions are defined in OctreeHeadlessViewer.
// Generic client side Octree renderer class.
class EntityTreeHeadlessViewer : public OctreeHeadlessViewer {
Q_OBJECT

View file

@ -26,28 +26,101 @@ public:
static void trackIncomingOctreePacket(const QByteArray& packet, const SharedNodePointer& sendingNode, bool wasStatsPacket);
public slots:
/**jsdoc
* @function EntityViewer.queryOctree
*/
void queryOctree();
// setters for camera attributes
/**jsdoc
* @function EntityViewer.setPosition
* @param {Vec3} position
*/
void setPosition(const glm::vec3& position) { _hasViewFrustum = true; _viewFrustum.setPosition(position); }
/**jsdoc
* @function EntityViewer.setOrientation
* @param {Quat} orientation
*/
void setOrientation(const glm::quat& orientation) { _hasViewFrustum = true; _viewFrustum.setOrientation(orientation); }
/**jsdoc
* @function EntityViewer.setCenterRadius
* @param {number} radius
*/
void setCenterRadius(float radius) { _hasViewFrustum = true; _viewFrustum.setCenterRadius(radius); }
/**jsdoc
* @function EntityViewer.setKeyholeRadius
* @param {number} radius
* @deprecated Use {@link EntityViewer.setCenterRadius|setCenterRadius} instead.
*/
void setKeyholeRadius(float radius) { _hasViewFrustum = true; _viewFrustum.setCenterRadius(radius); } // TODO: remove this legacy support
// setters for LOD and PPS
/**jsdoc
* @function EntityViewer.setVoxelSizeScale
* @param {number} sizeScale
*/
void setVoxelSizeScale(float sizeScale) { _octreeQuery.setOctreeSizeScale(sizeScale) ; }
/**jsdoc
* @function EntityViewer.setBoundaryLevelAdjust
* @param {number} boundaryLevelAdjust
*/
void setBoundaryLevelAdjust(int boundaryLevelAdjust) { _octreeQuery.setBoundaryLevelAdjust(boundaryLevelAdjust); }
/**jsdoc
* @function EntityViewer.setMaxPacketsPerSecond
* @param {number} maxPacketsPerSecond
*/
void setMaxPacketsPerSecond(int maxPacketsPerSecond) { _octreeQuery.setMaxQueryPacketsPerSecond(maxPacketsPerSecond); }
// getters for camera attributes
/**jsdoc
* @function EntityViewer.getPosition
* @returns {Vec3}
*/
const glm::vec3& getPosition() const { return _viewFrustum.getPosition(); }
/**jsdoc
* @function EntityViewer.getOrientation
* @returns {Quat}
*/
const glm::quat& getOrientation() const { return _viewFrustum.getOrientation(); }
// getters for LOD and PPS
/**jsdoc
* @function EntityViewer.getVoxelSizeScale
* @returns {number}
*/
float getVoxelSizeScale() const { return _octreeQuery.getOctreeSizeScale(); }
/**jsdoc
* @function EntityViewer.getBoundaryLevelAdjust
* @returns {number}
*/
int getBoundaryLevelAdjust() const { return _octreeQuery.getBoundaryLevelAdjust(); }
/**jsdoc
* @function EntityViewer.getMaxPacketsPerSecond
* @returns {number}
*/
int getMaxPacketsPerSecond() const { return _octreeQuery.getMaxQueryPacketsPerSecond(); }
/**jsdoc
* @function EntityViewer.getOctreeElementsCount
* @returns {number}
*/
unsigned getOctreeElementsCount() const { return _tree->getOctreeElementsCount(); }
private:

View file

@ -51,6 +51,9 @@ protected slots:
/**jsdoc
* @function AvatarBookmarks.deleteBookmark
*/
/**jsdoc
* @function LocationBookmarks.deleteBookmark
*/
void deleteBookmark();
private:

View file

@ -16,6 +16,13 @@
#include "Bookmarks.h"
/**jsdoc
* @namespace LocationBookmarks
*
* @hifi-client-entity
* @hifi-interface
*/
class LocationBookmarks : public Bookmarks, public Dependency {
Q_OBJECT
SINGLETON_DEPENDENCY
@ -27,7 +34,16 @@ public:
static const QString HOME_BOOKMARK;
public slots:
/**jsdoc
* @function LocationBookmarks.addBookmark
*/
void addBookmark();
/**jsdoc
* @function LocationBookmarks.setHomeLocationToAddress
* @param {string} address
*/
void setHomeLocationToAddress(const QVariant& address);
protected:

View file

@ -89,7 +89,7 @@ public:
/**jsdoc
* @function Audio.setReverbOptions
* @param {} options
* @param {AudioEffectOptions} options
*/
Q_INVOKABLE void setReverbOptions(const AudioEffectOptions* options);

View file

@ -30,6 +30,14 @@ public:
};
/**jsdoc
* @namespace Wallet
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} walletStatus
*/
class WalletScriptingInterface : public QObject, public Dependency {
Q_OBJECT
@ -38,17 +46,53 @@ class WalletScriptingInterface : public QObject, public Dependency {
public:
WalletScriptingInterface();
/**jsdoc
* @function Wallet.refreshWalletStatus
*/
Q_INVOKABLE void refreshWalletStatus();
/**jsdoc
* @function Wallet.getWalletStatus
* @returns {number}
*/
Q_INVOKABLE uint getWalletStatus() { return _walletStatus; }
/**jsdoc
* @function Wallet.proveAvatarEntityOwnershipVerification
* @param {Uuid} entityID
*/
Q_INVOKABLE void proveAvatarEntityOwnershipVerification(const QUuid& entityID);
// setWalletStatus() should never be made Q_INVOKABLE. If it were,
// scripts could cause the Wallet to incorrectly report its status.
void setWalletStatus(const uint& status);
signals:
/**jsdoc
* @function Wallet.walletStatusChanged
* @returns {Signal}
*/
void walletStatusChanged();
/**jsdoc
* @function Wallet.walletNotSetup
* @returns {Signal}
*/
void walletNotSetup();
/**jsdoc
* @function Wallet.ownershipVerificationSuccess
* @property {Uuid} entityID
* @returns {Signal}
*/
void ownershipVerificationSuccess(const QUuid& entityID);
/**jsdoc
* @function Wallet.ownershipVerificationFailed
* @property {Uuid} entityID
* @returns {Signal}
*/
void ownershipVerificationFailed(const QUuid& entityID);
private:

View file

@ -34,6 +34,14 @@ private:
QUrl _URL;
};
/**jsdoc
* @namespace Snapshot
*
* @hifi-interface
* @hifi-client-entity
*/
class Snapshot : public QObject, public Dependency {
Q_OBJECT
SINGLETON_DEPENDENCY
@ -46,11 +54,28 @@ public:
static void uploadSnapshot(const QString& filename, const QUrl& href = QUrl(""));
signals:
/**jsdoc
* @function Snapshot.snapshotLocationSet
* @param {string} location
* @returns {Signal}
*/
void snapshotLocationSet(const QString& value);
public slots:
/**jsdoc
* @function Snapshot.getSnapshotsLocation
* @returns {string}
*/
Q_INVOKABLE QString getSnapshotsLocation();
/**jsdoc
* @function Snapshot.setSnapshotsLocation
* @param {String} location
*/
Q_INVOKABLE void setSnapshotsLocation(const QString& location);
private:
static QFile* savedFileForSnapshot(QImage& image,
bool isTemporary,

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,38 @@
#include <QtScript/QScriptContext>
#include <QtScript/QScriptEngine>
/**jsdoc
* @class AudioEffectOptions
* @param {object} [properties=null]
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*
* @property {number} bandwidth
* @property {number} preDelay
* @property {number} lateDelay
* @property {number} reverbTime
* @property {number} earlyDiffusion
* @property {number} lateDiffusion
* @property {number} roomSize
* @property {number} density
* @property {number} bassMult
* @property {number} bassFreq
* @property {number} highGain
* @property {number} highFreq
* @property {number} modRate
* @property {number} modDepth
* @property {number} earlyGain
* @property {number} lateGain
* @property {number} earlyMixLeft
* @property {number} earlyMixRight
* @property {number} lateMixLeft
* @property {number} lateMixRight
* @property {number} wetDryMix
*/
class AudioEffectOptions : public QObject {
Q_OBJECT

View file

@ -36,6 +36,30 @@ namespace scriptable {
using ModelProviderPointer = std::shared_ptr<scriptable::ModelProvider>;
using WeakModelProviderPointer = std::weak_ptr<scriptable::ModelProvider>;
/**jsdoc
* @typedef {object} Graphics.Material
* @property {string} name
* @property {string} model
* @property {number} opacity
* @property {number} roughness
* @property {number} metallic
* @property {number} scattering
* @property {boolean} unlit
* @propety {Vec3} emissive
* @propety {Vec3} albedo
* @property {string} emissiveMap
* @property {string} albedoMap
* @property {string} opacityMap
* @property {string} metallicMap
* @property {string} specularMap
* @property {string} roughnessMap
* @property {string} glossMap
* @property {string} normalMap
* @property {string} bumpMap
* @property {string} occlusionMap
* @property {string} lightmapMap
* @property {string} scatteringMap
*/
class ScriptableMaterial {
public:
ScriptableMaterial() {}
@ -68,7 +92,7 @@ namespace scriptable {
/**jsdoc
* @typedef {object} Graphics.MaterialLayer
* @property {Material} material - This layer's material.
* @property {Graphics.Material} material - This layer's material.
* @property {number} priority - The priority of this layer. If multiple materials are applied to a mesh part, only the highest priority layer is used.
*/
class ScriptableMaterialLayer {

View file

@ -166,6 +166,17 @@ bool GraphicsScriptingInterface::updateMeshPart(scriptable::ScriptableMeshPointe
scriptable::ScriptableMeshPointer GraphicsScriptingInterface::newMesh(const QVariantMap& ifsMeshData) {
// TODO: this is bare-bones way for now to improvise a new mesh from the scripting side
// in the future we want to support a formal C++ structure data type here instead
/**jsdoc
* @typedef {object} Graphics.IFSData
* @property {string} [name=""] - mesh name (useful for debugging / debug prints).
* @property {string} [topology=""]
* @property {number[]} indices - vertex indices to use for the mesh faces.
* @property {Vec3[]} vertices - vertex positions (model space)
* @property {Vec3[]} [normals=[]] - vertex normals (normalized)
* @property {Vec3[]} [colors=[]] - vertex colors (normalized)
* @property {Vec2[]} [texCoords0=[]] - vertex texture coordinates (normalized)
*/
QString meshName = ifsMeshData.value("name").toString();
QString topologyName = ifsMeshData.value("topology").toString();
QVector<glm::uint32> indices = buffer_helpers::variantToVector<glm::uint32>(ifsMeshData.value("indices"));

View file

@ -46,10 +46,28 @@ public slots:
*/
scriptable::ScriptableModelPointer getModel(QUuid uuid);
/**jsdoc
* @function Graphics.updateModel
* @param {Uuid} id
* @param {Graphics.Model} model
* @returns {boolean}
*/
bool updateModel(QUuid uuid, const scriptable::ScriptableModelPointer& model);
/**jsdoc
* @function Graphics.canUpdateModel
* @param {Uuid} id
* @param {number} [meshIndex=-1]
* @param {number} [partNumber=-1]
* @returns {boolean}
*/
bool canUpdateModel(QUuid uuid, int meshIndex = -1, int partNumber = -1);
/**jsdoc
* @function Graphics.newModel
* @param {Graphics.Mesh[]} meshes
* @returns {Graphics.Model}
*/
scriptable::ScriptableModelPointer newModel(const scriptable::ScriptableMeshes& meshes);
/**jsdoc
@ -59,15 +77,6 @@ public slots:
* @param {Graphics.IFSData} ifsMeshData Index-Faced Set (IFS) arrays used to create the new mesh.
* @returns {Graphics.Mesh} the resulting Mesh / Mesh Part object
*/
/**jsdoc
* @typedef {object} Graphics.IFSData
* @property {string} [name] - mesh name (useful for debugging / debug prints).
* @property {number[]} indices - vertex indices to use for the mesh faces.
* @property {Vec3[]} vertices - vertex positions (model space)
* @property {Vec3[]} [normals] - vertex normals (normalized)
* @property {Vec3[]} [colors] - vertex colors (normalized)
* @property {Vec2[]} [texCoords0] - vertex texture coordinates (normalized)
*/
scriptable::ScriptableMeshPointer newMesh(const QVariantMap& ifsMeshData);
#ifdef SCRIPTABLE_MESH_TODO
@ -77,6 +86,11 @@ public slots:
bool updateMeshPart(scriptable::ScriptableMeshPointer mesh, scriptable::ScriptableMeshPartPointer part);
#endif
/**jsdoc
* @function Graphics.exportModelToOBJ
* @param {Graphics.Model} model
* @returns {string}
*/
QString exportModelToOBJ(const scriptable::ScriptableModel& in);
private:

View file

@ -36,6 +36,10 @@ namespace scriptable {
* @property {number} numIndices - Total number of vertex indices in the mesh.
* @property {number} numVertices - Total number of vertices in the Mesh.
* @property {number} numAttributes - Number of currently defined vertex attributes.
* @property {boolean} valid
* @property {boolean} strong
* @property {object} extents
* @property {object} bufferFormats
*/
class ScriptableMesh : public ScriptableMeshBase, QScriptable {
Q_OBJECT

View file

@ -12,7 +12,11 @@
namespace scriptable {
/**jsdoc
* @typedef {object} Graphics.MeshPart
* @property {boolean} valid
* @property {number} partIndex - The part index (within the containing Mesh).
* @property {number} firstVertexIndex
* @property {number} baseVertexIndex
* @property {number} lastVertexIndex
* @property {Graphics.Topology} topology - element interpretation (currently only 'triangles' is supported).
* @property {string[]} attributeNames - Vertex attribute names (color, normal, etc.)
* @property {number} numIndices - Number of vertex indices that this mesh part refers to.
@ -20,6 +24,8 @@ namespace scriptable {
* @property {number} numFaces - Number of faces represented by the mesh part (numIndices / numVerticesPerFace).
* @property {number} numVertices - Total number of vertices in the containing Mesh.
* @property {number} numAttributes - Number of currently defined vertex attributes.
* @property {object} extents
* @property {object} bufferFormats
*/
class ScriptableMeshPart : public QObject, QScriptable {

View file

@ -21,7 +21,7 @@ namespace scriptable {
* @property {Uuid} objectID - UUID of corresponding inworld object (if model is associated)
* @property {number} numMeshes - The number of submeshes contained in the model.
* @property {Graphics.Mesh[]} meshes - Array of submesh references.
* @property {Object.<string, Graphics.MaterialLayer[]>} materialLayers - Map of materials layer lists. You can look up a material layer list by mesh part number or by material name.
* @property {Object.<string,Graphics.MaterialLayer[]>} materialLayers - Map of materials layer lists. You can look up a material layer list by mesh part number or by material name.
* @property {string[]} materialNames - Array of all the material names used by the mesh parts of this model, in order (e.g. materialNames[0] is the name of the first mesh part's material).
*/

View file

@ -76,6 +76,23 @@ public:
// Access vertex position value
const Vec3& getPos(Index index) const { return _vertexBuffer.get<Vec3>(index); }
/**jsdoc
* <table>
* <thead>
* <tr><th>Value</th><th>Description</th></tr>
* </thead>
* <tbody>
* <tr><td><code>0</code></td><td>Points.</td></tr>
* <tr><td><code>1</code></td><td>Lines.</td></tr>
* <tr><td><code>2</code></td><td>Line strip.</td></tr>
* <tr><td><code>3</code></td><td>Triangles.</td></tr>
* <tr><td><code>4</code></td><td>Triangle strip.</td></tr>
* <tr><td><code>5</code></td><td>Quads.</td></tr>
* <tr><td><code>6</code></td><td>Quad strip.</td></tr>
* </tbody>
* </table>
* @typedef {number} Graphics.Topology
*/
enum Topology {
POINTS = 0,
LINES,

View file

@ -20,6 +20,13 @@
#include <vector>
#include <string>
/**jsdoc
* @namespace Midi
*
* @hifi-interface
* @hifi-client-entity
*/
class Midi : public QObject, public Dependency {
Q_OBJECT
SINGLETON_DEPENDENCY
@ -46,57 +53,135 @@ signals:
void midiReset();
public slots:
// Send Raw Midi Packet to all connected devices
/**jsdoc
* Send Raw MIDI packet to a particular device.
* @function Midi.sendRawDword
* @param {number} device - Integer device number.
* @param {number} raw - Integer (DWORD) raw MIDI message.
*/
Q_INVOKABLE void sendRawDword(int device, int raw);
/// Send Raw Midi message to selected device
/// @param {int} device: device number
/// @param {int} raw: raw midi message (DWORD)
// Send Midi Message to all connected devices
/**jsdoc
* Send MIDI message to a particular device.
* @function Midi.sendMidiMessage
* @param {number} device - Integer device number.
* @param {number} channel - Integer channel number.
* @param {number} type - 0x8 is note off, 0x9 is note on (if velocity=0, note off), etc.
* @param {number} note - MIDI note number.
* @param {number} velocity - Note velocity (0 means note off).
*/
Q_INVOKABLE void sendMidiMessage(int device, int channel, int type, int note, int velocity);
/// Send midi message to selected device/devices
/// @param {int} device: device number
/// @param {int} channel: channel number
/// @param {int} type: 0x8 is noteoff, 0x9 is noteon (if velocity=0, noteoff), etc
/// @param {int} note: midi note number
/// @param {int} velocity: note velocity (0 means noteoff)
// Send Midi Message to all connected devices
/**jsdoc
* Play a note on all connected devices.
* @function Midi.playMidiNote
* @param {number} status - 0x80 is note off, 0x90 is note on (if velocity=0, note off), etc.
* @param {number} note - MIDI note number.
* @param {number} velocity - Note velocity (0 means note off).
*/
Q_INVOKABLE void playMidiNote(int status, int note, int velocity);
/// play a note on all connected devices
/// @param {int} status: 0x80 is noteoff, 0x90 is noteon (if velocity=0, noteoff), etc
/// @param {int} note: midi note number
/// @param {int} velocity: note velocity (0 means noteoff)
/// turn off all notes on all connected devices
/**jsdoc
* Turn off all notes on all connected devices.
* @function Midi.allNotesOff
*/
Q_INVOKABLE void allNotesOff();
/// clean up and re-discover attached devices
/**jsdoc
* Clean up and re-discover attached devices.
* @function Midi.resetDevices
*/
Q_INVOKABLE void resetDevices();
/// ask for a list of inputs/outputs
/**jsdoc
* Get a list of inputs/outputs.
* @function Midi.listMidiDevices
* @param {boolean} output
* @returns {string[]}
*/
Q_INVOKABLE QStringList listMidiDevices(bool output);
/// block an input/output by name
/**jsdoc
* Block an input/output by name.
* @function Midi.blockMidiDevice
* @param {string} name
* @param {boolean} output
*/
Q_INVOKABLE void blockMidiDevice(QString name, bool output);
/// unblock an input/output by name
/**jsdoc
* Unblock an input/output by name.
* @function Midi.unblockMidiDevice
* @param {string} name
* @param {boolean} output
*/
Q_INVOKABLE void unblockMidiDevice(QString name, bool output);
/// repeat all incoming notes to all outputs (default disabled)
/**jsdoc
* Repeat all incoming notes to all outputs (default disabled).
* @function Midi.thruModeEnable
* @param {boolean} enable
*/
Q_INVOKABLE void thruModeEnable(bool enable);
/// broadcast on all unblocked devices
/**jsdoc
* Broadcast on all unblocked devices.
* @function Midi.broadcastEnable
* @param {boolean} enable
*/
Q_INVOKABLE void broadcastEnable(bool enable);
/// filter by event types
/**jsdoc
* @function Midi.typeNoteOffEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeNoteOffEnable(bool enable);
/**jsdoc
* @function Midi.typeNoteOnEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeNoteOnEnable(bool enable);
/**jsdoc
* @function Midi.typePolyKeyPressureEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typePolyKeyPressureEnable(bool enable);
/**jsdoc
* @function Midi.typeControlChangeEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeControlChangeEnable(bool enable);
/**jsdoc
* @function Midi.typeProgramChangeEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeProgramChangeEnable(bool enable);
/**jsdoc
* @function Midi.typeChanPressureEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeChanPressureEnable(bool enable);
/**jsdoc
* @function Midi.typePitchBendEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typePitchBendEnable(bool enable);
/**jsdoc
* @function Midi.typeSystemMessageEnable
* @param {boolean} enable
*/
Q_INVOKABLE void typeSystemMessageEnable(bool enable);

View file

@ -17,11 +17,30 @@
#include <DependencyManager.h>
/**jsdoc
* @namespace Resources
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
class ResourceScriptingInterface : public QObject, public Dependency {
Q_OBJECT
public:
/**jsdoc
* @function Resources.overrideUrlPrefix
* @param {string} prefix
* @param {string} replacement
*/
Q_INVOKABLE void overrideUrlPrefix(const QString& prefix, const QString& replacement);
/**jsdoc
* @function Resources.restoreUrlPrefix
* @param {string} prefix
*/
Q_INVOKABLE void restoreUrlPrefix(const QString& prefix) {
overrideUrlPrefix(prefix, "");
}

View file

@ -29,13 +29,30 @@ public:
void addPacketStatsAndSendStatsPacket(QJsonObject statsObject);
public slots:
// JSDoc: Overridden in Agent.h.
/// threaded run of assignment
virtual void run() = 0;
/**jsdoc
* @function Agent.stop
*/
Q_INVOKABLE virtual void stop() { setFinished(true); }
/**jsdoc
* @function Agent.sendStatsPacket
*/
virtual void sendStatsPacket();
/**jsdoc
* @function Agent.clearQueuedCheckIns
*/
void clearQueuedCheckIns() { _numQueuedCheckIns = 0; }
signals:
/**jsdoc
* @function Agent.finished
* @returns {Signal}
*/
void finished();
protected:
@ -47,6 +64,9 @@ protected:
int _numQueuedCheckIns { 0 };
protected slots:
/**jsdoc
* @function Agent.domainSettingsRequestFailed
*/
void domainSettingsRequestFailed();
private slots:

View file

@ -40,6 +40,15 @@ public:
virtual int getSteamVRBuildID() = 0;
};
/**jsdoc
* @namespace Steam
*
* @hifi-interface
* @hifi-client-entity
*
* @property {boolean} running - <em>Read-only.</em>
*/
class SteamScriptingInterface : public QObject {
Q_OBJECT
@ -49,7 +58,16 @@ public:
SteamScriptingInterface(QObject* parent, SteamClientPlugin* plugin) : QObject(parent), _plugin(plugin) {}
public slots:
/**jsdoc
* @function Steam.isRunning
* @returns {boolean}
*/
bool isRunning() const { return _plugin && _plugin->isRunning(); }
/**jsdoc
* @function Steam.openInviteOverlay
*/
void openInviteOverlay() const { if (_plugin) { _plugin->openInviteOverlay(); } }
private:

View file

@ -16,6 +16,15 @@
#include <QFileInfo>
#include <QString>
/**jsdoc
* @namespace File
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
class FileScriptingInterface : public QObject {
Q_OBJECT
@ -23,11 +32,41 @@ public:
FileScriptingInterface(QObject* parent);
public slots:
/**jsdoc
* @function File.convertUrlToPath
* @param {string} url
* @returns {string}
*/
QString convertUrlToPath(QUrl url);
/**jsdoc
* @function File.runUnzip
* @param {string} path
* @param {string} url
* @param {boolean} autoAdd
* @param {boolean} isZip
* @param {boolean} isBlocks
*/
void runUnzip(QString path, QUrl url, bool autoAdd, bool isZip, bool isBlocks);
/**jsdoc
* @function File.getTempDir
* @returns {string}
*/
QString getTempDir();
signals:
/**jsdoc
* @function File.unzipResult
* @param {string} zipFile
* @param {string} unzipFile
* @param {boolean} autoAdd
* @param {boolean} isZip
* @param {boolean} isBlocks
* @returns {Signal}
*/
void unzipResult(QString zipFile, QStringList unzipFile, bool autoAdd, bool isZip, bool isBlocks);
private:

View file

@ -21,33 +21,147 @@
#include <glm/glm.hpp>
#include "RegisteredMetaTypes.h"
/**jsdoc
* @namespace Mat4
*
* @hifi-interface
* @hifi-client-entity
* @hifi-server-entity
* @hifi-assignment-client
*/
/// Scriptable Mat4 object. Used exclusively in the JavaScript API
class Mat4 : public QObject, protected QScriptable {
Q_OBJECT
public slots:
/**jsdoc
* @function Mat4.multiply
* @param {Mat4} m1
* @param {Mat4} m2
* @returns {Mat4}
*/
glm::mat4 multiply(const glm::mat4& m1, const glm::mat4& m2) const;
/**jsdoc
* @function Mat4.createFromRotAndTrans
* @param {Quat} rot
* @param {Vec3} trans
* @returns {Mat4}
*/
glm::mat4 createFromRotAndTrans(const glm::quat& rot, const glm::vec3& trans) const;
/**jsdoc
* @function Mat4.createFromScaleRotAndTrans
* @param {Vec3} scale
* @param {Quat} rot
* @param {Vec3} trans
* @returns {Mat4}
*/
glm::mat4 createFromScaleRotAndTrans(const glm::vec3& scale, const glm::quat& rot, const glm::vec3& trans) const;
/**jsdoc
* @function Mat4.createFromColumns
* @param {Vec4} col0
* @param {Vec4} col1
* @param {Vec4} col2
* @param {Vec4} col
* @returns {Mat4}
*/
glm::mat4 createFromColumns(const glm::vec4& col0, const glm::vec4& col1, const glm::vec4& col2, const glm::vec4& col3) const;
/**jsdoc
* @function Mat4.createFromArray
* @param {number[]} numbers
* @returns {Mat4}
*/
glm::mat4 createFromArray(const QVector<float>& floats) const;
/**jsdoc
* @function Mat4.extractTranslation
* @param {Mat4} m
* @returns {Vec3}
*/
glm::vec3 extractTranslation(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.extractRotation
* @param {Mat4} m
* @returns {Vec3}
*/
glm::quat extractRotation(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.extractScale
* @param {Mat4} m
* @returns {Vec3}
*/
glm::vec3 extractScale(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.transformPoint
* @param {Mat4} m
* @param {Vec3} point
* @returns {Vec3}
*/
glm::vec3 transformPoint(const glm::mat4& m, const glm::vec3& point) const;
/**jsdoc
* @function Mat4.transformVector
* @param {Mat4} m
* @param {Vec3} vector
* @returns {Vec3}
*/
glm::vec3 transformVector(const glm::mat4& m, const glm::vec3& vector) const;
/**jsdoc
* @function Mat4.inverse
* @param {Mat4} m
* @returns {Mat4}
*/
glm::mat4 inverse(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.getFront
* @param {Mat4} m
* @returns {Vec3}
*/
// redundant, calls getForward which better describes the returned vector as a direction
glm::vec3 getFront(const glm::mat4& m) const { return getForward(m); }
/**jsdoc
* @function Mat4.getForward
* @param {Mat4} m
* @returns {Vec3}
*/
glm::vec3 getForward(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.getRight
* @param {Mat4} m
* @returns {Vec3}
*/
glm::vec3 getRight(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.getUp
* @param {Mat4} m
* @returns {Vec3}
*/
glm::vec3 getUp(const glm::mat4& m) const;
/**jsdoc
* @function Mat4.print
* @param {string} label
* @param {Mat4} m
* @param {boolean} [transpose=false]
*/
void print(const QString& label, const glm::mat4& m, bool transpose = false) const;
};

View file

@ -104,8 +104,17 @@ public:
virtual void setPresetList(const QJsonObject& object);
/**jsdoc
* @function Render.toJSON
* @returns {string}
*/
// This must be named toJSON to integrate with the global scripting JSON object
Q_INVOKABLE QString toJSON() { return QJsonDocument(toJsonValue(*this).toObject()).toJson(QJsonDocument::Compact); }
/**jsdoc
* @function Render.load
* @param {object} map
*/
Q_INVOKABLE void load(const QVariantMap& map) { qObjectFromJsonValue(QJsonObject::fromVariantMap(map), *this); emit loaded(); }
// Running Time measurement
@ -114,11 +123,31 @@ public:
double getCPURunTime() const { return _msCPURunTime; }
public slots:
/**jsdoc
* @function Render.load
* @param {object} map
*/
void load(const QJsonObject& val) { qObjectFromJsonValue(val, *this); emit loaded(); }
signals:
/**jsdoc
* @function Render.loaded
* @returns {Signal}
*/
void loaded();
/**jsdoc
* @function Render.newStats
* @returns {Signal}
*/
void newStats();
/**jsdoc
* @function Render.dirtyEnabled
* @returns {Signal}
*/
void dirtyEnabled();
};
@ -127,6 +156,16 @@ public:
using Config = JobConfig;
};
/**jsdoc
* @namespace Render
*
* @hifi-interface
* @hifi-client-entity
*
* @property {number} cpuRunTime - <em>Read-only.</em>
* @property {boolean} enabled
*/
class TaskConfig : public JobConfig {
Q_OBJECT
public:
@ -137,8 +176,11 @@ public:
TaskConfig() = default ;
TaskConfig(bool enabled) : JobConfig(enabled) {}
/**jsdoc
* @function Render.getConfig
* @param {string} name
* @returns {object}
*/
// Get a sub job config through task.getConfig(path)
// where path can be:
// - <job_name> search for the first job named job_name traversing the the sub graph of task and jobs (from this task as root)
@ -176,6 +218,10 @@ public:
JobConcept* _task;
public slots:
/**jsdoc
* @function Render.refresh
*/
void refresh();
};

View file

@ -30,6 +30,15 @@
#include <PointerManager.h>
/**jsdoc
* @namespace OffscreenFlags
*
* @hifi-interface
* @hifi-client-entity
* @property {boolean} navigationFocused
* @property {boolean} navigationFocusDisabled
*/
// Needs to match the constants in resources/qml/Global.js
class OffscreenFlags : public QObject {
Q_OBJECT
@ -58,7 +67,17 @@ public:
}
signals:
/**jsdoc
* @function OffscreenFlags.navigationFocusedChanged
* @returns {Signal}
*/
void navigationFocusedChanged();
/**jsdoc
* @function OffscreenFlags.navigationFocusDisabledChanged
* @returns {Signal}
*/
void navigationFocusDisabledChanged();
private:

View file

@ -11,6 +11,17 @@
#include "QmlWindowClass.h"
/**jsdoc
* @class OverlayWebWindow
* @augments OverlayWindow
* @param {object} [properties=null]
*
* @hifi-interface
* @hifi-client-en
*
* @property {string} url - <em>Read-only.</em>
*/
// FIXME refactor this class to be a QQuickItem derived type and eliminate the needless wrapping
class QmlWebWindowClass : public QmlWindowClass {
Q_OBJECT
@ -20,11 +31,29 @@ public:
static QScriptValue constructor(QScriptContext* context, QScriptEngine* engine);
public slots:
/**jsdoc
* @function OverlayWebWindow.getURL
* @returns {string}
*/
QString getURL();
/**jsdoc
* @function OverlayWebWindow.setURL
* @param {string} url
*/
void setURL(const QString& url);
/**jsdoc
* @function OverlayWebWindow.getURL
* @param {string} script
*/
void setScriptURL(const QString& script);
signals:
/**jsdoc
* @function OverlayWebWindow.getURL
* @returns {Signal}
*/
void urlChanged();
protected:

View file

@ -19,6 +19,18 @@
class QScriptEngine;
class QScriptContext;
/**jsdoc
* @class OverlayWindow
* @param {object} [properties=null]
*
* @hifi-interface
* @hifi-client-en
*
* @property {Vec2} position
* @property {Vec2} size
* @property {boolean} visible
*/
// FIXME refactor this class to be a QQuickItem derived type and eliminate the needless wrapping
class QmlWindowClass : public QObject {
Q_OBJECT
@ -31,46 +43,180 @@ public:
QmlWindowClass();
~QmlWindowClass();
/**jsdoc
* @function OverlayWindow.initQml
* @param {object} properties
*/
Q_INVOKABLE virtual void initQml(QVariantMap properties);
QQuickItem* asQuickItem() const;
public slots:
/**jsdoc
* @function OverlayWindow.isVisible
* @returns {boolean}
*/
bool isVisible();
/**jsdoc
* @function OverlayWindow.setVisible
* @param {boolean} visible
*/
void setVisible(bool visible);
/**jsdoc
* @function OverlayWindow.getPosition
* @returns {Vec2}
*/
glm::vec2 getPosition();
/**jsdoc
* @function OverlayWindow.setPosition
* @param {Vec2} position
*/
void setPosition(const glm::vec2& position);
/**jsdoc
* @function OverlayWindow.setPosition
* @param {number} x
* @param {number} y
*/
void setPosition(int x, int y);
/**jsdoc
* @function OverlayWindow.getSize
* @returns {Vec2}
*/
glm::vec2 getSize();
/**jsdoc
* @function OverlayWindow.setSize
* @param {Vec2} size
*/
void setSize(const glm::vec2& size);
/**jsdoc
* @function OverlayWindow.setSize
* @param {number} width
* @param {number} height
*/
void setSize(int width, int height);
/**jsdoc
* @function OverlayWindow.setTitle
* @param {string} title
*/
void setTitle(const QString& title);
/**jsdoc
* @function OverlayWindow.raise
*/
Q_INVOKABLE void raise();
/**jsdoc
* @function OverlayWindow.close
*/
Q_INVOKABLE void close();
/**jsdoc
* @function OverlayWindow.getEventBridge
* @returns {object}
*/
Q_INVOKABLE QObject* getEventBridge() { return this; };
/**jsdoc
* @function OverlayWindow.sendToQml
* @param {object} message
*/
// Scripts can use this to send a message to the QML object
void sendToQml(const QVariant& message);
/**jsdoc
* @function OverlayWindow.clearDebugWindow
*/
void clearDebugWindow();
/**jsdoc
* @function OverlayWindow.emitScriptEvent
* @param {object} message
*/
// QmlWindow content may include WebView requiring EventBridge.
void emitScriptEvent(const QVariant& scriptMessage);
/**jsdoc
* @function OverlayWindow.emitWebEvent
* @param {object} message
*/
void emitWebEvent(const QVariant& webMessage);
signals:
/**jsdoc
* @function OverlayWindow.visibleChanged
* @returns {Signal}
*/
void visibleChanged();
/**jsdoc
* @function OverlayWindow.positionChanged
* @returns {Signal}
*/
void positionChanged();
/**jsdoc
* @function OverlayWindow.sizeChanged
* @returns {Signal}
*/
void sizeChanged();
/**jsdoc
* @function OverlayWindow.moved
* @param {Vec2} position
* @returns {Signal}
*/
void moved(glm::vec2 position);
/**jsdoc
* @function OverlayWindow.resized
* @param {Size} size
* @returns {Signal}
*/
void resized(QSizeF size);
/**jsdoc
* @function OverlayWindow.closed
* @returns {Signal}
*/
void closed();
/**jsdoc
* @function OverlayWindow.fromQml
* @param {object} message
* @returns {Signal}
*/
// Scripts can connect to this signal to receive messages from the QML object
void fromQml(const QVariant& message);
/**jsdoc
* @function OverlayWindow.scriptEventReceived
* @param {object} message
* @returns {Signal}
*/
// QmlWindow content may include WebView requiring EventBridge.
void scriptEventReceived(const QVariant& message);
/**jsdoc
* @function OverlayWindow.webEventReceived
* @param {object} message
* @returns {Signal}
*/
void webEventReceived(const QVariant& message);
protected slots:

View file

@ -19,14 +19,30 @@
class QQuickItem;
/**jsdoc
* @class ToolbarButtonProxy
*
* @hifi-interface
* @hifi-client-entity
*/
class ToolbarButtonProxy : public QmlWrapper {
Q_OBJECT
public:
ToolbarButtonProxy(QObject* qmlObject, QObject* parent = nullptr);
/**jsdoc
* @function ToolbarButtonProxy#editProperties
* @param {object} properties
*/
Q_INVOKABLE void editProperties(const QVariantMap& properties);
signals:
/**jsdoc
* @function ToolbarButtonProxy#clicked
* @returns {Signal}
*/
void clicked();
protected:
@ -36,19 +52,48 @@ protected:
Q_DECLARE_METATYPE(ToolbarButtonProxy*);
/**jsdoc
* @class ToolbarProxy
*
* @hifi-interface
* @hifi-client-entity
*/
class ToolbarProxy : public QmlWrapper {
Q_OBJECT
public:
ToolbarProxy(QObject* qmlObject, QObject* parent = nullptr);
/**jsdoc
* @function ToolbarProxy#addButton
* @property {object} properties
* @returns {ToolbarButtonProxy}
*/
Q_INVOKABLE ToolbarButtonProxy* addButton(const QVariant& properties);
/**jsdoc
* @function ToolbarProxy#removeButton
* @property {string} name
*/
Q_INVOKABLE void removeButton(const QVariant& name);
};
Q_DECLARE_METATYPE(ToolbarProxy*);
/**jsdoc
* @namespace Toolbars
*
* @hifi-interface
* @hifi-client-entity
*/
class ToolbarScriptingInterface : public QObject, public Dependency {
Q_OBJECT
public:
/**jsdoc
* @function Toolbars.getToolbar
* @param {string} toolbarID
* @returns {ToolbarProxy}
*/
Q_INVOKABLE ToolbarProxy* getToolbar(const QString& toolbarId);
};

View file

@ -20,6 +20,9 @@ exports.handlers = {
// directories to scan for jsdoc comments
var dirList = [
'../../assignment-client/src',
'../../assignment-client/src/entities',
'../../assignment-client/src/octree',
'../../interface/src',
'../../interface/src/assets',
'../../interface/src/audio',
@ -41,17 +44,22 @@ exports.handlers = {
'../../libraries/controllers/src/controllers/impl/',
'../../libraries/display-plugins/src/display-plugins/',
'../../libraries/entities/src',
'../../libraries/graphics/src/graphics/',
'../../libraries/graphics-scripting/src/graphics-scripting/',
'../../libraries/input-plugins/src/input-plugins',
'../../libraries/midi/src',
'../../libraries/model-networking/src/model-networking/',
'../../libraries/networking/src',
'../../libraries/octree/src',
'../../libraries/physics/src',
'../../libraries/plugins/src/plugins',
'../../libraries/pointers/src',
'../../libraries/script-engine/src',
'../../libraries/shared/src',
'../../libraries/shared/src/shared',
'../../libraries/task/src/task',
'../../libraries/trackers/src/trackers',
'../../libraries/ui/src',
'../../libraries/ui/src/ui',
'../../plugins/oculus/src',
'../../plugins/openvr/src'