diff --git a/libraries/animation/src/AnimationCache.h b/libraries/animation/src/AnimationCache.h index d8f8a13cde..4b0a8901f5 100644 --- a/libraries/animation/src/AnimationCache.h +++ b/libraries/animation/src/AnimationCache.h @@ -70,7 +70,7 @@ public: * @function AnimationCache.prefetch * @param {string} url - URL of the resource to prefetch. * @param {object} [extra=null] - * @returns {Resource} + * @returns {ResourceObject} */ /**jsdoc @@ -79,7 +79,7 @@ public: * @param {string} url - URL of the resource to load. * @param {string} [fallback=""] - Fallback URL if load of the desired URL fails. * @param {} [extra=null] - * @returns {Resource} + * @returns {object} */ @@ -87,7 +87,7 @@ public: * Returns animation resource for particular animation. * @function AnimationCache.getAnimation * @param {string} url - URL to load. - * @returns {Resource} animation + * @returns {AnimationObject} animation */ Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); } Q_INVOKABLE AnimationPointer getAnimation(const QUrl& url); @@ -104,6 +104,17 @@ private: Q_DECLARE_METATYPE(AnimationPointer) +/**jsdoc + * @class AnimationObject + * + * @hifi-interface + * @hifi-client-entity + * @hifi-server-entity + * @hifi-assignment-client + * + * @property {string[]} jointNames + * @property {FBXAnimationFrame[]} frames + */ /// An animation loaded from the network. class Animation : public Resource { Q_OBJECT @@ -118,9 +129,16 @@ public: virtual bool isLoaded() const override; - + /**jsdoc + * @function AnimationObject.getJointNames + * @returns {string[]} + */ Q_INVOKABLE QStringList getJointNames() const; + /**jsdoc + * @function AnimationObject.getFrames + * @returns {FBXAnimationFrame[]} + */ Q_INVOKABLE QVector getFrames() const; const QVector& getFramesReference() const; diff --git a/libraries/audio/src/Sound.h b/libraries/audio/src/Sound.h index 69dbf5a913..4cfdac7792 100644 --- a/libraries/audio/src/Sound.h +++ b/libraries/audio/src/Sound.h @@ -77,6 +77,17 @@ private: typedef QSharedPointer SharedSoundPointer; +/**jsdoc + * @class SoundObject + * + * @hifi-interface + * @hifi-client-entity + * @hifi-server-entity + * @hifi-assignment-client + * + * @property {boolean} downloaded + * @property {number} duration + */ class SoundScriptingInterface : public QObject { Q_OBJECT @@ -90,6 +101,10 @@ public: bool isReady() const { return _sound->isReady(); } float getDuration() { return _sound->getDuration(); } +/**jsdoc + * @function SoundObject.ready + * @returns {Signal} + */ signals: void ready(); diff --git a/libraries/audio/src/SoundCache.h b/libraries/audio/src/SoundCache.h index 347f324353..4352b1d459 100644 --- a/libraries/audio/src/SoundCache.h +++ b/libraries/audio/src/SoundCache.h @@ -64,7 +64,7 @@ public: * @function SoundCache.prefetch * @param {string} url - URL of the resource to prefetch. * @param {object} [extra=null] - * @returns {Resource} + * @returns {ResourceObject} */ /**jsdoc @@ -73,14 +73,14 @@ public: * @param {string} url - URL of the resource to load. * @param {string} [fallback=""] - Fallback URL if load of the desired URL fails. * @param {} [extra=null] - * @returns {Resource} + * @returns {object} */ /**jsdoc * @function SoundCache.getSound * @param {string} url - * @returns {object} + * @returns {SoundObject} */ Q_INVOKABLE SharedSoundPointer getSound(const QUrl& url); protected: diff --git a/libraries/fbx/src/FBX.h b/libraries/fbx/src/FBX.h index ce3fc52c3a..5ca4b33f14 100644 --- a/libraries/fbx/src/FBX.h +++ b/libraries/fbx/src/FBX.h @@ -256,6 +256,11 @@ public: QHash texcoordSetMap; }; +/**jsdoc + * @typedef {object} FBXAnimationFrame + * @property {Quat[]} rotations + * @property {Vec3[]} translations + */ /// A single animation frame extracted from an FBX document. class FBXAnimationFrame { public: diff --git a/libraries/model-networking/src/model-networking/ModelCache.h b/libraries/model-networking/src/model-networking/ModelCache.h index 7e911bc9bf..ee13d6666c 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.h +++ b/libraries/model-networking/src/model-networking/ModelCache.h @@ -179,7 +179,7 @@ public: * @function ModelCache.prefetch * @param {string} url - URL of the resource to prefetch. * @param {object} [extra=null] - * @returns {Resource} + * @returns {ResourceObject} */ /**jsdoc @@ -188,7 +188,7 @@ public: * @param {string} url - URL of the resource to load. * @param {string} [fallback=""] - Fallback URL if load of the desired URL fails. * @param {} [extra=null] - * @returns {Resource} + * @returns {object} */ diff --git a/libraries/model-networking/src/model-networking/TextureCache.h b/libraries/model-networking/src/model-networking/TextureCache.h index 898f0e3d3a..bca64806c4 100644 --- a/libraries/model-networking/src/model-networking/TextureCache.h +++ b/libraries/model-networking/src/model-networking/TextureCache.h @@ -195,7 +195,7 @@ public: * @function TextureCache.prefetch * @param {string} url - URL of the resource to prefetch. * @param {object} [extra=null] - * @returns {Resource} + * @returns {ResourceObject} */ /**jsdoc @@ -204,7 +204,7 @@ public: * @param {string} url - URL of the resource to load. * @param {string} [fallback=""] - Fallback URL if load of the desired URL fails. * @param {} [extra=null] - * @returns {Resource} + * @returns {object} */ @@ -261,7 +261,7 @@ protected: * @param {string} url * @param {number} type * @param {number} [maxNumPixels=67108864] - * @returns {Resource} + * @returns {ResourceObject} */ // Overload ResourceCache::prefetch to allow specifying texture type for loads Q_INVOKABLE ScriptableResource* prefetch(const QUrl& url, int type, int maxNumPixels = ABSOLUTE_MAX_TEXTURE_NUM_PIXELS); diff --git a/libraries/networking/src/ResourceCache.h b/libraries/networking/src/ResourceCache.h index 18840cd11e..a4bd352563 100644 --- a/libraries/networking/src/ResourceCache.h +++ b/libraries/networking/src/ResourceCache.h @@ -87,7 +87,7 @@ private: class ScriptableResource : public QObject { /**jsdoc - * @constructor Resource + * @class ResourceObject * * @hifi-interface * @hifi-client-entity @@ -97,11 +97,6 @@ class ScriptableResource : public QObject { * @property {string} url - URL of this resource. * @property {Resource.State} state - Current loading state. */ - /**jsdoc - * @namespace Resource - * @variation 0 - * @property {Resource.State} State - */ Q_OBJECT Q_PROPERTY(QUrl url READ getURL) Q_PROPERTY(int state READ getState NOTIFY stateChanged) @@ -109,8 +104,7 @@ class ScriptableResource : public QObject { public: /**jsdoc - * @name Resource.State - * @static + * @typedef {object} Resource.State * @property {number} QUEUED - The resource is queued up, waiting to be loaded. * @property {number} LOADING - The resource is downloading. * @property {number} LOADED - The resource has finished downloaded by is not complete. @@ -131,7 +125,7 @@ public: /**jsdoc * Release this resource. - * @function Resource#release + * @function ResourceObject#release */ Q_INVOKABLE void release(); @@ -146,7 +140,7 @@ signals: /**jsdoc * Triggered when download progress for this resource has changed. - * @function Resource#progressChanged + * @function ResourceObject#progressChanged * @param {number} bytesReceived - Byytes downloaded so far. * @param {number} bytesTotal - Total number of bytes in the resource. * @returns {Signal} @@ -155,7 +149,7 @@ signals: /**jsdoc * Triggered when resource loading state has changed. - * @function Resource#stateChanged + * @function ResourceObject#stateChanged * @param {Resource.State} state - New state. * @returns {Signal} */ @@ -262,7 +256,7 @@ protected slots: * @function ResourceCache.prefetch * @param {string} url - URL of the resource to prefetch. * @param {object} [extra=null] - * @returns {Resource} + * @returns {ResourceObject} */ // Prefetches a resource to be held by the QScriptEngine. // Left as a protected member so subclasses can overload prefetch @@ -275,8 +269,9 @@ protected slots: * @param {string} url - URL of the resource to load. * @param {string} [fallback=""] - Fallback URL if load of the desired URL fails. * @param {} [extra=null] - * @returns {Resource} + * @returns {object} */ + // FIXME: The return type is not recognized by JavaScript. /// Loads a resource from the specified URL and returns it. /// If the caller is on a different thread than the ResourceCache, /// returns an empty smart pointer and loads its asynchronously. diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 23ffbabe77..0da99d11f8 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -558,6 +558,16 @@ static void scriptableResourceFromScriptValue(const QScriptValue& value, Scripta resource = static_cast(value.toQObject()); } +/**jsdoc + * @namespace Resource + * + * @hifi-interface + * @hifi-client-entity + * @hifi-server-entity + * @hifi-assignment-client + * + * @property {Resource.State} State + */ static QScriptValue createScriptableResourcePrototype(ScriptEnginePointer engine) { auto prototype = engine->newObject(); diff --git a/tools/jsdoc/plugins/hifi.js b/tools/jsdoc/plugins/hifi.js index 4378c2b4cb..049d32cceb 100644 --- a/tools/jsdoc/plugins/hifi.js +++ b/tools/jsdoc/plugins/hifi.js @@ -45,6 +45,7 @@ exports.handlers = { '../../libraries/controllers/src/controllers/impl/', '../../libraries/display-plugins/src/display-plugins/', '../../libraries/entities/src', + '../../libraries/fbx/src', '../../libraries/graphics/src/graphics/', '../../libraries/graphics-scripting/src/graphics-scripting/', '../../libraries/input-plugins/src/input-plugins',