Update JSDoc for Clipboard JavaScript API

This commit is contained in:
David Rowe 2017-11-10 21:53:55 +13:00
parent a482b7c371
commit 7bbe5cdf70
2 changed files with 29 additions and 16 deletions

View file

@ -34,7 +34,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, const
return retVal;
}
bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float s) {
bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float scale) {
bool retVal;
BLOCKING_INVOKE_METHOD(qApp, "exportEntities",
Q_RETURN_ARG(bool, retVal),
@ -42,7 +42,7 @@ bool ClipboardScriptingInterface::exportEntities(const QString& filename, float
Q_ARG(float, x),
Q_ARG(float, y),
Q_ARG(float, z),
Q_ARG(float, s));
Q_ARG(float, scale));
return retVal;
}

View file

@ -18,6 +18,8 @@
#include <EntityItemID.h>
/**jsdoc
* The Clipboard API enables you to export and import entities to and from JSON files.
*
* @namespace Clipboard
*/
class ClipboardScriptingInterface : public QObject {
@ -30,43 +32,54 @@ signals:
public:
/**jsdoc
* Compute the extents of the contents held in the clipboard.
* @function Clipboard.getContentsDimensions
* @return {Vec3} The extents of the contents held in the clipboard.
* @returns {Vec3} The extents of the contents held in the clipboard.
*/
Q_INVOKABLE glm::vec3 getContentsDimensions();
/**jsdoc
* Compute largest dimension of the extents of the contents held in the clipboard
* Compute the largest dimension of the extents of the contents held in the clipboard.
* @function Clipboard.getClipboardContentsLargestDimension
* @return {float} The largest dimension computed.
* @returns {float} The largest dimension computed.
*/
Q_INVOKABLE float getClipboardContentsLargestDimension();
/**jsdoc
* Import entities from a .json file containing entity data into the clipboard.
* You can generate * a .json file using {Clipboard.exportEntities}.
* Import entities from a JSON file containing entity data into the clipboard.
* You can generate a JSON file using {@link Clipboard.exportEntities}.
* @function Clipboard.importEntities
* @param {string} filename Filename of file to import.
* @return {bool} True if the import was succesful, otherwise false.
* @param {string} filename Path and name of file to import.
* @returns {bool} `true` if the import was successful, otherwise `false`.
*/
Q_INVOKABLE bool importEntities(const QString& filename);
/**jsdoc
* Export the entities listed in `entityIDs` to the file `filename`
* Export the entities specified to a JSON file.
* @function Clipboard.exportEntities
* @param {string} filename Path to the file to export entities to.
* @param {string} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {EntityID[]} entityIDs IDs of entities to export.
* @return {bool} True if the export was succesful, otherwise false.
* @returns {bool} `true` if the export was successful, otherwise `false`.
*/
Q_INVOKABLE bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);
Q_INVOKABLE bool exportEntities(const QString& filename, float x, float y, float z, float s);
/**jsdoc
* Export the entities with centers within a cube to a JSON file.
* @function Clipboard.exportEntities
* @param {string} filename Path and name of the file to export entities to. Should have the extension `.json`.
* @param {float} x X-coordinate of the cube center.
* @param {float} y Y-coordinate of the cube center.
* @param {float} z Z-coordinate of the cube center.
* @param {float} scale Half dimension of the cube.
* @returns {bool} `true` if the export was successful, otherwise `false`.
*/
Q_INVOKABLE bool exportEntities(const QString& filename, float x, float y, float z, float scale);
/**jsdoc
* Paste the contents of the clipboard into the world.
* @function Clipboard.pasteEntities
* @param {Vec3} position Position to paste clipboard at.
* @return {EntityID[]} Array of entity IDs for the new entities that were
* created as a result of the paste operation.
* @param {Vec3} position Position to paste the clipboard contents at.
* @returns {EntityID[]} Array of entity IDs for the new entities that were created as a result of the paste operation.
*/
Q_INVOKABLE QVector<EntityItemID> pasteEntities(glm::vec3 position);
};